@@ -115,7 +115,7 @@ |
||
115 | 115 | |
116 | 116 | $orders = new Orders(); |
117 | 117 | $form = $this->createForm(OrdersType::class, $orders); |
118 | - $return = ['orders' => $orders, 'form' => $form->createView(),]; |
|
118 | + $return = ['orders' => $orders, 'form' => $form->createView(), ]; |
|
119 | 119 | $form->handleRequest($request); |
120 | 120 | $supplier = $orders->getSupplier(); |
121 | 121 | $articles = $etm->getRepository('AppBundle:Article')->getArticleFromSupplier($supplier->getId()); |
@@ -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 | } |
@@ -257,7 +257,7 @@ |
||
257 | 257 | * @param Object $entity Entity |
258 | 258 | * @param Request $request Request in progress |
259 | 259 | * @param string $entityName Name of Entity |
260 | - * @return array |
|
260 | + * @return \Symfony\Component\HttpFoundation\RedirectResponse |
|
261 | 261 | */ |
262 | 262 | public function abstractDeleteWithArticlesAction($entity, Request $request, $entityName) |
263 | 263 | { |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | $this->addRoles($form, $entityNew); |
120 | 120 | } |
121 | 121 | $form->handleRequest($request); |
122 | - $return = [$entity => $entityNew, 'form' => $form->createView(),]; |
|
122 | + $return = [$entity => $entityNew, 'form' => $form->createView(), ]; |
|
123 | 123 | |
124 | 124 | if ($form->isValid()) { |
125 | 125 | $etm = $this->getDoctrine()->getManager(); |
@@ -228,9 +228,9 @@ discard block |
||
228 | 228 | public function abstractDeleteWithArticlesAction($entity, Request $request, $entityName) |
229 | 229 | { |
230 | 230 | $etm = $this->getDoctrine()->getManager(); |
231 | - $form = $this->createDeleteForm($entity->getId(), $entityName . '_delete'); |
|
231 | + $form = $this->createDeleteForm($entity->getId(), $entityName.'_delete'); |
|
232 | 232 | $entityArticles = $etm |
233 | - ->getRepository('AppBundle:' . ucfirst($entityName) . 'Articles') |
|
233 | + ->getRepository('AppBundle:'.ucfirst($entityName).'Articles') |
|
234 | 234 | ->findBy([$entityName => $entity->getId()]); |
235 | 235 | |
236 | 236 | if ($form->handleRequest($request)->isValid()) { |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | } else { |
266 | 266 | $alias = current($qbd->getDQLPart('from'))->getAlias(); |
267 | 267 | } |
268 | - $qbd->orderBy($alias . '.' . $order['field'], $order['type']); |
|
268 | + $qbd->orderBy($alias.'.'.$order['field'], $order['type']); |
|
269 | 269 | } |
270 | 270 | } |
271 | 271 |
@@ -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 |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | return $this->createForm( |
40 | 40 | OrdersType::class, |
41 | 41 | $orders, |
42 | - ['attr' => ['id' => 'create'], 'action' => $this->generateUrl($route), 'method' => 'POST',] |
|
42 | + ['attr' => ['id' => 'create'], 'action' => $this->generateUrl($route), 'method' => 'POST', ] |
|
43 | 43 | ); |
44 | 44 | } |
45 | 45 | |
@@ -52,22 +52,22 @@ discard block |
||
52 | 52 | */ |
53 | 53 | protected function abstractPrintAction(Orders $orders, $from) |
54 | 54 | { |
55 | - $file = $from . '-' . $orders->getId() . '.pdf'; |
|
55 | + $file = $from.'-'.$orders->getId().'.pdf'; |
|
56 | 56 | $company = $this->getDoctrine()->getManager()->getRepository('AppBundle:Company')->find(1); |
57 | 57 | // Create and save the PDF file to print |
58 | 58 | $html = $this->renderView( |
59 | - 'AppBundle:' . $from . ':print.pdf.twig', |
|
59 | + 'AppBundle:'.$from.':print.pdf.twig', |
|
60 | 60 | ['articles' => $orders->getArticles(), 'orders' => $orders, 'company' => $company, ] |
61 | 61 | ); |
62 | 62 | return new Response( |
63 | 63 | $this->get('knp_snappy.pdf')->getOutputFromHtml( |
64 | 64 | $html, |
65 | - $this->get('app.helper.controller')->getArray((string)date('d/m/y - H:i:s'), '') |
|
65 | + $this->get('app.helper.controller')->getArray((string) date('d/m/y - H:i:s'), '') |
|
66 | 66 | ), |
67 | 67 | 200, |
68 | 68 | array( |
69 | 69 | 'Content-Type' => 'application/pdf', |
70 | - 'Content-Disposition' => 'attachment; filename="' . $file . '"' |
|
70 | + 'Content-Disposition' => 'attachment; filename="'.$file.'"' |
|
71 | 71 | ) |
72 | 72 | ); |
73 | 73 | } |
@@ -147,7 +147,7 @@ |
||
147 | 147 | { |
148 | 148 | $session = new Session(); |
149 | 149 | |
150 | - return $session->has('sort.' . $name) ? $session->get('sort.' . $name) : null; |
|
150 | + return $session->has('sort.'.$name) ? $session->get('sort.'.$name) : null; |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | public function getId() |