Completed
Pull Request — master (#26)
by Laurent
02:42 queued 59s
created
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/FlightTypeSelect.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@
 block discarded – undo
43 43
      */
44 44
     private function buildOptions()
45 45
     {
46
-        foreach($this->flightType->getLines() as $currentFlightType){
46
+        foreach ($this->flightType->getLines() as $currentFlightType) {
47 47
             $this->addValueOption($currentFlightType->getId(), $currentFlightType->getLabel());
48 48
         }
49 49
     }
Please login to merge, or discard this patch.
validators/AbstractValidator.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -109,8 +109,8 @@
 block discarded – undo
109 109
      *
110 110
      * @return array|string[]
111 111
      */
112
-    public function getError($field){
113
-        if(!$this->hasError($field)){
112
+    public function getError($field) {
113
+        if (!$this->hasError($field)) {
114 114
             return [];
115 115
         }
116 116
 
Please login to merge, or discard this patch.
Form/Form.php 2 patches
Spacing   +16 added lines, -16 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,18 +98,18 @@  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 bound');
107 107
         }
108 108
 
109 109
         $validation = $this->validator->isValid($this->object, $_REQUEST);
110 110
         
111
-        if(!$validation){
112
-            foreach($this->elements as $fieldName => $field){
111
+        if (!$validation) {
112
+            foreach ($this->elements as $fieldName => $field) {
113 113
                 $field->setErrors($this->validator->getError($fieldName));
114 114
             }
115 115
         }
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
     /**
121 121
      * @return array|string[]
122 122
      */
123
-    public function getErrorMessages(){
123
+    public function getErrorMessages() {
124 124
         return $this->validator->getErrors();
125 125
     }
126 126
 
@@ -141,10 +141,10 @@  discard block
 block discarded – undo
141 141
      */
142 142
     public function bind($object)
143 143
     {
144
-        foreach($this->elements as $element){
144
+        foreach ($this->elements as $element) {
145 145
             $name = $this->camelCase($element->getName());
146
-            $methodName = 'get'.$name;
147
-            if(!method_exists($object, $methodName)){
146
+            $methodName = 'get' . $name;
147
+            if (!method_exists($object, $methodName)) {
148 148
                 continue;
149 149
             }
150 150
 
@@ -161,24 +161,24 @@  discard block
 block discarded – undo
161 161
      */
162 162
     public function setData(array $data)
163 163
     {
164
-        foreach($data as $fieldName => $currentData){
165
-            if(!key_exists($fieldName, $this->elements) || $this->elements[$fieldName]->isDisabled()){
164
+        foreach ($data as $fieldName => $currentData) {
165
+            if (!key_exists($fieldName, $this->elements) || $this->elements[$fieldName]->isDisabled()) {
166 166
                 continue;
167 167
             }
168 168
 
169 169
             $this->elements[$fieldName]->setValue($currentData);
170 170
 
171
-            $methodName = 'set'.$this->camelCase($fieldName);
172
-            if(null === $this->object){
171
+            $methodName = 'set' . $this->camelCase($fieldName);
172
+            if (null === $this->object) {
173 173
                 continue;
174 174
             }
175 175
 
176
-            if(method_exists($this->object, $methodName)){
176
+            if (method_exists($this->object, $methodName)) {
177 177
                 $this->object->{$methodName}($currentData);
178 178
                 continue;
179 179
             }
180 180
 
181
-            if(property_exists($this->object, $fieldName)){
181
+            if (property_exists($this->object, $fieldName)) {
182 182
                 $this->object->{$fieldName} = $currentData;
183 183
                 continue;
184 184
             }
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
      */
201 201
     public function getElement($elementName)
202 202
     {
203
-        if(!key_exists($elementName, $this->elements)){
203
+        if (!key_exists($elementName, $this->elements)) {
204 204
             throw new \InvalidArgumentException(sprintf('Element %s not found ', $elementName));
205 205
         }
206 206
 
Please login to merge, or discard this patch.
Doc Comments   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -95,6 +95,7 @@  discard block
 block discarded – undo
95 95
 
96 96
     /**
97 97
      * @inheritDoc
98
+     * @param string $fieldName
98 99
      */
99 100
     public function remove($fieldName)
100 101
     {
@@ -142,7 +143,7 @@  discard block
 block discarded – undo
142 143
     }
143 144
 
144 145
     /**
145
-     * @param null|\ValidatorInterface $validator
146
+     * @param ValidatorInterface $validator
146 147
      *
147 148
      * @return Form
148 149
      */
Please login to merge, or discard this patch.
Form/Select.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
      *
52 52
      * @return $this
53 53
      */
54
-    public function addValueOption($key, $value){
54
+    public function addValueOption($key, $value) {
55 55
         $this->valueOptions[$key] = $value;
56 56
         return $this;
57 57
     }
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
     {
64 64
         parent::setValue($value);
65 65
 
66
-        if(!isset($this->valueOptions[$value])){
66
+        if (!isset($this->valueOptions[$value])) {
67 67
             $this->valueOptions[$value] = empty($value) ? ' ' : $value;
68 68
         }
69 69
     }
Please login to merge, or discard this patch.
Form/BalloonSelect.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -31,12 +31,12 @@
 block discarded – undo
31 31
     private function buildOptions()
32 32
     {
33 33
         $sql = "SELECT";
34
-        $sql.= " t.rowid,";
35
-        $sql.= " t.immat,";
36
-        $sql.= " t.is_disable";
37
-        $sql.= " FROM llx_bbc_ballons as t";
38
-        $sql.= " WHERE t.is_disable = 0";
39
-        $sql.= " ORDER BY t.immat";
34
+        $sql .= " t.rowid,";
35
+        $sql .= " t.immat,";
36
+        $sql .= " t.is_disable";
37
+        $sql .= " FROM llx_bbc_ballons as t";
38
+        $sql .= " WHERE t.is_disable = 0";
39
+        $sql .= " ORDER BY t.immat";
40 40
 
41 41
         $resql = $this->db->query($sql);
42 42
         if ($resql) {
Please login to merge, or discard this patch.
Form/BaseInput.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
     /**
80 80
      * @inheritdoc
81 81
      */
82
-    public function getId(){
82
+    public function getId() {
83 83
         return $this->getOption('id') ?: $this->getName();
84 84
     }
85 85
 
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
     /**
116 116
      * @return $this
117 117
      */
118
-    public function required(){
118
+    public function required() {
119 119
         $this->options['attr']['required'] = 'required';
120 120
 
121 121
         return $this;
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
     /**
125 125
      * @return $this
126 126
      */
127
-    public function disable(){
127
+    public function disable() {
128 128
         $this->options['attr']['disabled'] = 'disabled';
129 129
         return $this;
130 130
     }
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
     /**
133 133
      * @inheritdoc
134 134
      */
135
-    public function isDisabled(){
135
+    public function isDisabled() {
136 136
         return isset($this->options['attr']['disabled']);
137 137
     }
138 138
 
@@ -141,8 +141,8 @@  discard block
 block discarded – undo
141 141
      *
142 142
      * @return string|int|boolean|null
143 143
      */
144
-    public function getOption($option){
145
-        if(!isset($this->options[$option])){
144
+    public function getOption($option) {
145
+        if (!isset($this->options[$option])) {
146 146
             return null;
147 147
         }
148 148
 
Please login to merge, or discard this patch.
Form/SimpleFormRenderer.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
                 $select = $element;
71 71
                 $html = $this->renderSelectElement($select);
72 72
 
73
-                if(isset($options['ajax']) && $options['ajax']){
73
+                if (isset($options['ajax']) && $options['ajax']) {
74 74
                     $html .= ajax_combobox($element->getName());
75 75
                 }
76 76
 
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
             default:
80 80
                 return sprintf('<input type="%s" class="%s" name="%s" value="%s" %s />',
81 81
                     $element->getType(),
82
-                    ' flat '.($element->hasError() ? 'error' : ''),
82
+                    ' flat ' . ($element->hasError() ? 'error' : ''),
83 83
                     $element->getName(),
84 84
                     $element->getValue(),
85 85
                     $this->formatOptions($element->getOptions())
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
      */
120 120
     private function renderSelectElement(Select $element)
121 121
     {
122
-        $selectElement = sprintf('<select id="%s" class="%s" name="%s" >', $element->getId(),$element->hasError() ? 'error' : '', $element->getName());
122
+        $selectElement = sprintf('<select id="%s" class="%s" name="%s" >', $element->getId(), $element->hasError() ? 'error' : '', $element->getName());
123 123
 
124 124
         if ($element->getValueOptions()) {
125 125
             foreach ($element->getValueOptions() as $optionValue => $optionLabel) {
Please login to merge, or discard this patch.
card.php 1 patch
Spacing   +21 added lines, -21 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
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 
146 146
 $parameters = array();
147 147
 $reshook = $hookmanager->executeHooks('doActions', $parameters, $object,
148
-    $action);    // Note that $action and $object may have been modified by some hooks
148
+    $action); // Note that $action and $object may have been modified by some hooks
149 149
 if ($reshook < 0) {
150 150
     setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
151 151
 }
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
 
252 252
 
253 253
 // Part to edit record
254
-if (($user->rights->flightlog->vol->edit || ($user->rights->flightlog->vol->add && $object->fk_pilot == $user->id )) && ($id || $ref) && $action == 'edit'): ?>
254
+if (($user->rights->flightlog->vol->edit || ($user->rights->flightlog->vol->add && $object->fk_pilot == $user->id)) && ($id || $ref) && $action == 'edit'): ?>
255 255
 
256 256
     <?php $renderer = new \flightlog\form\SimpleFormRenderer(); ?>
257 257
 
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
         <?php echo $renderer->render($formFlight->getElement('idBBC_vols')); ?>
270 270
 
271 271
         <!-- Date et heures -->
272
-        <?php if($formFlight->has('fk_type')): ?>
272
+        <?php if ($formFlight->has('fk_type')): ?>
273 273
         <section class="form-section">
274 274
             <h1 class="form-section-title"><?php echo $langs->trans('Type de vol'); ?></h1>
275 275
             <table class="border" width="50%">
@@ -286,14 +286,14 @@  discard block
 block discarded – undo
286 286
             <h1 class="form-section-title"><?php echo $langs->trans('Pilote & ballon') ?></h1>
287 287
             <table class="border" width="50%">
288 288
 
289
-                <?php if($formFlight->has('fk_pilot')): ?>
289
+                <?php if ($formFlight->has('fk_pilot')): ?>
290 290
                 <tr>
291 291
                     <td class="fieldrequired"> Pilote </td>
292
-                    <td><?php echo $renderer->render($formFlight->getElement('fk_pilot'),['ajax' => true]); ?></td>
292
+                    <td><?php echo $renderer->render($formFlight->getElement('fk_pilot'), ['ajax' => true]); ?></td>
293 293
                 </tr>
294 294
                 <?php endif; ?>
295 295
 
296
-                <?php if($formFlight->has('BBC_ballons_idBBC_ballons')): ?>
296
+                <?php if ($formFlight->has('BBC_ballons_idBBC_ballons')): ?>
297 297
                 <tr>
298 298
                     <td width="25%" class="fieldrequired">Ballon</td>
299 299
                     <td><?php echo $renderer->render($formFlight->getElement('BBC_ballons_idBBC_ballons')); ?></td>
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
             </table>
329 329
         </section>
330 330
 
331
-        <?php if($formFlight->has('fk_organisateur')): ?>
331
+        <?php if ($formFlight->has('fk_organisateur')): ?>
332 332
             <section class="form-section">
333 333
                 <h1 class="form-section-title"><span class="js-organisator-field">Organisateur</span></h1>
334 334
                 <table class="border" width="50%">
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
                         <td>
338 338
                             <?php
339 339
                             //organisateur
340
-                            print $renderer->render($formFlight->getElement('fk_organisateur'),['ajax' => true]);
340
+                            print $renderer->render($formFlight->getElement('fk_organisateur'), ['ajax' => true]);
341 341
                             ?>
342 342
                         </td>
343 343
                     </tr>
@@ -349,7 +349,7 @@  discard block
 block discarded – undo
349 349
         <section class="form-section js-expensable-field">
350 350
             <h1 class="form-section-title"><?php echo $langs->trans('Déplacements') ?></h1>
351 351
             <table class="border" width="50%">
352
-                <?php if($formFlight->has('kilometers')): ?>
352
+                <?php if ($formFlight->has('kilometers')): ?>
353 353
                     <!-- number of kilometers done for the flight -->
354 354
                     <tr>
355 355
                         <td class="fieldrequired">Nombre de kilometres effectués pour le vol</td>
@@ -359,7 +359,7 @@  discard block
 block discarded – undo
359 359
                     </tr>
360 360
                 <?php endif; ?>
361 361
 
362
-                <?php if($formFlight->has('justif_kilometers')): ?>
362
+                <?php if ($formFlight->has('justif_kilometers')): ?>
363 363
                     <!-- Justif Kilometers -->
364 364
                     <tr>
365 365
 
@@ -377,7 +377,7 @@  discard block
 block discarded – undo
377 377
         <section class="form-section">
378 378
             <h1 class="form-section-title"><?php echo $langs->trans('Passager') ?></h1>
379 379
             <table class="border" width="50%">
380
-                <?php if($formFlight->has('nbrPax')): ?>
380
+                <?php if ($formFlight->has('nbrPax')): ?>
381 381
                     <tr>
382 382
                         <td class="fieldrequired"><?php echo $langs->trans('Nombre de passagers'); ?></td>
383 383
                         <td>
@@ -386,7 +386,7 @@  discard block
 block discarded – undo
386 386
                     </tr>
387 387
                 <?php endif; ?>
388 388
 
389
-                <?php if($formFlight->has('passengerNames')): ?>
389
+                <?php if ($formFlight->has('passengerNames')): ?>
390 390
                     <!-- passenger names -->
391 391
                     <tr>
392 392
                         <td width="25%" class="fieldrequired"><?php echo $langs->trans('Noms des passagers'); ?><br/>(Séparé
@@ -396,7 +396,7 @@  discard block
 block discarded – undo
396 396
                             <?php print $renderer->render($formFlight->getElement('passengerNames')); ?>
397 397
                         </td>
398 398
                     </tr>
399
-                <?php endif;?>
399
+                <?php endif; ?>
400 400
             </table>
401 401
         </section>
402 402
 
@@ -405,17 +405,17 @@  discard block
 block discarded – undo
405 405
             <h1 class="form-section-title js-billable-field"><?php echo $langs->trans('Facturation') ?></h1>
406 406
             <table class="border" width="50%">
407 407
 
408
-                <?php if($formFlight->has('fk_receiver')): ?>
408
+                <?php if ($formFlight->has('fk_receiver')): ?>
409 409
                     <!-- Money receiver -->
410 410
                     <tr class="js-hide-order js-billable-field">
411 411
                         <td class="fieldrequired"><?php echo $langs->trans('Qui a perçu l\'argent') ?></td>
412 412
                         <td>
413
-                            <?php print $renderer->render($formFlight->getElement('fk_receiver'),['ajax' => true]); ?>
413
+                            <?php print $renderer->render($formFlight->getElement('fk_receiver'), ['ajax' => true]); ?>
414 414
                         </td>
415 415
                     </tr>
416 416
                 <?php endif; ?>
417 417
 
418
-                <?php if($formFlight->has('cost')): ?>
418
+                <?php if ($formFlight->has('cost')): ?>
419 419
                     <!-- Flight cost -->
420 420
                     <tr class="js-hide-order js-billable-field">
421 421
                         <td class="fieldrequired">Montant perçu</td>
@@ -433,7 +433,7 @@  discard block
 block discarded – undo
433 433
             <h1 class="form-section-title"><?php echo $langs->trans('Commentaires') ?></h1>
434 434
             <table class="border" width="50%">
435 435
 
436
-                <?php if($formFlight->has('remarque')): ?>
436
+                <?php if ($formFlight->has('remarque')): ?>
437 437
                     <!-- commentaires -->
438 438
                     <tr class="">
439 439
                         <td class="fieldrequired"> Commentaire</td>
@@ -443,7 +443,7 @@  discard block
 block discarded – undo
443 443
                     </tr>
444 444
                 <?php endif; ?>
445 445
 
446
-                <?php if($formFlight->has('incidents')): ?>
446
+                <?php if ($formFlight->has('incidents')): ?>
447 447
                     <!-- incidents -->
448 448
                     <tr class="">
449 449
                         <td class="fieldrequired"> incidents</td>
@@ -477,7 +477,7 @@  discard block
 block discarded – undo
477 477
         $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('DeleteMyOjbect'),
478 478
             $langs->trans('êtes-vous sure de vouloir supprimer ce vol ?'), 'confirm_delete', '', 0, 1);
479 479
         print $formconfirm;
480
-    } elseif ($user->rights->flightlog->vol->financial  && $action == ACTION_FLAG_BILLED) {
480
+    } elseif ($user->rights->flightlog->vol->financial && $action == ACTION_FLAG_BILLED) {
481 481
         $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id,
482 482
             $langs->trans('Marque comme facturé'),
483 483
             $langs->trans('Ce vol va être marqué comme facturé, est-ce bien le cas ?'), ACTION_CONFIRM_FLAG_BILLED, '',
@@ -509,7 +509,7 @@  discard block
 block discarded – undo
509 509
     print '<div class="tabsAction">' . "\n";
510 510
     $parameters = array();
511 511
     $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object,
512
-        $action);    // Note that $action and $object may have been modified by hook
512
+        $action); // Note that $action and $object may have been modified by hook
513 513
     if ($reshook < 0) {
514 514
         setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
515 515
     }
Please login to merge, or discard this patch.