@@ -257,7 +257,7 @@ discard block |
||
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 | { |
@@ -278,6 +278,9 @@ discard block |
||
278 | 278 | return $this->redirect($this->generateUrl($entityName)); |
279 | 279 | } |
280 | 280 | |
281 | + /** |
|
282 | + * @param string $entityName |
|
283 | + */ |
|
281 | 284 | private function testReturnParam($entity, $entityName) |
282 | 285 | { |
283 | 286 | $entityArray = ['company', 'settings', 'group', 'tva']; |
@@ -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()) { |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | { |
317 | 317 | $session = new Session(); |
318 | 318 | |
319 | - return $session->has('sort.' . $name) ? $session->get('sort.' . $name) : null; |
|
319 | + return $session->has('sort.'.$name) ? $session->get('sort.'.$name) : null; |
|
320 | 320 | } |
321 | 321 | |
322 | 322 | /** |
@@ -340,7 +340,7 @@ discard block |
||
340 | 340 | } else { |
341 | 341 | $alias = current($qbd->getDQLPart('from'))->getAlias(); |
342 | 342 | } |
343 | - $qbd->orderBy($alias . '.' . $order['field'], $order['type']); |
|
343 | + $qbd->orderBy($alias.'.'.$order['field'], $order['type']); |
|
344 | 344 | } |
345 | 345 | } |
346 | 346 |
@@ -99,9 +99,9 @@ discard block |
||
99 | 99 | public function createAction(Request $request) |
100 | 100 | { |
101 | 101 | $user = new User(); |
102 | - $form = $this->createForm(UserType::class, $user, ['action' => $this->generateUrl('user_create'),]); |
|
102 | + $form = $this->createForm(UserType::class, $user, ['action' => $this->generateUrl('user_create'), ]); |
|
103 | 103 | $form->handleRequest($request); |
104 | - $return = ['user' => $user, 'form' => $form->createView(),]; |
|
104 | + $return = ['user' => $user, 'form' => $form->createView(), ]; |
|
105 | 105 | |
106 | 106 | if ($form->isValid()) { |
107 | 107 | $user = $this->getRoles($user); |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | $editForm->handleRequest($request); |
168 | 168 | $return = ['user' => $user, |
169 | 169 | 'edit_form' => $editForm->createView(), |
170 | - 'delete_form' => $deleteForm->createView(),]; |
|
170 | + 'delete_form' => $deleteForm->createView(), ]; |
|
171 | 171 | |
172 | 172 | if ($editForm->isValid()) { |
173 | 173 | $user = $this->getRoles($user); |
@@ -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 | /** |
@@ -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,21 +61,21 @@ 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 | 72 | $pEnd = $pDays * 86400; |
73 | 73 | $idn = 0; |
74 | 74 | while ($idn < $pEnd) { |
75 | 75 | $idn = strtotime('+1 day', $idn); |
76 | - if (in_array(date('w', $pDate+$idn), array(0, 6)) || in_array(date('j_n', $pDate+$idn), $aBankHolidays)) { |
|
76 | + if (in_array(date('w', $pDate + $idn), array(0, 6)) || in_array(date('j_n', $pDate + $idn), $aBankHolidays)) { |
|
77 | 77 | $pEnd = strtotime('+1 day', $pEnd); |
78 | - $pDays ++; |
|
78 | + $pDays++; |
|
79 | 79 | } |
80 | 80 | } |
81 | 81 | return $pDays; |