@@ -25,7 +25,7 @@ |
||
25 | 25 | * get Easter date. |
26 | 26 | * |
27 | 27 | * @param integer $pYear |
28 | - * @return timestamp |
|
28 | + * @return integer |
|
29 | 29 | */ |
30 | 30 | private function getEaster ($pYear = null) |
31 | 31 | { |
@@ -29,22 +29,22 @@ discard block |
||
29 | 29 | */ |
30 | 30 | private function getEaster ($pYear = null) |
31 | 31 | { |
32 | - if (is_null ($pYear)) { |
|
32 | + if (is_null ($pYear)) { |
|
33 | 33 | $pYear = (int)date ('Y'); |
34 | - } |
|
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; |
|
42 | - if ($pResult > 0) { |
|
34 | + } |
|
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; |
|
42 | + if ($pResult > 0) { |
|
43 | 43 | $pEaster = strtotime ($pYear.'/04/'.$pResult); |
44 | - } else { |
|
44 | + } else { |
|
45 | 45 | $pEaster = strtotime ($pYear.'/03/'.(31+$pResult)); |
46 | - } |
|
47 | - return $pEaster; |
|
46 | + } |
|
47 | + return $pEaster; |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | /** |
@@ -58,25 +58,25 @@ discard block |
||
58 | 58 | * @return integer Delta next business day |
59 | 59 | */ |
60 | 60 | function getNextOpenDay ($pDate, $pDays) { |
61 | - $aBankHolidays = ['1_1', '1_5', '8_5', '14_7', '15_8', '1_11', '11_11', '25_12', ]; |
|
62 | - if (function_exists ('easter_date')) { |
|
61 | + $aBankHolidays = ['1_1', '1_5', '8_5', '14_7', '15_8', '1_11', '11_11', '25_12', ]; |
|
62 | + if (function_exists ('easter_date')) { |
|
63 | 63 | $pEaster = easter_date ((int)date('Y'), $pDate); |
64 | - } else { |
|
64 | + } else { |
|
65 | 65 | $pEaster = $this->getEaster ((int)date('Y'), $pDate); |
66 | - } |
|
67 | - $aBankHolidays[] = date ('j_n',$pEaster); |
|
68 | - $aBankHolidays[] = date ('j_n', $pEaster + (86400*39)); |
|
69 | - $aBankHolidays[] = date ('j_n', $pEaster + (86400*49)); |
|
66 | + } |
|
67 | + $aBankHolidays[] = date ('j_n',$pEaster); |
|
68 | + $aBankHolidays[] = date ('j_n', $pEaster + (86400*39)); |
|
69 | + $aBankHolidays[] = date ('j_n', $pEaster + (86400*49)); |
|
70 | 70 | |
71 | 71 | $pEnd = $pDays * 86400; |
72 | - $idn = 0; |
|
73 | - while ($idn < $pEnd) { |
|
74 | - $idn = strtotime ('+1 day', $idn); |
|
75 | - if (in_array (date ('w', $pDate+$idn),array (0,6) ) || in_array (date ('j_n', $pDate+$idn), $aBankHolidays)) { |
|
76 | - $pEnd = strtotime ('+1 day', $pEnd); |
|
77 | - $pDays ++; |
|
78 | - } |
|
79 | - } |
|
80 | - return $pDays; |
|
72 | + $idn = 0; |
|
73 | + while ($idn < $pEnd) { |
|
74 | + $idn = strtotime ('+1 day', $idn); |
|
75 | + if (in_array (date ('w', $pDate+$idn),array (0,6) ) || in_array (date ('j_n', $pDate+$idn), $aBankHolidays)) { |
|
76 | + $pEnd = strtotime ('+1 day', $pEnd); |
|
77 | + $pDays ++; |
|
78 | + } |
|
79 | + } |
|
80 | + return $pDays; |
|
81 | 81 | } |
82 | 82 | } |
@@ -27,22 +27,22 @@ discard block |
||
27 | 27 | * @param integer $pYear |
28 | 28 | * @return timestamp |
29 | 29 | */ |
30 | - private function getEaster ($pYear = null) |
|
30 | + private function getEaster($pYear = null) |
|
31 | 31 | { |
32 | - if (is_null ($pYear)) { |
|
33 | - $pYear = (int)date ('Y'); |
|
32 | + if (is_null($pYear)) { |
|
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 | - $pEaster = strtotime ($pYear.'/04/'.$pResult); |
|
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 | } |
@@ -57,24 +57,24 @@ discard block |
||
57 | 57 | * @param integer $pDays Delta for the day of delivery |
58 | 58 | * @return integer Delta next business day |
59 | 59 | */ |
60 | - function getNextOpenDay ($pDate, $pDays) { |
|
60 | + function getNextOpenDay($pDate, $pDays) { |
|
61 | 61 | $aBankHolidays = ['1_1', '1_5', '8_5', '14_7', '15_8', '1_11', '11_11', '25_12', ]; |
62 | - if (function_exists ('easter_date')) { |
|
63 | - $pEaster = easter_date ((int)date('Y'), $pDate); |
|
62 | + if (function_exists('easter_date')) { |
|
63 | + $pEaster = easter_date((int) date('Y'), $pDate); |
|
64 | 64 | } else { |
65 | - $pEaster = $this->getEaster ((int)date('Y'), $pDate); |
|
65 | + $pEaster = $this->getEaster((int) date('Y'), $pDate); |
|
66 | 66 | } |
67 | - $aBankHolidays[] = date ('j_n',$pEaster); |
|
68 | - $aBankHolidays[] = date ('j_n', $pEaster + (86400*39)); |
|
69 | - $aBankHolidays[] = date ('j_n', $pEaster + (86400*49)); |
|
67 | + $aBankHolidays[] = date('j_n', $pEaster); |
|
68 | + $aBankHolidays[] = date('j_n', $pEaster + (86400 * 39)); |
|
69 | + $aBankHolidays[] = date('j_n', $pEaster + (86400 * 49)); |
|
70 | 70 | |
71 | 71 | $pEnd = $pDays * 86400; |
72 | 72 | $idn = 0; |
73 | 73 | while ($idn < $pEnd) { |
74 | - $idn = strtotime ('+1 day', $idn); |
|
75 | - if (in_array (date ('w', $pDate+$idn),array (0,6) ) || in_array (date ('j_n', $pDate+$idn), $aBankHolidays)) { |
|
76 | - $pEnd = strtotime ('+1 day', $pEnd); |
|
77 | - $pDays ++; |
|
74 | + $idn = strtotime('+1 day', $idn); |
|
75 | + if (in_array(date('w', $pDate + $idn), array(0, 6)) || in_array(date('j_n', $pDate + $idn), $aBankHolidays)) { |
|
76 | + $pEnd = strtotime('+1 day', $pEnd); |
|
77 | + $pDays++; |
|
78 | 78 | } |
79 | 79 | } |
80 | 80 | return $pDays; |
@@ -57,7 +57,8 @@ |
||
57 | 57 | * @param integer $pDays Delta for the day of delivery |
58 | 58 | * @return integer Delta next business day |
59 | 59 | */ |
60 | - function getNextOpenDay ($pDate, $pDays) { |
|
60 | + function getNextOpenDay ($pDate, $pDays) |
|
61 | + { |
|
61 | 62 | $aBankHolidays = ['1_1', '1_5', '8_5', '14_7', '15_8', '1_11', '11_11', '25_12', ]; |
62 | 63 | if (function_exists ('easter_date')) { |
63 | 64 | $pEaster = easter_date ((int)date('Y'), $pDate); |
@@ -47,7 +47,8 @@ discard block |
||
47 | 47 | * |
48 | 48 | * @return \Doctrine\ORM\QueryBuilder |
49 | 49 | */ |
50 | - public function findOrders() { |
|
50 | + public function findOrders() |
|
51 | + { |
|
51 | 52 | $query = $this->findActive() |
52 | 53 | ->andWhere('o.delivdate > :date') |
53 | 54 | ->setParameter('date', date('Y-m-d')); |
@@ -60,7 +61,8 @@ discard block |
||
60 | 61 | * |
61 | 62 | * @return \Doctrine\ORM\QueryBuilder |
62 | 63 | */ |
63 | - public function findDeliveries() { |
|
64 | + public function findDeliveries() |
|
65 | + { |
|
64 | 66 | $query = $this->findActive() |
65 | 67 | ->andWhere('o.delivdate <= :date') |
66 | 68 | ->setParameter('date', date('Y-m-d')); |
@@ -68,7 +70,8 @@ discard block |
||
68 | 70 | return $query; |
69 | 71 | } |
70 | 72 | |
71 | - private function findActive() { |
|
73 | + private function findActive() |
|
74 | + { |
|
72 | 75 | $query = $this->createQueryBuilder('o') |
73 | 76 | ->orderBy('o.id', 'DESC') |
74 | 77 | ->where('o.status = 1'); |
@@ -115,7 +115,7 @@ discard block |
||
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()); |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | $diffDeliv = $this->get('app.helper.time') |
225 | 225 | ->getNextOpenDay($setOrderDate->getTimestamp(), $supplier->getDelaydeliv()); |
226 | 226 | |
227 | - $setDelivDate = new \DateTime(date('Y-m-d',$setOrderDate->getTimestamp())); |
|
227 | + $setDelivDate = new \DateTime(date('Y-m-d', $setOrderDate->getTimestamp())); |
|
228 | 228 | $setDelivDate->add(new \DateInterval('P'.$diffDeliv.'D')); |
229 | 229 | |
230 | 230 | $orders->setOrderdate($setOrderDate); |
@@ -42,7 +42,7 @@ |
||
42 | 42 | $etm = $this->getDoctrine()->getManager(); |
43 | 43 | $item = $this->container->getParameter('knp_paginator.page_range'); |
44 | 44 | $qbd = $etm->getRepository('AppBundle:Orders')->createQueryBuilder('o'); |
45 | - $qbd->where('o.delivdate <= ' . date('Y-m-d')); |
|
45 | + $qbd->where('o.delivdate <= '.date('Y-m-d')); |
|
46 | 46 | $qbd->andWhere('o.status = 1'); |
47 | 47 | |
48 | 48 | $paginator = $this->get('knp_paginator')->paginate($qbd, $request->query->get('page', 1), $item); |
@@ -43,25 +43,25 @@ discard block |
||
43 | 43 | ->add( |
44 | 44 | 'name', |
45 | 45 | TextType::class, |
46 | - ['label' => 'gestock.name', 'attr' => ['class' => 'form-control',],] |
|
46 | + ['label' => 'gestock.name', 'attr' => ['class' => 'form-control', ], ] |
|
47 | 47 | ) |
48 | 48 | ->add( |
49 | 49 | 'address', |
50 | 50 | TextType::class, |
51 | 51 | array( |
52 | 52 | 'label' => 'gestock.address', |
53 | - 'attr' => ['placeholder' => 'gestock.address', 'class' => 'form-control',], |
|
53 | + 'attr' => ['placeholder' => 'gestock.address', 'class' => 'form-control', ], |
|
54 | 54 | ) |
55 | 55 | ) |
56 | 56 | ->add( |
57 | 57 | 'zipcode', |
58 | 58 | TextType::class, |
59 | - ['attr' => ['placeholder' => 'gestock.zipcode', 'class' => 'form-control half',],] |
|
59 | + ['attr' => ['placeholder' => 'gestock.zipcode', 'class' => 'form-control half', ], ] |
|
60 | 60 | ) |
61 | 61 | ->add( |
62 | 62 | 'town', |
63 | 63 | TextType::class, |
64 | - ['attr' => ['placeholder' => 'gestock.town', 'class' => 'form-control half',],] |
|
64 | + ['attr' => ['placeholder' => 'gestock.town', 'class' => 'form-control half', ], ] |
|
65 | 65 | ) |
66 | 66 | ->add( |
67 | 67 | 'phone', |
@@ -70,8 +70,8 @@ discard block |
||
70 | 70 | 'default_region' => 'FR', |
71 | 71 | 'format' => PhoneNumberFormat::NATIONAL, |
72 | 72 | 'widget' => PhoneNumberType::WIDGET_COUNTRY_CHOICE, |
73 | - 'country_choices' => ['FR', 'GB', 'DE', 'IT',], |
|
74 | - 'preferred_country_choices' => ['FR',], |
|
73 | + 'country_choices' => ['FR', 'GB', 'DE', 'IT', ], |
|
74 | + 'preferred_country_choices' => ['FR', ], |
|
75 | 75 | 'label' => 'gestock.phone', |
76 | 76 | ) |
77 | 77 | ) |
@@ -82,21 +82,21 @@ discard block |
||
82 | 82 | 'default_region' => 'FR', |
83 | 83 | 'format' => PhoneNumberFormat::NATIONAL, |
84 | 84 | 'widget' => PhoneNumberType::WIDGET_COUNTRY_CHOICE, |
85 | - 'country_choices' => ['FR', 'GB', 'DE', 'IT',], |
|
86 | - 'preferred_country_choices' => ['FR',], |
|
85 | + 'country_choices' => ['FR', 'GB', 'DE', 'IT', ], |
|
86 | + 'preferred_country_choices' => ['FR', ], |
|
87 | 87 | 'label' => 'gestock.fax', |
88 | - 'attr' => ['class' => 'form-control',] |
|
88 | + 'attr' => ['class' => 'form-control', ] |
|
89 | 89 | ) |
90 | 90 | ) |
91 | 91 | ->add( |
92 | 92 | 'mail', |
93 | 93 | EmailType::class, |
94 | - ['label' => 'gestock.mail', 'attr' => ['class' => 'form-control',]] |
|
94 | + ['label' => 'gestock.mail', 'attr' => ['class' => 'form-control', ]] |
|
95 | 95 | ) |
96 | 96 | ->add( |
97 | 97 | 'contact', |
98 | 98 | TextType::class, |
99 | - ['label' => 'gestock.contact', 'attr' => ['class' => 'form-control',],] |
|
99 | + ['label' => 'gestock.contact', 'attr' => ['class' => 'form-control', ], ] |
|
100 | 100 | ) |
101 | 101 | ->add( |
102 | 102 | 'gsm', |
@@ -105,10 +105,10 @@ discard block |
||
105 | 105 | 'default_region' => 'FR', |
106 | 106 | 'format' => PhoneNumberFormat::NATIONAL, |
107 | 107 | 'widget' => PhoneNumberType::WIDGET_COUNTRY_CHOICE, |
108 | - 'country_choices' => ['FR', 'GB', 'DE', 'IT',], |
|
109 | - 'preferred_country_choices' => ['FR',], |
|
108 | + 'country_choices' => ['FR', 'GB', 'DE', 'IT', ], |
|
109 | + 'preferred_country_choices' => ['FR', ], |
|
110 | 110 | 'label' => 'gestock.gsm', |
111 | - 'attr' => ['class' => 'form-control',] |
|
111 | + 'attr' => ['class' => 'form-control', ] |
|
112 | 112 | ) |
113 | 113 | ) |
114 | 114 | /** |
@@ -119,11 +119,11 @@ discard block |
||
119 | 119 | 'delaydeliv', |
120 | 120 | ChoiceType::class, |
121 | 121 | array( |
122 | - 'choices' => ['form.atob' => 1, 'form.atoc' => 2, 'form.atod' => 3, 'form.atoe' => 4,], |
|
122 | + 'choices' => ['form.atob' => 1, 'form.atoc' => 2, 'form.atod' => 3, 'form.atoe' => 4, ], |
|
123 | 123 | 'choices_as_values' => true, |
124 | 124 | 'label' => 'settings.delay', |
125 | 125 | 'translation_domain' => 'gs_suppliers', |
126 | - 'attr' => ['class' => 'form-control half',] |
|
126 | + 'attr' => ['class' => 'form-control half', ] |
|
127 | 127 | ) |
128 | 128 | ) |
129 | 129 | /** |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | 'choice_translation_domain' => true, |
148 | 148 | 'translation_domain' => 'messages', |
149 | 149 | 'label' => 'day_order', |
150 | - 'attr' => ['class' => 'form-control',], |
|
150 | + 'attr' => ['class' => 'form-control', ], |
|
151 | 151 | 'expanded' => true, |
152 | 152 | 'multiple' => true, |
153 | 153 | ) |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | EntityType::class, |
158 | 158 | array( |
159 | 159 | 'class' => 'AppBundle:FamilyLog', |
160 | - 'query_builder' => function (EntityRepository $er) { |
|
160 | + 'query_builder' => function(EntityRepository $er) { |
|
161 | 161 | return $er->createQueryBuilder('f') |
162 | 162 | ->orderBy('f.path', 'ASC'); |
163 | 163 | }, |
@@ -166,10 +166,10 @@ discard block |
||
166 | 166 | 'placeholder' => 'gestock.settings.diverse.choice_family', |
167 | 167 | 'empty_data' => null, |
168 | 168 | 'label' => 'gestock.settings.diverse.familylog', |
169 | - 'attr' => ['class' => 'form-control half',] |
|
169 | + 'attr' => ['class' => 'form-control half', ] |
|
170 | 170 | ) |
171 | 171 | ) |
172 | - ->add('active', HiddenType::class, ['data' => true,]); |
|
172 | + ->add('active', HiddenType::class, ['data' => true, ]); |
|
173 | 173 | } |
174 | 174 | |
175 | 175 | /** |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | */ |
178 | 178 | public function configureOptions(OptionsResolver $resolver) |
179 | 179 | { |
180 | - $resolver->setDefaults(['data_class' => 'AppBundle\Entity\Supplier',]); |
|
180 | + $resolver->setDefaults(['data_class' => 'AppBundle\Entity\Supplier', ]); |
|
181 | 181 | } |
182 | 182 | |
183 | 183 | /** |