@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | */ |
150 | 150 | private function checkPassengersInformation($vol) |
151 | 151 | { |
152 | - if (!is_numeric($vol->nbrPax) || (int)$vol->nbrPax < 0) { |
|
152 | + if (!is_numeric($vol->nbrPax) || (int) $vol->nbrPax < 0) { |
|
153 | 153 | $this->addError('nbrPax', 'Erreur le nombre de passager est un nombre négatif.'); |
154 | 154 | } |
155 | 155 | |
@@ -241,10 +241,10 @@ discard block |
||
241 | 241 | $this->addError('order_id', 'Le nombre de passager par commande doit être >= 0.'); |
242 | 242 | } |
243 | 243 | |
244 | - $totalPassenegrs += (int)$nbrPassengers; |
|
244 | + $totalPassenegrs += (int) $nbrPassengers; |
|
245 | 245 | } |
246 | 246 | |
247 | - if ($totalPassenegrs !== (int)$vol->getNumberOfPassengers()) { |
|
247 | + if ($totalPassenegrs !== (int) $vol->getNumberOfPassengers()) { |
|
248 | 248 | $this->addError('nbrPax', 'Le nombre de passagers ne correspond pas au nombre entré sur les commandes'); |
249 | 249 | } |
250 | 250 | |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | */ |
259 | 259 | private function checkFlightDate(Bbcvols $flight) |
260 | 260 | { |
261 | - if($flight->getDate() > new DateTimeImmutable()){ |
|
261 | + if ($flight->getDate() > new DateTimeImmutable()) { |
|
262 | 262 | $this->addError('date', 'La date est plus grande que la date d\'aujourd\'hui'); |
263 | 263 | } |
264 | 264 |
@@ -123,11 +123,11 @@ |
||
123 | 123 | * Put here all code to do according to value of "action" parameter |
124 | 124 | */ |
125 | 125 | if ($action == EXPENSE_REPORT_GENERATOR_ACTION_GENERATE) { |
126 | - try{ |
|
127 | - $command = new CreateFlightBillCommand($flight->getId(), $modeReglement, $conditionReglement, $documentModel, $type, $publicNote, $privateNote,$bankAccount, $nbrPax, $customerId); |
|
126 | + try { |
|
127 | + $command = new CreateFlightBillCommand($flight->getId(), $modeReglement, $conditionReglement, $documentModel, $type, $publicNote, $privateNote, $bankAccount, $nbrPax, $customerId); |
|
128 | 128 | $handler->handle($command); |
129 | - }catch (\Exception $e){ |
|
130 | - dol_syslog($e->getMessage(),LOG_ERR); |
|
129 | + } catch (\Exception $e) { |
|
130 | + dol_syslog($e->getMessage(), LOG_ERR); |
|
131 | 131 | dol_htmloutput_mesg("Facture non créée", '', 'error'); |
132 | 132 | } |
133 | 133 | } |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | try{ |
127 | 127 | $command = new CreateFlightBillCommand($flight->getId(), $modeReglement, $conditionReglement, $documentModel, $type, $publicNote, $privateNote,$bankAccount, $nbrPax, $customerId); |
128 | 128 | $handler->handle($command); |
129 | - }catch (\Exception $e){ |
|
129 | + } catch (\Exception $e){ |
|
130 | 130 | dol_syslog($e->getMessage(),LOG_ERR); |
131 | 131 | dol_htmloutput_mesg("Facture non créée", '', 'error'); |
132 | 132 | } |
@@ -311,9 +311,12 @@ discard block |
||
311 | 311 | |
312 | 312 | <?php if (!$flightProduct || !$flight->hasReceiver()) : ?> |
313 | 313 | <a class="butActionRefused" href="#">Générer</a> |
314 | - <?php else: ?> |
|
314 | + <?php else { |
|
315 | + : ?> |
|
315 | 316 | <button class="butAction" type="submit">Générer</button> |
316 | - <?php endif; ?> |
|
317 | + <?php endif; |
|
318 | +} |
|
319 | +?> |
|
317 | 320 | |
318 | 321 | <a class="butAction" href="<?php echo DOL_URL_ROOT . '/flightlog/card.php?id=' . $flight->id; ?>">Retour au |
319 | 322 | vol</a> |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | $sql .= ' ' . (!isset($this->justif_kilometers) ? 'NULL' : "'" . $this->db->escape($this->justif_kilometers) . "'") . ','; |
260 | 260 | $sql .= ' ' . "'" . date('Y-m-d H:i:s') . "'" . ','; |
261 | 261 | $sql .= ' ' . "'" . date('Y-m-d H:i:s') . "'" . ','; |
262 | - $sql .= ' ' . "'" . $this->passengerNames . "'" ; |
|
262 | + $sql .= ' ' . "'" . $this->passengerNames . "'"; |
|
263 | 263 | $sql .= ')'; |
264 | 264 | |
265 | 265 | $this->db->begin(); |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | |
274 | 274 | if (!$error) { |
275 | 275 | $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . $this->table_element); |
276 | - if(!$this->insertOrders()){ |
|
276 | + if (!$this->insertOrders()) { |
|
277 | 277 | $error++; |
278 | 278 | } |
279 | 279 | |
@@ -299,9 +299,9 @@ discard block |
||
299 | 299 | /** |
300 | 300 | * Inserts the order linked to the flight |
301 | 301 | */ |
302 | - private function insertOrders(){ |
|
302 | + private function insertOrders() { |
|
303 | 303 | |
304 | - if(empty($this->orderIds)){ |
|
304 | + if (empty($this->orderIds)) { |
|
305 | 305 | return true; |
306 | 306 | } |
307 | 307 | |
@@ -316,12 +316,12 @@ discard block |
||
316 | 316 | |
317 | 317 | $values = []; |
318 | 318 | |
319 | - foreach($this->orderIds as $orderId=>$nbrPassengers){ |
|
319 | + foreach ($this->orderIds as $orderId=>$nbrPassengers) { |
|
320 | 320 | $values[] = sprintf( |
321 | 321 | $valueTemplate, |
322 | 322 | $orderId, |
323 | 323 | $this->db->escape($this->id), |
324 | - (!isset($nbrPassengers) ? '0' : $this->db->escape($nbrPassengers)) |
|
324 | + (!isset($nbrPassengers) ? '0' : $this->db->escape($nbrPassengers)) |
|
325 | 325 | ); |
326 | 326 | } |
327 | 327 | |
@@ -339,9 +339,9 @@ discard block |
||
339 | 339 | /** |
340 | 340 | * Inserts the order linked to the flight |
341 | 341 | */ |
342 | - private function updateOrders(){ |
|
342 | + private function updateOrders() { |
|
343 | 343 | |
344 | - if(empty($this->orderIds)){ |
|
344 | + if (empty($this->orderIds)) { |
|
345 | 345 | return true; |
346 | 346 | } |
347 | 347 | |
@@ -352,9 +352,9 @@ discard block |
||
352 | 352 | /** |
353 | 353 | * Inserts the order linked to the flight |
354 | 354 | */ |
355 | - private function deleteOrders(){ |
|
355 | + private function deleteOrders() { |
|
356 | 356 | |
357 | - if(empty($this->orderIds)){ |
|
357 | + if (empty($this->orderIds)) { |
|
358 | 358 | return true; |
359 | 359 | } |
360 | 360 | |
@@ -559,7 +559,7 @@ discard block |
||
559 | 559 | $sql .= ' fk_receiver = ' . (isset($this->fk_receiver) && (int) $this->fk_receiver > 0 ? $this->fk_receiver : "null") . ','; |
560 | 560 | $sql .= ' justif_kilometers = ' . (isset($this->justif_kilometers) ? "'" . $this->db->escape($this->justif_kilometers) . "'," : "'',"); |
561 | 561 | $sql .= ' date_update = ' . "'" . date('Y-m-d H:i:s') . "',"; |
562 | - $sql .= ' passenger_names = ' . "'" . trim($this->passengerNames)."'"; |
|
562 | + $sql .= ' passenger_names = ' . "'" . trim($this->passengerNames) . "'"; |
|
563 | 563 | |
564 | 564 | $sql .= ' WHERE idBBC_vols=' . $this->idBBC_vols; |
565 | 565 | |
@@ -1022,8 +1022,8 @@ discard block |
||
1022 | 1022 | * @param int $orderId |
1023 | 1023 | * @param int $nbrPassengers |
1024 | 1024 | */ |
1025 | - public function addOrderId($orderId, $nbrPassengers){ |
|
1026 | - if(!isset($this->orderIds)){ |
|
1025 | + public function addOrderId($orderId, $nbrPassengers) { |
|
1026 | + if (!isset($this->orderIds)) { |
|
1027 | 1027 | $this->orderIds = []; |
1028 | 1028 | } |
1029 | 1029 | |
@@ -1063,7 +1063,7 @@ discard block |
||
1063 | 1063 | if ($resql) { |
1064 | 1064 | $numrows = $this->db->num_rows($resql); |
1065 | 1065 | if ($numrows) { |
1066 | - for($i = 0 ; $i < $numrows ; $i++){ |
|
1066 | + for ($i = 0; $i < $numrows; $i++) { |
|
1067 | 1067 | $obj = $this->db->fetch_object($resql); |
1068 | 1068 | $this->orderIds[$obj->order_id] = $obj->nbr_passengers; |
1069 | 1069 | |
@@ -1084,7 +1084,7 @@ discard block |
||
1084 | 1084 | */ |
1085 | 1085 | public function getOrders() |
1086 | 1086 | { |
1087 | - if(!isset($this->orders) || empty($this->orders)){ |
|
1087 | + if (!isset($this->orders) || empty($this->orders)) { |
|
1088 | 1088 | $this->fetchOrder(); |
1089 | 1089 | } |
1090 | 1090 | return $this->orders; |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | $numberOfKilometers |
42 | 42 | ) |
43 | 43 | { |
44 | - $pilotId = (int)$pilotId; |
|
44 | + $pilotId = (int) $pilotId; |
|
45 | 45 | |
46 | 46 | if (!isset($this->items[$pilotId])) { |
47 | 47 | $this->items[$pilotId] = new PilotMissions($pilotId, $pilotFirstname, $pilotLastname); |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | */ |
58 | 58 | public function addPilot($pilotId, $pilotFirstname, $pilotLastname) |
59 | 59 | { |
60 | - $pilotId = (int)$pilotId; |
|
60 | + $pilotId = (int) $pilotId; |
|
61 | 61 | |
62 | 62 | if (isset($this->items[$pilotId])) { |
63 | 63 | return; |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | */ |
39 | 39 | public function __construct($pilotId, $pilotFirstname, $pilotLastname) |
40 | 40 | { |
41 | - $this->pilotId = (int)$pilotId; |
|
41 | + $this->pilotId = (int) $pilotId; |
|
42 | 42 | $this->pilotFirstname = $pilotFirstname; |
43 | 43 | $this->pilotLastname = $pilotLastname; |
44 | 44 | |
@@ -51,8 +51,8 @@ discard block |
||
51 | 51 | * @param int $numberOfFlights |
52 | 52 | * @param int $numberOfKilometers |
53 | 53 | */ |
54 | - public function addQuarter($quarter, $numberOfFlights, $numberOfKilometers){ |
|
55 | - $quarter = (int)$quarter; |
|
54 | + public function addQuarter($quarter, $numberOfFlights, $numberOfKilometers) { |
|
55 | + $quarter = (int) $quarter; |
|
56 | 56 | $this->quarterMissions[$quarter] = new QuarterMission($quarter, $numberOfFlights, $numberOfKilometers); |
57 | 57 | } |
58 | 58 | |
@@ -107,9 +107,9 @@ discard block |
||
107 | 107 | * |
108 | 108 | * @return QuarterMission |
109 | 109 | */ |
110 | - private function getQuarterMission($quarter){ |
|
111 | - if(!isset($this->quarterMissions[$quarter])){ |
|
112 | - return new QuarterMission($quarter,0,0); |
|
110 | + private function getQuarterMission($quarter) { |
|
111 | + if (!isset($this->quarterMissions[$quarter])) { |
|
112 | + return new QuarterMission($quarter, 0, 0); |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | return $this->quarterMissions[$quarter]; |
@@ -120,6 +120,6 @@ discard block |
||
120 | 120 | */ |
121 | 121 | public function getPilotName() |
122 | 122 | { |
123 | - return $this->pilotFirstname.' '.$this->pilotLastname; |
|
123 | + return $this->pilotFirstname . ' ' . $this->pilotLastname; |
|
124 | 124 | } |
125 | 125 | } |
126 | 126 | \ No newline at end of file |
@@ -57,7 +57,7 @@ |
||
57 | 57 | */ |
58 | 58 | public function __construct($id, $startPoint, $endPoint, $kilometersComment, $numberOfKilometers, DateTime $date) |
59 | 59 | { |
60 | - $this->id = (int)$id; |
|
60 | + $this->id = (int) $id; |
|
61 | 61 | $this->startPoint = $startPoint; |
62 | 62 | $this->endPoint = $endPoint; |
63 | 63 | $this->kilometersComment = $kilometersComment; |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | * |
27 | 27 | * @throws RestException |
28 | 28 | */ |
29 | - public function index(){ |
|
29 | + public function index() { |
|
30 | 30 | $obj_ret = array(); |
31 | 31 | |
32 | 32 | $sql = "SELECT "; |
@@ -52,9 +52,9 @@ discard block |
||
52 | 52 | $sql .= 'date_update,'; |
53 | 53 | $sql .= 'passenger_names'; |
54 | 54 | |
55 | - $sql.= " FROM ".MAIN_DB_PREFIX."bbc_vols"; |
|
55 | + $sql .= " FROM " . MAIN_DB_PREFIX . "bbc_vols"; |
|
56 | 56 | |
57 | - $sql.= ' WHERE 1=1 LIMIT 10'; |
|
57 | + $sql .= ' WHERE 1=1 LIMIT 10'; |
|
58 | 58 | |
59 | 59 | // Add sql filters |
60 | 60 | |
@@ -64,29 +64,29 @@ discard block |
||
64 | 64 | { |
65 | 65 | $num = $this->connection->num_rows($result); |
66 | 66 | $min = min($num, (-1 <= 0 ? $num : -1)); |
67 | - $i=0; |
|
67 | + $i = 0; |
|
68 | 68 | while ($i < $min) |
69 | 69 | { |
70 | 70 | $obj = $this->connection->fetch_object($result); |
71 | 71 | |
72 | 72 | $flight = new Flight(); |
73 | - $flight->rowid = (int)$obj->rowid; |
|
73 | + $flight->rowid = (int) $obj->rowid; |
|
74 | 74 | $flight->date = $obj->date; |
75 | 75 | $flight->lieuD = $obj->lieuD; |
76 | 76 | $flight->lieuA = $obj->lieuA; |
77 | 77 | $flight->heureD = $obj->heureD; |
78 | 78 | $flight->heureA = $obj->heureA; |
79 | - $flight->balloon = (int)$obj->BBC_ballons_idBBC_ballons; |
|
80 | - $flight->nbrPax = (int)$obj->nbrPax; |
|
79 | + $flight->balloon = (int) $obj->BBC_ballons_idBBC_ballons; |
|
80 | + $flight->nbrPax = (int) $obj->nbrPax; |
|
81 | 81 | $flight->remarque = $obj->remarque; |
82 | 82 | $flight->incidents = $obj->incidents; |
83 | - $flight->type = (int)$obj->fk_type; |
|
84 | - $flight->pilot = (int)$obj->fk_pilot; |
|
85 | - $flight->organisator = (int)$obj->fk_organisateur; |
|
86 | - $flight->billed = (bool)$obj->is_facture; |
|
87 | - $flight->cost = (int)$obj->cost; |
|
88 | - $flight->receiver = (int)$obj->fk_receiver; |
|
89 | - $flight->kilometers = (int)$obj->kilometers ; |
|
83 | + $flight->type = (int) $obj->fk_type; |
|
84 | + $flight->pilot = (int) $obj->fk_pilot; |
|
85 | + $flight->organisator = (int) $obj->fk_organisateur; |
|
86 | + $flight->billed = (bool) $obj->is_facture; |
|
87 | + $flight->cost = (int) $obj->cost; |
|
88 | + $flight->receiver = (int) $obj->fk_receiver; |
|
89 | + $flight->kilometers = (int) $obj->kilometers; |
|
90 | 90 | $flight->justifKilometers = $obj->justif_kilometers; |
91 | 91 | $flight->createdAt = $obj->date_creation; |
92 | 92 | $flight->updatedAt = $obj->date_update; |
@@ -97,10 +97,10 @@ discard block |
||
97 | 97 | } |
98 | 98 | } |
99 | 99 | else { |
100 | - throw new RestException(500, 'Error when retrieve commande list : '.$this->connection->lasterror()); |
|
100 | + throw new RestException(500, 'Error when retrieve commande list : ' . $this->connection->lasterror()); |
|
101 | 101 | } |
102 | 102 | |
103 | - if( ! count($obj_ret)) { |
|
103 | + if (!count($obj_ret)) { |
|
104 | 104 | throw new RestException(404, 'No flight found'); |
105 | 105 | } |
106 | 106 |
@@ -95,8 +95,7 @@ |
||
95 | 95 | |
96 | 96 | $i++; |
97 | 97 | } |
98 | - } |
|
99 | - else { |
|
98 | + } else { |
|
100 | 99 | throw new RestException(500, 'Error when retrieve commande list : '.$this->connection->lasterror()); |
101 | 100 | } |
102 | 101 |