@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | public function __invoke(CreateDamageCommand $command) |
43 | 43 | { |
44 | 44 | $damage = FlightDamage::waiting(new DamageAmount($command->getAmount()), AuthorId::create($command->getAuthorId()), new DamageLabel($command->getLabel())); |
45 | - if(null !== $command->getFlightId()){ |
|
45 | + if (null !== $command->getFlightId()) { |
|
46 | 46 | $damage = FlightDamage::damage(FlightId::create($command->getFlightId()), new DamageLabel($command->getLabel()), new DamageAmount($command->getAmount()), AuthorId::create($command->getAuthorId())); |
47 | 47 | } |
48 | 48 | |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | */ |
61 | 61 | private function linkSupplierInvoice($damageId, $invoiceId) |
62 | 62 | { |
63 | - if($invoiceId <= 0){ |
|
63 | + if ($invoiceId <= 0) { |
|
64 | 64 | return; |
65 | 65 | } |
66 | 66 | |
@@ -81,8 +81,8 @@ discard block |
||
81 | 81 | * @param int $targetId |
82 | 82 | * @param string $targetType |
83 | 83 | */ |
84 | - private function insertLinks($damageId, $targetId, $targetType){ |
|
85 | - $sql = "INSERT INTO ".MAIN_DB_PREFIX."element_element ("; |
|
84 | + private function insertLinks($damageId, $targetId, $targetType) { |
|
85 | + $sql = "INSERT INTO " . MAIN_DB_PREFIX . "element_element ("; |
|
86 | 86 | $sql .= "fk_source"; |
87 | 87 | $sql .= ", sourcetype"; |
88 | 88 | $sql .= ", fk_target"; |
@@ -90,8 +90,8 @@ discard block |
||
90 | 90 | $sql .= ") VALUES ("; |
91 | 91 | $sql .= $damageId; |
92 | 92 | $sql .= ", 'flightlog_damage'"; |
93 | - $sql .= ", ".$targetId; |
|
94 | - $sql .= ", '".$targetType."'"; |
|
93 | + $sql .= ", " . $targetId; |
|
94 | + $sql .= ", '" . $targetType . "'"; |
|
95 | 95 | $sql .= ")"; |
96 | 96 | |
97 | 97 | if ($this->db->query($sql)) |
@@ -15,7 +15,7 @@ |
||
15 | 15 | $this->label = $label; |
16 | 16 | } |
17 | 17 | |
18 | - public function value(){ |
|
18 | + public function value() { |
|
19 | 19 | return $this->label; |
20 | 20 | } |
21 | 21 |
@@ -106,11 +106,11 @@ discard block |
||
106 | 106 | return new Pilot($this->name, $this->id, $types); |
107 | 107 | } |
108 | 108 | |
109 | - public function addDamage(FlightDamageCount $damage){ |
|
109 | + public function addDamage(FlightDamageCount $damage) { |
|
110 | 110 | $this->damages[] = $damage; |
111 | 111 | } |
112 | 112 | |
113 | - public function addInvoicedDamage(FlightInvoicedDamageCount $damage){ |
|
113 | + public function addInvoicedDamage(FlightInvoicedDamageCount $damage) { |
|
114 | 114 | $this->damages[] = $damage; |
115 | 115 | } |
116 | 116 | |
@@ -161,21 +161,21 @@ discard block |
||
161 | 161 | return $flightsCost; |
162 | 162 | } |
163 | 163 | |
164 | - public function totalDamageCost(){ |
|
164 | + public function totalDamageCost() { |
|
165 | 165 | $flightCost = FlightCost::zero(); |
166 | 166 | |
167 | - foreach($this->damages as $damage){ |
|
167 | + foreach ($this->damages as $damage) { |
|
168 | 168 | $flightCost = $flightCost->addCost($damage->getCost()); |
169 | 169 | } |
170 | 170 | |
171 | 171 | return $flightCost; |
172 | 172 | } |
173 | 173 | |
174 | - public function damageCost(){ |
|
174 | + public function damageCost() { |
|
175 | 175 | $flightCost = FlightCost::zero(); |
176 | 176 | |
177 | - foreach($this->damages as $damage){ |
|
178 | - if(!$damage instanceof FlightDamageCount){ |
|
177 | + foreach ($this->damages as $damage) { |
|
178 | + if (!$damage instanceof FlightDamageCount) { |
|
179 | 179 | continue; |
180 | 180 | } |
181 | 181 | |
@@ -185,11 +185,11 @@ discard block |
||
185 | 185 | return $flightCost; |
186 | 186 | } |
187 | 187 | |
188 | - public function invoicedDamageCost(){ |
|
188 | + public function invoicedDamageCost() { |
|
189 | 189 | $flightCost = FlightCost::zero(); |
190 | 190 | |
191 | - foreach($this->damages as $damage){ |
|
192 | - if(!$damage instanceof FlightInvoicedDamageCount){ |
|
191 | + foreach ($this->damages as $damage) { |
|
192 | + if (!$damage instanceof FlightInvoicedDamageCount) { |
|
193 | 193 | continue; |
194 | 194 | } |
195 | 195 | |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | return $flightCost; |
200 | 200 | } |
201 | 201 | |
202 | - public function damages(){ |
|
202 | + public function damages() { |
|
203 | 203 | return $this->damages; |
204 | 204 | } |
205 | 205 |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | $pilots[$obj->pilot] = $pilots[$obj->pilot]->addCount( |
72 | 72 | new FlightTypeCount( |
73 | 73 | $obj->type, |
74 | - (int)$obj->nbr, |
|
74 | + (int) $obj->nbr, |
|
75 | 75 | $this->getFactorByType($obj->type) |
76 | 76 | ) |
77 | 77 | ); |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | $pilots[$obj->rowid] = $pilots[$obj->rowid]->addCount( |
107 | 107 | new FlightTypeCount( |
108 | 108 | 'orga', |
109 | - (int)$obj->total, |
|
109 | + (int) $obj->total, |
|
110 | 110 | $this->getFactorByType('orga') |
111 | 111 | ) |
112 | 112 | ); |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | $pilots[$obj->rowid] = $pilots[$obj->rowid]->addCount( |
137 | 137 | new FlightTypeCount( |
138 | 138 | 'orga_T6', |
139 | - (int)$obj->total, |
|
139 | + (int) $obj->total, |
|
140 | 140 | $this->getFactorByType('orga_T6') |
141 | 141 | ) |
142 | 142 | ); |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | |
149 | 149 | //Total damages |
150 | 150 | $damages = $this->pilotDamageQueryRepository->query($query->getFiscalYear()); |
151 | - foreach($damages as $currentDamage){ |
|
151 | + foreach ($damages as $currentDamage) { |
|
152 | 152 | |
153 | 153 | //Pilot doesn't exist |
154 | 154 | if (!isset($pilots[$currentDamage->getAuthorId()])) { |
@@ -157,13 +157,13 @@ discard block |
||
157 | 157 | |
158 | 158 | // Add all damage |
159 | 159 | $pilots[$currentDamage->getAuthorId()]->addDamage( |
160 | - new FlightDamageCount('', $currentDamage->getAmount()) |
|
160 | + new FlightDamageCount('', $currentDamage->getAmount()) |
|
161 | 161 | ); |
162 | 162 | |
163 | 163 | // The damage is already invoiced. So not take into account. |
164 | - if($currentDamage->isInvoiced()){ |
|
164 | + if ($currentDamage->isInvoiced()) { |
|
165 | 165 | $pilots[$currentDamage->getAuthorId()]->addInvoicedDamage( |
166 | - new FlightInvoicedDamageCount('', $currentDamage->getAmount()) |
|
166 | + new FlightInvoicedDamageCount('', $currentDamage->getAmount()) |
|
167 | 167 | ); |
168 | 168 | } |
169 | 169 | } |
@@ -43,8 +43,8 @@ discard block |
||
43 | 43 | ->setDate(new DateTimeImmutable($_POST['flight_date'])) |
44 | 44 | ->setLieuD($_POST['lieuD']) |
45 | 45 | ->setLieuA($_POST['lieuA']) |
46 | - ->setHeureD(new DateTimeImmutable($_POST['flight_date'].' '.$_POST['heureD'])) |
|
47 | - ->setHeureA(new DateTimeImmutable($_POST['flight_date'].' '.$_POST['heureA'])) |
|
46 | + ->setHeureD(new DateTimeImmutable($_POST['flight_date'] . ' ' . $_POST['heureD'])) |
|
47 | + ->setHeureA(new DateTimeImmutable($_POST['flight_date'] . ' ' . $_POST['heureA'])) |
|
48 | 48 | ->setBBCBallonsIdBBCBallons($_POST['ballon']) |
49 | 49 | ->setNbrPax($_POST['nbrPax']) |
50 | 50 | ->setRemarque($_POST['comm']) |
@@ -68,8 +68,8 @@ discard block |
||
68 | 68 | |
69 | 69 | $msg = '<div class="ok">L\'ajout du vol du : ' . $_POST["reday"] . '/' . $_POST["remonth"] . '/' . $_POST["reyear"] . ' s\'est correctement effectue ! </div>'; |
70 | 70 | Header("Location: card.php?id=" . $vol->id); |
71 | - }catch (\Exception $e){ |
|
72 | - $msg = '<div class="error">Erreur lors de l\'ajout du vol : ' . ($vol->error?:$e->getMessage()) . '! </div>'; |
|
71 | + } catch (\Exception $e) { |
|
72 | + $msg = '<div class="error">Erreur lors de l\'ajout du vol : ' . ($vol->error ?: $e->getMessage()) . '! </div>'; |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | } |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | </div> |
109 | 109 | <form class="flight-form js-form" name='add' action="addFlight.php" method="post"> |
110 | 110 | <input type="hidden" name="action" value="add"/> |
111 | - <input type="hidden" name="token" value="<?php echo newToken();?>"/> |
|
111 | + <input type="hidden" name="token" value="<?php echo newToken(); ?>"/> |
|
112 | 112 | |
113 | 113 | <!-- Date et heures --> |
114 | 114 | <section class="form-section"> |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | <div > |
164 | 164 | <div class="form-group"> |
165 | 165 | <label class="fieldrequired"> Pilote</label> |
166 | - <?php print $html->select_dolusers($_POST["pilot"] ? $_POST["pilot"] : $user->id, 'pilot', 0, null, 0, '', '', 0,0,0,'',0,'','', true); ?> |
|
166 | + <?php print $html->select_dolusers($_POST["pilot"] ? $_POST["pilot"] : $user->id, 'pilot', 0, null, 0, '', '', 0, 0, 0, '', 0, '', '', true); ?> |
|
167 | 167 | </div> |
168 | 168 | |
169 | 169 | <div class="form-group "> |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | </label> |
174 | 174 | <?php |
175 | 175 | //organisateur |
176 | - print $html->select_dolusers($_POST["orga"] ? $_POST["orga"] : $user->id, 'orga', 0, null, 0, '', '', 0,0,0,'',0,'','', true); |
|
176 | + print $html->select_dolusers($_POST["orga"] ? $_POST["orga"] : $user->id, 'orga', 0, null, 0, '', '', 0, 0, 0, '', 0, '', '', true); |
|
177 | 177 | ?> |
178 | 178 | </div> |
179 | 179 | |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | <input type="number" |
228 | 228 | name="nbrPax" |
229 | 229 | class="flat <?php echo $validator->hasError('nbrPax') ? 'error' : '' ?>" |
230 | - value="<?php echo $_POST['nbrPax']?: 0 ?>"/> |
|
230 | + value="<?php echo $_POST['nbrPax'] ?: 0 ?>"/> |
|
231 | 231 | </div> |
232 | 232 | |
233 | 233 | <!-- passenger names --> |
@@ -258,17 +258,17 @@ discard block |
||
258 | 258 | </tr> |
259 | 259 | |
260 | 260 | <tr> |
261 | - <td class="js-receiver" data-user-id="<?php echo $user->id;?>"> |
|
261 | + <td class="js-receiver" data-user-id="<?php echo $user->id; ?>"> |
|
262 | 262 | <label class=""><?php echo $langs->trans('Qui a perçu l\'argent')?>?</label> |
263 | 263 | <?php print $html->select_dolusers( |
264 | 264 | $_POST["fk_receiver"] ? $_POST["fk_receiver"] : -1, |
265 | - 'fk_receiver', true, null, 0, '', '', 0,0,0,'',0,'','', true); ?> |
|
265 | + 'fk_receiver', true, null, 0, '', '', 0, 0, 0, '', 0, '', '', true); ?> |
|
266 | 266 | |
267 | 267 | </td> |
268 | 268 | <td> |
269 | 269 | <label> </label> |
270 | 270 | <div class="input-group"> |
271 | - <input type="number" name="cost" step="1" min="0" class="flat js-cost" value="<?php echo $_POST['cost']?:0 ?>"/> |
|
271 | + <input type="number" name="cost" step="1" min="0" class="flat js-cost" value="<?php echo $_POST['cost'] ?: 0 ?>"/> |
|
272 | 272 | <span class="input-symbol">€</span> |
273 | 273 | </div> |
274 | 274 | </td> |
@@ -279,8 +279,8 @@ discard block |
||
279 | 279 | <th>Commande(s)</th> |
280 | 280 | <th>Nombre de passagers.</th> |
281 | 281 | </tr> |
282 | - <?php if(is_array($_POST['order_passengers_count']) && !empty($_POST['order_passengers_count'])): ?> |
|
283 | - <?php foreach($_POST['order_passengers_count'] as $order => $orderQuantity): ?> |
|
282 | + <?php if (is_array($_POST['order_passengers_count']) && !empty($_POST['order_passengers_count'])): ?> |
|
283 | + <?php foreach ($_POST['order_passengers_count'] as $order => $orderQuantity): ?> |
|
284 | 284 | <tr class="order-row"> |
285 | 285 | <td> |
286 | 286 | <span class="fa fa-trash remove js-remove" data-order-id="<?php echo $order; ?>"></span> |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | |
44 | 44 | $id = GETPOST('id', 'int') ?: GETPOST('idBBC_vols', 'int'); |
45 | 45 | $action = GETPOST('action', 'alpha'); |
46 | -$permissiondellink=$user->rights->flightlog->vol->financial; |
|
46 | +$permissiondellink = $user->rights->flightlog->vol->financial; |
|
47 | 47 | |
48 | 48 | $object = new Bbcvols($db); |
49 | 49 | $extrafields = new ExtraFields($db); |
@@ -62,8 +62,8 @@ discard block |
||
62 | 62 | $extralabels = $extrafields->fetch_name_optionals_label($object->table_element); |
63 | 63 | |
64 | 64 | // Load object |
65 | -include DOL_DOCUMENT_ROOT . '/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals |
|
66 | -include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; |
|
65 | +include DOL_DOCUMENT_ROOT . '/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals |
|
66 | +include DOL_DOCUMENT_ROOT . '/core/actions_dellink.inc.php'; |
|
67 | 67 | |
68 | 68 | // Initialize technical object to manage hooks of modules. Note that conf->hooks_modules contains array array |
69 | 69 | $hookmanager->initHooks(array('bbcvols')); |
@@ -99,20 +99,20 @@ discard block |
||
99 | 99 | print '<tr><td class="fieldrequired">' . $langs->trans("Fielddate") . '</td><td>' . dol_print_date($object->date) . '</td></tr>'; |
100 | 100 | |
101 | 101 | if ($user->rights->flightlog->vol->financial) { |
102 | - print '<tr><td class="fieldrequired">' . $langs->trans("Fieldis_facture") . '</td><td>' . $object->getLibStatut(5). '</td></tr>'; |
|
102 | + print '<tr><td class="fieldrequired">' . $langs->trans("Fieldis_facture") . '</td><td>' . $object->getLibStatut(5) . '</td></tr>'; |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | print '<tr><td class="fieldrequired">' . $langs->trans("Fieldkilometers") . '</td><td>' . $object->kilometers . ' KM</td></tr>'; |
106 | 106 | print '<tr><td class="fieldrequired">' . $langs->trans("Fieldjustif_kilometers") . '</td><td>' . $object->justif_kilometers . '</td></tr>'; |
107 | -if($object->hasReceiver()){ |
|
107 | +if ($object->hasReceiver()) { |
|
108 | 108 | print '<tr><td class="fieldrequired">' . $langs->trans("Fieldcost") . '</td><td>' . $object->cost . " " . $langs->getCurrencySymbol($conf->currency) . '</td></tr>'; |
109 | 109 | print '<tr><td class="fieldrequired">' . $langs->trans("Fieldfk_receiver") . '</td><td>' . $receiver->getNomUrl(1) . '</td></tr>'; |
110 | 110 | } |
111 | 111 | |
112 | -if($object->isLinkedToOrder()){ |
|
112 | +if ($object->isLinkedToOrder()) { |
|
113 | 113 | print '<tr><td class="fieldrequired">' . $langs->trans("Order") . '</td><td><ul>'; |
114 | - foreach($object->getOrders() as $currentOrder){ |
|
115 | - print '<li>'.$currentOrder->getNomUrl(1).'</li>'; |
|
114 | + foreach ($object->getOrders() as $currentOrder) { |
|
115 | + print '<li>' . $currentOrder->getNomUrl(1) . '</li>'; |
|
116 | 116 | } |
117 | 117 | print '</ul></td></tr>'; |
118 | 118 | } |
@@ -124,18 +124,18 @@ discard block |
||
124 | 124 | print '<div class="tabsAction">' . "\n"; |
125 | 125 | |
126 | 126 | // Make invoice |
127 | -if($user->rights->flightlog->vol->financial && $object->fk_type == 2 && !$object->hasFacture()){ |
|
128 | - print '<div class="inline-block divButAction"><a class="butAction" href="' . DOL_URL_ROOT . '/flightlog/facture.php?id=' . $object->id.'">' . $langs->trans("Facturer") . '</a></div>' . "\n"; |
|
127 | +if ($user->rights->flightlog->vol->financial && $object->fk_type == 2 && !$object->hasFacture()) { |
|
128 | + print '<div class="inline-block divButAction"><a class="butAction" href="' . DOL_URL_ROOT . '/flightlog/facture.php?id=' . $object->id . '">' . $langs->trans("Facturer") . '</a></div>' . "\n"; |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | // Open |
132 | -if($object->isBilled() && $object->isBillingRequired()){ |
|
133 | - print '<div class="inline-block divButAction"><a class="butAction" href="' . DOL_URL_ROOT . '/flightlog/card_tab_financial.php?action=open&id=' . $object->id.'">' . $langs->trans("Ouvrir") . '</a></div>' . "\n"; |
|
132 | +if ($object->isBilled() && $object->isBillingRequired()) { |
|
133 | + print '<div class="inline-block divButAction"><a class="butAction" href="' . DOL_URL_ROOT . '/flightlog/card_tab_financial.php?action=open&id=' . $object->id . '">' . $langs->trans("Ouvrir") . '</a></div>' . "\n"; |
|
134 | 134 | } |
135 | 135 | |
136 | 136 | print '</div>' . "\n"; |
137 | 137 | |
138 | -if($user->rights->flightlog->vol->financial){ |
|
138 | +if ($user->rights->flightlog->vol->financial) { |
|
139 | 139 | print '<div class="fichecenter"><div class="fichehalfleft">'; |
140 | 140 | $form->showLinkedObjectBlock($object); |
141 | 141 | print '</div></div>'; |
@@ -90,11 +90,11 @@ discard block |
||
90 | 90 | if ($num) { |
91 | 91 | while ($i < $num) { |
92 | 92 | $obj = $db->fetch_object($resql); |
93 | - $currentValue = substr($obj->immat, 0,2); |
|
93 | + $currentValue = substr($obj->immat, 0, 2); |
|
94 | 94 | |
95 | 95 | if ($obj) { |
96 | - if(true === $group && $currentValue !== $lastValue){ |
|
97 | - print '<optgroup label="'.$currentValue.'">'; |
|
96 | + if (true === $group && $currentValue !== $lastValue) { |
|
97 | + print '<optgroup label="' . $currentValue . '">'; |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | $lastValue = $currentValue; |
@@ -111,8 +111,8 @@ discard block |
||
111 | 111 | echo strtoupper($obj->immat); |
112 | 112 | print "</option>"; |
113 | 113 | |
114 | - if(true === $group && $currentValue !== $lastValue){ |
|
115 | - print '<optgroup label="'.$currentValue.'">'; |
|
114 | + if (true === $group && $currentValue !== $lastValue) { |
|
115 | + print '<optgroup label="' . $currentValue . '">'; |
|
116 | 116 | } |
117 | 117 | |
118 | 118 |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | $vol = new Bbcvols($this->db); |
66 | 66 | $vol->date = $command->getDate()->getTimestamp(); |
67 | 67 | $vol->lieuD = $command->getLieuD(); |
68 | - $vol->lieuA =$command->getLieuA(); |
|
68 | + $vol->lieuA = $command->getLieuA(); |
|
69 | 69 | $vol->heureD = $command->getHeureD()->format('Hi'); |
70 | 70 | $vol->heureA = $command->getHeureA()->format('Hi'); |
71 | 71 | $vol->BBC_ballons_idBBC_ballons = $command->getBBCBallonsIdBBCBallons(); |
@@ -73,14 +73,14 @@ discard block |
||
73 | 73 | $vol->remarque = $command->getRemarque(); |
74 | 74 | $vol->incidents = $command->getIncidents(); |
75 | 75 | $vol->fk_type = $command->getFkType(); |
76 | - $vol->fk_pilot =$command->getFkPilot(); |
|
76 | + $vol->fk_pilot = $command->getFkPilot(); |
|
77 | 77 | $vol->fk_organisateur = $command->getFkOrganisateur(); |
78 | 78 | $vol->kilometers = $command->getKilometers(); |
79 | 79 | $vol->cost = $command->getCost(); |
80 | 80 | $vol->fk_receiver = $command->getFkReceiver(); |
81 | 81 | $vol->justif_kilometers = $command->getJustifKilometers(); |
82 | 82 | $vol->setPassengerNames($command->getPassengerNames()); |
83 | - foreach($command->getOrderIds() as $orderId => $nbrPassengers){ |
|
83 | + foreach ($command->getOrderIds() as $orderId => $nbrPassengers) { |
|
84 | 84 | $vol->addOrderId($orderId, $nbrPassengers); |
85 | 85 | } |
86 | 86 | |
@@ -88,12 +88,12 @@ discard block |
||
88 | 88 | throw new Exception(); |
89 | 89 | } |
90 | 90 | |
91 | - if(!$vol->isBillingRequired() || ($vol->isLinkedToOrder() && $vol->hasReceiver())){ |
|
91 | + if (!$vol->isBillingRequired() || ($vol->isLinkedToOrder() && $vol->hasReceiver())) { |
|
92 | 92 | $vol->is_facture = true; |
93 | 93 | } |
94 | 94 | |
95 | 95 | $result = $vol->create($this->user); |
96 | - if($result <= 0){ |
|
96 | + if ($result <= 0) { |
|
97 | 97 | throw new Exception(); |
98 | 98 | } |
99 | 99 | |
@@ -113,27 +113,27 @@ discard block |
||
113 | 113 | { |
114 | 114 | $flight->fetch($flight->id); |
115 | 115 | |
116 | - if(!$flight->isLinkedToOrder()){ |
|
116 | + if (!$flight->isLinkedToOrder()) { |
|
117 | 117 | return; |
118 | 118 | } |
119 | 119 | |
120 | - foreach($flight->getOrders() as $currentOrder){ |
|
120 | + foreach ($flight->getOrders() as $currentOrder) { |
|
121 | 121 | $currentOrder->add_object_linked('flightlog_bbcvols', $flight->getId()); |
122 | 122 | $currentOrder->fetch_lines(); |
123 | 123 | |
124 | 124 | $qtyOrder = 0; |
125 | 125 | /** @var OrderLine $currentOrderLine */ |
126 | - foreach($currentOrder->lines as $currentOrderLine){ |
|
127 | - $qtyOrder += (int)$currentOrderLine->qty; |
|
126 | + foreach ($currentOrder->lines as $currentOrderLine) { |
|
127 | + $qtyOrder += (int) $currentOrderLine->qty; |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | $passangersCount = $this->numberOfPassengersLinkedToOrder($currentOrder->id); |
131 | 131 | |
132 | - if($passangersCount < $qtyOrder){ |
|
132 | + if ($passangersCount < $qtyOrder) { |
|
133 | 133 | continue; |
134 | 134 | } |
135 | 135 | |
136 | - if($currentOrder->statut == Commande::STATUS_VALIDATED){ |
|
136 | + if ($currentOrder->statut == Commande::STATUS_VALIDATED) { |
|
137 | 137 | $currentOrder->cloture($this->user); |
138 | 138 | } |
139 | 139 | } |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | */ |
152 | 152 | private function checkPassengersInformation($vol) |
153 | 153 | { |
154 | - if (!is_numeric($vol->nbrPax) || (int)$vol->nbrPax < 0) { |
|
154 | + if (!is_numeric($vol->nbrPax) || (int) $vol->nbrPax < 0) { |
|
155 | 155 | $this->addError('nbrPax', 'Erreur le nombre de passager est un nombre négatif.'); |
156 | 156 | } |
157 | 157 | |
@@ -203,13 +203,13 @@ discard block |
||
203 | 203 | */ |
204 | 204 | private function checkFlightInformation($vol) |
205 | 205 | { |
206 | - if(empty($vol->getHeureD()) || $vol->getHeureD() === '0000'){ |
|
206 | + if (empty($vol->getHeureD()) || $vol->getHeureD() === '0000') { |
|
207 | 207 | $this->addError('heureD', "L'heure depart est vide"); |
208 | 208 | } |
209 | 209 | if (!$this->isHourValid($vol->heureD)) { |
210 | 210 | $this->addError('heureD', "L'heure depart n'est pas correcte"); |
211 | 211 | } |
212 | - if(empty($vol->getHeureA()) || $vol->getHeureA() === '0000'){ |
|
212 | + if (empty($vol->getHeureA()) || $vol->getHeureA() === '0000') { |
|
213 | 213 | $this->addError('heureD', "L'heure d'arrivée est vide"); |
214 | 214 | } |
215 | 215 | |
@@ -249,10 +249,10 @@ discard block |
||
249 | 249 | $this->addError('order_id', 'Le nombre de passager par commande doit être >= 0.'); |
250 | 250 | } |
251 | 251 | |
252 | - $totalPassenegrs += (int)$nbrPassengers; |
|
252 | + $totalPassenegrs += (int) $nbrPassengers; |
|
253 | 253 | } |
254 | 254 | |
255 | - if (!$vol->hasReceiver() && $totalPassenegrs !== (int)$vol->getNumberOfPassengers()) { |
|
255 | + if (!$vol->hasReceiver() && $totalPassenegrs !== (int) $vol->getNumberOfPassengers()) { |
|
256 | 256 | $this->addError('nbrPax', 'Le nombre de passagers ne correspond pas au nombre entré sur les commandes'); |
257 | 257 | } |
258 | 258 | |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | |
279 | 279 | private function checkBalloon(Bbcvols $flight) |
280 | 280 | { |
281 | - if($flight->getBBCBallonsIdBBCBallons() > 0){ |
|
281 | + if ($flight->getBBCBallonsIdBBCBallons() > 0) { |
|
282 | 282 | return $this; |
283 | 283 | } |
284 | 284 |