@@ -30,19 +30,19 @@ discard block |
||
30 | 30 | private function getEaster($pYear = null) |
31 | 31 | { |
32 | 32 | if (is_null($pYear)) { |
33 | - $pYear = (int)date('Y'); |
|
33 | + $pYear = (int) date('Y'); |
|
34 | 34 | } |
35 | 35 | $nDate = $pYear - 1900; |
36 | - $pAa = $nDate%19; |
|
37 | - $pBb = floor(((7*$pAa)+1)/19); |
|
38 | - $pCc = ((11*$pAa)-$pBb+4)%29; |
|
39 | - $pDd = floor($nDate/4); |
|
40 | - $pEe = ($nDate-$pCc+$pDd+31)%7; |
|
41 | - $pResult = 25-$pCc-$pEe; |
|
36 | + $pAa = $nDate % 19; |
|
37 | + $pBb = floor(((7 * $pAa) + 1) / 19); |
|
38 | + $pCc = ((11 * $pAa) - $pBb + 4) % 29; |
|
39 | + $pDd = floor($nDate / 4); |
|
40 | + $pEe = ($nDate - $pCc + $pDd + 31) % 7; |
|
41 | + $pResult = 25 - $pCc - $pEe; |
|
42 | 42 | if ($pResult > 0) { |
43 | 43 | $pEaster = strtotime($pYear.'/04/'.$pResult); |
44 | 44 | } else { |
45 | - $pEaster = strtotime($pYear.'/03/'.(31+$pResult)); |
|
45 | + $pEaster = strtotime($pYear.'/03/'.(31 + $pResult)); |
|
46 | 46 | } |
47 | 47 | return $pEaster; |
48 | 48 | } |
@@ -61,20 +61,20 @@ discard block |
||
61 | 61 | { |
62 | 62 | $aBankHolidays = ['1_1', '1_5', '8_5', '14_7', '15_8', '1_11', '11_11', '25_12', ]; |
63 | 63 | if (function_exists('easter_date')) { |
64 | - $pEaster = easter_date((int)date('Y', $pDate)); |
|
64 | + $pEaster = easter_date((int) date('Y', $pDate)); |
|
65 | 65 | } else { |
66 | - $pEaster = $this->getEaster((int)date('Y', $pDate)); |
|
66 | + $pEaster = $this->getEaster((int) date('Y', $pDate)); |
|
67 | 67 | } |
68 | 68 | $aBankHolidays[] = date('j_n', $pEaster); |
69 | - $aBankHolidays[] = date('j_n', $pEaster + (86400*39)); |
|
70 | - $aBankHolidays[] = date('j_n', $pEaster + (86400*49)); |
|
69 | + $aBankHolidays[] = date('j_n', $pEaster + (86400 * 39)); |
|
70 | + $aBankHolidays[] = date('j_n', $pEaster + (86400 * 49)); |
|
71 | 71 | |
72 | - $pEnd = strtotime('+' . $pDays . ' day', $pDate); |
|
72 | + $pEnd = strtotime('+'.$pDays.' day', $pDate); |
|
73 | 73 | $idn = 0; |
74 | 74 | while ($idn < $pEnd) { |
75 | 75 | if (in_array(date('w', $pEnd), array(0, 6)) || in_array(date('j_n', $pEnd), $aBankHolidays)) { |
76 | 76 | $pEnd = strtotime('+1 day', $pEnd); |
77 | - $pDays ++; |
|
77 | + $pDays++; |
|
78 | 78 | } |
79 | 79 | $idn = strtotime('+1 day', $idn); |
80 | 80 | } |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | $this->addRolesAction($form, $entityNew); |
154 | 154 | } |
155 | 155 | $form->handleRequest($request); |
156 | - $return = [$entity => $entityNew, 'form' => $form->createView(),]; |
|
156 | + $return = [$entity => $entityNew, 'form' => $form->createView(), ]; |
|
157 | 157 | |
158 | 158 | if ($form->isValid()) { |
159 | 159 | $etm = $this->getDoctrine()->getManager(); |
@@ -262,9 +262,9 @@ discard block |
||
262 | 262 | public function abstractDeleteWithArticlesAction($entity, Request $request, $entityName) |
263 | 263 | { |
264 | 264 | $etm = $this->getDoctrine()->getManager(); |
265 | - $form = $this->createDeleteForm($entity->getId(), $entityName . '_delete'); |
|
265 | + $form = $this->createDeleteForm($entity->getId(), $entityName.'_delete'); |
|
266 | 266 | $entityArticles = $etm |
267 | - ->getRepository('AppBundle:' . ucfirst($entityName) . 'Articles') |
|
267 | + ->getRepository('AppBundle:'.ucfirst($entityName).'Articles') |
|
268 | 268 | ->findBy([$entityName => $entity->getId()]); |
269 | 269 | |
270 | 270 | if ($form->handleRequest($request)->isValid()) { |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | } else { |
300 | 300 | $alias = current($qbd->getDQLPart('from'))->getAlias(); |
301 | 301 | } |
302 | - $qbd->orderBy($alias . '.' . $order['field'], $order['type']); |
|
302 | + $qbd->orderBy($alias.'.'.$order['field'], $order['type']); |
|
303 | 303 | } |
304 | 304 | } |
305 | 305 |
@@ -223,7 +223,7 @@ |
||
223 | 223 | * @param Object $entity Entity |
224 | 224 | * @param \Symfony\Component\HttpFoundation\Request $request Request in progress |
225 | 225 | * @param string $entityName Name of Entity |
226 | - * @return array |
|
226 | + * @return \Symfony\Component\HttpFoundation\RedirectResponse |
|
227 | 227 | */ |
228 | 228 | public function abstractDeleteWithArticlesAction($entity, Request $request, $entityName) |
229 | 229 | { |
@@ -114,6 +114,6 @@ |
||
114 | 114 | { |
115 | 115 | $session = new Session(); |
116 | 116 | |
117 | - return $session->has('sort.' . $name) ? $session->get('sort.' . $name) : null; |
|
117 | + return $session->has('sort.'.$name) ? $session->get('sort.'.$name) : null; |
|
118 | 118 | } |
119 | 119 | } |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | */ |
288 | 288 | public function printAction(Inventory $inventory) |
289 | 289 | { |
290 | - $file = $inventory->getDate()->format('Ymd') . '-inventory.pdf'; |
|
290 | + $file = $inventory->getDate()->format('Ymd').'-inventory.pdf'; |
|
291 | 291 | // Create and save the PDF file to print |
292 | 292 | $html = $this->renderView( |
293 | 293 | 'AppBundle:Inventory:print.pdf.twig', |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | ->getArray((string) $inventory->getDate()->format('d/m/Y'), '- Inventaire -') |
301 | 301 | ), |
302 | 302 | 200, |
303 | - ['Content-Type' => 'application/pdf', 'Content-Disposition' => 'attachment; filename="' . $file . '"',] |
|
303 | + ['Content-Type' => 'application/pdf', 'Content-Disposition' => 'attachment; filename="'.$file.'"', ] |
|
304 | 304 | ); |
305 | 305 | } |
306 | 306 | |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | ->getArray((string) $inventory->getDate()->format('d/m/Y'), '- Inventaire -') |
327 | 327 | ), |
328 | 328 | 200, |
329 | - ['Content-Type' => 'application/pdf', 'Content-Disposition' => 'attachment; filename="prepare.pdf"',] |
|
329 | + ['Content-Type' => 'application/pdf', 'Content-Disposition' => 'attachment; filename="prepare.pdf"', ] |
|
330 | 330 | ); |
331 | 331 | } |
332 | 332 |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | 'empty_data' => '0,000', |
69 | 69 | 'label' => 'settings.quantity', |
70 | 70 | 'translation_domain' => 'gs_articles', |
71 | - 'attr'=> ['class' => 'form-control text-right',], |
|
71 | + 'attr'=> ['class' => 'form-control text-right', ], |
|
72 | 72 | ) |
73 | 73 | ) |
74 | 74 | ->add( |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | 'currency' => 'EUR', |
93 | 93 | 'label' => 'settings.price', |
94 | 94 | 'translation_domain' => 'gs_articles', |
95 | - 'attr'=> ['class' => 'form-control text-right', 'readonly' => true,], |
|
95 | + 'attr'=> ['class' => 'form-control text-right', 'readonly' => true, ], |
|
96 | 96 | ) |
97 | 97 | ) |
98 | 98 | ->add( |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | 'label' => 'seizure.total', |
119 | 119 | 'translation_domain' => 'gs_orders', |
120 | 120 | 'mapped' => false, |
121 | - 'attr'=> ['class' => 'form-control text-right', 'readonly' => true,] |
|
121 | + 'attr'=> ['class' => 'form-control text-right', 'readonly' => true, ] |
|
122 | 122 | ) |
123 | 123 | ) |
124 | 124 | ; |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | /** |
48 | 48 | * Displays a form to edit an existing item entity. |
49 | 49 | * |
50 | - * @param Object $entity Entity |
|
50 | + * @param Orders $entity Entity |
|
51 | 51 | * @param string $entityName Name of Entity |
52 | 52 | * @param string $typePath Path of FormType |
53 | 53 | * @return array |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | /** |
70 | 70 | * Edits an existing item entity. |
71 | 71 | * |
72 | - * @param Object $entity Entity |
|
72 | + * @param Orders $entity Entity |
|
73 | 73 | * @param \Symfony\Component\HttpFoundation\Request $request Request in progress |
74 | 74 | * @param string $entityName Name of Entity |
75 | 75 | * @param string $typePath Path of FormType |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | return $this->createForm( |
41 | 41 | OrdersType::class, |
42 | 42 | $orders, |
43 | - ['attr' => ['id' => 'create'], 'action' => $this->generateUrl($route), 'method' => 'POST',] |
|
43 | + ['attr' => ['id' => 'create'], 'action' => $this->generateUrl($route), 'method' => 'POST', ] |
|
44 | 44 | ); |
45 | 45 | } |
46 | 46 | |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | $this->addRolesAction($editForm, $entity); |
64 | 64 | } |
65 | 65 | |
66 | - return [$entityName => $entity, 'edit_form' => $editForm->createView(),]; |
|
66 | + return [$entityName => $entity, 'edit_form' => $editForm->createView(), ]; |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | /** |
@@ -117,22 +117,22 @@ discard block |
||
117 | 117 | */ |
118 | 118 | protected function abstractPrintAction(Orders $orders, $from) |
119 | 119 | { |
120 | - $file = $from . '-' . $orders->getId() . '.pdf'; |
|
120 | + $file = $from.'-'.$orders->getId().'.pdf'; |
|
121 | 121 | $company = $this->getDoctrine()->getManager()->getRepository('AppBundle:Company')->find(1); |
122 | 122 | // Create and save the PDF file to print |
123 | 123 | $html = $this->renderView( |
124 | - 'AppBundle:' . $from . ':print.pdf.twig', |
|
124 | + 'AppBundle:'.$from.':print.pdf.twig', |
|
125 | 125 | ['articles' => $orders->getArticles(), 'orders' => $orders, 'company' => $company, ] |
126 | 126 | ); |
127 | 127 | return new Response( |
128 | 128 | $this->get('knp_snappy.pdf')->getOutputFromHtml( |
129 | 129 | $html, |
130 | - $this->get('app.helper.controller')->getArray((string)date('d/m/y - H:i:s'), '') |
|
130 | + $this->get('app.helper.controller')->getArray((string) date('d/m/y - H:i:s'), '') |
|
131 | 131 | ), |
132 | 132 | 200, |
133 | 133 | array( |
134 | 134 | 'Content-Type' => 'application/pdf', |
135 | - 'Content-Disposition' => 'attachment; filename="' . $file . '"' |
|
135 | + 'Content-Disposition' => 'attachment; filename="'.$file.'"' |
|
136 | 136 | ) |
137 | 137 | ); |
138 | 138 | } |