Completed
Push — feature/number_enhancement ( b65f30 )
by Laurent
01:38
created
class/Damage/ValueObject/DamageLabel.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
class/flight/Pilot.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -106,11 +106,11 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
query/BillableFlightQueryHandler.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
         }
Please login to merge, or discard this patch.
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.
class/bbcvols.class.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
         $sql .= ' ' . (!isset($this->justif_kilometers) ? 'NULL' : "'" . $this->db->escape($this->justif_kilometers) . "'") . ',';
260 260
         $sql .= ' ' . "'" . date('Y-m-d H:i:s') . "'" . ',';
261 261
         $sql .= ' ' . "'" . date('Y-m-d H:i:s') . "'" . ',';
262
-        $sql .= ' ' . "'" . $this->passengerNames . "'" ;
262
+        $sql .= ' ' . "'" . $this->passengerNames . "'";
263 263
         $sql .= ')';
264 264
 
265 265
         $this->db->begin();
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
 
274 274
         if (!$error) {
275 275
             $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . $this->table_element);
276
-            if(!$this->insertOrders()){
276
+            if (!$this->insertOrders()) {
277 277
                 $error++;
278 278
             }
279 279
 
@@ -299,9 +299,9 @@  discard block
 block discarded – undo
299 299
     /**
300 300
      * Inserts the order linked to the flight
301 301
      */
302
-    private function insertOrders(){
302
+    private function insertOrders() {
303 303
 
304
-        if(empty($this->orderIds)){
304
+        if (empty($this->orderIds)) {
305 305
             return true;
306 306
         }
307 307
 
@@ -316,12 +316,12 @@  discard block
 block discarded – undo
316 316
         
317 317
         $values = [];
318 318
 
319
-        foreach($this->orderIds as $orderId=>$nbrPassengers){
319
+        foreach ($this->orderIds as $orderId=>$nbrPassengers) {
320 320
             $values[] = sprintf(
321 321
                 $valueTemplate,
322 322
                 $orderId,
323 323
                 $this->db->escape($this->id),
324
-                (!isset($nbrPassengers) ? '0' :  $this->db->escape($nbrPassengers))
324
+                (!isset($nbrPassengers) ? '0' : $this->db->escape($nbrPassengers))
325 325
             );
326 326
         }
327 327
 
@@ -339,9 +339,9 @@  discard block
 block discarded – undo
339 339
     /**
340 340
      * Inserts the order linked to the flight
341 341
      */
342
-    private function updateOrders(){
342
+    private function updateOrders() {
343 343
 
344
-        if(empty($this->orderIds)){
344
+        if (empty($this->orderIds)) {
345 345
             return true;
346 346
         }
347 347
 
@@ -352,9 +352,9 @@  discard block
 block discarded – undo
352 352
     /**
353 353
      * Inserts the order linked to the flight
354 354
      */
355
-    private function deleteOrders(){
355
+    private function deleteOrders() {
356 356
 
357
-        if(empty($this->orderIds)){
357
+        if (empty($this->orderIds)) {
358 358
             return true;
359 359
         }
360 360
 
@@ -559,7 +559,7 @@  discard block
 block discarded – undo
559 559
         $sql .= ' fk_receiver = ' . (isset($this->fk_receiver) && (int) $this->fk_receiver > 0 ? $this->fk_receiver : "null") . ',';
560 560
         $sql .= ' justif_kilometers = ' . (isset($this->justif_kilometers) ? "'" . $this->db->escape($this->justif_kilometers) . "'," : "'',");
561 561
         $sql .= ' date_update = ' . "'" . date('Y-m-d H:i:s') . "',";
562
-        $sql .= ' passenger_names = ' . "'" . trim($this->passengerNames)."'";
562
+        $sql .= ' passenger_names = ' . "'" . trim($this->passengerNames) . "'";
563 563
 
564 564
         $sql .= ' WHERE idBBC_vols=' . $this->idBBC_vols;
565 565
 
@@ -1022,8 +1022,8 @@  discard block
 block discarded – undo
1022 1022
      * @param int $orderId
1023 1023
      * @param int $nbrPassengers
1024 1024
      */
1025
-    public function addOrderId($orderId, $nbrPassengers){
1026
-        if(!isset($this->orderIds)){
1025
+    public function addOrderId($orderId, $nbrPassengers) {
1026
+        if (!isset($this->orderIds)) {
1027 1027
             $this->orderIds = [];
1028 1028
         }
1029 1029
 
@@ -1063,7 +1063,7 @@  discard block
 block discarded – undo
1063 1063
         if ($resql) {
1064 1064
             $numrows = $this->db->num_rows($resql);
1065 1065
             if ($numrows) {
1066
-                for($i = 0 ; $i < $numrows ; $i++){
1066
+                for ($i = 0; $i < $numrows; $i++) {
1067 1067
                     $obj = $this->db->fetch_object($resql);
1068 1068
                     $this->orderIds[$obj->order_id] = $obj->nbr_passengers;
1069 1069
 
@@ -1084,7 +1084,7 @@  discard block
 block discarded – undo
1084 1084
      */
1085 1085
     public function getOrders()
1086 1086
     {
1087
-        if(!isset($this->orders) || empty($this->orders)){
1087
+        if (!isset($this->orders) || empty($this->orders)) {
1088 1088
             $this->fetchOrder();
1089 1089
         }
1090 1090
         return $this->orders;
@@ -1209,7 +1209,7 @@  discard block
 block discarded – undo
1209 1209
      */
1210 1210
     public function getBBCBallonsIdBBCBallons()
1211 1211
     {
1212
-        return (int)$this->BBC_ballons_idBBC_ballons;
1212
+        return (int) $this->BBC_ballons_idBBC_ballons;
1213 1213
     }
1214 1214
 
1215 1215
     /**
@@ -1285,7 +1285,7 @@  discard block
 block discarded – undo
1285 1285
      */
1286 1286
     public function getFkType()
1287 1287
     {
1288
-        return (int)$this->fk_type;
1288
+        return (int) $this->fk_type;
1289 1289
     }
1290 1290
 
1291 1291
     /**
@@ -1380,7 +1380,7 @@  discard block
 block discarded – undo
1380 1380
      */
1381 1381
     public function getFkReceiver()
1382 1382
     {
1383
-        return (int)$this->fk_receiver;
1383
+        return (int) $this->fk_receiver;
1384 1384
     }
1385 1385
 
1386 1386
     /**
Please login to merge, or discard this patch.
card.php 1 patch
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 $extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
128 128
 
129 129
 // Load object
130
-include DOL_DOCUMENT_ROOT . '/core/actions_fetchobject.inc.php';  // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
130
+include DOL_DOCUMENT_ROOT . '/core/actions_fetchobject.inc.php'; // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
131 131
 include DOL_DOCUMENT_ROOT . '/core/actions_dellink.inc.php';
132 132
 
133 133
 // Initialize technical object to manage hooks of modules. Note that conf->hooks_modules contains array array
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
 
157 157
 $parameters = array();
158 158
 $reshook = $hookmanager->executeHooks('doActions', $parameters, $object,
159
-    $action);    // Note that $action and $object may have been modified by some hooks
159
+    $action); // Note that $action and $object may have been modified by some hooks
160 160
 if ($reshook < 0) {
161 161
     setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
162 162
 }
@@ -234,12 +234,12 @@  discard block
 block discarded – undo
234 234
 
235 235
     // Action to classify in a project
236 236
     if (!empty($conf->projet->enabled) && $user->rights->projet->creer && $action === ACTION_CLASSIN) {
237
-        try{
237
+        try {
238 238
             $handler = new \flightlog\command\ClassifyFlightHandler($db, $conf, $langs, $user);
239 239
             $handler->handle(new \flightlog\command\ClassifyFlight($id, GETPOST('projectid')));
240 240
             $object->fetch($id);
241 241
             $action = 'show';
242
-        }catch(Exception $e){
242
+        } catch (Exception $e) {
243 243
             setEventMessages($e->getMessage(), null, 'errors');
244 244
         }
245 245
     }
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
 
273 273
 
274 274
 // Part to edit record
275
-if (($user->rights->flightlog->vol->edit || ($user->rights->flightlog->vol->add && $object->fk_pilot == $user->id )) && ($id || $ref) && $action == 'edit'): ?>
275
+if (($user->rights->flightlog->vol->edit || ($user->rights->flightlog->vol->add && $object->fk_pilot == $user->id)) && ($id || $ref) && $action == 'edit'): ?>
276 276
 
277 277
     <?php $renderer = new \flightlog\form\SimpleFormRenderer(); ?>
278 278
 
@@ -286,11 +286,11 @@  discard block
 block discarded – undo
286 286
 
287 287
     <form class="flight-form js-form" name='add' action="card.php?rowid=<?php echo $object->getId(); ?>" method="POST">
288 288
         <input type="hidden" name="action" value="update"/>
289
-        <input type="hidden" name="token" value="<?php echo newToken();?>"/>
289
+        <input type="hidden" name="token" value="<?php echo newToken(); ?>"/>
290 290
 
291 291
         <?php echo $renderer->render($formFlight->getElement('idBBC_vols')); ?>
292 292
 
293
-        <?php if($formFlight->has('fk_type')): ?>
293
+        <?php if ($formFlight->has('fk_type')): ?>
294 294
         <section class="form-section">
295 295
             <h1 class="form-section-title"><?php echo $langs->trans('Type de vol'); ?></h1>
296 296
             <table class="border" width="50%">
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
         <?php endif; ?>
305 305
 
306 306
         <!-- Date et heures -->
307
-        <?php if($formFlight->has('date')): ?>
307
+        <?php if ($formFlight->has('date')): ?>
308 308
             <section class="form-section">
309 309
                 <h1 class="form-section-title"><?php echo $langs->trans('Date'); ?></h1>
310 310
                 <table class="border" width="50%">
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
             </section>
317 317
         <?php endif; ?>
318 318
 
319
-        <?php if($formFlight->has('heureD') && $formFlight->has('heureA')): ?>
319
+        <?php if ($formFlight->has('heureD') && $formFlight->has('heureA')): ?>
320 320
             <section class="form-section">
321 321
                 <h1 class="form-section-title"><?php echo $langs->trans('Heures'); ?></h1>
322 322
                 <table class="border" width="50%">
@@ -336,14 +336,14 @@  discard block
 block discarded – undo
336 336
             <h1 class="form-section-title"><?php echo $langs->trans('Pilote & ballon') ?></h1>
337 337
             <table class="border" width="50%">
338 338
 
339
-                <?php if($formFlight->has('fk_pilot')): ?>
339
+                <?php if ($formFlight->has('fk_pilot')): ?>
340 340
                 <tr>
341 341
                     <td class="fieldrequired"> Pilote </td>
342
-                    <td><?php echo $renderer->render($formFlight->getElement('fk_pilot'),['ajax' => true]); ?></td>
342
+                    <td><?php echo $renderer->render($formFlight->getElement('fk_pilot'), ['ajax' => true]); ?></td>
343 343
                 </tr>
344 344
                 <?php endif; ?>
345 345
 
346
-                <?php if($formFlight->has('BBC_ballons_idBBC_ballons')): ?>
346
+                <?php if ($formFlight->has('BBC_ballons_idBBC_ballons')): ?>
347 347
                 <tr>
348 348
                     <td width="25%" class="fieldrequired">Ballon</td>
349 349
                     <td><?php echo $renderer->render($formFlight->getElement('BBC_ballons_idBBC_ballons')); ?></td>
@@ -378,7 +378,7 @@  discard block
 block discarded – undo
378 378
             </table>
379 379
         </section>
380 380
 
381
-        <?php if($formFlight->has('fk_organisateur')): ?>
381
+        <?php if ($formFlight->has('fk_organisateur')): ?>
382 382
             <section class="form-section">
383 383
                 <h1 class="form-section-title"><span class="js-organisator-field">Organisateur</span></h1>
384 384
                 <table class="border" width="50%">
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
                         <td>
388 388
                             <?php
389 389
                             //organisateur
390
-                            print $renderer->render($formFlight->getElement('fk_organisateur'),['ajax' => true]);
390
+                            print $renderer->render($formFlight->getElement('fk_organisateur'), ['ajax' => true]);
391 391
                             ?>
392 392
                         </td>
393 393
                     </tr>
@@ -399,7 +399,7 @@  discard block
 block discarded – undo
399 399
         <section class="form-section js-expensable-field">
400 400
             <h1 class="form-section-title"><?php echo $langs->trans('Déplacements') ?></h1>
401 401
             <table class="border" width="50%">
402
-                <?php if($formFlight->has('kilometers')): ?>
402
+                <?php if ($formFlight->has('kilometers')): ?>
403 403
                     <!-- number of kilometers done for the flight -->
404 404
                     <tr>
405 405
                         <td class="fieldrequired">Nombre de kilometres effectués pour le vol</td>
@@ -409,7 +409,7 @@  discard block
 block discarded – undo
409 409
                     </tr>
410 410
                 <?php endif; ?>
411 411
 
412
-                <?php if($formFlight->has('justif_kilometers')): ?>
412
+                <?php if ($formFlight->has('justif_kilometers')): ?>
413 413
                     <!-- Justif Kilometers -->
414 414
                     <tr>
415 415
 
@@ -427,7 +427,7 @@  discard block
 block discarded – undo
427 427
         <section class="form-section">
428 428
             <h1 class="form-section-title"><?php echo $langs->trans('Passager') ?></h1>
429 429
             <table class="border" width="50%">
430
-                <?php if($formFlight->has('nbrPax')): ?>
430
+                <?php if ($formFlight->has('nbrPax')): ?>
431 431
                     <tr>
432 432
                         <td class="fieldrequired"><?php echo $langs->trans('Nombre de passagers'); ?></td>
433 433
                         <td>
@@ -436,7 +436,7 @@  discard block
 block discarded – undo
436 436
                     </tr>
437 437
                 <?php endif; ?>
438 438
 
439
-                <?php if($formFlight->has('passengerNames')): ?>
439
+                <?php if ($formFlight->has('passengerNames')): ?>
440 440
                     <!-- passenger names -->
441 441
                     <tr>
442 442
                         <td width="25%" class="fieldrequired"><?php echo $langs->trans('Noms des passagers'); ?><br/>(Séparé
@@ -446,7 +446,7 @@  discard block
 block discarded – undo
446 446
                             <?php print $renderer->render($formFlight->getElement('passengerNames')); ?>
447 447
                         </td>
448 448
                     </tr>
449
-                <?php endif;?>
449
+                <?php endif; ?>
450 450
             </table>
451 451
         </section>
452 452
 
@@ -455,17 +455,17 @@  discard block
 block discarded – undo
455 455
             <h1 class="form-section-title js-billable-field"><?php echo $langs->trans('Facturation') ?></h1>
456 456
             <table class="border" width="50%">
457 457
 
458
-                <?php if($formFlight->has('fk_receiver')): ?>
458
+                <?php if ($formFlight->has('fk_receiver')): ?>
459 459
                     <!-- Money receiver -->
460 460
                     <tr class="js-hide-order js-billable-field">
461 461
                         <td class="fieldrequired"><?php echo $langs->trans('Qui a perçu l\'argent') ?></td>
462 462
                         <td>
463
-                            <?php print $renderer->render($formFlight->getElement('fk_receiver'),['ajax' => true]); ?>
463
+                            <?php print $renderer->render($formFlight->getElement('fk_receiver'), ['ajax' => true]); ?>
464 464
                         </td>
465 465
                     </tr>
466 466
                 <?php endif; ?>
467 467
 
468
-                <?php if($formFlight->has('cost')): ?>
468
+                <?php if ($formFlight->has('cost')): ?>
469 469
                     <!-- Flight cost -->
470 470
                     <tr class="js-hide-order js-billable-field">
471 471
                         <td class="fieldrequired">Montant perçu</td>
@@ -486,7 +486,7 @@  discard block
 block discarded – undo
486 486
             <h1 class="form-section-title"><?php echo $langs->trans('Commentaires') ?></h1>
487 487
             <table class="border" width="50%">
488 488
 
489
-                <?php if($formFlight->has('remarque')): ?>
489
+                <?php if ($formFlight->has('remarque')): ?>
490 490
                     <!-- commentaires -->
491 491
                     <tr class="">
492 492
                         <td class="fieldrequired"> Commentaire</td>
@@ -496,7 +496,7 @@  discard block
 block discarded – undo
496 496
                     </tr>
497 497
                 <?php endif; ?>
498 498
 
499
-                <?php if($formFlight->has('incidents')): ?>
499
+                <?php if ($formFlight->has('incidents')): ?>
500 500
                     <!-- incidents -->
501 501
                     <tr class="">
502 502
                         <td class="fieldrequired"> incidents</td>
@@ -530,7 +530,7 @@  discard block
 block discarded – undo
530 530
         $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('DeleteMyOjbect'),
531 531
             $langs->trans('êtes-vous sure de vouloir supprimer ce vol ?'), 'confirm_delete', '', 0, 1);
532 532
         print $formconfirm;
533
-    } elseif ($user->rights->flightlog->vol->financial  && $action == ACTION_FLAG_BILLED) {
533
+    } elseif ($user->rights->flightlog->vol->financial && $action == ACTION_FLAG_BILLED) {
534 534
         $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id,
535 535
             $langs->trans('Marque comme facturé'),
536 536
             $langs->trans('Ce vol va être marqué comme facturé, est-ce bien le cas ?'), ACTION_CONFIRM_FLAG_BILLED, '',
@@ -554,29 +554,29 @@  discard block
 block discarded – undo
554 554
     print '<tr><td class="fieldrequired">' . $langs->trans("Fieldfk_pilot") . '</td><td>' . $pilot->getNomUrl(1) . '</td></tr>';
555 555
     print '<tr><td class="fieldrequired">' . $langs->trans("Fieldfk_organisateur") . '</td><td>' . $organisator->getNomUrl(1) . '</td></tr>';
556 556
 
557
-    if (! empty($conf->projet->enabled))
557
+    if (!empty($conf->projet->enabled))
558 558
     {
559 559
         print '<tr><td class="fieldrequired">' . $langs->trans("Project") . '</td><td>';
560 560
         $morehtmlref = '';
561 561
         if ($user->rights->projet->creer)
562 562
         {
563 563
             if ($action !== ACTION_CLASSIFY) {
564
-                $morehtmlref .= '<a href="' . $_SERVER['PHP_SELF'] . '?action='.ACTION_CLASSIFY.'&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> ';
564
+                $morehtmlref .= '<a href="' . $_SERVER['PHP_SELF'] . '?action=' . ACTION_CLASSIFY . '&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> ';
565 565
             }
566 566
             if ($action === ACTION_CLASSIFY) {
567
-                $morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
568
-                $morehtmlref.='<input type="hidden" name="action" value="'.ACTION_CLASSIN.'">';
569
-                $morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
570
-                $morehtmlref.=$formproject->select_projects((empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS)?$object->socid:-1), $object->fk_project, 'projectid', 80, 0, 1, 0, 1, 0, 0, '', 1);
571
-                $morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
572
-                $morehtmlref.='</form>';
567
+                $morehtmlref .= '<form method="post" action="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '">';
568
+                $morehtmlref .= '<input type="hidden" name="action" value="' . ACTION_CLASSIN . '">';
569
+                $morehtmlref .= '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
570
+                $morehtmlref .= $formproject->select_projects((empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS) ? $object->socid : -1), $object->fk_project, 'projectid', 80, 0, 1, 0, 1, 0, 0, '', 1);
571
+                $morehtmlref .= '<input type="submit" class="button valignmiddle" value="' . $langs->trans("Modify") . '">';
572
+                $morehtmlref .= '</form>';
573 573
             }
574 574
         }
575 575
 
576 576
         if ($object->hasProject()) {
577 577
             $proj = new Project($db);
578 578
             $proj->fetch($object->fk_project);
579
-            $morehtmlref.=$proj->getNomUrl(1);
579
+            $morehtmlref .= $proj->getNomUrl(1);
580 580
         }
581 581
         print $morehtmlref . '</td>';
582 582
     }
@@ -591,7 +591,7 @@  discard block
 block discarded – undo
591 591
     print '<div class="tabsAction">' . "\n";
592 592
     $parameters = array();
593 593
     $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object,
594
-        $action);    // Note that $action and $object may have been modified by hook
594
+        $action); // Note that $action and $object may have been modified by hook
595 595
     if ($reshook < 0) {
596 596
         setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
597 597
     }
Please login to merge, or discard this patch.