Completed
Push — feature/pilot_information ( cc067b...4835e7 )
by Laurent
01:49
created
card_tab_financial.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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>';
Please login to merge, or discard this patch.
lib/flightLog.lib.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -90,11 +90,11 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
command/CreateFlightCommandHandler.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
         }
Please login to merge, or discard this patch.
validators/FlightValidator.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
lib/card.lib.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@
 block discarded – undo
33 33
         'Vol',
34 34
         'Finances',
35 35
         'Dégâts',
36
-        'Remarques '.($flight->hasComment() ? ' - <span class="fa fa-comment" title="'.$flight->getComment().'"></span>' : '').($flight->hasIncidents() ? ' - <span class="fa fa-exclamation" title="'.$flight->getIncident().'"></span>' : ''),
36
+        'Remarques ' . ($flight->hasComment() ? ' - <span class="fa fa-comment" title="' . $flight->getComment() . '"></span>' : '') . ($flight->hasIncidents() ? ' - <span class="fa fa-exclamation" title="' . $flight->getIncident() . '"></span>' : ''),
37 37
         'Suivis',
38 38
     ];
39 39
 
Please login to merge, or discard this patch.
Infrastructure/Flight/Query/Repository/TakeOffQueryRepository.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
             WHERE 
36 36
               fk_type IN (1,2)
37 37
               AND YEAR(NOW())-1 <= YEAR(llx_bbc_vols.date)
38
-              AND llx_bbc_vols.fk_pilot = '.$pilot.'
38
+              AND llx_bbc_vols.fk_pilot = '.$pilot . '
39 39
             
40 40
             GROUP BY
41 41
               llx_bbc_vols.lieuD
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 
58 58
         $places = [];
59 59
 
60
-        for($i = 0; $i < $num ; $i++) {
60
+        for ($i = 0; $i < $num; $i++) {
61 61
             $properties = $this->db->fetch_array($resql);
62 62
             $stat = new TakeOffPlace($properties['place']);
63 63
             $places[] = $stat;
Please login to merge, or discard this patch.
Infrastructure/Flight/Query/Repository/BalloonQueryRepository.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
         $this->db = $db;
21 21
     }
22 22
 
23
-    public function query($params = []){
23
+    public function query($params = []) {
24 24
         $sql = '
25 25
             SELECT 
26 26
               balloon.rowid as id,
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
             
34 34
             WHERE 
35 35
               balloon.is_disable = false
36
-              AND llx_bbc_vols.fk_pilot = '.$params['pilot'].'
36
+              AND llx_bbc_vols.fk_pilot = '.$params['pilot'] . '
37 37
               
38 38
             GROUP BY balloon.rowid
39 39
             ORDER  BY counter DESC
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
             return new Balloon(0);
51 51
         }
52 52
 
53
-        for($i = 0; $i < $num ; $i++) {
53
+        for ($i = 0; $i < $num; $i++) {
54 54
             $properties = $this->db->fetch_array($resql);
55 55
             return Balloon::fromArray($properties);
56 56
         }
Please login to merge, or discard this patch.
addFlight.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -43,8 +43,8 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
     }
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 
104 104
 <section class="bbc-style">
105 105
 
106
-    <?php if(!empty($takeOffPlaces)): ?>
106
+    <?php if (!empty($takeOffPlaces)): ?>
107 107
         <datalist id="take_off_places_id">
108 108
             <?php foreach ($takeOffPlaces as $takeOffPlace): ?>
109 109
                 <option value="<?php echo $takeOffPlace->getPlace(); ?>"></option>
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
     <form class="flight-form js-form" name='add' action="addFlight.php" method="post">
122 122
         <input type="hidden" name="action" value="add"/>
123 123
         <input type="hidden" name="user_id" value="<?php echo $user->id; ?>"/>
124
-        <input type="hidden" name="token" value="<?php echo newToken();?>"/>
124
+        <input type="hidden" name="token" value="<?php echo newToken(); ?>"/>
125 125
 
126 126
         <!-- Date et heures -->
127 127
         <section class="form-section">
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
             <div >
183 183
                 <div class="form-group">
184 184
                     <label class="fieldrequired"> Pilote</label>
185
-                    <?php print $html->select_dolusers($_POST["pilot"] ? $_POST["pilot"] : $user->id, 'pilot', 0, null, 0, '', '', 0,0,0,'',0,'','', true); ?>
185
+                    <?php print $html->select_dolusers($_POST["pilot"] ? $_POST["pilot"] : $user->id, 'pilot', 0, null, 0, '', '', 0, 0, 0, '', 0, '', '', true); ?>
186 186
                 </div>
187 187
 
188 188
                 <div class="form-group ">
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
                     </label>
193 193
                     <?php
194 194
                         //organisateur
195
-                        print $html->select_dolusers($_POST["orga"] ? $_POST["orga"] : $user->id, 'orga', 0, null, 0, '', '', 0,0,0,'',0,'','', true);
195
+                        print $html->select_dolusers($_POST["orga"] ? $_POST["orga"] : $user->id, 'orga', 0, null, 0, '', '', 0, 0, 0, '', 0, '', '', true);
196 196
                     ?>
197 197
                 </div>
198 198
 
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
 
209 209
                 <div class="form-group">
210 210
                     <label class="fieldrequired">Ballon</label>
211
-                    <?php select_balloons($_POST['ballon']?: ($mostUsedBalloon ? $mostUsedBalloon->getId() : ''), 'ballon', 0, false, true); ?>
211
+                    <?php select_balloons($_POST['ballon'] ?: ($mostUsedBalloon ? $mostUsedBalloon->getId() : ''), 'ballon', 0, false, true); ?>
212 212
                 </div>
213 213
 
214 214
                 <div class="form-group">
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
                            min="0"
249 249
                            max="5"
250 250
                            class="flat <?php echo $validator->hasError('nbrPax') ? 'error' : '' ?>"
251
-                           value="<?php echo $_POST['nbrPax']?: 0 ?>"/>
251
+                           value="<?php echo $_POST['nbrPax'] ?: 0 ?>"/>
252 252
                 </div>
253 253
 
254 254
                 <!-- passenger names -->
@@ -285,16 +285,16 @@  discard block
 block discarded – undo
285 285
                         </tr>
286 286
 
287 287
                         <tr>
288
-                            <td class="js-receiver" data-user-id="<?php echo $user->id;?>">
288
+                            <td class="js-receiver" data-user-id="<?php echo $user->id; ?>">
289 289
                                 <label class=""><?php echo $langs->trans('Membre ayant perçu l\'argent')?>?</label>
290 290
                                 <?php print $html->select_dolusers(
291 291
                                         $_POST["fk_receiver"] ? $_POST["fk_receiver"] : -1,
292
-                                    'fk_receiver', true, null, 0, '', '', 0,0,0,'',0,'','', true); ?>
292
+                                    'fk_receiver', true, null, 0, '', '', 0, 0, 0, '', 0, '', '', true); ?>
293 293
                             </td>
294 294
                             <td>
295 295
                                 <label>&nbsp;</label>
296 296
                                 <div class="input-group">
297
-                                    <input type="number" name="cost"  step="1" min="0" class="flat js-cost" disabled value="<?php echo $_POST['cost']?:0 ?>"/>
297
+                                    <input type="number" name="cost"  step="1" min="0" class="flat js-cost" disabled value="<?php echo $_POST['cost'] ?: 0 ?>"/>
298 298
                                     <span class="input-symbol">&euro;</span>
299 299
                                 </div>
300 300
                             </td>
@@ -305,8 +305,8 @@  discard block
 block discarded – undo
305 305
                             <th>B. Commande(s)</th>
306 306
                             <th>Nombre de passagers.</th>
307 307
                         </tr>
308
-                        <?php if(is_array($_POST['order_passengers_count']) && !empty($_POST['order_passengers_count'])): ?>
309
-                            <?php foreach($_POST['order_passengers_count'] as $order => $orderQuantity): ?>
308
+                        <?php if (is_array($_POST['order_passengers_count']) && !empty($_POST['order_passengers_count'])): ?>
309
+                            <?php foreach ($_POST['order_passengers_count'] as $order => $orderQuantity): ?>
310 310
                                 <tr class="order-row">
311 311
                                     <td>
312 312
                                         <span class="fa fa-trash remove js-remove" data-order-id="<?php echo $order; ?>"></span>
Please login to merge, or discard this patch.
command/CreatePilotYearBillCommandHandler.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -147,22 +147,22 @@  discard block
 block discarded – undo
147 147
 
148 148
         $remainingPoints = $command->getPilot()->getFlightBonus()->addPoints(FlightPoints::create($command->getAdditionalBonus()));
149 149
 
150
-        foreach ($amountPerRate as $rate => $cost){
151
-            if($cost->getValue() <= 0){
150
+        foreach ($amountPerRate as $rate => $cost) {
151
+            if ($cost->getValue() <= 0) {
152 152
                 continue;
153 153
             }
154 154
 
155
-            if($cost->getValue() <= $remainingPoints->getValue()){
155
+            if ($cost->getValue() <= $remainingPoints->getValue()) {
156 156
                 $remainingPoints = $remainingPoints->minCosts($cost);
157 157
                 continue;
158 158
             }
159 159
 
160 160
             $subject = 'vols';
161
-            if((int)$rate === 21){
161
+            if ((int) $rate === 21) {
162 162
                 $subject = 'réparations';
163 163
             }
164 164
 
165
-            $this->addOrderLine($object, 'Cloture d\'année concernant les ' . $subject, $cost->minBonus($remainingPoints)->getValue(), (int)$rate, 1, $startYearTimestamp, $endYearTimestamp );
165
+            $this->addOrderLine($object, 'Cloture d\'année concernant les ' . $subject, $cost->minBonus($remainingPoints)->getValue(), (int) $rate, 1, $startYearTimestamp, $endYearTimestamp);
166 166
             $remainingPoints = FlightBonus::zero();
167 167
 
168 168
         }
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
      */
209 209
     private function addOrderLine($object, $title, $priceTtc, $rate, $qty, $startDate, $endDate)
210 210
     {
211
-        if($qty <= 0){
211
+        if ($qty <= 0) {
212 212
             return;
213 213
         }
214 214
 
@@ -264,35 +264,35 @@  discard block
 block discarded – undo
264 264
 
265 265
         //T3
266 266
         $rate = $this->t3->getService()->tva_tx;
267
-        if(!isset($costs[$rate])){
267
+        if (!isset($costs[$rate])) {
268 268
             $costs[$rate] = FlightCost::zero();
269 269
         }
270 270
         $costs[$rate] = $costs[$rate]->addCost($pilot->getCountForType('3')->getCost());
271 271
 
272 272
         //T4
273 273
         $rate = $this->t4->getService()->tva_tx;
274
-        if(!isset($costs[$rate])){
274
+        if (!isset($costs[$rate])) {
275 275
             $costs[$rate] = FlightCost::zero();
276 276
         }
277 277
         $costs[$rate] = $costs[$rate]->addCost($pilot->getCountForType('4')->getCost());
278 278
 
279 279
         //T6
280 280
         $rate = $this->t6->getService()->tva_tx;
281
-        if(!isset($costs[$rate])){
281
+        if (!isset($costs[$rate])) {
282 282
             $costs[$rate] = FlightCost::zero();
283 283
         }
284 284
         $costs[$rate] = $costs[$rate]->addCost($pilot->getCountForType('6')->getCost());
285 285
 
286 286
         //T7
287 287
         $rate = $this->t7->getService()->tva_tx;
288
-        if(!isset($costs[$rate])){
288
+        if (!isset($costs[$rate])) {
289 289
             $costs[$rate] = FlightCost::zero();
290 290
         }
291 291
         $costs[$rate] = $costs[$rate]->addCost($pilot->getCountForType('7')->getCost());
292 292
 
293 293
         //Damages
294 294
         $rate = 21;
295
-        if(!isset($costs[$rate])){
295
+        if (!isset($costs[$rate])) {
296 296
             $costs[$rate] = FlightCost::zero();
297 297
         }
298 298
         $costs[$rate] = $costs[$rate]->addCost($pilot->damageCost()->minCost($pilot->invoicedDamageCost()->multiply(-1)));
Please login to merge, or discard this patch.