@@ -16,7 +16,7 @@ |
||
| 16 | 16 | parent::__construct($name, FormElementInterface::TYPE_CHECKBOX, $options); |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | - public function checkedValue(){ |
|
| 19 | + public function checkedValue() { |
|
| 20 | 20 | return 1; |
| 21 | 21 | } |
| 22 | 22 | } |
| 23 | 23 | \ No newline at end of file |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | public function __construct(\DoliDB $db, $tableName) |
| 24 | 24 | { |
| 25 | 25 | $this->db = $db; |
| 26 | - $this->tableName = strpos($tableName, MAIN_DB_PREFIX) === 0 ? $tableName : MAIN_DB_PREFIX.$tableName; |
|
| 26 | + $this->tableName = strpos($tableName, MAIN_DB_PREFIX) === 0 ? $tableName : MAIN_DB_PREFIX . $tableName; |
|
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | /** |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | * |
| 34 | 34 | * @throws \Exception |
| 35 | 35 | */ |
| 36 | - protected function write(array $elements){ |
|
| 36 | + protected function write(array $elements) { |
|
| 37 | 37 | $columns = join(',', array_keys($elements)); |
| 38 | 38 | $values = join(',', array_map([$this, 'escape'], array_values($elements))); |
| 39 | 39 | |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | $lasterror = $this->db->lasterror(); |
| 45 | 45 | dol_syslog(__METHOD__ . ' ' . $lasterror, LOG_ERR); |
| 46 | 46 | $this->db->rollback(); |
| 47 | - throw new \Exception("Repository error - ".$lasterror); |
|
| 47 | + throw new \Exception("Repository error - " . $lasterror); |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | $id = $this->db->last_insert_id($this->tableName); |
@@ -57,16 +57,16 @@ discard block |
||
| 57 | 57 | * |
| 58 | 58 | * @return int|string|null |
| 59 | 59 | */ |
| 60 | - private function escape($value){ |
|
| 61 | - if(is_null($value)){ |
|
| 60 | + private function escape($value) { |
|
| 61 | + if (is_null($value)) { |
|
| 62 | 62 | return 'NULL'; |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | - if(is_bool($value)){ |
|
| 66 | - return (int)$value; |
|
| 65 | + if (is_bool($value)) { |
|
| 66 | + return (int) $value; |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | - return is_string($value) ? "'".$this->db->escape($value)."'" : $value ; |
|
| 69 | + return is_string($value) ? "'" . $this->db->escape($value) . "'" : $value; |
|
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | /** |
@@ -79,18 +79,18 @@ discard block |
||
| 79 | 79 | { |
| 80 | 80 | $sqlModifications = []; |
| 81 | 81 | |
| 82 | - foreach($elements as $field => $value){ |
|
| 82 | + foreach ($elements as $field => $value) { |
|
| 83 | 83 | $sqlModifications[] = sprintf('%s=%s', $field, $this->escape($value)); |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | $this->db->begin(); |
| 87 | - $resql = $this->db->query(sprintf('UPDATE %s SET %s WHERE '.$idCol.' = %s ', $this->tableName, join(',',$sqlModifications), $id)); |
|
| 87 | + $resql = $this->db->query(sprintf('UPDATE %s SET %s WHERE ' . $idCol . ' = %s ', $this->tableName, join(',', $sqlModifications), $id)); |
|
| 88 | 88 | |
| 89 | 89 | if (!$resql) { |
| 90 | 90 | $lasterror = $this->db->lasterror(); |
| 91 | 91 | dol_syslog(__METHOD__ . ' ' . $lasterror, LOG_ERR); |
| 92 | 92 | $this->db->rollback(); |
| 93 | - throw new \Exception("Repository error - ".$lasterror); |
|
| 93 | + throw new \Exception("Repository error - " . $lasterror); |
|
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | $this->db->commit(); |
@@ -104,8 +104,8 @@ discard block |
||
| 104 | 104 | * |
| 105 | 105 | * @return array|null |
| 106 | 106 | */ |
| 107 | - protected function get($id, $idCol = 'rowid'){ |
|
| 108 | - $sql = sprintf('SELECT * FROM %s WHERE '.$idCol.' = %s', $this->tableName, $id ); |
|
| 107 | + protected function get($id, $idCol = 'rowid') { |
|
| 108 | + $sql = sprintf('SELECT * FROM %s WHERE ' . $idCol . ' = %s', $this->tableName, $id); |
|
| 109 | 109 | |
| 110 | 110 | $resql = $this->db->query($sql); |
| 111 | 111 | if (!$resql) { |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | return null; |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | - for($i = 0; $i < $num ; $i++) { |
|
| 120 | + for ($i = 0; $i < $num; $i++) { |
|
| 121 | 121 | return $this->db->fetch_array($resql); |
| 122 | 122 | } |
| 123 | 123 | |
@@ -16,17 +16,17 @@ discard block |
||
| 16 | 16 | final class PilotEditController extends WebController |
| 17 | 17 | { |
| 18 | 18 | |
| 19 | - public function index(){ |
|
| 19 | + public function index() { |
|
| 20 | 20 | $id = $this->request->getParam('id'); |
| 21 | 21 | |
| 22 | - if($id === null){ |
|
| 22 | + if ($id === null) { |
|
| 23 | 23 | $this->renderHtml('<p>Paramètre ID non fournis.</p>'); |
| 24 | 24 | return; |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | $command = new CreateUpdatePilotInformationCommand($id); |
| 28 | 28 | |
| 29 | - if($this->getPilotRepository()->exist(PilotId::create($id))){ |
|
| 29 | + if ($this->getPilotRepository()->exist(PilotId::create($id))) { |
|
| 30 | 30 | $command->fromPilot($this->getPilotRepository()->getById(PilotId::create($id))); |
| 31 | 31 | } |
| 32 | 32 | |
@@ -36,19 +36,19 @@ discard block |
||
| 36 | 36 | $user = new \User($this->db); |
| 37 | 37 | $user->fetch($id); |
| 38 | 38 | |
| 39 | - if($this->request->isPost()){ |
|
| 39 | + if ($this->request->isPost()) { |
|
| 40 | 40 | $form->setData($this->request->getPostParameters()); |
| 41 | 41 | |
| 42 | - if(!$form->validate()){ |
|
| 42 | + if (!$form->validate()) { |
|
| 43 | 43 | return $this->render('pilot/edit.phtml', [ |
| 44 | 44 | 'form' => $form, |
| 45 | 45 | ]); |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | - try{ |
|
| 48 | + try { |
|
| 49 | 49 | $this->handle($form->getObject()); |
| 50 | - return $this->redirect($_SERVER["PHP_SELF"].'?id='.$id.'&r=list_members'); |
|
| 51 | - }catch(\Exception $e){ |
|
| 50 | + return $this->redirect($_SERVER["PHP_SELF"] . '?id=' . $id . '&r=list_members'); |
|
| 51 | + } catch (\Exception $e) { |
|
| 52 | 52 | print $e->getMessage(); |
| 53 | 53 | dol_syslog($e->getMessage(), LOG_ERR); |
| 54 | 54 | } |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | /** |
| 77 | 77 | * @return CreateUpdatePilotInformationCommandHandler() |
| 78 | 78 | */ |
| 79 | - private function getHandler(){ |
|
| 79 | + private function getHandler() { |
|
| 80 | 80 | return new CreateUpdatePilotInformationCommandHandler($this->getPilotRepository()); |
| 81 | 81 | } |
| 82 | 82 | |
@@ -48,7 +48,7 @@ |
||
| 48 | 48 | try{ |
| 49 | 49 | $this->handle($form->getObject()); |
| 50 | 50 | return $this->redirect($_SERVER["PHP_SELF"].'?id='.$id.'&r=list_members'); |
| 51 | - }catch(\Exception $e){ |
|
| 51 | + } catch(\Exception $e){ |
|
| 52 | 52 | print $e->getMessage(); |
| 53 | 53 | dol_syslog($e->getMessage(), LOG_ERR); |
| 54 | 54 | } |
@@ -150,9 +150,9 @@ discard block |
||
| 150 | 150 | |
| 151 | 151 | dol_include_once('/fourn/class/fournisseur.facture.class.php'); |
| 152 | 152 | |
| 153 | -scan(__DIR__.'/Http/Web/Controller'); |
|
| 154 | -scan(__DIR__.'/Infrastructure'); |
|
| 155 | -scan(__DIR__.'/Application'); |
|
| 153 | +scan(__DIR__ . '/Http/Web/Controller'); |
|
| 154 | +scan(__DIR__ . '/Infrastructure'); |
|
| 155 | +scan(__DIR__ . '/Application'); |
|
| 156 | 156 | |
| 157 | 157 | function scan(string $root) |
| 158 | 158 | { |
@@ -172,13 +172,13 @@ discard block |
||
| 172 | 172 | continue; |
| 173 | 173 | } |
| 174 | 174 | |
| 175 | - if($match == ".." || $match == "." || substr($match, 0,1) === '.'){ |
|
| 175 | + if ($match == ".." || $match == "." || substr($match, 0, 1) === '.') { |
|
| 176 | 176 | continue; |
| 177 | 177 | } |
| 178 | 178 | |
| 179 | 179 | $element = $root . DIRECTORY_SEPARATOR . $match; |
| 180 | 180 | |
| 181 | - if(substr_count($element, '/', 3) >= 1){ |
|
| 181 | + if (substr_count($element, '/', 3) >= 1) { |
|
| 182 | 182 | scan($element); |
| 183 | 183 | } |
| 184 | 184 | |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | */ |
| 88 | 88 | public function add(FormElementInterface $element) |
| 89 | 89 | { |
| 90 | - if(array_key_exists($element->getName(), $this->elements)){ |
|
| 90 | + if (array_key_exists($element->getName(), $this->elements)) { |
|
| 91 | 91 | throw new \InvalidArgumentException('Element already exists'); |
| 92 | 92 | } |
| 93 | 93 | $this->elements[$element->getName()] = $element; |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | */ |
| 142 | 142 | public function getErrorMessages() |
| 143 | 143 | { |
| 144 | - if(!$this->validator){ |
|
| 144 | + if (!$this->validator) { |
|
| 145 | 145 | return []; |
| 146 | 146 | } |
| 147 | 147 | |
@@ -186,12 +186,12 @@ discard block |
||
| 186 | 186 | */ |
| 187 | 187 | public function setData(array $data) |
| 188 | 188 | { |
| 189 | - foreach($this->elements as $element){ |
|
| 190 | - if($element->getType() !== 'checkbox'){ |
|
| 189 | + foreach ($this->elements as $element) { |
|
| 190 | + if ($element->getType() !== 'checkbox') { |
|
| 191 | 191 | continue; |
| 192 | 192 | } |
| 193 | 193 | |
| 194 | - if(isset($data[$element->getName()])){ |
|
| 194 | + if (isset($data[$element->getName()])) { |
|
| 195 | 195 | continue; |
| 196 | 196 | } |
| 197 | 197 | |
@@ -459,7 +459,7 @@ discard block |
||
| 459 | 459 | || !$this->isTrainingFirstHelpValid(); |
| 460 | 460 | } |
| 461 | 461 | |
| 462 | - public function isWarning(){ |
|
| 462 | + public function isWarning() { |
|
| 463 | 463 | return !$this->isHoursAndTakeOffValidGroupA() || !$this->isProValid(); |
| 464 | 464 | } |
| 465 | 465 | |
@@ -469,7 +469,7 @@ discard block |
||
| 469 | 469 | |
| 470 | 470 | $ok = '<span class="text-success text-italic">OK</span>'; |
| 471 | 471 | |
| 472 | - if($this->isPilot()){ |
|
| 472 | + if ($this->isPilot()) { |
|
| 473 | 473 | $reasons .= '<br> <span class="text-bold">Médical : </span> ' . ($this->isMedicalValid() ? $ok : 'L\'échéance est atteinte ou dépassée.'); |
| 474 | 474 | $reasons .= '<br> <span class="text-bold">Training flight : </span> ' . ($this->isTrainingFlightValid() ? $ok : 'Pas de vol avec un FI dans les 48 derniers mois.'); |
| 475 | 475 | $reasons .= '<br> <span class="text-bold">Exp. récente Gr. A: </span> ' . ($this->isHoursAndTakeOffValidGroupA() ? $ok : 'Pas 6H & 10TO dans les 24 derniers mois'); |
@@ -481,27 +481,27 @@ discard block |
||
| 481 | 481 | } |
| 482 | 482 | |
| 483 | 483 | |
| 484 | - if($this->isPilot() || $this->isTrainingFire()){ |
|
| 484 | + if ($this->isPilot() || $this->isTrainingFire()) { |
|
| 485 | 485 | $reasons .= '<br><span class="text-bold">Feu: </span> ' . ($this->isTrainingFireValid() ? $ok : 'Date expirée'); |
| 486 | 486 | } |
| 487 | 487 | |
| 488 | - if($this->isPilot() || $this->isTrainingFirstHelp()){ |
|
| 488 | + if ($this->isPilot() || $this->isTrainingFirstHelp()) { |
|
| 489 | 489 | $reasons .= '<br><span class="text-bold">Premiers secours: </span> ' . ($this->isTrainingFirstHelpValid() ? $ok : 'Date expirée'); |
| 490 | 490 | } |
| 491 | 491 | |
| 492 | 492 | |
| 493 | 493 | $qualification = $ok; |
| 494 | - if(!$this->isPilot()){ |
|
| 494 | + if (!$this->isPilot()) { |
|
| 495 | 495 | $qualification = '<span class="text-success">CREW</span>'; |
| 496 | 496 | } |
| 497 | - if($this->isWarning()){ |
|
| 497 | + if ($this->isWarning()) { |
|
| 498 | 498 | $qualification = '<span class="text-warning">Controle du carnet de vol nécessaire</span>'; |
| 499 | 499 | } |
| 500 | - if($this->isDanger()){ |
|
| 500 | + if ($this->isDanger()) { |
|
| 501 | 501 | $qualification = '<span class="text-danger">Vol non autorisé</span>'; |
| 502 | 502 | } |
| 503 | 503 | |
| 504 | - return '<u><span class="text-bold">Qualification </span> : ' . $qualification .'</u>'. $reasons; |
|
| 504 | + return '<u><span class="text-bold">Qualification </span> : ' . $qualification . '</u>' . $reasons; |
|
| 505 | 505 | } |
| 506 | 506 | |
| 507 | 507 | private function isMedicalValid(): bool |
@@ -510,7 +510,7 @@ discard block |
||
| 510 | 510 | return true; |
| 511 | 511 | } |
| 512 | 512 | |
| 513 | - if(null === $this->medicalEndDate){ |
|
| 513 | + if (null === $this->medicalEndDate) { |
|
| 514 | 514 | return false; |
| 515 | 515 | } |
| 516 | 516 | |
@@ -520,11 +520,11 @@ discard block |
||
| 520 | 520 | |
| 521 | 521 | private function isTrainingFlightValid(): bool |
| 522 | 522 | { |
| 523 | - if(!$this->isPilot()){ |
|
| 523 | + if (!$this->isPilot()) { |
|
| 524 | 524 | return true; |
| 525 | 525 | } |
| 526 | 526 | |
| 527 | - if(null === $this->lastTrainingFlightDate){ |
|
| 527 | + if (null === $this->lastTrainingFlightDate) { |
|
| 528 | 528 | return false; |
| 529 | 529 | } |
| 530 | 530 | |
@@ -533,7 +533,7 @@ discard block |
||
| 533 | 533 | |
| 534 | 534 | private function isHoursAndTakeOffValidGroupA(): bool |
| 535 | 535 | { |
| 536 | - if(!$this->isPilot()){ |
|
| 536 | + if (!$this->isPilot()) { |
|
| 537 | 537 | return true; |
| 538 | 538 | } |
| 539 | 539 | |
@@ -560,7 +560,7 @@ discard block |
||
| 560 | 560 | |
| 561 | 561 | private function isProDateValid(): bool |
| 562 | 562 | { |
| 563 | - if(!$this->isPilot()){ |
|
| 563 | + if (!$this->isPilot()) { |
|
| 564 | 564 | return true; |
| 565 | 565 | } |
| 566 | 566 | |
@@ -574,7 +574,7 @@ discard block |
||
| 574 | 574 | |
| 575 | 575 | private function isProValid(): bool |
| 576 | 576 | { |
| 577 | - if(!$this->isPilot()){ |
|
| 577 | + if (!$this->isPilot()) { |
|
| 578 | 578 | return true; |
| 579 | 579 | } |
| 580 | 580 | |
@@ -582,7 +582,7 @@ discard block |
||
| 582 | 582 | return true; |
| 583 | 583 | } |
| 584 | 584 | |
| 585 | - if($this->lastOpcDate && $this->diffDateInMonths($this->lastOpcDate) < 6){ |
|
| 585 | + if ($this->lastOpcDate && $this->diffDateInMonths($this->lastOpcDate) < 6) { |
|
| 586 | 586 | return true; |
| 587 | 587 | } |
| 588 | 588 | |
@@ -602,7 +602,7 @@ discard block |
||
| 602 | 602 | } |
| 603 | 603 | |
| 604 | 604 | private function diffDateInMonths(\DateTimeImmutable $dateA, \DateTimeImmutable $dateB = null): int{ |
| 605 | - if(null === $dateB){ |
|
| 605 | + if (null === $dateB) { |
|
| 606 | 606 | $dateB = new \DateTimeImmutable(); |
| 607 | 607 | } |
| 608 | 608 | |
@@ -612,11 +612,11 @@ discard block |
||
| 612 | 612 | |
| 613 | 613 | private function isTrainingFireValid() |
| 614 | 614 | { |
| 615 | - if(!$this->isTrainingFire() && !$this->isPilot()){ |
|
| 615 | + if (!$this->isTrainingFire() && !$this->isPilot()) { |
|
| 616 | 616 | return true; |
| 617 | 617 | } |
| 618 | 618 | |
| 619 | - if(null === $this->lastTrainingFireDate){ |
|
| 619 | + if (null === $this->lastTrainingFireDate) { |
|
| 620 | 620 | return false; |
| 621 | 621 | } |
| 622 | 622 | |
@@ -625,11 +625,11 @@ discard block |
||
| 625 | 625 | |
| 626 | 626 | private function isTrainingFirstHelpValid() |
| 627 | 627 | { |
| 628 | - if(!$this->isTrainingFirstHelp() && !$this->isPilot() ){ |
|
| 628 | + if (!$this->isTrainingFirstHelp() && !$this->isPilot()) { |
|
| 629 | 629 | return true; |
| 630 | 630 | } |
| 631 | 631 | |
| 632 | - if(null === $this->lastTrainingFirstHelpDate){ |
|
| 632 | + if (null === $this->lastTrainingFirstHelpDate) { |
|
| 633 | 633 | return false; |
| 634 | 634 | } |
| 635 | 635 | |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | * |
| 32 | 32 | * @return Pilot |
| 33 | 33 | */ |
| 34 | - public function byId($id){ |
|
| 34 | + public function byId($id) { |
|
| 35 | 35 | $pilots = $this->filter(['id' => $id]); |
| 36 | 36 | if (empty($pilots)) { |
| 37 | 37 | return Pilot::fromArray(['id' => $id]); |
@@ -90,8 +90,8 @@ discard block |
||
| 90 | 90 | )) |
| 91 | 91 | '; |
| 92 | 92 | |
| 93 | - if(isset($filters['id'])){ |
|
| 94 | - $sql .= ' AND llx_user.rowid = '.$filters['id']; |
|
| 93 | + if (isset($filters['id'])) { |
|
| 94 | + $sql .= ' AND llx_user.rowid = ' . $filters['id']; |
|
| 95 | 95 | } |
| 96 | 96 | $sql .= ' ORDER BY llx_user.firstname, llx_user.lastname, llx_user.rowid, flight.date'; |
| 97 | 97 | |
@@ -107,16 +107,16 @@ discard block |
||
| 107 | 107 | |
| 108 | 108 | /** @var Pilot[] $pilots */ |
| 109 | 109 | $pilots = []; |
| 110 | - for($i = 0; $i < $num ; $i++) { |
|
| 110 | + for ($i = 0; $i < $num; $i++) { |
|
| 111 | 111 | $values = $this->db->fetch_array($resql); |
| 112 | 112 | $pilotId = $values['id']; |
| 113 | 113 | |
| 114 | - if(!isset($pilots[$pilotId])){ |
|
| 114 | + if (!isset($pilots[$pilotId])) { |
|
| 115 | 115 | $pilots[$pilotId] = Pilot::fromArray($values); |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | $flight = PilotFlight::fromArray($values, 'flight'); |
| 119 | - if($flight->isValid()){ |
|
| 119 | + if ($flight->isValid()) { |
|
| 120 | 120 | $pilots[$pilotId]->addFlight($flight); |
| 121 | 121 | } |
| 122 | 122 | |
@@ -101,15 +101,15 @@ discard block |
||
| 101 | 101 | |
| 102 | 102 | $sql .= " FROM "; |
| 103 | 103 | $sql .= MAIN_DB_PREFIX . "bbc_vols as f "; |
| 104 | - $sql .= ' INNER JOIN ' . MAIN_DB_PREFIX."user as pilot ON pilot.rowid = f.fk_pilot "; |
|
| 105 | - $sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX."user as organisator ON organisator.rowid = f.fk_organisateur "; |
|
| 106 | - $sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX."user as receiver ON receiver.rowid = f.fk_receiver "; |
|
| 104 | + $sql .= ' INNER JOIN ' . MAIN_DB_PREFIX . "user as pilot ON pilot.rowid = f.fk_pilot "; |
|
| 105 | + $sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . "user as organisator ON organisator.rowid = f.fk_organisateur "; |
|
| 106 | + $sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . "user as receiver ON receiver.rowid = f.fk_receiver "; |
|
| 107 | 107 | |
| 108 | 108 | $sql .= "WHERE 1 = 1 "; |
| 109 | 109 | |
| 110 | - if($object instanceof FactureFournisseur){ |
|
| 110 | + if ($object instanceof FactureFournisseur) { |
|
| 111 | 111 | $sql .= " AND (YEAR(f.date) = (YEAR(NOW())) OR YEAR(f.date) = (YEAR(NOW()) - 1))"; |
| 112 | - }else{ |
|
| 112 | + } else { |
|
| 113 | 113 | $sql .= " AND YEAR(f.date) = (YEAR(NOW())) "; |
| 114 | 114 | $sql .= " AND f.fk_type IN (1,2) "; |
| 115 | 115 | $sql .= " AND f.is_facture = 0 "; |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | ]; |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | - public function addOpenElementsDashboardLine(){ |
|
| 157 | + public function addOpenElementsDashboardLine() { |
|
| 158 | 158 | $result = new WorkboardResponse(); |
| 159 | 159 | $result->label = 'En ordre'; |
| 160 | 160 | $result->nbtodo = 10; |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | ]; |
| 171 | 171 | } |
| 172 | 172 | |
| 173 | - public function printTopRightMenu(array $parameters = []){ |
|
| 173 | + public function printTopRightMenu(array $parameters = []) { |
|
| 174 | 174 | /** @var DoliDB $db */ |
| 175 | 175 | global $db, $user; |
| 176 | 176 | |
@@ -109,7 +109,7 @@ |
||
| 109 | 109 | |
| 110 | 110 | if($object instanceof FactureFournisseur){ |
| 111 | 111 | $sql .= " AND (YEAR(f.date) = (YEAR(NOW())) OR YEAR(f.date) = (YEAR(NOW()) - 1))"; |
| 112 | - }else{ |
|
| 112 | + } else{ |
|
| 113 | 113 | $sql .= " AND YEAR(f.date) = (YEAR(NOW())) "; |
| 114 | 114 | $sql .= " AND f.fk_type IN (1,2) "; |
| 115 | 115 | $sql .= " AND f.is_facture = 0 "; |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | */ |
| 130 | 130 | public function getIdBBCVols() |
| 131 | 131 | { |
| 132 | - return (int)$this->idBBC_vols; |
|
| 132 | + return (int) $this->idBBC_vols; |
|
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | /** |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | */ |
| 138 | 138 | public function getId() |
| 139 | 139 | { |
| 140 | - return (int)$this->getIdBBCVols(); |
|
| 140 | + return (int) $this->getIdBBCVols(); |
|
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | /** |
@@ -274,13 +274,13 @@ discard block |
||
| 274 | 274 | $sql .= ' ' . (!isset($this->nbrPax) ? 'NULL' : "'" . $this->db->escape($this->nbrPax) . "'") . ','; |
| 275 | 275 | $sql .= ' ' . (!isset($this->remarque) ? 'NULL' : "'" . $this->db->escape($this->remarque) . "'") . ','; |
| 276 | 276 | $sql .= ' ' . (!isset($this->incidents) ? 'NULL' : "'" . $this->db->escape($this->incidents) . "'") . ','; |
| 277 | - $sql .= ' ' . (!isset($this->fk_type) || (int)$this->fk_type === -1 ? 'NULL' : $this->fk_type) . ','; |
|
| 278 | - $sql .= ' ' . (!isset($this->fk_pilot) || (int)$this->fk_pilot === -1 ? 'NULL' : $this->fk_pilot) . ','; |
|
| 279 | - $sql .= ' ' . (!isset($this->fk_organisateur) || (int)$this->fk_organisateur === -1 ? 'NULL' : $this->fk_organisateur) . ','; |
|
| 277 | + $sql .= ' ' . (!isset($this->fk_type) || (int) $this->fk_type === -1 ? 'NULL' : $this->fk_type) . ','; |
|
| 278 | + $sql .= ' ' . (!isset($this->fk_pilot) || (int) $this->fk_pilot === -1 ? 'NULL' : $this->fk_pilot) . ','; |
|
| 279 | + $sql .= ' ' . (!isset($this->fk_organisateur) || (int) $this->fk_organisateur === -1 ? 'NULL' : $this->fk_organisateur) . ','; |
|
| 280 | 280 | $sql .= ' ' . (!isset($this->is_facture) ? '0' : $this->is_facture) . ','; |
| 281 | 281 | $sql .= ' ' . (!isset($this->kilometers) || empty($this->kilometers) ? '0' : $this->kilometers) . ','; |
| 282 | 282 | $sql .= ' ' . (!isset($this->cost) ? 'NULL' : "'" . $this->db->escape($this->cost) . "'") . ','; |
| 283 | - $sql .= ' ' . (!isset($this->fk_receiver) || (int)$this->fk_receiver === -1 ? 'NULL' : $this->fk_receiver) . ','; |
|
| 283 | + $sql .= ' ' . (!isset($this->fk_receiver) || (int) $this->fk_receiver === -1 ? 'NULL' : $this->fk_receiver) . ','; |
|
| 284 | 284 | $sql .= ' ' . (!isset($this->justif_kilometers) ? 'NULL' : "'" . $this->db->escape($this->justif_kilometers) . "'") . ','; |
| 285 | 285 | $sql .= ' ' . "'" . date('Y-m-d H:i:s') . "'" . ','; |
| 286 | 286 | $sql .= ' ' . "'" . date('Y-m-d H:i:s') . "'" . ','; |
@@ -455,23 +455,23 @@ discard block |
||
| 455 | 455 | |
| 456 | 456 | $this->id = $obj->idBBC_vols; |
| 457 | 457 | |
| 458 | - $this->idBBC_vols = (int)$obj->idBBC_vols; |
|
| 458 | + $this->idBBC_vols = (int) $obj->idBBC_vols; |
|
| 459 | 459 | $this->date = $this->db->jdate($obj->date); |
| 460 | 460 | $this->lieuD = $obj->lieuD; |
| 461 | 461 | $this->lieuA = $obj->lieuA; |
| 462 | 462 | $this->heureD = $obj->heureD; |
| 463 | 463 | $this->heureA = $obj->heureA; |
| 464 | - $this->BBC_ballons_idBBC_ballons = (int)$obj->BBC_ballons_idBBC_ballons; |
|
| 464 | + $this->BBC_ballons_idBBC_ballons = (int) $obj->BBC_ballons_idBBC_ballons; |
|
| 465 | 465 | $this->nbrPax = $obj->nbrPax; |
| 466 | 466 | $this->remarque = $obj->remarque; |
| 467 | 467 | $this->incidents = $obj->incidents; |
| 468 | - $this->fk_type = (int)$obj->fk_type; |
|
| 469 | - $this->fk_pilot = (int)$obj->fk_pilot; |
|
| 470 | - $this->fk_organisateur = (int)$obj->fk_organisateur; |
|
| 471 | - $this->statut = $this->is_facture = (int)$obj->is_facture; |
|
| 468 | + $this->fk_type = (int) $obj->fk_type; |
|
| 469 | + $this->fk_pilot = (int) $obj->fk_pilot; |
|
| 470 | + $this->fk_organisateur = (int) $obj->fk_organisateur; |
|
| 471 | + $this->statut = $this->is_facture = (int) $obj->is_facture; |
|
| 472 | 472 | $this->kilometers = $obj->kilometers; |
| 473 | 473 | $this->total_ttc = $this->cost = $obj->cost; |
| 474 | - $this->fk_receiver = (int)$obj->fk_receiver; |
|
| 474 | + $this->fk_receiver = (int) $obj->fk_receiver; |
|
| 475 | 475 | $this->justif_kilometers = $obj->justif_kilometers; |
| 476 | 476 | $this->date_creation = $obj->date_creation; |
| 477 | 477 | $this->date_update = $obj->date_update; |
@@ -587,13 +587,13 @@ discard block |
||
| 587 | 587 | $sql .= ' nbrPax = ' . (isset($this->nbrPax) ? "'" . $this->db->escape($this->nbrPax) . "'" : "null") . ','; |
| 588 | 588 | $sql .= ' remarque = ' . (isset($this->remarque) ? "'" . $this->db->escape($this->remarque) . "'" : "null") . ','; |
| 589 | 589 | $sql .= ' incidents = ' . (isset($this->incidents) ? "'" . $this->db->escape($this->incidents) . "'" : "null") . ','; |
| 590 | - $sql .= ' fk_type = ' . (isset($this->fk_type) && (int)$this->fk_type > 0 ? $this->fk_type : "null") . ','; |
|
| 591 | - $sql .= ' fk_pilot = ' . (isset($this->fk_pilot) && (int)$this->fk_pilot > 0 ? $this->fk_pilot : "null") . ','; |
|
| 592 | - $sql .= ' fk_organisateur = ' . (isset($this->fk_organisateur) && (int)$this->fk_organisateur > 0 ? $this->fk_organisateur : "null") . ','; |
|
| 590 | + $sql .= ' fk_type = ' . (isset($this->fk_type) && (int) $this->fk_type > 0 ? $this->fk_type : "null") . ','; |
|
| 591 | + $sql .= ' fk_pilot = ' . (isset($this->fk_pilot) && (int) $this->fk_pilot > 0 ? $this->fk_pilot : "null") . ','; |
|
| 592 | + $sql .= ' fk_organisateur = ' . (isset($this->fk_organisateur) && (int) $this->fk_organisateur > 0 ? $this->fk_organisateur : "null") . ','; |
|
| 593 | 593 | $sql .= ' is_facture = ' . (isset($this->is_facture) ? $this->is_facture : "0") . ','; |
| 594 | 594 | $sql .= ' kilometers = ' . (!empty($this->kilometers) ? $this->kilometers : "0") . ','; |
| 595 | 595 | $sql .= ' cost = ' . (isset($this->cost) ? "'" . $this->db->escape($this->cost) . "'" : "''") . ','; |
| 596 | - $sql .= ' fk_receiver = ' . (isset($this->fk_receiver) && (int)$this->fk_receiver > 0 ? $this->fk_receiver : "null") . ','; |
|
| 596 | + $sql .= ' fk_receiver = ' . (isset($this->fk_receiver) && (int) $this->fk_receiver > 0 ? $this->fk_receiver : "null") . ','; |
|
| 597 | 597 | $sql .= ' justif_kilometers = ' . (isset($this->justif_kilometers) ? "'" . $this->db->escape($this->justif_kilometers) . "'," : "'',"); |
| 598 | 598 | $sql .= ' date_update = ' . "'" . date('Y-m-d H:i:s') . "',"; |
| 599 | 599 | $sql .= ' is_night = ' . ($this->nightFlight ? 1 : 0) . ','; |
@@ -701,9 +701,9 @@ discard block |
||
| 701 | 701 | |
| 702 | 702 | $label = '<u>' . $langs->trans("MyModule") . '</u>'; |
| 703 | 703 | $label .= '<div width="100%">'; |
| 704 | - $label .= '<b>' . $langs->trans('Ref') . ':</b> ' . $this->idBBC_vols . ' - <b>'.$langs->trans('T') . '</b>' . $this->fk_type . '<br>'; |
|
| 704 | + $label .= '<b>' . $langs->trans('Ref') . ':</b> ' . $this->idBBC_vols . ' - <b>' . $langs->trans('T') . '</b>' . $this->fk_type . '<br>'; |
|
| 705 | 705 | $label .= '<b>' . $langs->trans('Date') . ':</b> ' . dol_print_date($this->date, '%d-%m-%Y') . '<br/>'; |
| 706 | - $label .= '<b>' . $langs->trans('De') . ':</b> ' . $this->lieuD . ' - '. '<b>' . $langs->trans('à') . ':</b> ' . $this->lieuA . '<br/>'; |
|
| 706 | + $label .= '<b>' . $langs->trans('De') . ':</b> ' . $this->lieuD . ' - ' . '<b>' . $langs->trans('à') . ':</b> ' . $this->lieuA . '<br/>'; |
|
| 707 | 707 | $label .= '<b>' . $langs->trans('Pilote') . ':</b> ' . $this->getPilot()->getFullName($langs) . '<br/>'; |
| 708 | 708 | $label .= '<b>' . $langs->trans('Organisateur') . ':</b> ' . $this->getOrganisator()->getFullName($langs) . '<br/>'; |
| 709 | 709 | $label .= '</div>'; |
@@ -903,7 +903,7 @@ discard block |
||
| 903 | 903 | */ |
| 904 | 904 | public function getPilotId() |
| 905 | 905 | { |
| 906 | - return (int)$this->fk_pilot; |
|
| 906 | + return (int) $this->fk_pilot; |
|
| 907 | 907 | } |
| 908 | 908 | |
| 909 | 909 | /** |
@@ -911,7 +911,7 @@ discard block |
||
| 911 | 911 | */ |
| 912 | 912 | public function getOrganisatorId() |
| 913 | 913 | { |
| 914 | - return (int)$this->fk_organisateur; |
|
| 914 | + return (int) $this->fk_organisateur; |
|
| 915 | 915 | } |
| 916 | 916 | |
| 917 | 917 | /** |
@@ -948,7 +948,7 @@ discard block |
||
| 948 | 948 | */ |
| 949 | 949 | public function hasPax() |
| 950 | 950 | { |
| 951 | - return (int)$this->nbrPax > 0; |
|
| 951 | + return (int) $this->nbrPax > 0; |
|
| 952 | 952 | } |
| 953 | 953 | |
| 954 | 954 | /** |
@@ -1017,7 +1017,7 @@ discard block |
||
| 1017 | 1017 | */ |
| 1018 | 1018 | public function getKilometers() |
| 1019 | 1019 | { |
| 1020 | - return (int)$this->kilometers; |
|
| 1020 | + return (int) $this->kilometers; |
|
| 1021 | 1021 | } |
| 1022 | 1022 | |
| 1023 | 1023 | /** |
@@ -1060,7 +1060,7 @@ discard block |
||
| 1060 | 1060 | */ |
| 1061 | 1061 | public function getNumberOfPassengers() |
| 1062 | 1062 | { |
| 1063 | - return (int)$this->nbrPax; |
|
| 1063 | + return (int) $this->nbrPax; |
|
| 1064 | 1064 | } |
| 1065 | 1065 | |
| 1066 | 1066 | /** |
@@ -1263,7 +1263,7 @@ discard block |
||
| 1263 | 1263 | */ |
| 1264 | 1264 | public function getBBCBallonsIdBBCBallons() |
| 1265 | 1265 | { |
| 1266 | - return (int)$this->BBC_ballons_idBBC_ballons; |
|
| 1266 | + return (int) $this->BBC_ballons_idBBC_ballons; |
|
| 1267 | 1267 | } |
| 1268 | 1268 | |
| 1269 | 1269 | /** |
@@ -1339,7 +1339,7 @@ discard block |
||
| 1339 | 1339 | */ |
| 1340 | 1340 | public function getFkType() |
| 1341 | 1341 | { |
| 1342 | - return (int)$this->fk_type; |
|
| 1342 | + return (int) $this->fk_type; |
|
| 1343 | 1343 | } |
| 1344 | 1344 | |
| 1345 | 1345 | /** |
@@ -1434,7 +1434,7 @@ discard block |
||
| 1434 | 1434 | */ |
| 1435 | 1435 | public function getFkReceiver() |
| 1436 | 1436 | { |
| 1437 | - return (int)$this->fk_receiver; |
|
| 1437 | + return (int) $this->fk_receiver; |
|
| 1438 | 1438 | } |
| 1439 | 1439 | |
| 1440 | 1440 | /** |