Completed
Push — feature/fixing_cost ( f58af6...414fbf )
by Laurent
01:41
created
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 1 patch
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.
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 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.