@@ -24,7 +24,7 @@ |
||
| 24 | 24 | <?php echo $renderer->render($form->getElement('flight_id')); ?> |
| 25 | 25 | <?php echo $renderer->render($form->getElement('token')); ?> |
| 26 | 26 | |
| 27 | - <?php if($form->has('amount')): ?> |
|
| 27 | + <?php if ($form->has('amount')): ?> |
|
| 28 | 28 | <section class="form-section"> |
| 29 | 29 | <h1 class="form-section-title"><?php echo $langs->trans('Ajout de dégâts'); ?></h1> |
| 30 | 30 | <table class="border" width="50%"> |
@@ -16,21 +16,21 @@ |
||
| 16 | 16 | <td colspan="2"> </td> |
| 17 | 17 | </tr> |
| 18 | 18 | <?php $total = 0; ?> |
| 19 | - <?php foreach($damages as $currentDamage):?> |
|
| 19 | + <?php foreach ($damages as $currentDamage):?> |
|
| 20 | 20 | <?php $total += $currentDamage->getAmount(); ?> |
| 21 | 21 | <tr> |
| 22 | - <td><?php echo $currentDamage->getAuthorName();?></td> |
|
| 23 | - <td><?php echo $currentDamage->getLabel();?></td> |
|
| 24 | - <td><?php echo $currentDamage->getAmount();?>€</td> |
|
| 22 | + <td><?php echo $currentDamage->getAuthorName(); ?></td> |
|
| 23 | + <td><?php echo $currentDamage->getLabel(); ?></td> |
|
| 24 | + <td><?php echo $currentDamage->getAmount(); ?>€</td> |
|
| 25 | 25 | <td> |
| 26 | - <?php if($currentDamage->isInvoiced()): ?> |
|
| 26 | + <?php if ($currentDamage->isInvoiced()): ?> |
|
| 27 | 27 | <i class="fas fa-check"></i> |
| 28 | 28 | <?php else: ?> |
| 29 | 29 | <i class="fas fa-times"></i> |
| 30 | 30 | <?php endif; ?> |
| 31 | 31 | </td> |
| 32 | 32 | <td> |
| 33 | - <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> |
|
| 33 | + <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> |
|
| 34 | 34 | </td> |
| 35 | 35 | </tr> |
| 36 | 36 | <?php endforeach; ?> |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | print '<td>' . $pilot->getCountForType('orga_T6')->getCount() . '</td>'; |
| 190 | 190 | print '<td>' . $pilot->getCountForType('orga_T6')->getCost()->getValue() . '</td>'; |
| 191 | 191 | |
| 192 | - print sprintf('<td class="%s">', $pilot->getFlightBonus()->getValue() === 0?'text-muted':'text-bold'). $pilot->getFlightBonus()->getValue() . ' pts</td>'; |
|
| 192 | + print sprintf('<td class="%s">', $pilot->getFlightBonus()->getValue() === 0 ? 'text-muted' : 'text-bold') . $pilot->getFlightBonus()->getValue() . ' pts</td>'; |
|
| 193 | 193 | |
| 194 | 194 | print '<td>' . $pilot->getCountForType('3')->getCount() . '</td>'; |
| 195 | 195 | print '<td>' . price($pilot->getCountForType('3')->getCost()->getValue()) . '€</td>'; |
@@ -208,8 +208,8 @@ discard block |
||
| 208 | 208 | print '<td>' . price($pilot->damageCost()->getValue()) . '€</td>'; |
| 209 | 209 | print '<td>' . price($pilot->invoicedDamageCost()->getValue()) . '€</td>'; |
| 210 | 210 | |
| 211 | - print sprintf('<td class="%s">', $pilot->getFlightsCost()->getValue() === 0?'text-muted':'text-bold'). price($pilot->getFlightsCost()->getValue()) . '€ </td>'; |
|
| 212 | - print sprintf('<td class="%s">', $pilot->isBillable(FlightBonus::zero())?'text-bold':'text-muted'). price($pilot->getTotalBill()->getValue()) . '€</td>'; |
|
| 211 | + print sprintf('<td class="%s">', $pilot->getFlightsCost()->getValue() === 0 ? 'text-muted' : 'text-bold') . price($pilot->getFlightsCost()->getValue()) . '€ </td>'; |
|
| 212 | + print sprintf('<td class="%s">', $pilot->isBillable(FlightBonus::zero()) ? 'text-bold' : 'text-muted') . price($pilot->getTotalBill()->getValue()) . '€</td>'; |
|
| 213 | 213 | print '</tr>'; |
| 214 | 214 | } |
| 215 | 215 | |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | print '<td>' . $totalT3 . '</td>'; |
| 235 | 235 | print '<td></td>'; |
| 236 | 236 | |
| 237 | -print '<td>' . $totalT4. '</td>'; |
|
| 237 | +print '<td>' . $totalT4 . '</td>'; |
|
| 238 | 238 | print '<td></td>'; |
| 239 | 239 | |
| 240 | 240 | print '<td>' . $totalT5 . '</td>'; |
@@ -263,7 +263,7 @@ discard block |
||
| 263 | 263 | //table km |
| 264 | 264 | $tauxRemb = isset($conf->global->BBC_FLIGHT_LOG_TAUX_REMB_KM) ? $conf->global->BBC_FLIGHT_LOG_TAUX_REMB_KM : 0; |
| 265 | 265 | $year = GETPOST("year", 'int'); |
| 266 | -if(empty($year)){ |
|
| 266 | +if (empty($year)) { |
|
| 267 | 267 | $year = date('Y'); |
| 268 | 268 | } |
| 269 | 269 | |
@@ -31,15 +31,15 @@ |
||
| 31 | 31 | public function __invoke($flightId) |
| 32 | 32 | { |
| 33 | 33 | $sql = 'SELECT damage.author_id as author_id, damage.rowid as id, damage.amount, damage.label, CONCAT(author.firstname, " " , author.lastname) as author_name, damage.billed as invoiced'; |
| 34 | - $sql.=' FROM '.MAIN_DB_PREFIX.'bbc_flight_damages as damage'; |
|
| 35 | - $sql.=' INNER JOIN '.MAIN_DB_PREFIX.'user as author ON author.rowid = damage.author_id'; |
|
| 36 | - $sql.=' WHERE damage.flight_id = '.$this->db->escape($flightId); |
|
| 34 | + $sql .= ' FROM ' . MAIN_DB_PREFIX . 'bbc_flight_damages as damage'; |
|
| 35 | + $sql .= ' INNER JOIN ' . MAIN_DB_PREFIX . 'user as author ON author.rowid = damage.author_id'; |
|
| 36 | + $sql .= ' WHERE damage.flight_id = ' . $this->db->escape($flightId); |
|
| 37 | 37 | |
| 38 | 38 | $resql = $this->db->query($sql); |
| 39 | 39 | if ($resql) { |
| 40 | 40 | $num = $this->db->num_rows($resql); |
| 41 | 41 | if ($num) { |
| 42 | - for($i = 0; $i < $num ; $i++) { |
|
| 42 | + for ($i = 0; $i < $num; $i++) { |
|
| 43 | 43 | $properties = $this->db->fetch_array($resql); |
| 44 | 44 | yield Damage::fromArray($properties); |
| 45 | 45 | } |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | 'label' => $flightDamage->getLabel()->value(), |
| 38 | 38 | ]; |
| 39 | 39 | |
| 40 | - if($flightDamage->getId()){ |
|
| 40 | + if ($flightDamage->getId()) { |
|
| 41 | 41 | $this->update($flightDamage->getId()->getId(), $fields); |
| 42 | 42 | return $flightDamage->getId()->getId(); |
| 43 | 43 | } |
@@ -52,10 +52,10 @@ discard block |
||
| 52 | 52 | * |
| 53 | 53 | * @throws \Exception |
| 54 | 54 | */ |
| 55 | - public function getById(DamageId $id){ |
|
| 55 | + public function getById(DamageId $id) { |
|
| 56 | 56 | $damage = $this->get($id->getId()); |
| 57 | 57 | |
| 58 | - if(null === $damage){ |
|
| 58 | + if (null === $damage) { |
|
| 59 | 59 | throw new \Exception('Damage not found'); |
| 60 | 60 | } |
| 61 | 61 | |
@@ -72,14 +72,14 @@ |
||
| 72 | 72 | * |
| 73 | 73 | * @return Damage |
| 74 | 74 | */ |
| 75 | - public static function fromArray(array $properties){ |
|
| 75 | + public static function fromArray(array $properties) { |
|
| 76 | 76 | $authorId = $properties['author_id']; |
| 77 | 77 | $author = $properties['author_name']; |
| 78 | 78 | $label = $properties['label']; |
| 79 | 79 | $amount = $properties['amount']; |
| 80 | 80 | $id = $properties['id']; |
| 81 | 81 | $flightId = isset($properties['flight_id']) ? $properties['flight_id'] : null; |
| 82 | - $invoiced = (bool)$properties['invoiced']; |
|
| 82 | + $invoiced = (bool) $properties['invoiced']; |
|
| 83 | 83 | |
| 84 | 84 | return new self($authorId, $author, $amount, $id, $invoiced, $flightId, $label); |
| 85 | 85 | } |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | public function __invoke(CreateDamageCommand $command) |
| 43 | 43 | { |
| 44 | 44 | $damage = FlightDamage::waiting(new DamageAmount($command->getAmount()), AuthorId::create($command->getAuthorId()), new DamageLabel($command->getLabel())); |
| 45 | - if(null !== $command->getFlightId()){ |
|
| 45 | + if (null !== $command->getFlightId()) { |
|
| 46 | 46 | $damage = FlightDamage::damage(FlightId::create($command->getFlightId()), new DamageLabel($command->getLabel()), new DamageAmount($command->getAmount()), AuthorId::create($command->getAuthorId())); |
| 47 | 47 | } |
| 48 | 48 | |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | */ |
| 61 | 61 | private function linkSupplierInvoice($damageId, $invoiceId) |
| 62 | 62 | { |
| 63 | - if($invoiceId <= 0){ |
|
| 63 | + if ($invoiceId <= 0) { |
|
| 64 | 64 | return; |
| 65 | 65 | } |
| 66 | 66 | |
@@ -81,8 +81,8 @@ discard block |
||
| 81 | 81 | * @param int $targetId |
| 82 | 82 | * @param string $targetType |
| 83 | 83 | */ |
| 84 | - private function insertLinks($damageId, $targetId, $targetType){ |
|
| 85 | - $sql = "INSERT INTO ".MAIN_DB_PREFIX."element_element ("; |
|
| 84 | + private function insertLinks($damageId, $targetId, $targetType) { |
|
| 85 | + $sql = "INSERT INTO " . MAIN_DB_PREFIX . "element_element ("; |
|
| 86 | 86 | $sql .= "fk_source"; |
| 87 | 87 | $sql .= ", sourcetype"; |
| 88 | 88 | $sql .= ", fk_target"; |
@@ -90,8 +90,8 @@ discard block |
||
| 90 | 90 | $sql .= ") VALUES ("; |
| 91 | 91 | $sql .= $damageId; |
| 92 | 92 | $sql .= ", 'flightlog_damage'"; |
| 93 | - $sql .= ", ".$targetId; |
|
| 94 | - $sql .= ", '".$targetType."'"; |
|
| 93 | + $sql .= ", " . $targetId; |
|
| 94 | + $sql .= ", '" . $targetType . "'"; |
|
| 95 | 95 | $sql .= ")"; |
| 96 | 96 | |
| 97 | 97 | if ($this->db->query($sql)) |
@@ -15,7 +15,7 @@ |
||
| 15 | 15 | $this->label = $label; |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | - public function value(){ |
|
| 18 | + public function value() { |
|
| 19 | 19 | return $this->label; |
| 20 | 20 | } |
| 21 | 21 | |
@@ -106,11 +106,11 @@ discard block |
||
| 106 | 106 | return new Pilot($this->name, $this->id, $types); |
| 107 | 107 | } |
| 108 | 108 | |
| 109 | - public function addDamage(FlightDamageCount $damage){ |
|
| 109 | + public function addDamage(FlightDamageCount $damage) { |
|
| 110 | 110 | $this->damages[] = $damage; |
| 111 | 111 | } |
| 112 | 112 | |
| 113 | - public function addInvoicedDamage(FlightInvoicedDamageCount $damage){ |
|
| 113 | + public function addInvoicedDamage(FlightInvoicedDamageCount $damage) { |
|
| 114 | 114 | $this->damages[] = $damage; |
| 115 | 115 | } |
| 116 | 116 | |
@@ -161,21 +161,21 @@ discard block |
||
| 161 | 161 | return $flightsCost; |
| 162 | 162 | } |
| 163 | 163 | |
| 164 | - public function totalDamageCost(){ |
|
| 164 | + public function totalDamageCost() { |
|
| 165 | 165 | $flightCost = FlightCost::zero(); |
| 166 | 166 | |
| 167 | - foreach($this->damages as $damage){ |
|
| 167 | + foreach ($this->damages as $damage) { |
|
| 168 | 168 | $flightCost = $flightCost->addCost($damage->getCost()); |
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | return $flightCost; |
| 172 | 172 | } |
| 173 | 173 | |
| 174 | - public function damageCost(){ |
|
| 174 | + public function damageCost() { |
|
| 175 | 175 | $flightCost = FlightCost::zero(); |
| 176 | 176 | |
| 177 | - foreach($this->damages as $damage){ |
|
| 178 | - if(!$damage instanceof FlightDamageCount){ |
|
| 177 | + foreach ($this->damages as $damage) { |
|
| 178 | + if (!$damage instanceof FlightDamageCount) { |
|
| 179 | 179 | continue; |
| 180 | 180 | } |
| 181 | 181 | |
@@ -185,11 +185,11 @@ discard block |
||
| 185 | 185 | return $flightCost; |
| 186 | 186 | } |
| 187 | 187 | |
| 188 | - public function invoicedDamageCost(){ |
|
| 188 | + public function invoicedDamageCost() { |
|
| 189 | 189 | $flightCost = FlightCost::zero(); |
| 190 | 190 | |
| 191 | - foreach($this->damages as $damage){ |
|
| 192 | - if(!$damage instanceof FlightInvoicedDamageCount){ |
|
| 191 | + foreach ($this->damages as $damage) { |
|
| 192 | + if (!$damage instanceof FlightInvoicedDamageCount) { |
|
| 193 | 193 | continue; |
| 194 | 194 | } |
| 195 | 195 | |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | return $flightCost; |
| 200 | 200 | } |
| 201 | 201 | |
| 202 | - public function damages(){ |
|
| 202 | + public function damages() { |
|
| 203 | 203 | return $this->damages; |
| 204 | 204 | } |
| 205 | 205 | |