@@ -57,7 +57,7 @@ |
||
57 | 57 | */ |
58 | 58 | public function __construct($id, $startPoint, $endPoint, $kilometersComment, $numberOfKilometers, DateTime $date) |
59 | 59 | { |
60 | - $this->id = (int)$id; |
|
60 | + $this->id = (int) $id; |
|
61 | 61 | $this->startPoint = $startPoint; |
62 | 62 | $this->endPoint = $endPoint; |
63 | 63 | $this->kilometersComment = $kilometersComment; |
@@ -13,12 +13,12 @@ discard block |
||
13 | 13 | * |
14 | 14 | * @return mixed |
15 | 15 | */ |
16 | - public function getParam($name, $defaultValue = null){ |
|
17 | - if($_POST[$name]){ |
|
16 | + public function getParam($name, $defaultValue = null) { |
|
17 | + if ($_POST[$name]) { |
|
18 | 18 | return $_POST[$name]; |
19 | 19 | } |
20 | 20 | |
21 | - if($_GET[$name]){ |
|
21 | + if ($_GET[$name]) { |
|
22 | 22 | return $_GET[$name]; |
23 | 23 | } |
24 | 24 | |
@@ -28,14 +28,14 @@ discard block |
||
28 | 28 | /** |
29 | 29 | * @return bool |
30 | 30 | */ |
31 | - public function isPost(){ |
|
31 | + public function isPost() { |
|
32 | 32 | return strtoupper($_SERVER['REQUEST_METHOD']) === 'POST'; |
33 | 33 | } |
34 | 34 | |
35 | 35 | /** |
36 | 36 | * @return array |
37 | 37 | */ |
38 | - public function getPostParameters(){ |
|
38 | + public function getPostParameters() { |
|
39 | 39 | return $_POST; |
40 | 40 | } |
41 | 41 | } |
42 | 42 | \ No newline at end of file |
@@ -36,9 +36,9 @@ |
||
36 | 36 | } |
37 | 37 | |
38 | 38 | $sql = 'SELECT f.rowid, f.ref as ref_supplier, f.total_ttc, society.nom'; |
39 | - $sql.= ' FROM '.MAIN_DB_PREFIX.'facture_fourn as f'; |
|
40 | - $sql.= ' INNER JOIN '.MAIN_DB_PREFIX.'societe as society ON society.rowid = f.fk_soc'; |
|
41 | - $sql.= ' ORDER BY f.datec DESC'; |
|
39 | + $sql .= ' FROM ' . MAIN_DB_PREFIX . 'facture_fourn as f'; |
|
40 | + $sql .= ' INNER JOIN ' . MAIN_DB_PREFIX . 'societe as society ON society.rowid = f.fk_soc'; |
|
41 | + $sql .= ' ORDER BY f.datec DESC'; |
|
42 | 42 | |
43 | 43 | $resql = $this->db->query($sql); |
44 | 44 | if ($resql) { |
@@ -53,7 +53,7 @@ |
||
53 | 53 | * @return array |
54 | 54 | */ |
55 | 55 | public function toArray() { |
56 | - return array_map(function(Tab $tab){ |
|
56 | + return array_map(function(Tab $tab) { |
|
57 | 57 | return $tab->toArray(); |
58 | 58 | }, $this->tabs); |
59 | 59 | } |
@@ -35,16 +35,16 @@ |
||
35 | 35 | public function query($year) |
36 | 36 | { |
37 | 37 | $sql = 'SELECT damage.amount as amount, damage.billed as billed, damage.author_id as author, author.firstname as author_name'; |
38 | - $sql.=' FROM '.MAIN_DB_PREFIX.'bbc_flight_damages as damage'; |
|
39 | - $sql.=' INNER JOIN '.MAIN_DB_PREFIX.'bbc_vols as flight ON flight.rowid = damage.flight_id'; |
|
40 | - $sql.=' INNER JOIN '.MAIN_DB_PREFIX.'user as author ON author.rowid = damage.author_id'; |
|
41 | - $sql.=' WHERE YEAR(flight.date) = '.$this->db->escape($year); |
|
38 | + $sql .= ' FROM ' . MAIN_DB_PREFIX . 'bbc_flight_damages as damage'; |
|
39 | + $sql .= ' INNER JOIN ' . MAIN_DB_PREFIX . 'bbc_vols as flight ON flight.rowid = damage.flight_id'; |
|
40 | + $sql .= ' INNER JOIN ' . MAIN_DB_PREFIX . 'user as author ON author.rowid = damage.author_id'; |
|
41 | + $sql .= ' WHERE YEAR(flight.date) = ' . $this->db->escape($year); |
|
42 | 42 | |
43 | 43 | $resql = $this->db->query($sql); |
44 | 44 | if ($resql) { |
45 | 45 | $num = $this->db->num_rows($resql); |
46 | 46 | if ($num) { |
47 | - for($i = 0; $i < $num ; $i++) { |
|
47 | + for ($i = 0; $i < $num; $i++) { |
|
48 | 48 | $properties = $this->db->fetch_array($resql); |
49 | 49 | $damage = TotalDamage::fromArray($properties); |
50 | 50 | yield $damage; |
@@ -28,7 +28,7 @@ |
||
28 | 28 | * |
29 | 29 | * @throws \Exception |
30 | 30 | */ |
31 | - public function __invoke(InvoiceDamageCommand $command){ |
|
31 | + public function __invoke(InvoiceDamageCommand $command) { |
|
32 | 32 | $damage = $this->damageRepository->getById(DamageId::create($command->getDamageId())); |
33 | 33 | $damage = $damage->invoice(); |
34 | 34 | $this->damageRepository->save($damage); |
@@ -53,9 +53,9 @@ |
||
53 | 53 | ?> |
54 | 54 | |
55 | 55 | <table class="border centpercent"> |
56 | - <tr><td class="fieldrequired">Auteur</td><td><?php echo $damage->getAuthorName();?></td></tr> |
|
57 | - <tr><td class="fieldrequired">Montant</td><td><?php echo $damage->getAmount();?>€</td></tr> |
|
58 | - <tr><td class="fieldrequired">Facturé</td><td><?php echo $damage->isInvoiced()? 'Oui' : 'Non';?></td></tr> |
|
56 | + <tr><td class="fieldrequired">Auteur</td><td><?php echo $damage->getAuthorName(); ?></td></tr> |
|
57 | + <tr><td class="fieldrequired">Montant</td><td><?php echo $damage->getAmount(); ?>€</td></tr> |
|
58 | + <tr><td class="fieldrequired">Facturé</td><td><?php echo $damage->isInvoiced() ? 'Oui' : 'Non'; ?></td></tr> |
|
59 | 59 | <tr> |
60 | 60 | <td class="fieldrequired">Vol</td> |
61 | 61 | <td> |
@@ -65,7 +65,7 @@ |
||
65 | 65 | * |
66 | 66 | * @return bool |
67 | 67 | */ |
68 | - public function match($route){ |
|
68 | + public function match($route) { |
|
69 | 69 | return $this->name === $route; |
70 | 70 | } |
71 | 71 |
@@ -19,16 +19,16 @@ discard block |
||
19 | 19 | /** |
20 | 20 | * Display the form. |
21 | 21 | */ |
22 | - public function view(){ |
|
22 | + public function view() { |
|
23 | 23 | $id = $this->request->getParam('id'); |
24 | 24 | |
25 | - if($id === null){ |
|
25 | + if ($id === null) { |
|
26 | 26 | print '<p>Paramètre non fournis.</p>'; |
27 | 27 | return; |
28 | 28 | } |
29 | 29 | |
30 | 30 | $flight = new \Bbcvols($this->db); |
31 | - if($flight->fetch($id) <= 0){ |
|
31 | + if ($flight->fetch($id) <= 0) { |
|
32 | 32 | print '<p>Vol non trouvé</p>'; |
33 | 33 | return; |
34 | 34 | } |
@@ -39,24 +39,24 @@ discard block |
||
39 | 39 | $form = new DamageCreationForm('damage_creation', $this->db); |
40 | 40 | $form->bind($command); |
41 | 41 | |
42 | - if($this->request->isPost()){ |
|
42 | + if ($this->request->isPost()) { |
|
43 | 43 | $form->setData($this->request->getPostParameters()); |
44 | 44 | |
45 | - if(!$form->validate()){ |
|
45 | + if (!$form->validate()) { |
|
46 | 46 | return $this->render('flight_damage/form.php', [ |
47 | 47 | 'form' => $form, |
48 | 48 | ]); |
49 | 49 | } |
50 | 50 | |
51 | - try{ |
|
51 | + try { |
|
52 | 52 | $this->handle($form->getObject()); |
53 | - }catch(\Exception $e){ |
|
53 | + } catch (\Exception $e) { |
|
54 | 54 | print $e->getMessage(); |
55 | 55 | dol_syslog($e->getMessage(), LOG_ERR); |
56 | 56 | } |
57 | 57 | |
58 | 58 | |
59 | - return $this->redirect($_SERVER["PHP_SELF"].'?id='.$id); |
|
59 | + return $this->redirect($_SERVER["PHP_SELF"] . '?id=' . $id); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | return $this->render('flight_damage/form.php', [ |
@@ -77,14 +77,14 @@ discard block |
||
77 | 77 | /** |
78 | 78 | * @return CreateDamageCommandHandler |
79 | 79 | */ |
80 | - private function getHandler(){ |
|
80 | + private function getHandler() { |
|
81 | 81 | return new CreateDamageCommandHandler($this->db, $this->getDamageRepository()); |
82 | 82 | } |
83 | 83 | |
84 | 84 | /** |
85 | 85 | * @return FlightDamageRepository |
86 | 86 | */ |
87 | - private function getDamageRepository(){ |
|
87 | + private function getDamageRepository() { |
|
88 | 88 | return new FlightDamageRepository($this->db); |
89 | 89 | } |
90 | 90 |