Completed
Push — feature/damages ( 8f70f7...06d026 )
by Laurent
31s
created
Infrastructure/Damage/Query/Repository/GetPilotDamagesQueryRepository.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -35,16 +35,16 @@
 block discarded – undo
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;
Please login to merge, or discard this patch.
Application/Damage/Command/InvoiceDamageCommandHandler.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@
 block discarded – undo
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);
Please login to merge, or discard this patch.
Http/Web/templates/flight_damage/view.php 2 patches
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.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -16,21 +16,21 @@
 block discarded – undo
16 16
         <td colspan="2">&nbsp;</td>
17 17
     </tr>
18 18
     <?php $total = 0; ?>
19
-    <?php foreach($damages as $currentDamage):?>
19
+    <?php foreach ($damages as $currentDamage):?>
20 20
         <?php $total += $currentDamage->getAmount(); ?>
21 21
         <tr>
22
-            <td><?php echo $currentDamage->getAuthorName();?></td>
23
-            <td><?php echo $currentDamage->getLabel();?></td>
24
-            <td><?php echo $currentDamage->getAmount();?>€</td>
22
+            <td><?php echo $currentDamage->getAuthorName(); ?></td>
23
+            <td><?php echo $currentDamage->getLabel(); ?></td>
24
+            <td><?php echo $currentDamage->getAmount(); ?>€</td>
25 25
             <td>
26
-                <?php if($currentDamage->isInvoiced()): ?>
26
+                <?php if ($currentDamage->isInvoiced()): ?>
27 27
                     <i class="fas fa-check"></i>
28 28
                 <?php else: ?>
29 29
                     <i class="fas fa-times"></i>
30 30
                 <?php endif; ?>
31 31
             </td>
32 32
             <td>
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>
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>
34 34
             </td>
35 35
         </tr>
36 36
     <?php endforeach; ?>
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
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.
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,16 +31,16 @@  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
-        return $this->redirect($_SERVER["PHP_SELF"].'?id='.$damageId);
44
+        return $this->redirect($_SERVER["PHP_SELF"] . '?id=' . $damageId);
45 45
     }
46 46
 }
47 47
\ No newline at end of file
Please login to merge, or discard this patch.
Infrastructure/Common/Routes/Route.php 1 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.
Http/Web/Controller/WebController.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -32,19 +32,19 @@
 block discarded – undo
32 32
      *
33 33
      * @return Response
34 34
      */
35
-    protected function render($template, array $variables = []){
35
+    protected function render($template, array $variables = []) {
36 36
 
37
-        foreach($variables as $variableName => $variableValue){
37
+        foreach ($variables as $variableName => $variableValue) {
38 38
             $GLOBALS[$variableName] = $variableValue;
39 39
         }
40 40
 
41
-        return new Response(__DIR__.'/../templates/'.$template);
41
+        return new Response(__DIR__ . '/../templates/' . $template);
42 42
     }
43 43
 
44 44
     /**
45 45
      * @param string $html
46 46
      */
47
-    protected function renderHtml($html){
47
+    protected function renderHtml($html) {
48 48
         print $html;
49 49
     }
50 50
 
Please login to merge, or discard this patch.
Http/Web/Controller/FlightController.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -6,9 +6,9 @@
 block discarded – undo
6 6
 
7 7
 final class FlightController extends WebController
8 8
 {
9
-    public function view(){
9
+    public function view() {
10 10
         $id = $this->request->getParam('id');
11
-        return $this->redirect(DOL_URL_ROOT.'/flightlog/card.php?id='.$id);
11
+        return $this->redirect(DOL_URL_ROOT . '/flightlog/card.php?id=' . $id);
12 12
     }
13 13
 
14 14
 }
15 15
\ No newline at end of file
Please login to merge, or discard this patch.
Http/Web/Response/Redirect.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@
 block discarded – undo
25 25
      *
26 26
      * @return Redirect
27 27
      */
28
-    public static function create($url){
28
+    public static function create($url) {
29 29
         return new self($url);
30 30
     }
31 31
 
Please login to merge, or discard this patch.