Completed
Push — feature/multiple_order_one_fli... ( 4a4e05...e0cd6a )
by Laurent
03:48 queued 02:03
created
class/bbcvols.class.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
         if (!$error) {
270 270
             $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . $this->table_element);
271 271
 
272
-            try{
272
+            try {
273 273
                 $this->createLinksWithOrder($this->id);
274 274
 
275 275
                 if (!$notrigger) {
@@ -278,8 +278,8 @@  discard block
 block discarded – undo
278 278
                         $error++;
279 279
                     }
280 280
                 }
281
-            }catch(Exception $e){
282
-                $error ++;
281
+            } catch (Exception $e) {
282
+                $error++;
283 283
                 $this->errors[] = 'Error ' . $e->getMessage();
284 284
                 dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
285 285
             }
@@ -932,8 +932,8 @@  discard block
 block discarded – undo
932 932
      */
933 933
     public function getOrderIds()
934 934
     {
935
-        if(empty($this->orderIds)){
936
-            $sql = sprintf('SELECT id, order_id FROM %s WHERE flight_id = %s', MAIN_DB_PREFIX . 'bbc_flights_orders' ,$this->getId());
935
+        if (empty($this->orderIds)) {
936
+            $sql = sprintf('SELECT id, order_id FROM %s WHERE flight_id = %s', MAIN_DB_PREFIX . 'bbc_flights_orders', $this->getId());
937 937
             $resql = $this->db->query($sql);
938 938
             if ($resql) {
939 939
                 $num = $this->db->num_rows($resql);
@@ -999,7 +999,7 @@  discard block
 block discarded – undo
999 999
      */
1000 1000
     public function getOrders()
1001 1001
     {
1002
-        if(empty($this->orders)){
1002
+        if (empty($this->orders)) {
1003 1003
             $this->fetchOrder();
1004 1004
         }
1005 1005
 
@@ -1041,15 +1041,15 @@  discard block
 block discarded – undo
1041 1041
         $sql .= ') VALUES ';
1042 1042
 
1043 1043
         $i = 0;
1044
-        foreach ($this->orderIds as $orderId){
1044
+        foreach ($this->orderIds as $orderId) {
1045 1045
             $sql .= '(';
1046
-            $sql .= $orderId.', ';
1046
+            $sql .= $orderId . ', ';
1047 1047
             $sql .= $id;
1048 1048
             $sql .= ')';
1049 1049
 
1050 1050
             $i++;
1051
-            if(count($this->orderIds) !== $i){
1052
-                $sql.=',';
1051
+            if (count($this->orderIds) !== $i) {
1052
+                $sql .= ',';
1053 1053
             }
1054 1054
         }
1055 1055
 
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -278,7 +278,7 @@
 block discarded – undo
278 278
                         $error++;
279 279
                     }
280 280
                 }
281
-            }catch(Exception $e){
281
+            } catch(Exception $e){
282 282
                 $error ++;
283 283
                 $this->errors[] = 'Error ' . $e->getMessage();
284 284
                 dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
Please login to merge, or discard this patch.
command/CreateFlightCommandHandler.php 1 patch
Spacing   +10 added lines, -10 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();
67 67
         $vol->lieuD = $command->getLieuD();
68
-        $vol->lieuA =$command->getLieuA();
68
+        $vol->lieuA = $command->getLieuA();
69 69
         $vol->heureD = $command->getHeureD();
70 70
         $vol->heureA = $command->getHeureA();
71 71
         $vol->BBC_ballons_idBBC_ballons = $command->getBBCBallonsIdBBCBallons();
@@ -73,7 +73,7 @@  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();
@@ -86,12 +86,12 @@  discard block
 block discarded – undo
86 86
             throw new Exception();
87 87
         }
88 88
 
89
-        if(!$vol->getFlightType()->isBillingRequired() || $vol->isLinkedToOrder()){
89
+        if (!$vol->getFlightType()->isBillingRequired() || $vol->isLinkedToOrder()) {
90 90
             $vol->is_facture = true;
91 91
         }
92 92
 
93 93
         $result = $vol->create($this->user);
94
-        if($result <= 0){
94
+        if ($result <= 0) {
95 95
             throw new Exception();
96 96
         }
97 97
 
@@ -111,28 +111,28 @@  discard block
 block discarded – undo
111 111
     {
112 112
         $flight->fetch($flight->id);
113 113
 
114
-        if(!$flight->isLinkedToOrder()){
114
+        if (!$flight->isLinkedToOrder()) {
115 115
             return;
116 116
         }
117 117
 
118
-        foreach($flight->getOrders() as $order){
118
+        foreach ($flight->getOrders() as $order) {
119 119
 
120 120
             $order->add_object_linked('flightlog_bbcvols', $flight->getId());
121 121
             $order->fetch_lines();
122 122
 
123 123
             $qtyOrder = 0;
124 124
             /** @var OrderLine $currentOrderLine */
125
-            foreach($order->lines as $currentOrderLine){
126
-                $qtyOrder += (int)$currentOrderLine->qty;
125
+            foreach ($order->lines as $currentOrderLine) {
126
+                $qtyOrder += (int) $currentOrderLine->qty;
127 127
             }
128 128
 
129 129
             $passangersCount = $this->numberOfPassengersLinkedToOrder($order->id);
130 130
 
131
-            if($passangersCount != $qtyOrder){
131
+            if ($passangersCount != $qtyOrder) {
132 132
                 continue;
133 133
             }
134 134
 
135
-            if($order->statut == Commande::STATUS_VALIDATED){
135
+            if ($order->statut == Commande::STATUS_VALIDATED) {
136 136
                 $order->cloture($this->user);
137 137
             }
138 138
         }
Please login to merge, or discard this patch.
addFlight.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
             ->setGroupedFlight($isGroupedFlight)
61 61
             ->setOrderIds($orderIds);
62 62
 
63
-        try{
63
+        try {
64 64
             $vol = $createFlightHandler->handle($volCommand);
65 65
 
66 66
             include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 
70 70
             $msg = '<div class="ok">L\'ajout du vol du : ' . $_POST["reday"] . '/' . $_POST["remonth"] . '/' . $_POST["reyear"] . ' s\'est correctement effectue ! </div>';
71 71
             Header("Location: card.php?id=" . $vol->id);
72
-        }catch (\Exception $e){
72
+        } catch (\Exception $e) {
73 73
             $msg = '<div class="error">Erreur lors de l\'ajout du vol : ' . $vol->error . '! </div>';
74 74
         }
75 75
 
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
                     <input type="number"
239 239
                            name="nbrPax"
240 240
                            class="flat <?php echo $validator->hasError('nbrPax') ? 'error' : '' ?>"
241
-                           value="<?php echo $_POST['nbrPax']?: 0 ?>"/>
241
+                           value="<?php echo $_POST['nbrPax'] ?: 0 ?>"/>
242 242
                 </td>
243 243
             </tr>
244 244
 
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
                 <td class="fieldrequired"><?php echo $langs->trans('Commande du vol')?></td>
263 263
                 <td class="js-order">
264 264
                     <?php
265
-                        echo $html::multiselectarray('order_id', $commande->liste_array(2),$_POST['order_id'],0,0,'',0,'100%');
265
+                        echo $html::multiselectarray('order_id', $commande->liste_array(2), $_POST['order_id'], 0, 0, '', 0, '100%');
266 266
                     ?>
267 267
                 </td>
268 268
             </tr>
Please login to merge, or discard this patch.