Completed
Push — feature/multi_order ( eb7707...3f8ee1 )
by Laurent
01:48
created
addFlight.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
             ->setGroupedFlight($isGroupedFlight)
62 62
             ->setOrderIds($orderPassengersCount);
63 63
 
64
-        try{
64
+        try {
65 65
             $vol = $createFlightHandler->handle($volCommand);
66 66
 
67 67
             include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
@@ -70,8 +70,8 @@  discard block
 block discarded – undo
70 70
 
71 71
             $msg = '<div class="ok">L\'ajout du vol du : ' . $_POST["reday"] . '/' . $_POST["remonth"] . '/' . $_POST["reyear"] . ' s\'est correctement effectue ! </div>';
72 72
             Header("Location: card.php?id=" . $vol->id);
73
-        }catch (\Exception $e){
74
-            $msg = '<div class="error">Erreur lors de l\'ajout du vol : ' . ($vol->error?:$e->getMessage()) . '! </div>';
73
+        } catch (\Exception $e) {
74
+            $msg = '<div class="error">Erreur lors de l\'ajout du vol : ' . ($vol->error ?: $e->getMessage()) . '! </div>';
75 75
         }
76 76
 
77 77
     }
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
             //Pilote
151 151
             print "<tr>";
152 152
             print '<td class="fieldrequired"> Pilote </td><td >';
153
-            print $html->select_dolusers($_POST["pilot"] ? $_POST["pilot"] : $user->id, 'pilot', 0, null, 0, '', '', 0,0,0,'',0,'','', true);
153
+            print $html->select_dolusers($_POST["pilot"] ? $_POST["pilot"] : $user->id, 'pilot', 0, null, 0, '', '', 0, 0, 0, '', 0, '', '', true);
154 154
             print '</td></tr>';
155 155
 
156 156
             //Ballon
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
                 <td>
197 197
                 <?php
198 198
                     //organisateur
199
-                    print $html->select_dolusers($_POST["orga"] ? $_POST["orga"] : $user->id, 'orga', 0, null, 0, '', '', 0,0,0,'',0,'','', true);
199
+                    print $html->select_dolusers($_POST["orga"] ? $_POST["orga"] : $user->id, 'orga', 0, null, 0, '', '', 0, 0, 0, '', 0, '', '', true);
200 200
                 ?>
201 201
                 </td>
202 202
             </tr>
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
                     <input type="number"
237 237
                            name="nbrPax"
238 238
                            class="flat <?php echo $validator->hasError('nbrPax') ? 'error' : '' ?>"
239
-                           value="<?php echo $_POST['nbrPax']?: 0 ?>"/>
239
+                           value="<?php echo $_POST['nbrPax'] ?: 0 ?>"/>
240 240
                 </td>
241 241
             </tr>
242 242
 
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
                 <td class="js-order">
262 262
                     <p class="text-muted">Pour retirer une commande merci de la retirer de la liste ci-dessous.</p>
263 263
                     <?php
264
-                        echo $html::multiselectarray('order_id', $commande->liste_array(2),$_POST['order_id'],0,0, $validator->hasError('order_id') ? 'error' : '',0,'100%');
264
+                        echo $html::multiselectarray('order_id', $commande->liste_array(2), $_POST['order_id'], 0, 0, $validator->hasError('order_id') ? 'error' : '', 0, '100%');
265 265
                     ?>
266 266
                 </td>
267 267
             </tr>
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
             <tr class="js-hide-order js-billable-field">
271 271
                 <td class="fieldrequired"><?php echo $langs->trans('Qui a perçu l\'argent')?></td><td>
272 272
                     <?php print $html->select_dolusers($_POST["fk_receiver"] ? $_POST["fk_receiver"] : $user->id,
273
-                        'fk_receiver', true, null, 0, '', '', 0,0,0,'',0,'','', true); ?>
273
+                        'fk_receiver', true, null, 0, '', '', 0, 0, 0, '', 0, '', '', true); ?>
274 274
                 </td>
275 275
             </tr>
276 276
 
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
             <tr class="js-hide-order js-billable-field">
279 279
                 <td class="fieldrequired">Montant perçu</td>
280 280
                 <td>
281
-                    <input type="text" name="cost" class="flat  <?php echo $validator->hasError('cost') ? 'error' : '' ?>" value="<?php echo $_POST['cost']?:0 ?> "/>
281
+                    <input type="text" name="cost" class="flat  <?php echo $validator->hasError('cost') ? 'error' : '' ?>" value="<?php echo $_POST['cost'] ?: 0 ?> "/>
282 282
                     &euro;
283 283
                 </td>
284 284
             </tr>
@@ -325,9 +325,9 @@  discard block
 block discarded – undo
325 325
 
326 326
 <script type="application/javascript">
327 327
 
328
-    <?php if(!empty(GETPOST('order_passengers_count', 'array', 2))): ?>
328
+    <?php if (!empty(GETPOST('order_passengers_count', 'array', 2))): ?>
329 329
         var orders = {};
330
-        <?php foreach( GETPOST('order_passengers_count', 'array', 2) as $currentOrderId=>$nbrPaxForOrder): ?>
330
+        <?php foreach (GETPOST('order_passengers_count', 'array', 2) as $currentOrderId=>$nbrPaxForOrder): ?>
331 331
         orders[<?php echo $currentOrderId; ?>] = <?php echo $nbrPaxForOrder; ?>;
332 332
         <?php endforeach; ?>
333 333
     <?php endif; ?>
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -70,7 +70,7 @@
 block discarded – undo
70 70
 
71 71
             $msg = '<div class="ok">L\'ajout du vol du : ' . $_POST["reday"] . '/' . $_POST["remonth"] . '/' . $_POST["reyear"] . ' s\'est correctement effectue ! </div>';
72 72
             Header("Location: card.php?id=" . $vol->id);
73
-        }catch (\Exception $e){
73
+        } catch (\Exception $e){
74 74
             $msg = '<div class="error">Erreur lors de l\'ajout du vol : ' . ($vol->error?:$e->getMessage()) . '! </div>';
75 75
         }
76 76
 
Please login to merge, or discard this patch.
class/bbcvols.class.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
         $sql .= ' ' . (!isset($this->justif_kilometers) ? 'NULL' : "'" . $this->db->escape($this->justif_kilometers) . "'") . ',';
256 256
         $sql .= ' ' . "'" . date('Y-m-d H:i:s') . "'" . ',';
257 257
         $sql .= ' ' . "'" . date('Y-m-d H:i:s') . "'" . ',';
258
-        $sql .= ' ' . "'" . $this->passengerNames . "'" ;
258
+        $sql .= ' ' . "'" . $this->passengerNames . "'";
259 259
         $sql .= ')';
260 260
 
261 261
         $this->db->begin();
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
 
270 270
         if (!$error) {
271 271
             $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . $this->table_element);
272
-            if(!$this->insertOrders()){
272
+            if (!$this->insertOrders()) {
273 273
                 $error++;
274 274
             }
275 275
 
@@ -295,9 +295,9 @@  discard block
 block discarded – undo
295 295
     /**
296 296
      * Inserts the order linked to the flight
297 297
      */
298
-    private function insertOrders(){
298
+    private function insertOrders() {
299 299
 
300
-        if(empty($this->orderIds)){
300
+        if (empty($this->orderIds)) {
301 301
             return true;
302 302
         }
303 303
 
@@ -312,12 +312,12 @@  discard block
 block discarded – undo
312 312
         
313 313
         $values = [];
314 314
 
315
-        foreach($this->orderIds as $orderId=>$nbrPassengers){
315
+        foreach ($this->orderIds as $orderId=>$nbrPassengers) {
316 316
             $values[] = sprintf(
317 317
                 $valueTemplate,
318 318
                 $orderId,
319 319
                 $this->db->escape($this->id),
320
-                (!isset($nbrPassengers) ? '0' :  $this->db->escape($nbrPassengers))
320
+                (!isset($nbrPassengers) ? '0' : $this->db->escape($nbrPassengers))
321 321
             );
322 322
         }
323 323
 
@@ -335,9 +335,9 @@  discard block
 block discarded – undo
335 335
     /**
336 336
      * Inserts the order linked to the flight
337 337
      */
338
-    private function updateOrders(){
338
+    private function updateOrders() {
339 339
 
340
-        if(empty($this->orderIds)){
340
+        if (empty($this->orderIds)) {
341 341
             return true;
342 342
         }
343 343
 
@@ -348,9 +348,9 @@  discard block
 block discarded – undo
348 348
     /**
349 349
      * Inserts the order linked to the flight
350 350
      */
351
-    private function deleteOrders(){
351
+    private function deleteOrders() {
352 352
 
353
-        if(empty($this->orderIds)){
353
+        if (empty($this->orderIds)) {
354 354
             return true;
355 355
         }
356 356
 
@@ -1015,8 +1015,8 @@  discard block
 block discarded – undo
1015 1015
      * @param int $orderId
1016 1016
      * @param int $nbrPassengers
1017 1017
      */
1018
-    public function addOrderId($orderId, $nbrPassengers){
1019
-        if(!isset($this->orderIds)){
1018
+    public function addOrderId($orderId, $nbrPassengers) {
1019
+        if (!isset($this->orderIds)) {
1020 1020
             $this->orderIds = [];
1021 1021
         }
1022 1022
 
@@ -1056,7 +1056,7 @@  discard block
 block discarded – undo
1056 1056
         if ($resql) {
1057 1057
             $numrows = $this->db->num_rows($resql);
1058 1058
             if ($numrows) {
1059
-                for($i = 0 ; $i < $numrows ; $i++){
1059
+                for ($i = 0; $i < $numrows; $i++) {
1060 1060
                     $obj = $this->db->fetch_object($resql);
1061 1061
                     $this->orderIds[$obj->order_id] = $obj->nbr_passengers;
1062 1062
 
@@ -1077,7 +1077,7 @@  discard block
 block discarded – undo
1077 1077
      */
1078 1078
     public function getOrders()
1079 1079
     {
1080
-        if(!isset($this->orders) || empty($this->orders)){
1080
+        if (!isset($this->orders) || empty($this->orders)) {
1081 1081
             $this->fetchOrder();
1082 1082
         }
1083 1083
         return $this->orders;
Please login to merge, or discard this patch.
validators/FlightValidator.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -228,20 +228,20 @@
 block discarded – undo
228 228
      */
229 229
     private function checkOrderInformation(Bbcvols $vol)
230 230
     {
231
-        if(!$vol->isLinkedToOrder()){
231
+        if (!$vol->isLinkedToOrder()) {
232 232
             return;
233 233
         }
234 234
 
235 235
         $totalPassenegrs = 0;
236
-        foreach($vol->getOrderIds() as $orderId => $nbrPassengers){
237
-            if($nbrPassengers <= 0){
236
+        foreach ($vol->getOrderIds() as $orderId => $nbrPassengers) {
237
+            if ($nbrPassengers <= 0) {
238 238
                 $this->addError('order_id', 'Le nombre de passager par commande doit être >= 0.');
239 239
             }
240 240
 
241
-            $totalPassenegrs+=(int)$nbrPassengers;
241
+            $totalPassenegrs += (int) $nbrPassengers;
242 242
         }
243 243
 
244
-        if($totalPassenegrs !== (int)$vol->getNumberOfPassengers()){
244
+        if ($totalPassenegrs !== (int) $vol->getNumberOfPassengers()) {
245 245
             $this->addError('nbrPax', 'Le nombre de passagers ne correspond pas au nombre entré sur les commandes');
246 246
         }
247 247
 
Please login to merge, or discard this patch.