Completed
Push — feature/fixing_cost ( f58af6...414fbf )
by Laurent
01:41
created
Application/Damage/Command/CreateDamageCommand.php 1 patch
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -27,6 +27,9 @@
 block discarded – undo
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;
Please login to merge, or discard this patch.
Infrastructure/Common/Routes/Route.php 3 patches
Doc Comments   -1 removed lines patch added patch discarded remove patch
@@ -61,7 +61,6 @@
 block discarded – undo
61 61
     }
62 62
 
63 63
     /**
64
-     * @param string $action
65 64
      *
66 65
      * @return bool
67 66
      */
Please login to merge, or discard this patch.
Unused Use Statements   -2 removed lines patch added patch discarded remove patch
@@ -4,8 +4,6 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
command/CreatePilotYearBillCommandHandler.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
index.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -53,14 +53,14 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
Application/Damage/Command/CreateDamageCommandHandler.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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))
Please login to merge, or discard this patch.
Application/Damage/ViewModel/Damage.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -59,12 +59,12 @@
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
Http/Web/templates/flight_damage/view.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -14,20 +14,20 @@
 block discarded – undo
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; ?>
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -22,9 +22,12 @@
 block discarded – undo
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>
Please login to merge, or discard this patch.
Http/Web/templates/damage/view.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -53,9 +53,9 @@
 block discarded – undo
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>
Please login to merge, or discard this patch.
Http/Web/Controller/DamageController.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -13,14 +13,14 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@
 block discarded – undo
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
     }
Please login to merge, or discard this patch.