@@ -91,7 +91,7 @@ |
||
91 | 91 | throw new \InvalidArgumentException('Model document is missing'); |
92 | 92 | } |
93 | 93 | |
94 | - if(!isset($nbrPax) || !is_numeric($nbrPax) || !is_integer($nbrPax)){ |
|
94 | + if (!isset($nbrPax) || !is_numeric($nbrPax) || !is_integer($nbrPax)) { |
|
95 | 95 | throw new \InvalidArgumentException('The number of pax is not correct, an integer is expected'); |
96 | 96 | } |
97 | 97 |
@@ -247,18 +247,18 @@ discard block |
||
247 | 247 | $sql .= ' ' . (!isset($this->nbrPax) ? 'NULL' : "'" . $this->db->escape($this->nbrPax) . "'") . ','; |
248 | 248 | $sql .= ' ' . (!isset($this->remarque) ? 'NULL' : "'" . $this->db->escape($this->remarque) . "'") . ','; |
249 | 249 | $sql .= ' ' . (!isset($this->incidents) ? 'NULL' : "'" . $this->db->escape($this->incidents) . "'") . ','; |
250 | - $sql .= ' ' . (!isset($this->fk_type) || (int)$this->fk_type === -1 ? 'NULL' : $this->fk_type) . ','; |
|
251 | - $sql .= ' ' . (!isset($this->fk_pilot) || (int)$this->fk_pilot === -1 ? 'NULL' : $this->fk_pilot) . ','; |
|
252 | - $sql .= ' ' . (!isset($this->fk_organisateur) || (int)$this->fk_organisateur === -1 ? 'NULL' : $this->fk_organisateur) . ','; |
|
250 | + $sql .= ' ' . (!isset($this->fk_type) || (int) $this->fk_type === -1 ? 'NULL' : $this->fk_type) . ','; |
|
251 | + $sql .= ' ' . (!isset($this->fk_pilot) || (int) $this->fk_pilot === -1 ? 'NULL' : $this->fk_pilot) . ','; |
|
252 | + $sql .= ' ' . (!isset($this->fk_organisateur) || (int) $this->fk_organisateur === -1 ? 'NULL' : $this->fk_organisateur) . ','; |
|
253 | 253 | $sql .= ' ' . (!isset($this->is_facture) ? '0' : $this->is_facture) . ','; |
254 | 254 | $sql .= ' ' . (!isset($this->kilometers) || empty($this->kilometers) ? '0' : $this->kilometers) . ','; |
255 | 255 | $sql .= ' ' . (!isset($this->cost) ? 'NULL' : "'" . $this->db->escape($this->cost) . "'") . ','; |
256 | - $sql .= ' ' . (!isset($this->fk_receiver) || (int)$this->fk_receiver === -1 ? 'NULL' : $this->fk_receiver) . ','; |
|
256 | + $sql .= ' ' . (!isset($this->fk_receiver) || (int) $this->fk_receiver === -1 ? 'NULL' : $this->fk_receiver) . ','; |
|
257 | 257 | $sql .= ' ' . (!isset($this->justif_kilometers) ? 'NULL' : "'" . $this->db->escape($this->justif_kilometers) . "'") . ','; |
258 | 258 | $sql .= ' ' . "'" . date('Y-m-d H:i:s') . "'" . ','; |
259 | 259 | $sql .= ' ' . "'" . date('Y-m-d H:i:s') . "'" . ','; |
260 | 260 | $sql .= ' ' . "'" . $this->passengerNames . "'" . ','; |
261 | - $sql .= ' ' . (!isset($this->orderId) || (int)$this->orderId === -1 ? 'NULL' : $this->orderId) . ''; |
|
261 | + $sql .= ' ' . (!isset($this->orderId) || (int) $this->orderId === -1 ? 'NULL' : $this->orderId) . ''; |
|
262 | 262 | |
263 | 263 | $sql .= ')'; |
264 | 264 | |
@@ -346,28 +346,28 @@ discard block |
||
346 | 346 | |
347 | 347 | $this->id = $obj->idBBC_vols; |
348 | 348 | |
349 | - $this->idBBC_vols = (int)$obj->idBBC_vols; |
|
349 | + $this->idBBC_vols = (int) $obj->idBBC_vols; |
|
350 | 350 | $this->date = $this->db->jdate($obj->date); |
351 | 351 | $this->lieuD = $obj->lieuD; |
352 | 352 | $this->lieuA = $obj->lieuA; |
353 | 353 | $this->heureD = $obj->heureD; |
354 | 354 | $this->heureA = $obj->heureA; |
355 | - $this->BBC_ballons_idBBC_ballons = (int)$obj->BBC_ballons_idBBC_ballons; |
|
355 | + $this->BBC_ballons_idBBC_ballons = (int) $obj->BBC_ballons_idBBC_ballons; |
|
356 | 356 | $this->nbrPax = $obj->nbrPax; |
357 | 357 | $this->remarque = $obj->remarque; |
358 | 358 | $this->incidents = $obj->incidents; |
359 | - $this->fk_type = (int)$obj->fk_type; |
|
360 | - $this->fk_pilot = (int)$obj->fk_pilot; |
|
361 | - $this->fk_organisateur = (int)$obj->fk_organisateur; |
|
362 | - $this->is_facture = (int)$obj->is_facture; |
|
359 | + $this->fk_type = (int) $obj->fk_type; |
|
360 | + $this->fk_pilot = (int) $obj->fk_pilot; |
|
361 | + $this->fk_organisateur = (int) $obj->fk_organisateur; |
|
362 | + $this->is_facture = (int) $obj->is_facture; |
|
363 | 363 | $this->kilometers = $obj->kilometers; |
364 | 364 | $this->cost = $obj->cost; |
365 | - $this->fk_receiver = (int)$obj->fk_receiver; |
|
365 | + $this->fk_receiver = (int) $obj->fk_receiver; |
|
366 | 366 | $this->justif_kilometers = $obj->justif_kilometers; |
367 | 367 | $this->date_creation = $obj->date_creation; |
368 | 368 | $this->date_update = $obj->date_update; |
369 | 369 | $this->passengerNames = $obj->passenger_names; |
370 | - $this->orderId = (int)$obj->order_id; |
|
370 | + $this->orderId = (int) $obj->order_id; |
|
371 | 371 | |
372 | 372 | $this->balloon = $this->fetchBalloon(); |
373 | 373 | $this->pilot = $this->fetchUser($this->fk_pilot); |
@@ -476,17 +476,17 @@ discard block |
||
476 | 476 | $sql .= ' nbrPax = ' . (isset($this->nbrPax) ? "'" . $this->db->escape($this->nbrPax) . "'" : "null") . ','; |
477 | 477 | $sql .= ' remarque = ' . (isset($this->remarque) ? "'" . $this->db->escape($this->remarque) . "'" : "null") . ','; |
478 | 478 | $sql .= ' incidents = ' . (isset($this->incidents) ? "'" . $this->db->escape($this->incidents) . "'" : "null") . ','; |
479 | - $sql .= ' fk_type = ' . (isset($this->fk_type) && (int)$this->fk_type > 0 ? $this->fk_type : "null") . ','; |
|
480 | - $sql .= ' fk_pilot = ' . (isset($this->fk_pilot) && (int)$this->fk_pilot > 0 ? $this->fk_pilot : "null") . ','; |
|
481 | - $sql .= ' fk_organisateur = ' . (isset($this->fk_organisateur) && (int)$this->fk_organisateur > 0 ? $this->fk_organisateur : "null") . ','; |
|
479 | + $sql .= ' fk_type = ' . (isset($this->fk_type) && (int) $this->fk_type > 0 ? $this->fk_type : "null") . ','; |
|
480 | + $sql .= ' fk_pilot = ' . (isset($this->fk_pilot) && (int) $this->fk_pilot > 0 ? $this->fk_pilot : "null") . ','; |
|
481 | + $sql .= ' fk_organisateur = ' . (isset($this->fk_organisateur) && (int) $this->fk_organisateur > 0 ? $this->fk_organisateur : "null") . ','; |
|
482 | 482 | $sql .= ' is_facture = ' . (isset($this->is_facture) ? $this->is_facture : "0") . ','; |
483 | 483 | $sql .= ' kilometers = ' . (!empty($this->kilometers) ? $this->kilometers : "0") . ','; |
484 | 484 | $sql .= ' cost = ' . (isset($this->cost) ? "'" . $this->db->escape($this->cost) . "'" : "''") . ','; |
485 | - $sql .= ' fk_receiver = ' . (isset($this->fk_receiver) && (int)$this->fk_receiver > 0 ? $this->fk_receiver : "null") . ','; |
|
485 | + $sql .= ' fk_receiver = ' . (isset($this->fk_receiver) && (int) $this->fk_receiver > 0 ? $this->fk_receiver : "null") . ','; |
|
486 | 486 | $sql .= ' justif_kilometers = ' . (isset($this->justif_kilometers) ? "'" . $this->db->escape($this->justif_kilometers) . "'," : "'',"); |
487 | 487 | $sql .= ' date_update = ' . "'" . date('Y-m-d H:i:s') . "',"; |
488 | 488 | $sql .= ' passenger_names = ' . "'" . trim($this->passengerNames) . "',"; |
489 | - $sql .= ' order_id = ' . (!isset($this->orderId) || (int)$this->orderId === -1 ? 'null' : $this->orderId); |
|
489 | + $sql .= ' order_id = ' . (!isset($this->orderId) || (int) $this->orderId === -1 ? 'null' : $this->orderId); |
|
490 | 490 | |
491 | 491 | $sql .= ' WHERE idBBC_vols=' . $this->idBBC_vols; |
492 | 492 | |
@@ -853,7 +853,7 @@ discard block |
||
853 | 853 | */ |
854 | 854 | public function getAmountPerPassenger() |
855 | 855 | { |
856 | - $nbrPax = $this->nbrPax > 0 ? $this->nbrPax : 1 ; |
|
856 | + $nbrPax = $this->nbrPax > 0 ? $this->nbrPax : 1; |
|
857 | 857 | return $this->cost / $nbrPax; |
858 | 858 | } |
859 | 859 |
@@ -124,12 +124,12 @@ |
||
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 | 130 | Header("Location: card.php?id=" . $flight->getId()); |
131 | - }catch (\Exception $e){ |
|
132 | - dol_syslog($e->getMessage(),LOG_ERR); |
|
131 | + } catch (\Exception $e) { |
|
132 | + dol_syslog($e->getMessage(), LOG_ERR); |
|
133 | 133 | dol_htmloutput_mesg("Facture non créée", '', 'error'); |
134 | 134 | } |
135 | 135 | } |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | |
70 | 70 | $isAllowedEdit = ($user->rights->flightlog->vol->edit || ($user->rights->flightlog->vol->add && $object->fk_pilot == $user->id)); |
71 | 71 | $isAllowedDelete = ($user->rights->flightlog->vol->delete || ($user->rights->flightlog->vol->add && $object->fk_pilot == $user->id && !$object->is_facture)); |
72 | -$permissiondellink=$user->rights->flightlog->vol->financial; |
|
72 | +$permissiondellink = $user->rights->flightlog->vol->financial; |
|
73 | 73 | |
74 | 74 | $search_idBBC_vols = GETPOST('search_idBBC_vols', 'int'); |
75 | 75 | $search_lieuD = GETPOST('search_lieuD', 'alpha'); |
@@ -116,8 +116,8 @@ 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 |
|
120 | -include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; |
|
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 | +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 |
123 | 123 | $hookmanager->initHooks(array('bbcvols')); |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | |
143 | 143 | $parameters = array(); |
144 | 144 | $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, |
145 | - $action); // Note that $action and $object may have been modified by some hooks |
|
145 | + $action); // Note that $action and $object may have been modified by some hooks |
|
146 | 146 | if ($reshook < 0) { |
147 | 147 | setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
148 | 148 | } |
@@ -377,7 +377,7 @@ discard block |
||
377 | 377 | print '<div class="tabsAction">' . "\n"; |
378 | 378 | $parameters = array(); |
379 | 379 | $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, |
380 | - $action); // Note that $action and $object may have been modified by hook |
|
380 | + $action); // Note that $action and $object may have been modified by hook |
|
381 | 381 | if ($reshook < 0) { |
382 | 382 | setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
383 | 383 | } |
@@ -390,14 +390,14 @@ discard block |
||
390 | 390 | print '<div class="inline-block divButAction"><a class="butActionDelete" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=delete">' . $langs->trans('Delete') . '</a></div>' . "\n"; |
391 | 391 | } |
392 | 392 | |
393 | - if($user->rights->flightlog->vol->financial && $object->fk_type == 2 && !$object->hasFacture() && $object->hasReceiver()){ |
|
394 | - print '<div class="inline-block divButAction"><a class="butAction" href="' . DOL_URL_ROOT . '/flightlog/facture.php?id=' . $object->id.'">' . $langs->trans("Facturer") . '</a></div>' . "\n"; |
|
393 | + if ($user->rights->flightlog->vol->financial && $object->fk_type == 2 && !$object->hasFacture() && $object->hasReceiver()) { |
|
394 | + print '<div class="inline-block divButAction"><a class="butAction" href="' . DOL_URL_ROOT . '/flightlog/facture.php?id=' . $object->id . '">' . $langs->trans("Facturer") . '</a></div>' . "\n"; |
|
395 | 395 | } |
396 | 396 | ?> |
397 | 397 | |
398 | - <?php if($user->rights->flightlog->vol->financial && !$object->isBilled() ): ?> |
|
398 | + <?php if ($user->rights->flightlog->vol->financial && !$object->isBilled()): ?> |
|
399 | 399 | <div class="inline-block divButAction"> |
400 | - <a class="butAction" href="<?php echo sprintf('%s?id=%s&action=%s' , $_SERVER["PHP_SELF"], $object->id, ACTION_FLAG_BILLED);?>"> |
|
400 | + <a class="butAction" href="<?php echo sprintf('%s?id=%s&action=%s', $_SERVER["PHP_SELF"], $object->id, ACTION_FLAG_BILLED); ?>"> |
|
401 | 401 | <?php echo $langs->trans("Marqué comme facturé ") ?> |
402 | 402 | </a> |
403 | 403 | </div> |
@@ -405,7 +405,7 @@ discard block |
||
405 | 405 | |
406 | 406 | </div> |
407 | 407 | <?php |
408 | - if($user->rights->flightlog->vol->financial){ |
|
408 | + if ($user->rights->flightlog->vol->financial) { |
|
409 | 409 | print '<div class="fichecenter"><div class="fichehalfleft">'; |
410 | 410 | $form->showLinkedObjectBlock($object); |
411 | 411 | print '</div></div>'; |