Completed
Pull Request — master (#24)
by Laurent
15:04 queued 10:25
created
command/CreateFlightBillCommand.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -91,7 +91,7 @@
 block discarded – undo
91 91
             throw new \InvalidArgumentException('Model document is missing');
92 92
         }
93 93
 
94
-        if(!isset($nbrPax) || !is_numeric($nbrPax) || !is_integer($nbrPax)){
94
+        if (!isset($nbrPax) || !is_numeric($nbrPax) || !is_integer($nbrPax)) {
95 95
             throw new \InvalidArgumentException('The number of pax is not correct, an integer is expected');
96 96
         }
97 97
 
Please login to merge, or discard this patch.
class/bbcvols.class.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -247,18 +247,18 @@  discard block
 block discarded – undo
247 247
         $sql .= ' ' . (!isset($this->nbrPax) ? 'NULL' : "'" . $this->db->escape($this->nbrPax) . "'") . ',';
248 248
         $sql .= ' ' . (!isset($this->remarque) ? 'NULL' : "'" . $this->db->escape($this->remarque) . "'") . ',';
249 249
         $sql .= ' ' . (!isset($this->incidents) ? 'NULL' : "'" . $this->db->escape($this->incidents) . "'") . ',';
250
-        $sql .= ' ' . (!isset($this->fk_type) || (int)$this->fk_type === -1 ? 'NULL' : $this->fk_type) . ',';
251
-        $sql .= ' ' . (!isset($this->fk_pilot) || (int)$this->fk_pilot === -1 ? 'NULL' : $this->fk_pilot) . ',';
252
-        $sql .= ' ' . (!isset($this->fk_organisateur) || (int)$this->fk_organisateur === -1 ? 'NULL' : $this->fk_organisateur) . ',';
250
+        $sql .= ' ' . (!isset($this->fk_type) || (int) $this->fk_type === -1 ? 'NULL' : $this->fk_type) . ',';
251
+        $sql .= ' ' . (!isset($this->fk_pilot) || (int) $this->fk_pilot === -1 ? 'NULL' : $this->fk_pilot) . ',';
252
+        $sql .= ' ' . (!isset($this->fk_organisateur) || (int) $this->fk_organisateur === -1 ? 'NULL' : $this->fk_organisateur) . ',';
253 253
         $sql .= ' ' . (!isset($this->is_facture) ? '0' : $this->is_facture) . ',';
254 254
         $sql .= ' ' . (!isset($this->kilometers) || empty($this->kilometers) ? '0' : $this->kilometers) . ',';
255 255
         $sql .= ' ' . (!isset($this->cost) ? 'NULL' : "'" . $this->db->escape($this->cost) . "'") . ',';
256
-        $sql .= ' ' . (!isset($this->fk_receiver) || (int)$this->fk_receiver === -1 ? 'NULL' : $this->fk_receiver) . ',';
256
+        $sql .= ' ' . (!isset($this->fk_receiver) || (int) $this->fk_receiver === -1 ? 'NULL' : $this->fk_receiver) . ',';
257 257
         $sql .= ' ' . (!isset($this->justif_kilometers) ? 'NULL' : "'" . $this->db->escape($this->justif_kilometers) . "'") . ',';
258 258
         $sql .= ' ' . "'" . date('Y-m-d H:i:s') . "'" . ',';
259 259
         $sql .= ' ' . "'" . date('Y-m-d H:i:s') . "'" . ',';
260 260
         $sql .= ' ' . "'" . $this->passengerNames . "'" . ',';
261
-        $sql .= ' ' . (!isset($this->orderId) || (int)$this->orderId === -1 ? 'NULL' : $this->orderId) . '';
261
+        $sql .= ' ' . (!isset($this->orderId) || (int) $this->orderId === -1 ? 'NULL' : $this->orderId) . '';
262 262
 
263 263
         $sql .= ')';
264 264
 
@@ -346,28 +346,28 @@  discard block
 block discarded – undo
346 346
 
347 347
                 $this->id = $obj->idBBC_vols;
348 348
 
349
-                $this->idBBC_vols = (int)$obj->idBBC_vols;
349
+                $this->idBBC_vols = (int) $obj->idBBC_vols;
350 350
                 $this->date = $this->db->jdate($obj->date);
351 351
                 $this->lieuD = $obj->lieuD;
352 352
                 $this->lieuA = $obj->lieuA;
353 353
                 $this->heureD = $obj->heureD;
354 354
                 $this->heureA = $obj->heureA;
355
-                $this->BBC_ballons_idBBC_ballons = (int)$obj->BBC_ballons_idBBC_ballons;
355
+                $this->BBC_ballons_idBBC_ballons = (int) $obj->BBC_ballons_idBBC_ballons;
356 356
                 $this->nbrPax = $obj->nbrPax;
357 357
                 $this->remarque = $obj->remarque;
358 358
                 $this->incidents = $obj->incidents;
359
-                $this->fk_type = (int)$obj->fk_type;
360
-                $this->fk_pilot = (int)$obj->fk_pilot;
361
-                $this->fk_organisateur = (int)$obj->fk_organisateur;
362
-                $this->is_facture = (int)$obj->is_facture;
359
+                $this->fk_type = (int) $obj->fk_type;
360
+                $this->fk_pilot = (int) $obj->fk_pilot;
361
+                $this->fk_organisateur = (int) $obj->fk_organisateur;
362
+                $this->is_facture = (int) $obj->is_facture;
363 363
                 $this->kilometers = $obj->kilometers;
364 364
                 $this->cost = $obj->cost;
365
-                $this->fk_receiver = (int)$obj->fk_receiver;
365
+                $this->fk_receiver = (int) $obj->fk_receiver;
366 366
                 $this->justif_kilometers = $obj->justif_kilometers;
367 367
                 $this->date_creation = $obj->date_creation;
368 368
                 $this->date_update = $obj->date_update;
369 369
                 $this->passengerNames = $obj->passenger_names;
370
-                $this->orderId = (int)$obj->order_id;
370
+                $this->orderId = (int) $obj->order_id;
371 371
 
372 372
                 $this->balloon = $this->fetchBalloon();
373 373
                 $this->pilot = $this->fetchUser($this->fk_pilot);
@@ -476,17 +476,17 @@  discard block
 block discarded – undo
476 476
         $sql .= ' nbrPax = ' . (isset($this->nbrPax) ? "'" . $this->db->escape($this->nbrPax) . "'" : "null") . ',';
477 477
         $sql .= ' remarque = ' . (isset($this->remarque) ? "'" . $this->db->escape($this->remarque) . "'" : "null") . ',';
478 478
         $sql .= ' incidents = ' . (isset($this->incidents) ? "'" . $this->db->escape($this->incidents) . "'" : "null") . ',';
479
-        $sql .= ' fk_type = ' . (isset($this->fk_type) && (int)$this->fk_type > 0 ? $this->fk_type : "null") . ',';
480
-        $sql .= ' fk_pilot = ' . (isset($this->fk_pilot) && (int)$this->fk_pilot > 0 ? $this->fk_pilot : "null") . ',';
481
-        $sql .= ' fk_organisateur = ' . (isset($this->fk_organisateur) && (int)$this->fk_organisateur > 0 ? $this->fk_organisateur : "null") . ',';
479
+        $sql .= ' fk_type = ' . (isset($this->fk_type) && (int) $this->fk_type > 0 ? $this->fk_type : "null") . ',';
480
+        $sql .= ' fk_pilot = ' . (isset($this->fk_pilot) && (int) $this->fk_pilot > 0 ? $this->fk_pilot : "null") . ',';
481
+        $sql .= ' fk_organisateur = ' . (isset($this->fk_organisateur) && (int) $this->fk_organisateur > 0 ? $this->fk_organisateur : "null") . ',';
482 482
         $sql .= ' is_facture = ' . (isset($this->is_facture) ? $this->is_facture : "0") . ',';
483 483
         $sql .= ' kilometers = ' . (!empty($this->kilometers) ? $this->kilometers : "0") . ',';
484 484
         $sql .= ' cost = ' . (isset($this->cost) ? "'" . $this->db->escape($this->cost) . "'" : "''") . ',';
485
-        $sql .= ' fk_receiver = ' . (isset($this->fk_receiver) && (int)$this->fk_receiver > 0 ? $this->fk_receiver : "null") . ',';
485
+        $sql .= ' fk_receiver = ' . (isset($this->fk_receiver) && (int) $this->fk_receiver > 0 ? $this->fk_receiver : "null") . ',';
486 486
         $sql .= ' justif_kilometers = ' . (isset($this->justif_kilometers) ? "'" . $this->db->escape($this->justif_kilometers) . "'," : "'',");
487 487
         $sql .= ' date_update = ' . "'" . date('Y-m-d H:i:s') . "',";
488 488
         $sql .= ' passenger_names = ' . "'" . trim($this->passengerNames) . "',";
489
-        $sql .= ' order_id = ' .  (!isset($this->orderId) || (int)$this->orderId === -1 ? 'null' : $this->orderId);
489
+        $sql .= ' order_id = ' . (!isset($this->orderId) || (int) $this->orderId === -1 ? 'null' : $this->orderId);
490 490
 
491 491
         $sql .= ' WHERE idBBC_vols=' . $this->idBBC_vols;
492 492
 
@@ -853,7 +853,7 @@  discard block
 block discarded – undo
853 853
      */
854 854
     public function getAmountPerPassenger()
855 855
     {
856
-        $nbrPax = $this->nbrPax > 0 ? $this->nbrPax : 1 ;
856
+        $nbrPax = $this->nbrPax > 0 ? $this->nbrPax : 1;
857 857
         return $this->cost / $nbrPax;
858 858
     }
859 859
 
Please login to merge, or discard this patch.
facture.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -124,12 +124,12 @@
 block discarded – undo
124 124
  * Put here all code to do according to value of "action" parameter
125 125
  */
126 126
 if ($action == EXPENSE_REPORT_GENERATOR_ACTION_GENERATE) {
127
-    try{
128
-        $command = new CreateFlightBillCommand($flight->getId(), $modeReglement, $conditionReglement, $documentModel, $type, $publicNote, $privateNote,$bankAccount, $nbrPax);
127
+    try {
128
+        $command = new CreateFlightBillCommand($flight->getId(), $modeReglement, $conditionReglement, $documentModel, $type, $publicNote, $privateNote, $bankAccount, $nbrPax);
129 129
         $handler->handle($command);
130 130
         Header("Location: card.php?id=" . $flight->getId());
131
-    }catch (\Exception $e){
132
-        dol_syslog($e->getMessage(),LOG_ERR);
131
+    } catch (\Exception $e) {
132
+        dol_syslog($e->getMessage(), LOG_ERR);
133 133
         dol_htmloutput_mesg("Facture non créée", '', 'error');
134 134
     }
135 135
 }
Please login to merge, or discard this patch.
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
         $command = new CreateFlightBillCommand($flight->getId(), $modeReglement, $conditionReglement, $documentModel, $type, $publicNote, $privateNote,$bankAccount, $nbrPax);
129 129
         $handler->handle($command);
130 130
         Header("Location: card.php?id=" . $flight->getId());
131
-    }catch (\Exception $e){
131
+    } catch (\Exception $e){
132 132
         dol_syslog($e->getMessage(),LOG_ERR);
133 133
         dol_htmloutput_mesg("Facture non créée", '', 'error');
134 134
     }
@@ -269,9 +269,12 @@  discard block
 block discarded – undo
269 269
 
270 270
         <?php if (!$flightProduct || !$flight->hasReceiver()) : ?>
271 271
             <a class="butActionRefused" href="#">Générer</a>
272
-        <?php else: ?>
272
+        <?php else {
273
+    : ?>
273 274
             <button class="butAction" type="submit">Générer</button>
274
-        <?php endif; ?>
275
+        <?php endif;
276
+}
277
+?>
275 278
 
276 279
         <a class="butAction" href="<?php echo DOL_URL_ROOT . '/flightlog/card.php?id=' . $flight->id; ?>">Retour au
277 280
             vol</a>
Please login to merge, or discard this patch.