@@ -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 | { |
@@ -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 | |
@@ -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 | |
@@ -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 | } |