Completed
Push — feature/refactor_ui ( 5b72cd...525b74 )
by Laurent
01:37
created
Form/InputDate.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@
 block discarded – undo
28 28
      */
29 29
     public function setValue($value)
30 30
     {
31
-        if($value instanceof \DateTime){
31
+        if ($value instanceof \DateTime) {
32 32
             return parent::setValue($value->format('Y-m-d'));
33 33
         }
34 34
 
Please login to merge, or discard this patch.
Form/FlightForm.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
      * @param array $options
28 28
      * @param \User $user
29 29
      */
30
-    public function __construct(\ValidatorInterface $validator, $baseObject, \DoliDB $db, $options,\User $user)
30
+    public function __construct(\ValidatorInterface $validator, $baseObject, \DoliDB $db, $options, \User $user)
31 31
     {
32 32
 
33 33
         parent::__construct('flight_form', FormInterface::METHOD_POST, $this->buildOptionsfromConfiguration($options));
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
         $flight = $object;
84 84
 
85 85
         // Quick fix - Fixme by a factory on this form.
86
-        if($this->user->rights->flightlog->vol->advanced){
86
+        if ($this->user->rights->flightlog->vol->advanced) {
87 87
             return parent::bind($object);
88 88
         }
89 89
 
Please login to merge, or discard this patch.
command/CreateExpenseNoteCommandHandler.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -272,7 +272,7 @@
 block discarded – undo
272 272
         $expenseNoteUser = new User($this->db);
273 273
         $expenseNoteUser->id = $currentMissionUserId;
274 274
         $id = $expenseNote->create($expenseNoteUser);
275
-        if($id < 0){
275
+        if ($id < 0) {
276 276
             return null;
277 277
         }
278 278
 
Please login to merge, or discard this patch.
query/GetPilotsWithMissionsQueryHandler.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -52,9 +52,9 @@  discard block
 block discarded – undo
52 52
                         $pilotLastname = $obj->lastname;
53 53
                         $pilotFirstname = $obj->firstname;
54 54
 
55
-                        if($query->isPilotsOnly()){
55
+                        if ($query->isPilotsOnly()) {
56 56
                             $result->addPilot($pilotId, $pilotFirstname, $pilotLastname);
57
-                        }else{
57
+                        } else {
58 58
                             $result->addMission($obj->quartil, $pilotId, $pilotFirstname, $pilotLastname,
59 59
                                 $obj->number_flights, $obj->total_kilometers);
60 60
                         }
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
         $sql .= " , SUM(VOL.kilometers) as total_kilometers ";
80 80
         $sql .= " , COUNT(VOL.idBBC_vols) as number_flights";
81 81
 
82
-        if(!$query->isPilotsOnly()){
82
+        if (!$query->isPilotsOnly()) {
83 83
             $sql .= " , QUARTER(VOL.date) as quartil ";
84 84
         }
85 85
 
Please login to merge, or discard this patch.
command/CreateFlightCommand.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -397,7 +397,7 @@
 block discarded – undo
397 397
     /**
398 398
      * @return bool
399 399
      */
400
-    public function hasOrderId(){
400
+    public function hasOrderId() {
401 401
         return count($this->orderIds) > 0;
402 402
     }
403 403
 }
404 404
\ No newline at end of file
Please login to merge, or discard this patch.
command/ClassifyFlight.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -26,8 +26,8 @@
 block discarded – undo
26 26
      */
27 27
     public function __construct($flightId, $projectId)
28 28
     {
29
-        $this->flightId = (int)$flightId;
30
-        $this->projectId = (int)$projectId;
29
+        $this->flightId = (int) $flightId;
30
+        $this->projectId = (int) $projectId;
31 31
     }
32 32
 
33 33
     /**
Please login to merge, or discard this patch.
card.php 1 patch
Spacing   +34 added lines, -34 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
 
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
 
290 290
         <?php echo $renderer->render($formFlight->getElement('idBBC_vols')); ?>
291 291
 
292
-        <?php if($formFlight->has('fk_type')): ?>
292
+        <?php if ($formFlight->has('fk_type')): ?>
293 293
         <section class="form-section">
294 294
             <h1 class="form-section-title"><?php echo $langs->trans('Type de vol'); ?></h1>
295 295
             <table class="border" width="50%">
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
         <?php endif; ?>
304 304
 
305 305
         <!-- Date et heures -->
306
-        <?php if($formFlight->has('date')): ?>
306
+        <?php if ($formFlight->has('date')): ?>
307 307
             <section class="form-section">
308 308
                 <h1 class="form-section-title"><?php echo $langs->trans('Date'); ?></h1>
309 309
                 <table class="border" width="50%">
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
             </section>
316 316
         <?php endif; ?>
317 317
 
318
-        <?php if($formFlight->has('heureD') && $formFlight->has('heureA')): ?>
318
+        <?php if ($formFlight->has('heureD') && $formFlight->has('heureA')): ?>
319 319
             <section class="form-section">
320 320
                 <h1 class="form-section-title"><?php echo $langs->trans('Heures'); ?></h1>
321 321
                 <table class="border" width="50%">
@@ -335,14 +335,14 @@  discard block
 block discarded – undo
335 335
             <h1 class="form-section-title"><?php echo $langs->trans('Pilote & ballon') ?></h1>
336 336
             <table class="border" width="50%">
337 337
 
338
-                <?php if($formFlight->has('fk_pilot')): ?>
338
+                <?php if ($formFlight->has('fk_pilot')): ?>
339 339
                 <tr>
340 340
                     <td class="fieldrequired"> Pilote </td>
341
-                    <td><?php echo $renderer->render($formFlight->getElement('fk_pilot'),['ajax' => true]); ?></td>
341
+                    <td><?php echo $renderer->render($formFlight->getElement('fk_pilot'), ['ajax' => true]); ?></td>
342 342
                 </tr>
343 343
                 <?php endif; ?>
344 344
 
345
-                <?php if($formFlight->has('BBC_ballons_idBBC_ballons')): ?>
345
+                <?php if ($formFlight->has('BBC_ballons_idBBC_ballons')): ?>
346 346
                 <tr>
347 347
                     <td width="25%" class="fieldrequired">Ballon</td>
348 348
                     <td><?php echo $renderer->render($formFlight->getElement('BBC_ballons_idBBC_ballons')); ?></td>
@@ -377,7 +377,7 @@  discard block
 block discarded – undo
377 377
             </table>
378 378
         </section>
379 379
 
380
-        <?php if($formFlight->has('fk_organisateur')): ?>
380
+        <?php if ($formFlight->has('fk_organisateur')): ?>
381 381
             <section class="form-section">
382 382
                 <h1 class="form-section-title"><span class="js-organisator-field">Organisateur</span></h1>
383 383
                 <table class="border" width="50%">
@@ -386,7 +386,7 @@  discard block
 block discarded – undo
386 386
                         <td>
387 387
                             <?php
388 388
                             //organisateur
389
-                            print $renderer->render($formFlight->getElement('fk_organisateur'),['ajax' => true]);
389
+                            print $renderer->render($formFlight->getElement('fk_organisateur'), ['ajax' => true]);
390 390
                             ?>
391 391
                         </td>
392 392
                     </tr>
@@ -398,7 +398,7 @@  discard block
 block discarded – undo
398 398
         <section class="form-section js-expensable-field">
399 399
             <h1 class="form-section-title"><?php echo $langs->trans('Déplacements') ?></h1>
400 400
             <table class="border" width="50%">
401
-                <?php if($formFlight->has('kilometers')): ?>
401
+                <?php if ($formFlight->has('kilometers')): ?>
402 402
                     <!-- number of kilometers done for the flight -->
403 403
                     <tr>
404 404
                         <td class="fieldrequired">Nombre de kilometres effectués pour le vol</td>
@@ -408,7 +408,7 @@  discard block
 block discarded – undo
408 408
                     </tr>
409 409
                 <?php endif; ?>
410 410
 
411
-                <?php if($formFlight->has('justif_kilometers')): ?>
411
+                <?php if ($formFlight->has('justif_kilometers')): ?>
412 412
                     <!-- Justif Kilometers -->
413 413
                     <tr>
414 414
 
@@ -426,7 +426,7 @@  discard block
 block discarded – undo
426 426
         <section class="form-section">
427 427
             <h1 class="form-section-title"><?php echo $langs->trans('Passager') ?></h1>
428 428
             <table class="border" width="50%">
429
-                <?php if($formFlight->has('nbrPax')): ?>
429
+                <?php if ($formFlight->has('nbrPax')): ?>
430 430
                     <tr>
431 431
                         <td class="fieldrequired"><?php echo $langs->trans('Nombre de passagers'); ?></td>
432 432
                         <td>
@@ -435,7 +435,7 @@  discard block
 block discarded – undo
435 435
                     </tr>
436 436
                 <?php endif; ?>
437 437
 
438
-                <?php if($formFlight->has('passengerNames')): ?>
438
+                <?php if ($formFlight->has('passengerNames')): ?>
439 439
                     <!-- passenger names -->
440 440
                     <tr>
441 441
                         <td width="25%" class="fieldrequired"><?php echo $langs->trans('Noms des passagers'); ?><br/>(Séparé
@@ -445,7 +445,7 @@  discard block
 block discarded – undo
445 445
                             <?php print $renderer->render($formFlight->getElement('passengerNames')); ?>
446 446
                         </td>
447 447
                     </tr>
448
-                <?php endif;?>
448
+                <?php endif; ?>
449 449
             </table>
450 450
         </section>
451 451
 
@@ -454,17 +454,17 @@  discard block
 block discarded – undo
454 454
             <h1 class="form-section-title js-billable-field"><?php echo $langs->trans('Facturation') ?></h1>
455 455
             <table class="border" width="50%">
456 456
 
457
-                <?php if($formFlight->has('fk_receiver')): ?>
457
+                <?php if ($formFlight->has('fk_receiver')): ?>
458 458
                     <!-- Money receiver -->
459 459
                     <tr class="js-hide-order js-billable-field">
460 460
                         <td class="fieldrequired"><?php echo $langs->trans('Qui a perçu l\'argent') ?></td>
461 461
                         <td>
462
-                            <?php print $renderer->render($formFlight->getElement('fk_receiver'),['ajax' => true]); ?>
462
+                            <?php print $renderer->render($formFlight->getElement('fk_receiver'), ['ajax' => true]); ?>
463 463
                         </td>
464 464
                     </tr>
465 465
                 <?php endif; ?>
466 466
 
467
-                <?php if($formFlight->has('cost')): ?>
467
+                <?php if ($formFlight->has('cost')): ?>
468 468
                     <!-- Flight cost -->
469 469
                     <tr class="js-hide-order js-billable-field">
470 470
                         <td class="fieldrequired">Montant perçu</td>
@@ -482,7 +482,7 @@  discard block
 block discarded – undo
482 482
             <h1 class="form-section-title"><?php echo $langs->trans('Commentaires') ?></h1>
483 483
             <table class="border" width="50%">
484 484
 
485
-                <?php if($formFlight->has('remarque')): ?>
485
+                <?php if ($formFlight->has('remarque')): ?>
486 486
                     <!-- commentaires -->
487 487
                     <tr class="">
488 488
                         <td class="fieldrequired"> Commentaire</td>
@@ -492,7 +492,7 @@  discard block
 block discarded – undo
492 492
                     </tr>
493 493
                 <?php endif; ?>
494 494
 
495
-                <?php if($formFlight->has('incidents')): ?>
495
+                <?php if ($formFlight->has('incidents')): ?>
496 496
                     <!-- incidents -->
497 497
                     <tr class="">
498 498
                         <td class="fieldrequired"> incidents</td>
@@ -526,7 +526,7 @@  discard block
 block discarded – undo
526 526
         $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('DeleteMyOjbect'),
527 527
             $langs->trans('êtes-vous sure de vouloir supprimer ce vol ?'), 'confirm_delete', '', 0, 1);
528 528
         print $formconfirm;
529
-    } elseif ($user->rights->flightlog->vol->financial  && $action == ACTION_FLAG_BILLED) {
529
+    } elseif ($user->rights->flightlog->vol->financial && $action == ACTION_FLAG_BILLED) {
530 530
         $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id,
531 531
             $langs->trans('Marque comme facturé'),
532 532
             $langs->trans('Ce vol va être marqué comme facturé, est-ce bien le cas ?'), ACTION_CONFIRM_FLAG_BILLED, '',
@@ -550,29 +550,29 @@  discard block
 block discarded – undo
550 550
     print '<tr><td class="fieldrequired">' . $langs->trans("Fieldfk_pilot") . '</td><td>' . $pilot->getNomUrl(1) . '</td></tr>';
551 551
     print '<tr><td class="fieldrequired">' . $langs->trans("Fieldfk_organisateur") . '</td><td>' . $organisator->getNomUrl(1) . '</td></tr>';
552 552
 
553
-    if (! empty($conf->projet->enabled))
553
+    if (!empty($conf->projet->enabled))
554 554
     {
555 555
         print '<tr><td class="fieldrequired">' . $langs->trans("Project") . '</td><td>';
556 556
         $morehtmlref = '';
557 557
         if ($user->rights->projet->creer)
558 558
         {
559 559
             if ($action !== ACTION_CLASSIFY) {
560
-                $morehtmlref .= '<a href="' . $_SERVER['PHP_SELF'] . '?action='.ACTION_CLASSIFY.'&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> ';
560
+                $morehtmlref .= '<a href="' . $_SERVER['PHP_SELF'] . '?action=' . ACTION_CLASSIFY . '&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> ';
561 561
             }
562 562
             if ($action === ACTION_CLASSIFY) {
563
-                $morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
564
-                $morehtmlref.='<input type="hidden" name="action" value="'.ACTION_CLASSIN.'">';
565
-                $morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
566
-                $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);
567
-                $morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
568
-                $morehtmlref.='</form>';
563
+                $morehtmlref .= '<form method="post" action="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '">';
564
+                $morehtmlref .= '<input type="hidden" name="action" value="' . ACTION_CLASSIN . '">';
565
+                $morehtmlref .= '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
566
+                $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);
567
+                $morehtmlref .= '<input type="submit" class="button valignmiddle" value="' . $langs->trans("Modify") . '">';
568
+                $morehtmlref .= '</form>';
569 569
             }
570 570
         }
571 571
 
572 572
         if ($object->hasProject()) {
573 573
             $proj = new Project($db);
574 574
             $proj->fetch($object->fk_project);
575
-            $morehtmlref.=$proj->getNomUrl(1);
575
+            $morehtmlref .= $proj->getNomUrl(1);
576 576
         }
577 577
         print $morehtmlref . '</td>';
578 578
     }
@@ -587,7 +587,7 @@  discard block
 block discarded – undo
587 587
     print '<div class="tabsAction">' . "\n";
588 588
     $parameters = array();
589 589
     $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object,
590
-        $action);    // Note that $action and $object may have been modified by hook
590
+        $action); // Note that $action and $object may have been modified by hook
591 591
     if ($reshook < 0) {
592 592
         setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
593 593
     }
Please login to merge, or discard this patch.
command/CreateOrderCommand.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -124,7 +124,7 @@
 block discarded – undo
124 124
         $this->language = $form->language;
125 125
         $this->userId = $userId;
126 126
         $this->publicComment = $form->isCommentPublic == 1;
127
-        $this->socid = (int)$form->socid;
127
+        $this->socid = (int) $form->socid;
128 128
     }
129 129
 
130 130
     /**
Please login to merge, or discard this patch.
validators/SimpleOrderValidator.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -52,12 +52,12 @@
 block discarded – undo
52 52
         if (!isset($value->socid) && empty($value->email) && empty($value->phone)) {
53 53
             $this->addWarning('Soit l\'e-mail soit le téléphone n\'a pas été complété');
54 54
         }
55
-        if (empty($value->nbrPax) || (int)$value->nbrPax <= 0) {
55
+        if (empty($value->nbrPax) || (int) $value->nbrPax <= 0) {
56 56
             $this->addError('nbrPax', 'Le nombre de passagers doit être plus grand que 0.');
57 57
         }
58 58
 
59
-        if ((int)$value->nbrPax > 0) {
60
-            $costPerPax = $value->cost / (int)$value->nbrPax;
59
+        if ((int) $value->nbrPax > 0) {
60
+            $costPerPax = $value->cost / (int) $value->nbrPax;
61 61
             if ($costPerPax < $this->getMinPrice()) {
62 62
                 $this->addError('cost',
63 63
                     sprintf('Le prix demandé par passagé est trop peu élevé. Un minimum de %s est demandé',
Please login to merge, or discard this patch.