Completed
Push — feature/fixing_cost ( f58af6...414fbf )
by Laurent
01:41
created
Http/Web/templates/flight_damage/view.php 1 patch
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.
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 1 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,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.
class/Damage/FlightDamage.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
      *
56 56
      * @return FlightDamage
57 57
      */
58
-    public static function load(FlightId $flightId, DamageAmount $amount, $billed, AuthorId $authorId, DamageId $id = null){
58
+    public static function load(FlightId $flightId, DamageAmount $amount, $billed, AuthorId $authorId, DamageId $id = null) {
59 59
         return new self($amount, $billed, $authorId, $flightId, $id);
60 60
     }
61 61
 
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
      *
67 67
      * @return FlightDamage
68 68
      */
69
-    public static function damage(FlightId $flightId, DamageAmount $amount, AuthorId $authorId){
69
+    public static function damage(FlightId $flightId, DamageAmount $amount, AuthorId $authorId) {
70 70
         return new self($amount, false, $authorId, $flightId);
71 71
     }
72 72
 
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
      *
77 77
      * @return FlightDamage
78 78
      */
79
-    public static function waiting(DamageAmount $amount, AuthorId $authorId){
79
+    public static function waiting(DamageAmount $amount, AuthorId $authorId) {
80 80
         return new self($amount, false, $authorId);
81 81
     }
82 82
 
@@ -91,14 +91,14 @@  discard block
 block discarded – undo
91 91
     /**
92 92
      * @return FlightId
93 93
      */
94
-    public function getFlightId(){
94
+    public function getFlightId() {
95 95
         return $this->flight;
96 96
     }
97 97
 
98 98
     /**
99 99
      * @return DamageAmount
100 100
      */
101
-    public function amount(){
101
+    public function amount() {
102 102
         return $this->amount;
103 103
     }
104 104
 
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
      *
116 116
      * @return FlightDamage
117 117
      */
118
-    public function invoice(){
118
+    public function invoice() {
119 119
         return new self($this->flight, $this->amount, true, $this->author, $this->id);
120 120
     }
121 121
 
Please login to merge, or discard this patch.
card_tab_damage.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 
50 50
 $id = GETPOST('id', 'int') ?: GETPOST('idBBC_vols', 'int');
51 51
 $action = GETPOST('action', 'alpha');
52
-$permissiondellink=$user->rights->flightlog->vol->financial;
52
+$permissiondellink = $user->rights->flightlog->vol->financial;
53 53
 
54 54
 $object = new Bbcvols($db);
55 55
 
@@ -57,8 +57,8 @@  discard block
 block discarded – undo
57 57
 $extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
58 58
 
59 59
 // Load object
60
-include DOL_DOCUMENT_ROOT . '/core/actions_fetchobject.inc.php';  // Must be include, not include_once  // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
61
-include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php';
60
+include DOL_DOCUMENT_ROOT . '/core/actions_fetchobject.inc.php'; // Must be include, not include_once  // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
61
+include DOL_DOCUMENT_ROOT . '/core/actions_dellink.inc.php';
62 62
 
63 63
 // Initialize technical object to manage hooks of modules. Note that conf->hooks_modules contains array array
64 64
 $hookmanager->initHooks(array('bbcvols'));
@@ -85,12 +85,12 @@  discard block
 block discarded – undo
85 85
         FLIGHTLOG_ACTION_HANDLE_ADD_DAMAGE => [AddFlightDamageController::class, 'view'],
86 86
     ];
87 87
 
88
-    if(isset($routes[$action])){
88
+    if (isset($routes[$action])) {
89 89
         $controllerName = $routes[$action][0];
90 90
         $actionName = $routes[$action][1];
91 91
 
92 92
         call_user_func([new $controllerName($db), $actionName]);
93
-    }else{
93
+    } else {
94 94
         echo 'Route non trouvée.';
95 95
     }
96 96
 ?>
@@ -102,13 +102,13 @@  discard block
 block discarded – undo
102 102
 // Buttons
103 103
 print '<div class="tabsAction">' . "\n";
104 104
 
105
-if($user->rights->flightlog->vol->financial){
106
-    print '<div class="inline-block divButAction"><a class="butAction" href="' . DOL_URL_ROOT . '/flightlog/card_tab_damage.php?id=' . $object->id.'&action='.FLIGHTLOG_ACTION_ADD_DAMAGE.'">' . $langs->trans("Ajouter") . '</a></div>' . "\n";
105
+if ($user->rights->flightlog->vol->financial) {
106
+    print '<div class="inline-block divButAction"><a class="butAction" href="' . DOL_URL_ROOT . '/flightlog/card_tab_damage.php?id=' . $object->id . '&action=' . FLIGHTLOG_ACTION_ADD_DAMAGE . '">' . $langs->trans("Ajouter") . '</a></div>' . "\n";
107 107
 }
108 108
 
109 109
 print '</div>' . "\n";
110 110
 
111
-if($user->rights->flightlog->vol->financial){
111
+if ($user->rights->flightlog->vol->financial) {
112 112
     print '<div class="fichecenter"><div class="fichehalfleft">';
113 113
     $form->showLinkedObjectBlock($object);
114 114
     print '</div></div>';
Please login to merge, or discard this patch.
Infrastructure/Damage/Query/Repository/GetDamageQueryRepository.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
         $this->db = $db;
23 23
     }
24 24
 
25
-    private function element($objectType, $rowid){
25
+    private function element($objectType, $rowid) {
26 26
         $element = null;
27 27
         $subelement = null;
28 28
 
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
             $subelement = $regs[2];
34 34
         }
35 35
 
36
-        $classpath = $element.'/class';
36
+        $classpath = $element . '/class';
37 37
 
38 38
         if ($objectType == 'facture') {
39 39
             $classpath = 'compta/facture/class';
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
             $classfile = 'subscription'; $classname = 'Subscription';
86 86
         }
87 87
 
88
-        dol_include_once('/'.$classpath.'/'.$classfile.'.class.php');
88
+        dol_include_once('/' . $classpath . '/' . $classfile . '.class.php');
89 89
         if (!class_exists($classname))
90 90
         {
91 91
             return null;
@@ -104,14 +104,14 @@  discard block
 block discarded – undo
104 104
      *
105 105
      * @throws \Exception
106 106
      */
107
-    public function query($damageId){
107
+    public function query($damageId) {
108 108
 
109 109
         $sql = 'SELECT damage.rowid as id, damage.amount, author.login as author_name, damage.billed as invoiced, damage.flight_id as flight_id';
110
-        $sql.= ', element.rowid as element_id ,element.fk_target as element_fk_target, element.targettype as element_target_type';
111
-        $sql.=' FROM '.MAIN_DB_PREFIX.'bbc_flight_damages as damage';
112
-        $sql.=' INNER JOIN '.MAIN_DB_PREFIX.'user as author ON author.rowid = damage.author_id';
113
-        $sql.=' LEFT JOIN '.MAIN_DB_PREFIX.'element_element as element ON (element.fk_source = damage.rowid AND element.sourcetype = "flightlog_damage")';
114
-        $sql.=' WHERE damage.rowid = '.$damageId;
110
+        $sql .= ', element.rowid as element_id ,element.fk_target as element_fk_target, element.targettype as element_target_type';
111
+        $sql .= ' FROM ' . MAIN_DB_PREFIX . 'bbc_flight_damages as damage';
112
+        $sql .= ' INNER JOIN ' . MAIN_DB_PREFIX . 'user as author ON author.rowid = damage.author_id';
113
+        $sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'element_element as element ON (element.fk_source = damage.rowid AND element.sourcetype = "flightlog_damage")';
114
+        $sql .= ' WHERE damage.rowid = ' . $damageId;
115 115
 
116 116
         $resql = $this->db->query($sql);
117 117
         if (!$resql) {
@@ -125,13 +125,13 @@  discard block
 block discarded – undo
125 125
 
126 126
         /** @var Damage $damage */
127 127
         $damage = null;
128
-        for($i = 0; $i < $num ; $i++) {
128
+        for ($i = 0; $i < $num; $i++) {
129 129
             $properties = $this->db->fetch_array($resql);
130
-            if(!$damage){
130
+            if (!$damage) {
131 131
                 $damage = Damage::fromArray($properties);
132 132
             }
133 133
 
134
-            if(!isset($properties['element_id'])){
134
+            if (!isset($properties['element_id'])) {
135 135
                 continue;
136 136
             }
137 137
 
Please login to merge, or discard this patch.
Infrastructure/Damage/Repository/FlightDamageRepository.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
             'author_id' => $flightDamage->getAuthor()->getId()
36 36
         ];
37 37
 
38
-        if($flightDamage->getId()){
38
+        if ($flightDamage->getId()) {
39 39
             $this->update($flightDamage->getId()->getId(), $fields);
40 40
             return $flightDamage->getId()->getId();
41 41
         }
@@ -50,10 +50,10 @@  discard block
 block discarded – undo
50 50
      *
51 51
      * @throws \Exception
52 52
      */
53
-    public function getById(DamageId $id){
53
+    public function getById(DamageId $id) {
54 54
         $damage = $this->get($id->getId());
55 55
 
56
-        if(null === $damage){
56
+        if (null === $damage) {
57 57
             throw new \Exception('Damage not found');
58 58
         }
59 59
 
Please login to merge, or discard this patch.
Infrastructure/Common/Routes/RouteManager.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -29,8 +29,8 @@  discard block
 block discarded – undo
29 29
      *
30 30
      * @throws \Exception
31 31
      */
32
-    public function add(Route $route){
33
-        if(isset($this->routes[$route->getName()])){
32
+    public function add(Route $route) {
33
+        if (isset($this->routes[$route->getName()])) {
34 34
             throw new \Exception('Route exists');
35 35
         }
36 36
 
@@ -42,8 +42,8 @@  discard block
 block discarded – undo
42 42
      *
43 43
      * @throws \Exception
44 44
      */
45
-    public function load(array $routes){
46
-        foreach($routes as $currentRoute){
45
+    public function load(array $routes) {
46
+        foreach ($routes as $currentRoute) {
47 47
             $this->add($currentRoute);
48 48
         }
49 49
     }
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
      */
56 56
     public function __invoke($name)
57 57
     {
58
-        if(!isset($this->routes[$name])){
58
+        if (!isset($this->routes[$name])) {
59 59
             throw new \Exception('Route not found');
60 60
         }
61 61
 
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.