@@ -124,11 +124,11 @@ |
||
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 | } |
@@ -733,7 +733,7 @@ |
||
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 | /** |
@@ -52,7 +52,7 @@ |
||
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 |
@@ -43,7 +43,7 @@ |
||
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 | } |
@@ -249,18 +249,18 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
@@ -109,8 +109,8 @@ |
||
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 |
@@ -116,7 +116,7 @@ discard block |
||
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 |
||
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 | } |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | |
287 | 287 | <tr> |
288 | 288 | <td class="fieldrequired"> Pilote </td> |
289 | - <td><?php echo $renderer->render($formFlight->getElement('fk_pilot'),['ajax' => true]); ?></td> |
|
289 | + <td><?php echo $renderer->render($formFlight->getElement('fk_pilot'), ['ajax' => true]); ?></td> |
|
290 | 290 | </tr> |
291 | 291 | |
292 | 292 | <tr> |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | <td> |
333 | 333 | <?php |
334 | 334 | //organisateur |
335 | - print $renderer->render($formFlight->getElement('fk_organisateur'),['ajax' => true]); |
|
335 | + print $renderer->render($formFlight->getElement('fk_organisateur'), ['ajax' => true]); |
|
336 | 336 | ?> |
337 | 337 | </td> |
338 | 338 | </tr> |
@@ -395,7 +395,7 @@ discard block |
||
395 | 395 | <tr class="js-hide-order js-billable-field"> |
396 | 396 | <td class="fieldrequired"><?php echo $langs->trans('Qui a perçu l\'argent') ?></td> |
397 | 397 | <td> |
398 | - <?php print $renderer->render($formFlight->getElement('fk_receiver'),['ajax' => true]); ?> |
|
398 | + <?php print $renderer->render($formFlight->getElement('fk_receiver'), ['ajax' => true]); ?> |
|
399 | 399 | </td> |
400 | 400 | </tr> |
401 | 401 | |
@@ -485,7 +485,7 @@ discard block |
||
485 | 485 | print '<div class="tabsAction">' . "\n"; |
486 | 486 | $parameters = array(); |
487 | 487 | $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, |
488 | - $action); // Note that $action and $object may have been modified by hook |
|
488 | + $action); // Note that $action and $object may have been modified by hook |
|
489 | 489 | if ($reshook < 0) { |
490 | 490 | setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
491 | 491 | } |
@@ -78,7 +78,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
@@ -51,7 +51,7 @@ discard block |
||
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 |
||
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 | } |