Completed
Push — feature/update_flight ( 5eb300...a7cb77 )
by Laurent
01:44
created
card.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 $extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
117 117
 
118 118
 // Load object
119
-include DOL_DOCUMENT_ROOT . '/core/actions_fetchobject.inc.php';  // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
119
+include DOL_DOCUMENT_ROOT . '/core/actions_fetchobject.inc.php'; // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
120 120
 include DOL_DOCUMENT_ROOT . '/core/actions_dellink.inc.php';
121 121
 
122 122
 // Initialize technical object to manage hooks of modules. Note that conf->hooks_modules contains array array
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 
143 143
 $parameters = array();
144 144
 $reshook = $hookmanager->executeHooks('doActions', $parameters, $object,
145
-    $action);    // Note that $action and $object may have been modified by some hooks
145
+    $action); // Note that $action and $object may have been modified by some hooks
146 146
 if ($reshook < 0) {
147 147
     setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
148 148
 }
@@ -526,7 +526,7 @@  discard block
 block discarded – undo
526 526
     print '<div class="tabsAction">' . "\n";
527 527
     $parameters = array();
528 528
     $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object,
529
-        $action);    // Note that $action and $object may have been modified by hook
529
+        $action); // Note that $action and $object may have been modified by hook
530 530
     if ($reshook < 0) {
531 531
         setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
532 532
     }
Please login to merge, or discard this patch.
Form/SimpleFormRenderer.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
      */
52 52
     private function renderElement(FormElementInterface $element)
53 53
     {
54
-        switch($element->getType()){
54
+        switch ($element->getType()) {
55 55
             case FormElementInterface::TYPE_TEXTAREA:
56 56
                 return sprintf('<textarea name="%s" %s>%s</textarea>', $element->getName(), $this->formatOptions($element->getOptions()), $element->getValue());
57 57
 
@@ -97,14 +97,14 @@  discard block
 block discarded – undo
97 97
     {
98 98
         $selectElement = sprintf('<select name="%s" >', $element->getName());
99 99
 
100
-        if($element->getValueOptions()){
101
-            foreach($element->getValueOptions() as $optionValue => $optionLabel){
100
+        if ($element->getValueOptions()) {
101
+            foreach ($element->getValueOptions() as $optionValue => $optionLabel) {
102 102
                 $selectedAttribute = $optionValue === $element->getValue() ? 'selected' : '';
103 103
                 $selectElement .= sprintf('<option value="%s" %s >%s</option>', $optionValue, $selectedAttribute, $optionLabel);
104 104
             }
105 105
         }
106 106
 
107
-        $selectElement.='</select>';
107
+        $selectElement .= '</select>';
108 108
 
109 109
         return $selectElement;
110 110
     }
Please login to merge, or discard this patch.
Form/Form.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
     /**
79 79
      * @inheritDoc
80 80
      */
81
-    public function getOptions(){
81
+    public function getOptions() {
82 82
         return $this->options;
83 83
     }
84 84
 
@@ -98,11 +98,11 @@  discard block
 block discarded – undo
98 98
      */
99 99
     public function validate()
100 100
     {
101
-        if(!$this->validator){
101
+        if (!$this->validator) {
102 102
             return true;
103 103
         }
104 104
 
105
-        if(null === $this->object){
105
+        if (null === $this->object) {
106 106
             throw new \InvalidArgumentException('Object not bind');
107 107
         }
108 108
 
@@ -126,10 +126,10 @@  discard block
 block discarded – undo
126 126
      */
127 127
     public function bind($object)
128 128
     {
129
-        foreach($this->elements as $element){
129
+        foreach ($this->elements as $element) {
130 130
             $name = $this->camelCase($element->getName());
131
-            $methodName = 'get'.$name;
132
-            if(!method_exists($object, $methodName)){
131
+            $methodName = 'get' . $name;
132
+            if (!method_exists($object, $methodName)) {
133 133
                 continue;
134 134
             }
135 135
 
@@ -146,15 +146,15 @@  discard block
 block discarded – undo
146 146
      */
147 147
     public function setData(array $data)
148 148
     {
149
-        foreach($data as $fieldName => $currentData){
150
-            if(!key_exists($fieldName, $this->elements)){
149
+        foreach ($data as $fieldName => $currentData) {
150
+            if (!key_exists($fieldName, $this->elements)) {
151 151
                 continue;
152 152
             }
153 153
 
154 154
             $this->elements[$fieldName]->setValue($currentData);
155 155
 
156
-            $methodName = 'set'.$this->camelCase($fieldName);
157
-            if(null === $this->object || !method_exists($this->object, $methodName)){
156
+            $methodName = 'set' . $this->camelCase($fieldName);
157
+            if (null === $this->object || !method_exists($this->object, $methodName)) {
158 158
                 continue;
159 159
             }
160 160
 
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
      */
178 178
     public function getElement($elementName)
179 179
     {
180
-        if(!key_exists($elementName, $this->elements)){
180
+        if (!key_exists($elementName, $this->elements)) {
181 181
             throw new \InvalidArgumentException(sprintf('Element %s not found ', $elementName));
182 182
         }
183 183
 
Please login to merge, or discard this patch.
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) || $nbrPax != (int) $nbrPax){
94
+        if (!isset($nbrPax) || !is_numeric($nbrPax) || $nbrPax != (int) $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.
command/CreateFlightBillCommandHandler.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -112,7 +112,7 @@
 block discarded – undo
112 112
     {
113 113
         $customer = new Client($this->db);
114 114
 
115
-        if($flight->fk_receiver) {
115
+        if ($flight->fk_receiver) {
116 116
             return $this->fetchCustomerFromFlight($flight);
117 117
         }
118 118
 
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,11 +124,11 @@
 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
-    }catch (\Exception $e){
131
-        dol_syslog($e->getMessage(),LOG_ERR);
130
+    } catch (\Exception $e) {
131
+        dol_syslog($e->getMessage(), LOG_ERR);
132 132
         dol_htmloutput_mesg("Facture non créée", '', 'error');
133 133
     }
134 134
 }
Please login to merge, or discard this patch.
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
     try{
128 128
         $command = new CreateFlightBillCommand($flight->getId(), $modeReglement, $conditionReglement, $documentModel, $type, $publicNote, $privateNote,$bankAccount, $nbrPax);
129 129
         $handler->handle($command);
130
-    }catch (\Exception $e){
130
+    } catch (\Exception $e){
131 131
         dol_syslog($e->getMessage(),LOG_ERR);
132 132
         dol_htmloutput_mesg("Facture non créée", '', 'error');
133 133
     }
@@ -268,9 +268,12 @@  discard block
 block discarded – undo
268 268
 
269 269
         <?php if (!$flightProduct || !$flight->hasReceiver()) : ?>
270 270
             <a class="butActionRefused" href="#">Générer</a>
271
-        <?php else: ?>
271
+        <?php else {
272
+    : ?>
272 273
             <button class="butAction" type="submit">Générer</button>
273
-        <?php endif; ?>
274
+        <?php endif;
275
+}
276
+?>
274 277
 
275 278
         <a class="butAction" href="<?php echo DOL_URL_ROOT . '/flightlog/card.php?id=' . $flight->id; ?>">Retour au
276 279
             vol</a>
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
@@ -249,18 +249,18 @@  discard block
 block discarded – undo
249 249
         $sql .= ' ' . (!isset($this->nbrPax) ? 'NULL' : "'" . $this->db->escape($this->nbrPax) . "'") . ',';
250 250
         $sql .= ' ' . (!isset($this->remarque) ? 'NULL' : "'" . $this->db->escape($this->remarque) . "'") . ',';
251 251
         $sql .= ' ' . (!isset($this->incidents) ? 'NULL' : "'" . $this->db->escape($this->incidents) . "'") . ',';
252
-        $sql .= ' ' . (!isset($this->fk_type) || (int)$this->fk_type === -1 ? 'NULL' : $this->fk_type) . ',';
253
-        $sql .= ' ' . (!isset($this->fk_pilot) || (int)$this->fk_pilot === -1 ? 'NULL' : $this->fk_pilot) . ',';
254
-        $sql .= ' ' . (!isset($this->fk_organisateur) || (int)$this->fk_organisateur === -1 ? 'NULL' : $this->fk_organisateur) . ',';
252
+        $sql .= ' ' . (!isset($this->fk_type) || (int) $this->fk_type === -1 ? 'NULL' : $this->fk_type) . ',';
253
+        $sql .= ' ' . (!isset($this->fk_pilot) || (int) $this->fk_pilot === -1 ? 'NULL' : $this->fk_pilot) . ',';
254
+        $sql .= ' ' . (!isset($this->fk_organisateur) || (int) $this->fk_organisateur === -1 ? 'NULL' : $this->fk_organisateur) . ',';
255 255
         $sql .= ' ' . (!isset($this->is_facture) ? '0' : $this->is_facture) . ',';
256 256
         $sql .= ' ' . (!isset($this->kilometers) || empty($this->kilometers) ? '0' : $this->kilometers) . ',';
257 257
         $sql .= ' ' . (!isset($this->cost) ? 'NULL' : "'" . $this->db->escape($this->cost) . "'") . ',';
258
-        $sql .= ' ' . (!isset($this->fk_receiver) || (int)$this->fk_receiver === -1 ? 'NULL' : $this->fk_receiver) . ',';
258
+        $sql .= ' ' . (!isset($this->fk_receiver) || (int) $this->fk_receiver === -1 ? 'NULL' : $this->fk_receiver) . ',';
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 262
         $sql .= ' ' . "'" . $this->passengerNames . "'" . ',';
263
-        $sql .= ' ' . (!isset($this->orderId) || (int)$this->orderId === -1 ? 'NULL' : $this->orderId) . '';
263
+        $sql .= ' ' . (!isset($this->orderId) || (int) $this->orderId === -1 ? 'NULL' : $this->orderId) . '';
264 264
 
265 265
         $sql .= ')';
266 266
 
@@ -348,28 +348,28 @@  discard block
 block discarded – undo
348 348
 
349 349
                 $this->id = $obj->idBBC_vols;
350 350
 
351
-                $this->idBBC_vols = (int)$obj->idBBC_vols;
351
+                $this->idBBC_vols = (int) $obj->idBBC_vols;
352 352
                 $this->date = $this->db->jdate($obj->date);
353 353
                 $this->lieuD = $obj->lieuD;
354 354
                 $this->lieuA = $obj->lieuA;
355 355
                 $this->heureD = $obj->heureD;
356 356
                 $this->heureA = $obj->heureA;
357
-                $this->BBC_ballons_idBBC_ballons = (int)$obj->BBC_ballons_idBBC_ballons;
357
+                $this->BBC_ballons_idBBC_ballons = (int) $obj->BBC_ballons_idBBC_ballons;
358 358
                 $this->nbrPax = $obj->nbrPax;
359 359
                 $this->remarque = $obj->remarque;
360 360
                 $this->incidents = $obj->incidents;
361
-                $this->fk_type = (int)$obj->fk_type;
362
-                $this->fk_pilot = (int)$obj->fk_pilot;
363
-                $this->fk_organisateur = (int)$obj->fk_organisateur;
364
-                $this->is_facture = (int)$obj->is_facture;
361
+                $this->fk_type = (int) $obj->fk_type;
362
+                $this->fk_pilot = (int) $obj->fk_pilot;
363
+                $this->fk_organisateur = (int) $obj->fk_organisateur;
364
+                $this->is_facture = (int) $obj->is_facture;
365 365
                 $this->kilometers = $obj->kilometers;
366 366
                 $this->cost = $obj->cost;
367
-                $this->fk_receiver = (int)$obj->fk_receiver;
367
+                $this->fk_receiver = (int) $obj->fk_receiver;
368 368
                 $this->justif_kilometers = $obj->justif_kilometers;
369 369
                 $this->date_creation = $obj->date_creation;
370 370
                 $this->date_update = $obj->date_update;
371 371
                 $this->passengerNames = $obj->passenger_names;
372
-                $this->orderId = (int)$obj->order_id;
372
+                $this->orderId = (int) $obj->order_id;
373 373
 
374 374
                 $this->balloon = $this->fetchBalloon();
375 375
                 $this->pilot = $this->fetchUser($this->fk_pilot);
@@ -478,17 +478,17 @@  discard block
 block discarded – undo
478 478
         $sql .= ' nbrPax = ' . (isset($this->nbrPax) ? "'" . $this->db->escape($this->nbrPax) . "'" : "null") . ',';
479 479
         $sql .= ' remarque = ' . (isset($this->remarque) ? "'" . $this->db->escape($this->remarque) . "'" : "null") . ',';
480 480
         $sql .= ' incidents = ' . (isset($this->incidents) ? "'" . $this->db->escape($this->incidents) . "'" : "null") . ',';
481
-        $sql .= ' fk_type = ' . (isset($this->fk_type) && (int)$this->fk_type > 0 ? $this->fk_type : "null") . ',';
482
-        $sql .= ' fk_pilot = ' . (isset($this->fk_pilot) && (int)$this->fk_pilot > 0 ? $this->fk_pilot : "null") . ',';
483
-        $sql .= ' fk_organisateur = ' . (isset($this->fk_organisateur) && (int)$this->fk_organisateur > 0 ? $this->fk_organisateur : "null") . ',';
481
+        $sql .= ' fk_type = ' . (isset($this->fk_type) && (int) $this->fk_type > 0 ? $this->fk_type : "null") . ',';
482
+        $sql .= ' fk_pilot = ' . (isset($this->fk_pilot) && (int) $this->fk_pilot > 0 ? $this->fk_pilot : "null") . ',';
483
+        $sql .= ' fk_organisateur = ' . (isset($this->fk_organisateur) && (int) $this->fk_organisateur > 0 ? $this->fk_organisateur : "null") . ',';
484 484
         $sql .= ' is_facture = ' . (isset($this->is_facture) ? $this->is_facture : "0") . ',';
485 485
         $sql .= ' kilometers = ' . (!empty($this->kilometers) ? $this->kilometers : "0") . ',';
486 486
         $sql .= ' cost = ' . (isset($this->cost) ? "'" . $this->db->escape($this->cost) . "'" : "''") . ',';
487
-        $sql .= ' fk_receiver = ' . (isset($this->fk_receiver) && (int)$this->fk_receiver > 0 ? $this->fk_receiver : "null") . ',';
487
+        $sql .= ' fk_receiver = ' . (isset($this->fk_receiver) && (int) $this->fk_receiver > 0 ? $this->fk_receiver : "null") . ',';
488 488
         $sql .= ' justif_kilometers = ' . (isset($this->justif_kilometers) ? "'" . $this->db->escape($this->justif_kilometers) . "'," : "'',");
489 489
         $sql .= ' date_update = ' . "'" . date('Y-m-d H:i:s') . "',";
490 490
         $sql .= ' passenger_names = ' . "'" . trim($this->passengerNames) . "',";
491
-        $sql .= ' order_id = ' .  (!isset($this->orderId) || (int)$this->orderId === -1|| (int)$this->orderId === 0 ? 'null' : $this->orderId);
491
+        $sql .= ' order_id = ' . (!isset($this->orderId) || (int) $this->orderId === -1 || (int) $this->orderId === 0 ? 'null' : $this->orderId);
492 492
 
493 493
         $sql .= ' WHERE idBBC_vols=' . $this->idBBC_vols;
494 494
 
@@ -857,7 +857,7 @@  discard block
 block discarded – undo
857 857
      */
858 858
     public function getAmountPerPassenger()
859 859
     {
860
-        $nbrPax = $this->nbrPax > 0 ? $this->nbrPax : 1 ;
860
+        $nbrPax = $this->nbrPax > 0 ? $this->nbrPax : 1;
861 861
         return $this->cost / $nbrPax;
862 862
     }
863 863
 
Please login to merge, or discard this patch.
class/bbctypes.class.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -645,7 +645,7 @@
 block discarded – undo
645 645
     }
646 646
 
647 647
     /**
648
-     * @return array|BbctypesLine[]
648
+     * @return BbctypesLine[]
649 649
      */
650 650
     public function getLines()
651 651
     {
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -733,7 +733,7 @@
 block discarded – undo
733 733
      */
734 734
     public function getActive()
735 735
     {
736
-        return (boolean)$this->active;
736
+        return (boolean) $this->active;
737 737
     }
738 738
 
739 739
     /**
Please login to merge, or discard this patch.
Form/FlightForm.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@
 block discarded – undo
52 52
     {
53 53
         $values = [];
54 54
 
55
-        foreach ($options as $value){
55
+        foreach ($options as $value) {
56 56
             $values[] = $value;
57 57
         }
58 58
 
Please login to merge, or discard this patch.