@@ -27,6 +27,9 @@ |
||
27 | 27 | */ |
28 | 28 | private $billId; |
29 | 29 | |
30 | + /** |
|
31 | + * @param integer $authorId |
|
32 | + */ |
|
30 | 33 | public function __construct($authorId) |
31 | 34 | { |
32 | 35 | $this->authorId = $authorId; |
@@ -61,7 +61,6 @@ |
||
61 | 61 | } |
62 | 62 | |
63 | 63 | /** |
64 | - * @param string $action |
|
65 | 64 | * |
66 | 65 | * @return bool |
67 | 66 | */ |
@@ -4,8 +4,6 @@ |
||
4 | 4 | namespace FlightLog\Infrastructure\Common\Routes; |
5 | 5 | |
6 | 6 | |
7 | -use FlightLog\Http\Web\Controller\WebController; |
|
8 | - |
|
9 | 7 | final class Route |
10 | 8 | { |
11 | 9 |
@@ -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 |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | return; |
281 | 281 | } |
282 | 282 | |
283 | - $pointsHt = $command->getAdditionalBonus()/(1+6/100); |
|
283 | + $pointsHt = $command->getAdditionalBonus() / (1 + 6 / 100); |
|
284 | 284 | $desc = sprintf("%s - %s", $command->getYear(), $command->getBonusAdditionalMessage()); |
285 | 285 | |
286 | 286 | $discountid = $this->getCompany($object->socid)->set_remise_except($pointsHt, $this->user, $desc, 6); |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | { |
301 | 301 | $price = $damage->getCost()->addCost($invoicedDamage->getCost())->getValue(); |
302 | 302 | |
303 | - if($price <= 0 ){ |
|
303 | + if ($price <= 0) { |
|
304 | 304 | return; |
305 | 305 | } |
306 | 306 |
@@ -53,14 +53,14 @@ |
||
53 | 53 | |
54 | 54 | $routes = require './Infrastructure/Common/Routes/routes.conf.php'; |
55 | 55 | |
56 | -try{ |
|
56 | +try { |
|
57 | 57 | $routeName = GETPOST('r'); |
58 | 58 | |
59 | 59 | $routeManager = new \FlightLog\Infrastructure\Common\Routes\RouteManager($db); |
60 | 60 | $routeManager->load($routes); |
61 | 61 | |
62 | 62 | $routeManager->__invoke($routeName); |
63 | -}catch (\Exception $e){ |
|
63 | +} catch (\Exception $e) { |
|
64 | 64 | dol_syslog($e->getMessage(), LOG_ERR); |
65 | 65 | echo $e->getMessage(); |
66 | 66 | } |
@@ -60,7 +60,7 @@ |
||
60 | 60 | $routeManager->load($routes); |
61 | 61 | |
62 | 62 | $routeManager->__invoke($routeName); |
63 | -}catch (\Exception $e){ |
|
63 | +} catch (\Exception $e){ |
|
64 | 64 | dol_syslog($e->getMessage(), LOG_ERR); |
65 | 65 | echo $e->getMessage(); |
66 | 66 | } |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | public function __invoke(CreateDamageCommand $command) |
42 | 42 | { |
43 | 43 | $damage = FlightDamage::waiting(new DamageAmount($command->getAmount()), AuthorId::create($command->getAuthorId())); |
44 | - if(null !== $command->getFlightId()){ |
|
44 | + if (null !== $command->getFlightId()) { |
|
45 | 45 | $damage = FlightDamage::damage(FlightId::create($command->getFlightId()), new DamageAmount($command->getAmount()), AuthorId::create($command->getAuthorId())); |
46 | 46 | } |
47 | 47 | |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | */ |
60 | 60 | private function linkSupplierInvoice($damageId, $invoiceId) |
61 | 61 | { |
62 | - if($invoiceId <= 0){ |
|
62 | + if ($invoiceId <= 0) { |
|
63 | 63 | return; |
64 | 64 | } |
65 | 65 | |
@@ -80,8 +80,8 @@ discard block |
||
80 | 80 | * @param int $targetId |
81 | 81 | * @param string $targetType |
82 | 82 | */ |
83 | - private function insertLinks($damageId, $targetId, $targetType){ |
|
84 | - $sql = "INSERT INTO ".MAIN_DB_PREFIX."element_element ("; |
|
83 | + private function insertLinks($damageId, $targetId, $targetType) { |
|
84 | + $sql = "INSERT INTO " . MAIN_DB_PREFIX . "element_element ("; |
|
85 | 85 | $sql .= "fk_source"; |
86 | 86 | $sql .= ", sourcetype"; |
87 | 87 | $sql .= ", fk_target"; |
@@ -89,8 +89,8 @@ discard block |
||
89 | 89 | $sql .= ") VALUES ("; |
90 | 90 | $sql .= $damageId; |
91 | 91 | $sql .= ", 'flightlog_damage'"; |
92 | - $sql .= ", ".$targetId; |
|
93 | - $sql .= ", '".$targetType."'"; |
|
92 | + $sql .= ", " . $targetId; |
|
93 | + $sql .= ", '" . $targetType . "'"; |
|
94 | 94 | $sql .= ")"; |
95 | 95 | |
96 | 96 | if ($this->db->query($sql)) |
@@ -59,12 +59,12 @@ |
||
59 | 59 | * |
60 | 60 | * @return Damage |
61 | 61 | */ |
62 | - public static function fromArray(array $properties){ |
|
62 | + public static function fromArray(array $properties) { |
|
63 | 63 | $author = $properties['author_name']; |
64 | 64 | $amount = $properties['amount']; |
65 | 65 | $id = $properties['id']; |
66 | 66 | $flightId = isset($properties['flight_id']) ? $properties['flight_id'] : null; |
67 | - $invoiced = (bool)$properties['invoiced']; |
|
67 | + $invoiced = (bool) $properties['invoiced']; |
|
68 | 68 | |
69 | 69 | return new self($author, $amount, $id, $invoiced, $flightId); |
70 | 70 | } |
@@ -14,20 +14,20 @@ |
||
14 | 14 | <td>Montant</td> |
15 | 15 | </tr> |
16 | 16 | <?php $total = 0; ?> |
17 | - <?php foreach($damages as $currentDamage):?> |
|
17 | + <?php foreach ($damages as $currentDamage):?> |
|
18 | 18 | <?php $total += $currentDamage->getAmount(); ?> |
19 | 19 | <tr> |
20 | - <td><?php echo $currentDamage->getAuthorName();?></td> |
|
21 | - <td><?php echo $currentDamage->getAmount();?>€</td> |
|
20 | + <td><?php echo $currentDamage->getAuthorName(); ?></td> |
|
21 | + <td><?php echo $currentDamage->getAmount(); ?>€</td> |
|
22 | 22 | <td> |
23 | - <?php if($currentDamage->isInvoiced()): ?> |
|
23 | + <?php if ($currentDamage->isInvoiced()): ?> |
|
24 | 24 | <i class="fas fa-check"></i> |
25 | 25 | <?php else: ?> |
26 | 26 | <i class="fas fa-times"></i> |
27 | 27 | <?php endif; ?> |
28 | 28 | </td> |
29 | 29 | <td> |
30 | - <a href="<?php print sprintf('%s/flightlog/index.php?r=get_one_damage&id=%s', DOL_URL_ROOT, $currentDamage->getId());?>"><i class="fas fa-link"></i></a> |
|
30 | + <a href="<?php print sprintf('%s/flightlog/index.php?r=get_one_damage&id=%s', DOL_URL_ROOT, $currentDamage->getId()); ?>"><i class="fas fa-link"></i></a> |
|
31 | 31 | </td> |
32 | 32 | </tr> |
33 | 33 | <?php endforeach; ?> |
@@ -22,9 +22,12 @@ |
||
22 | 22 | <td> |
23 | 23 | <?php if($currentDamage->isInvoiced()): ?> |
24 | 24 | <i class="fas fa-check"></i> |
25 | - <?php else: ?> |
|
25 | + <?php else { |
|
26 | + : ?> |
|
26 | 27 | <i class="fas fa-times"></i> |
27 | - <?php endif; ?> |
|
28 | + <?php endif; |
|
29 | +} |
|
30 | +?> |
|
28 | 31 | </td> |
29 | 32 | <td> |
30 | 33 | <a href="<?php print sprintf('%s/flightlog/index.php?r=get_one_damage&id=%s', DOL_URL_ROOT, $currentDamage->getId());?>"><i class="fas fa-link"></i></a> |
@@ -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> |
@@ -13,14 +13,14 @@ discard block |
||
13 | 13 | /** |
14 | 14 | * @return GetDamageQueryRepository |
15 | 15 | */ |
16 | - private function getDamageRepository(){ |
|
16 | + private function getDamageRepository() { |
|
17 | 17 | return new GetDamageQueryRepository($this->db); |
18 | 18 | } |
19 | 19 | |
20 | - public function view(){ |
|
20 | + public function view() { |
|
21 | 21 | $damageId = $this->request->getParam('id'); |
22 | 22 | |
23 | - try{ |
|
23 | + try { |
|
24 | 24 | $damage = $this->getDamageRepository()->query($damageId); |
25 | 25 | |
26 | 26 | $flight = new \Bbcvols($this->db); |
@@ -31,17 +31,17 @@ discard block |
||
31 | 31 | 'form' => new Form($this->db), |
32 | 32 | 'flight' => $flight |
33 | 33 | ]); |
34 | - }catch (\Exception $e){ |
|
34 | + } catch (\Exception $e) { |
|
35 | 35 | echo $e->getMessage(); |
36 | 36 | } |
37 | 37 | } |
38 | 38 | |
39 | - public function invoice(){ |
|
39 | + public function invoice() { |
|
40 | 40 | $damageId = $this->request->getParam('id'); |
41 | 41 | |
42 | 42 | |
43 | 43 | |
44 | - $this->redirect($_SERVER["PHP_SELF"].'?id='.$damageId); |
|
44 | + $this->redirect($_SERVER["PHP_SELF"] . '?id=' . $damageId); |
|
45 | 45 | exit; |
46 | 46 | } |
47 | 47 | } |
48 | 48 | \ No newline at end of file |
@@ -31,7 +31,7 @@ |
||
31 | 31 | 'form' => new Form($this->db), |
32 | 32 | 'flight' => $flight |
33 | 33 | ]); |
34 | - }catch (\Exception $e){ |
|
34 | + } catch (\Exception $e){ |
|
35 | 35 | echo $e->getMessage(); |
36 | 36 | } |
37 | 37 | } |