Completed
Push — feature/link_expense_note ( dad966...3db735 )
by Laurent
02:03
created
facture.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -124,12 +124,12 @@
 block discarded – undo
124 124
  * Put here all code to do according to value of "action" parameter
125 125
  */
126 126
 if ($action == EXPENSE_REPORT_GENERATOR_ACTION_GENERATE) {
127
-    try{
128
-        $command = new CreateFlightBillCommand($flight->getId(), $modeReglement, $conditionReglement, $documentModel, $type, $publicNote, $privateNote,$bankAccount, $nbrPax);
127
+    try {
128
+        $command = new CreateFlightBillCommand($flight->getId(), $modeReglement, $conditionReglement, $documentModel, $type, $publicNote, $privateNote, $bankAccount, $nbrPax);
129 129
         $handler->handle($command);
130 130
         Header("Location: card.php?id=" . $flight->getId());
131
-    }catch (\Exception $e){
132
-        dol_syslog($e->getMessage(),LOG_ERR);
131
+    } catch (\Exception $e) {
132
+        dol_syslog($e->getMessage(), LOG_ERR);
133 133
         dol_htmloutput_mesg("Facture non créée", '', 'error');
134 134
     }
135 135
 }
Please login to merge, or discard this patch.
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
         $command = new CreateFlightBillCommand($flight->getId(), $modeReglement, $conditionReglement, $documentModel, $type, $publicNote, $privateNote,$bankAccount, $nbrPax);
129 129
         $handler->handle($command);
130 130
         Header("Location: card.php?id=" . $flight->getId());
131
-    }catch (\Exception $e){
131
+    } catch (\Exception $e){
132 132
         dol_syslog($e->getMessage(),LOG_ERR);
133 133
         dol_htmloutput_mesg("Facture non créée", '', 'error');
134 134
     }
@@ -269,9 +269,12 @@  discard block
 block discarded – undo
269 269
 
270 270
         <?php if (!$flightProduct || !$flight->hasReceiver()) : ?>
271 271
             <a class="butActionRefused" href="#">Générer</a>
272
-        <?php else: ?>
272
+        <?php else {
273
+    : ?>
273 274
             <button class="butAction" type="submit">Générer</button>
274
-        <?php endif; ?>
275
+        <?php endif;
276
+}
277
+?>
275 278
 
276 279
         <a class="butAction" href="<?php echo DOL_URL_ROOT . '/flightlog/card.php?id=' . $flight->id; ?>">Retour au
277 280
             vol</a>
Please login to merge, or discard this patch.
class/missions/FlightMission.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@
 block discarded – undo
64 64
         Assert::string($kilometersComment);
65 65
         Assert::integerish($numberOfKilometers);
66 66
 
67
-        $this->id = (int)$id;
67
+        $this->id = (int) $id;
68 68
         $this->startPoint = $startPoint;
69 69
         $this->endPoint = $endPoint;
70 70
         $this->kilometersComment = $kilometersComment;
Please login to merge, or discard this patch.
class/missions/PilotMissions.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
         Assert::nullOrString($pilotLastname);
47 47
         Assert::nullOrString($pilotFirstname);
48 48
 
49
-        $this->pilotId = (int)$pilotId;
49
+        $this->pilotId = (int) $pilotId;
50 50
         $this->pilotFirstname = $pilotFirstname;
51 51
         $this->pilotLastname = $pilotLastname;
52 52
 
@@ -59,9 +59,9 @@  discard block
 block discarded – undo
59 59
      * @param int $numberOfFlights
60 60
      * @param int $numberOfKilometers
61 61
      */
62
-    public function addQuarter($quarter, $numberOfFlights, $numberOfKilometers){
62
+    public function addQuarter($quarter, $numberOfFlights, $numberOfKilometers) {
63 63
         Assert::integerish($quarter);
64
-        $quarter = (int)$quarter;
64
+        $quarter = (int) $quarter;
65 65
 
66 66
         Assert::keyNotExists($this->quarterMissions, $quarter);
67 67
 
@@ -119,13 +119,13 @@  discard block
 block discarded – undo
119 119
      *
120 120
      * @return QuarterMission
121 121
      */
122
-    private function getQuarterMission($quarter){
122
+    private function getQuarterMission($quarter) {
123 123
         Assert::integer($quarter);
124 124
         Assert::greaterThan($quarter, 0);
125 125
         Assert::lessThanEq($quarter, 4);
126 126
 
127
-        if(!isset($this->quarterMissions[$quarter])){
128
-            return new QuarterMission($quarter,0,0);
127
+        if (!isset($this->quarterMissions[$quarter])) {
128
+            return new QuarterMission($quarter, 0, 0);
129 129
         }
130 130
 
131 131
         return $this->quarterMissions[$quarter];
@@ -136,6 +136,6 @@  discard block
 block discarded – undo
136 136
      */
137 137
     public function getPilotName()
138 138
     {
139
-        return $this->pilotFirstname.' '.$this->pilotLastname;
139
+        return $this->pilotFirstname . ' ' . $this->pilotLastname;
140 140
     }
141 141
 }
142 142
\ No newline at end of file
Please login to merge, or discard this patch.
query/FlightForQuarterAndPilotQueryHandler.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@
 block discarded – undo
46 46
                 while ($i < $num) {
47 47
                     $flight = $this->db->fetch_object($resql);
48 48
                     if ($flight) {
49
-                        $flights[] = new FlightMission($flight->rowid, $flight->lieuD,$flight->lieuA, $flight->justif_kilometers, $flight->kilometers, new \DateTime($flight->date));
49
+                        $flights[] = new FlightMission($flight->rowid, $flight->lieuD, $flight->lieuA, $flight->justif_kilometers, $flight->kilometers, new \DateTime($flight->date));
50 50
                     }
51 51
                     $i++;
52 52
                 }
Please login to merge, or discard this patch.
query/GetPilotsWithMissionsQuery.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -33,14 +33,14 @@
 block discarded – undo
33 33
         Assert::greaterThan($year, 0);
34 34
 
35 35
         Assert::nullOrIntegerish($quarter);
36
-        if($quarter !== null){
36
+        if ($quarter !== null) {
37 37
             Assert::greaterThan($quarter, 0);
38 38
             Assert::lessThanEq($quarter, 4);
39 39
 
40 40
         }
41 41
 
42
-        $this->quarter = (int)$quarter;
43
-        $this->year = (int)$year;
42
+        $this->quarter = (int) $quarter;
43
+        $this->year = (int) $year;
44 44
     }
45 45
 
46 46
     /**
Please login to merge, or discard this patch.
query/FlightForQuarterAndPilotQuery.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -39,9 +39,9 @@
 block discarded – undo
39 39
         Assert::integerish($quarter);
40 40
         Assert::integerish($year);
41 41
 
42
-        $this->pilotId = (int)$pilotId;
43
-        $this->quarter = (int)$quarter;
44
-        $this->year = (int)$year;
42
+        $this->pilotId = (int) $pilotId;
43
+        $this->quarter = (int) $quarter;
44
+        $this->year = (int) $year;
45 45
     }
46 46
 
47 47
     /**
Please login to merge, or discard this patch.
generateExpenseNote.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -87,9 +87,9 @@  discard block
 block discarded – undo
87 87
     try {
88 88
         $command = new CreateExpenseNoteCommand($year, $quarter, $userValidatorId, $privateNote, $publicNote);
89 89
         $commandHandler->__invoke($command);
90
-    } catch(PeriodNotFinishedException $e){
90
+    } catch (PeriodNotFinishedException $e) {
91 91
         dol_htmloutput_errors("Le quadri n'est pas encore fini !");
92
-    } catch(\Exception $e){
92
+    } catch (\Exception $e) {
93 93
         dol_syslog($e->getMessage(), LOG_ERR);
94 94
         dol_htmloutput_errors('Error : ' . $e->getMessage());
95 95
     }
@@ -105,15 +105,15 @@  discard block
 block discarded – undo
105 105
 $form = new Form($db);
106 106
 
107 107
 $tabLinks = [];
108
-foreach($flightYears as $currentFlightYear){
108
+foreach ($flightYears as $currentFlightYear) {
109 109
     $tabLinks[] = [
110
-        DOL_URL_ROOT."/flightlog/generateExpenseNote.php?year=".$currentFlightYear,
110
+        DOL_URL_ROOT . "/flightlog/generateExpenseNote.php?year=" . $currentFlightYear,
111 111
         $currentFlightYear,
112
-        "tab_".$currentFlightYear
112
+        "tab_" . $currentFlightYear
113 113
     ];
114 114
 }
115 115
 
116
-dol_fiche_head($tabLinks, "tab_".$year);
116
+dol_fiche_head($tabLinks, "tab_" . $year);
117 117
 
118 118
 ?>
119 119
     <form method="POST">
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
         <select name="quarter" id="field_quarter">
135 135
             <option value="1" <?= ($year == $currentYear && $currentQuarter <= 1) ? 'disabled="disabled"' : "" ?>>1</option>
136 136
             <option value="2" <?= ($year == $currentYear && $currentQuarter <= 2) ? 'disabled="disabled"' : "" ?>>2</option>
137
-            <option value="3" <?= ($year == $currentYear && $currentQuarter <= 3) ? 'disabled="disabled"': "" ?>>3</option>
137
+            <option value="3" <?= ($year == $currentYear && $currentQuarter <= 3) ? 'disabled="disabled"' : "" ?>>3</option>
138 138
             <option value="4" <?= ($year == $currentYear && $currentQuarter <= 4) ? 'disabled="disabled"' : "" ?>>4</option>
139 139
         </select>
140 140
         <br/>
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
         <label><?= $langs->trans("Validateur de la note de frais")?></label><br/>
144 144
         <?php
145 145
             $include_users = $object->fetch_users_approver_expensereport();
146
-            print $form->select_dolusers($user->id,"fk_user_validator",1,"",0,$include_users);
146
+            print $form->select_dolusers($user->id, "fk_user_validator", 1, "", 0, $include_users);
147 147
         ?>
148 148
         <br/>
149 149
 
Please login to merge, or discard this patch.
readFlights.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
 print '<td>' . $totalT3 . '</td>';
267 267
 print '<td></td>';
268 268
 
269
-print '<td>' . $totalT4. '</td>';
269
+print '<td>' . $totalT4 . '</td>';
270 270
 print '<td></td>';
271 271
 
272 272
 print '<td>' . $totalT5 . '</td>';
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
 //table km
293 293
 $tauxRemb = isset($conf->global->BBC_FLIGHT_LOG_TAUX_REMB_KM) ? $conf->global->BBC_FLIGHT_LOG_TAUX_REMB_KM : 0;
294 294
 $year = GETPOST("year", 'int');
295
-if(empty($year)){
295
+if (empty($year)) {
296 296
     $year = date('Y');
297 297
 }
298 298
 
Please login to merge, or discard this patch.
command/CreateExpenseNoteCommandHandler.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
         $missions = $this->getMissionsQueryHandler->__invoke(new GetPilotsWithMissionsQuery($command->getYear(),
96 96
             $command->getQuartile()));
97 97
 
98
-        if(!$missions->hasMission()){
98
+        if (!$missions->hasMission()) {
99 99
             throw new NoMissionException();
100 100
         }
101 101
 
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
                 $isFlightInError = $this->addFlight($currentFlightForQuarter, $expenseNote) || $isFlightInError;
118 118
             }
119 119
 
120
-            if(!$isFlightInError){
120
+            if (!$isFlightInError) {
121 121
                 $expenseNote->fetch($expenseNoteId);
122 122
                 $expenseNote->setValidate($this->user);
123 123
                 $expenseNote->setApproved($this->user);
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
                 $expenseNote->setDocModel($this->user, "standard");
127 127
                 $error = $expenseNote->generateDocument($expenseNote->modelpdf, $this->langs) <= 0;
128 128
 
129
-                if(!$error){
129
+                if (!$error) {
130 130
                     dol_htmloutput_mesg(sprintf("Notes de frais crée pour %s", $currentMission->getPilotName()));
131 131
                     continue;
132 132
                 }
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
 
201 201
         $isError = $object_ligne->insert() <= 0;
202 202
 
203
-        if(!$isError){
203
+        if (!$isError) {
204 204
             $expenseReport->add_object_linked(self::FLIGHT_ELEMENT, $currentFlightForQuarter->getId());
205 205
         }
206 206
 
Please login to merge, or discard this patch.