@@ -91,7 +91,7 @@ |
||
91 | 91 | throw new \InvalidArgumentException('Model document is missing'); |
92 | 92 | } |
93 | 93 | |
94 | - if(!isset($nbrPax) || !is_numeric($nbrPax) || $nbrPax != (int) $nbrPax){ |
|
94 | + if (!isset($nbrPax) || !is_numeric($nbrPax) || $nbrPax != (int) $nbrPax) { |
|
95 | 95 | throw new \InvalidArgumentException('The number of pax is not correct, an integer is expected'); |
96 | 96 | } |
97 | 97 |
@@ -112,7 +112,7 @@ |
||
112 | 112 | { |
113 | 113 | $customer = new Client($this->db); |
114 | 114 | |
115 | - if($flight->fk_receiver) { |
|
115 | + if ($flight->fk_receiver) { |
|
116 | 116 | return $this->fetchCustomerFromFlight($flight); |
117 | 117 | } |
118 | 118 |
@@ -124,11 +124,11 @@ |
||
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 | - }catch (\Exception $e){ |
|
131 | - dol_syslog($e->getMessage(),LOG_ERR); |
|
130 | + } catch (\Exception $e) { |
|
131 | + dol_syslog($e->getMessage(), LOG_ERR); |
|
132 | 132 | dol_htmloutput_mesg("Facture non créée", '', 'error'); |
133 | 133 | } |
134 | 134 | } |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | try{ |
128 | 128 | $command = new CreateFlightBillCommand($flight->getId(), $modeReglement, $conditionReglement, $documentModel, $type, $publicNote, $privateNote,$bankAccount, $nbrPax); |
129 | 129 | $handler->handle($command); |
130 | - }catch (\Exception $e){ |
|
130 | + } catch (\Exception $e){ |
|
131 | 131 | dol_syslog($e->getMessage(),LOG_ERR); |
132 | 132 | dol_htmloutput_mesg("Facture non créée", '', 'error'); |
133 | 133 | } |
@@ -268,9 +268,12 @@ discard block |
||
268 | 268 | |
269 | 269 | <?php if (!$flightProduct || !$flight->hasReceiver()) : ?> |
270 | 270 | <a class="butActionRefused" href="#">Générer</a> |
271 | - <?php else: ?> |
|
271 | + <?php else { |
|
272 | + : ?> |
|
272 | 273 | <button class="butAction" type="submit">Générer</button> |
273 | - <?php endif; ?> |
|
274 | + <?php endif; |
|
275 | +} |
|
276 | +?> |
|
274 | 277 | |
275 | 278 | <a class="butAction" href="<?php echo DOL_URL_ROOT . '/flightlog/card.php?id=' . $flight->id; ?>">Retour au |
276 | 279 | vol</a> |
@@ -645,7 +645,7 @@ |
||
645 | 645 | } |
646 | 646 | |
647 | 647 | /** |
648 | - * @return array|BbctypesLine[] |
|
648 | + * @return BbctypesLine[] |
|
649 | 649 | */ |
650 | 650 | public function getLines() |
651 | 651 | { |
@@ -733,7 +733,7 @@ |
||
733 | 733 | */ |
734 | 734 | public function getActive() |
735 | 735 | { |
736 | - return (boolean)$this->active; |
|
736 | + return (boolean) $this->active; |
|
737 | 737 | } |
738 | 738 | |
739 | 739 | /** |
@@ -43,7 +43,7 @@ |
||
43 | 43 | */ |
44 | 44 | private function buildOptions() |
45 | 45 | { |
46 | - foreach($this->flightType->getLines() as $currentFlightType){ |
|
46 | + foreach ($this->flightType->getLines() as $currentFlightType) { |
|
47 | 47 | $this->addValueOption($currentFlightType->getId(), $currentFlightType->getLabel()); |
48 | 48 | } |
49 | 49 | } |
@@ -109,8 +109,8 @@ |
||
109 | 109 | * |
110 | 110 | * @return array|string[] |
111 | 111 | */ |
112 | - public function getError($field){ |
|
113 | - if(!$this->hasError($field)){ |
|
112 | + public function getError($field) { |
|
113 | + if (!$this->hasError($field)) { |
|
114 | 114 | return []; |
115 | 115 | } |
116 | 116 |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | /** |
79 | 79 | * @inheritDoc |
80 | 80 | */ |
81 | - public function getOptions(){ |
|
81 | + public function getOptions() { |
|
82 | 82 | return $this->options; |
83 | 83 | } |
84 | 84 | |
@@ -98,18 +98,18 @@ discard block |
||
98 | 98 | */ |
99 | 99 | public function validate() |
100 | 100 | { |
101 | - if(!$this->validator){ |
|
101 | + if (!$this->validator) { |
|
102 | 102 | return true; |
103 | 103 | } |
104 | 104 | |
105 | - if(null === $this->object){ |
|
105 | + if (null === $this->object) { |
|
106 | 106 | throw new \InvalidArgumentException('Object not bound'); |
107 | 107 | } |
108 | 108 | |
109 | 109 | $validation = $this->validator->isValid($this->object, $_REQUEST); |
110 | 110 | |
111 | - if(!$validation){ |
|
112 | - foreach($this->elements as $fieldName => $field){ |
|
111 | + if (!$validation) { |
|
112 | + foreach ($this->elements as $fieldName => $field) { |
|
113 | 113 | $field->setErrors($this->validator->getError($fieldName)); |
114 | 114 | } |
115 | 115 | } |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | /** |
121 | 121 | * @return array|string[] |
122 | 122 | */ |
123 | - public function getErrorMessages(){ |
|
123 | + public function getErrorMessages() { |
|
124 | 124 | return $this->validator->getErrors(); |
125 | 125 | } |
126 | 126 | |
@@ -141,10 +141,10 @@ discard block |
||
141 | 141 | */ |
142 | 142 | public function bind($object) |
143 | 143 | { |
144 | - foreach($this->elements as $element){ |
|
144 | + foreach ($this->elements as $element) { |
|
145 | 145 | $name = $this->camelCase($element->getName()); |
146 | - $methodName = 'get'.$name; |
|
147 | - if(!method_exists($object, $methodName)){ |
|
146 | + $methodName = 'get' . $name; |
|
147 | + if (!method_exists($object, $methodName)) { |
|
148 | 148 | continue; |
149 | 149 | } |
150 | 150 | |
@@ -161,24 +161,24 @@ discard block |
||
161 | 161 | */ |
162 | 162 | public function setData(array $data) |
163 | 163 | { |
164 | - foreach($data as $fieldName => $currentData){ |
|
165 | - if(!key_exists($fieldName, $this->elements) || $this->elements[$fieldName]->isDisabled()){ |
|
164 | + foreach ($data as $fieldName => $currentData) { |
|
165 | + if (!key_exists($fieldName, $this->elements) || $this->elements[$fieldName]->isDisabled()) { |
|
166 | 166 | continue; |
167 | 167 | } |
168 | 168 | |
169 | 169 | $this->elements[$fieldName]->setValue($currentData); |
170 | 170 | |
171 | - $methodName = 'set'.$this->camelCase($fieldName); |
|
172 | - if(null === $this->object){ |
|
171 | + $methodName = 'set' . $this->camelCase($fieldName); |
|
172 | + if (null === $this->object) { |
|
173 | 173 | continue; |
174 | 174 | } |
175 | 175 | |
176 | - if(method_exists($this->object, $methodName)){ |
|
176 | + if (method_exists($this->object, $methodName)) { |
|
177 | 177 | $this->object->{$methodName}($currentData); |
178 | 178 | continue; |
179 | 179 | } |
180 | 180 | |
181 | - if(property_exists($this->object, $fieldName)){ |
|
181 | + if (property_exists($this->object, $fieldName)) { |
|
182 | 182 | $this->object->{$fieldName} = $currentData; |
183 | 183 | continue; |
184 | 184 | } |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | */ |
201 | 201 | public function getElement($elementName) |
202 | 202 | { |
203 | - if(!key_exists($elementName, $this->elements)){ |
|
203 | + if (!key_exists($elementName, $this->elements)) { |
|
204 | 204 | throw new \InvalidArgumentException(sprintf('Element %s not found ', $elementName)); |
205 | 205 | } |
206 | 206 |
@@ -95,6 +95,7 @@ discard block |
||
95 | 95 | |
96 | 96 | /** |
97 | 97 | * @inheritDoc |
98 | + * @param string $fieldName |
|
98 | 99 | */ |
99 | 100 | public function remove($fieldName) |
100 | 101 | { |
@@ -142,7 +143,7 @@ discard block |
||
142 | 143 | } |
143 | 144 | |
144 | 145 | /** |
145 | - * @param null|\ValidatorInterface $validator |
|
146 | + * @param ValidatorInterface $validator |
|
146 | 147 | * |
147 | 148 | * @return Form |
148 | 149 | */ |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | * |
52 | 52 | * @return $this |
53 | 53 | */ |
54 | - public function addValueOption($key, $value){ |
|
54 | + public function addValueOption($key, $value) { |
|
55 | 55 | $this->valueOptions[$key] = $value; |
56 | 56 | return $this; |
57 | 57 | } |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | { |
64 | 64 | parent::setValue($value); |
65 | 65 | |
66 | - if(!isset($this->valueOptions[$value])){ |
|
66 | + if (!isset($this->valueOptions[$value])) { |
|
67 | 67 | $this->valueOptions[$value] = empty($value) ? ' ' : $value; |
68 | 68 | } |
69 | 69 | } |
@@ -31,12 +31,12 @@ |
||
31 | 31 | private function buildOptions() |
32 | 32 | { |
33 | 33 | $sql = "SELECT"; |
34 | - $sql.= " t.rowid,"; |
|
35 | - $sql.= " t.immat,"; |
|
36 | - $sql.= " t.is_disable"; |
|
37 | - $sql.= " FROM llx_bbc_ballons as t"; |
|
38 | - $sql.= " WHERE t.is_disable = 0"; |
|
39 | - $sql.= " ORDER BY t.immat"; |
|
34 | + $sql .= " t.rowid,"; |
|
35 | + $sql .= " t.immat,"; |
|
36 | + $sql .= " t.is_disable"; |
|
37 | + $sql .= " FROM llx_bbc_ballons as t"; |
|
38 | + $sql .= " WHERE t.is_disable = 0"; |
|
39 | + $sql .= " ORDER BY t.immat"; |
|
40 | 40 | |
41 | 41 | $resql = $this->db->query($sql); |
42 | 42 | if ($resql) { |