@@ -147,22 +147,22 @@ discard block |
||
147 | 147 | |
148 | 148 | $remainingPoints = $command->getPilot()->getFlightBonus()->addPoints(FlightPoints::create($command->getAdditionalBonus())); |
149 | 149 | |
150 | - foreach ($amountPerRate as $rate => $cost){ |
|
151 | - if($cost->getValue() <= 0){ |
|
150 | + foreach ($amountPerRate as $rate => $cost) { |
|
151 | + if ($cost->getValue() <= 0) { |
|
152 | 152 | continue; |
153 | 153 | } |
154 | 154 | |
155 | - if($cost->getValue() <= $remainingPoints->getValue()){ |
|
155 | + if ($cost->getValue() <= $remainingPoints->getValue()) { |
|
156 | 156 | $remainingPoints = $remainingPoints->minCosts($cost); |
157 | 157 | continue; |
158 | 158 | } |
159 | 159 | |
160 | 160 | $subject = 'vols'; |
161 | - if((int)$rate === 21){ |
|
161 | + if ((int) $rate === 21) { |
|
162 | 162 | $subject = 'réparations'; |
163 | 163 | } |
164 | 164 | |
165 | - $this->addOrderLine($object, 'Cloture d\'année concernant les ' . $subject, $cost->minBonus($remainingPoints)->getValue(), (int)$rate, 1, $startYearTimestamp, $endYearTimestamp ); |
|
165 | + $this->addOrderLine($object, 'Cloture d\'année concernant les ' . $subject, $cost->minBonus($remainingPoints)->getValue(), (int) $rate, 1, $startYearTimestamp, $endYearTimestamp); |
|
166 | 166 | $remainingPoints = FlightBonus::zero(); |
167 | 167 | |
168 | 168 | } |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | */ |
209 | 209 | private function addOrderLine($object, $title, $priceTtc, $rate, $qty, $startDate, $endDate) |
210 | 210 | { |
211 | - if($qty <= 0){ |
|
211 | + if ($qty <= 0) { |
|
212 | 212 | return; |
213 | 213 | } |
214 | 214 | |
@@ -264,35 +264,35 @@ discard block |
||
264 | 264 | |
265 | 265 | //T3 |
266 | 266 | $rate = $this->t3->getService()->tva_tx; |
267 | - if(!isset($costs[$rate])){ |
|
267 | + if (!isset($costs[$rate])) { |
|
268 | 268 | $costs[$rate] = FlightCost::zero(); |
269 | 269 | } |
270 | 270 | $costs[$rate] = $costs[$rate]->addCost($pilot->getCountForType('3')->getCost()); |
271 | 271 | |
272 | 272 | //T4 |
273 | 273 | $rate = $this->t4->getService()->tva_tx; |
274 | - if(!isset($costs[$rate])){ |
|
274 | + if (!isset($costs[$rate])) { |
|
275 | 275 | $costs[$rate] = FlightCost::zero(); |
276 | 276 | } |
277 | 277 | $costs[$rate] = $costs[$rate]->addCost($pilot->getCountForType('4')->getCost()); |
278 | 278 | |
279 | 279 | //T6 |
280 | 280 | $rate = $this->t6->getService()->tva_tx; |
281 | - if(!isset($costs[$rate])){ |
|
281 | + if (!isset($costs[$rate])) { |
|
282 | 282 | $costs[$rate] = FlightCost::zero(); |
283 | 283 | } |
284 | 284 | $costs[$rate] = $costs[$rate]->addCost($pilot->getCountForType('6')->getCost()); |
285 | 285 | |
286 | 286 | //T7 |
287 | 287 | $rate = $this->t7->getService()->tva_tx; |
288 | - if(!isset($costs[$rate])){ |
|
288 | + if (!isset($costs[$rate])) { |
|
289 | 289 | $costs[$rate] = FlightCost::zero(); |
290 | 290 | } |
291 | 291 | $costs[$rate] = $costs[$rate]->addCost($pilot->getCountForType('7')->getCost()); |
292 | 292 | |
293 | 293 | //Damages |
294 | 294 | $rate = 21; |
295 | - if(!isset($costs[$rate])){ |
|
295 | + if (!isset($costs[$rate])) { |
|
296 | 296 | $costs[$rate] = FlightCost::zero(); |
297 | 297 | } |
298 | 298 | $costs[$rate] = $costs[$rate]->addCost($pilot->damageCost()->minCost($pilot->invoicedDamageCost()->multiply(-1))); |
@@ -48,7 +48,7 @@ |
||
48 | 48 | public function minCosts(FlightCost $cost) |
49 | 49 | { |
50 | 50 | $bonusAmount = $this->bonusAmount - $cost->getValue(); |
51 | - if($bonusAmount < 0){ |
|
51 | + if ($bonusAmount < 0) { |
|
52 | 52 | return FlightBonus::zero(); |
53 | 53 | } |
54 | 54 |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | $extralabels = $extrafields->fetch_name_optionals_label($object->table_element); |
138 | 138 | |
139 | 139 | // Load object |
140 | -include DOL_DOCUMENT_ROOT . '/core/actions_fetchobject.inc.php'; // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals |
|
140 | +include DOL_DOCUMENT_ROOT . '/core/actions_fetchobject.inc.php'; // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals |
|
141 | 141 | include DOL_DOCUMENT_ROOT . '/core/actions_dellink.inc.php'; |
142 | 142 | |
143 | 143 | // Initialize technical object to manage hooks of modules. Note that conf->hooks_modules contains array array |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | |
167 | 167 | $parameters = array(); |
168 | 168 | $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, |
169 | - $action); // Note that $action and $object may have been modified by some hooks |
|
169 | + $action); // Note that $action and $object may have been modified by some hooks |
|
170 | 170 | if ($reshook < 0) { |
171 | 171 | setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
172 | 172 | } |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | } |
244 | 244 | |
245 | 245 | // toggle is static flight |
246 | - if(($user->rights->flightlog->vol->advanced || $user->rights->flightlog->pilot->edit || $user->rights->flightlog->vol->edit || ($user->rights->flightlog->vol->add && $object->fk_pilot == $user->id)) && $action == ACTION_CONFIRM_TOGGLE_STATIC){ |
|
246 | + if (($user->rights->flightlog->vol->advanced || $user->rights->flightlog->pilot->edit || $user->rights->flightlog->vol->edit || ($user->rights->flightlog->vol->add && $object->fk_pilot == $user->id)) && $action == ACTION_CONFIRM_TOGGLE_STATIC) { |
|
247 | 247 | $result = $object |
248 | 248 | ->toggleStaticFlight() |
249 | 249 | ->update($user); |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | } |
261 | 261 | } |
262 | 262 | // toggle is night flight |
263 | - if(($user->rights->flightlog->vol->advanced || $user->rights->flightlog->pilot->edit || $user->rights->flightlog->vol->edit || ($user->rights->flightlog->vol->add && $object->fk_pilot == $user->id)) && $action == ACTION_CONFIRM_TOGGLE_NIGHT){ |
|
263 | + if (($user->rights->flightlog->vol->advanced || $user->rights->flightlog->pilot->edit || $user->rights->flightlog->vol->edit || ($user->rights->flightlog->vol->add && $object->fk_pilot == $user->id)) && $action == ACTION_CONFIRM_TOGGLE_NIGHT) { |
|
264 | 264 | $result = $object |
265 | 265 | ->toggleNightFlight() |
266 | 266 | ->update($user); |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | } |
278 | 278 | } |
279 | 279 | // toggle is exams |
280 | - if(($user->rights->flightlog->vol->advanced || $user->rights->flightlog->pilot->edit || $user->rights->flightlog->vol->edit || ($user->rights->flightlog->vol->add && $object->fk_pilot == $user->id)) && $action == ACTION_CONFIRM_TOGGLE_EXAM){ |
|
280 | + if (($user->rights->flightlog->vol->advanced || $user->rights->flightlog->pilot->edit || $user->rights->flightlog->vol->edit || ($user->rights->flightlog->vol->add && $object->fk_pilot == $user->id)) && $action == ACTION_CONFIRM_TOGGLE_EXAM) { |
|
281 | 281 | $result = $object |
282 | 282 | ->toggleExamFlight() |
283 | 283 | ->update($user); |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | } |
295 | 295 | } |
296 | 296 | // toggle is refresh |
297 | - if(($user->rights->flightlog->vol->advanced || $user->rights->flightlog->pilot->edit || $user->rights->flightlog->vol->edit || ($user->rights->flightlog->vol->add && $object->fk_pilot == $user->id)) && $action == ACTION_CONFIRM_TOGGLE_REFRESH){ |
|
297 | + if (($user->rights->flightlog->vol->advanced || $user->rights->flightlog->pilot->edit || $user->rights->flightlog->vol->edit || ($user->rights->flightlog->vol->add && $object->fk_pilot == $user->id)) && $action == ACTION_CONFIRM_TOGGLE_REFRESH) { |
|
298 | 298 | $result = $object |
299 | 299 | ->toggleRefreshFlight() |
300 | 300 | ->update($user); |
@@ -313,12 +313,12 @@ discard block |
||
313 | 313 | |
314 | 314 | // Action to classify in a project |
315 | 315 | if (!empty($conf->projet->enabled) && $user->rights->projet->creer && $action === ACTION_CLASSIN) { |
316 | - try{ |
|
316 | + try { |
|
317 | 317 | $handler = new \flightlog\command\ClassifyFlightHandler($db, $conf, $langs, $user); |
318 | 318 | $handler->handle(new \flightlog\command\ClassifyFlight($id, GETPOST('projectid'))); |
319 | 319 | $object->fetch($id); |
320 | 320 | $action = 'show'; |
321 | - }catch(Exception $e){ |
|
321 | + } catch (Exception $e) { |
|
322 | 322 | setEventMessages($e->getMessage(), null, 'errors'); |
323 | 323 | } |
324 | 324 | } |
@@ -351,7 +351,7 @@ discard block |
||
351 | 351 | |
352 | 352 | |
353 | 353 | // Part to edit record |
354 | -if (($user->rights->flightlog->vol->edit || ($user->rights->flightlog->vol->add && $object->fk_pilot == $user->id )) && ($id || $ref) && $action == 'edit'): ?> |
|
354 | +if (($user->rights->flightlog->vol->edit || ($user->rights->flightlog->vol->add && $object->fk_pilot == $user->id)) && ($id || $ref) && $action == 'edit'): ?> |
|
355 | 355 | |
356 | 356 | <?php $renderer = new \flightlog\form\SimpleFormRenderer(); ?> |
357 | 357 | |
@@ -365,11 +365,11 @@ discard block |
||
365 | 365 | |
366 | 366 | <form class="flight-form js-form" name='add' action="card.php?rowid=<?php echo $object->getId(); ?>" method="POST"> |
367 | 367 | <input type="hidden" name="action" value="update"/> |
368 | - <input type="hidden" name="token" value="<?php echo newToken();?>"/> |
|
368 | + <input type="hidden" name="token" value="<?php echo newToken(); ?>"/> |
|
369 | 369 | |
370 | 370 | <?php echo $renderer->render($formFlight->getElement('idBBC_vols')); ?> |
371 | 371 | |
372 | - <?php if($formFlight->has('fk_type')): ?> |
|
372 | + <?php if ($formFlight->has('fk_type')): ?> |
|
373 | 373 | <section class="form-section"> |
374 | 374 | <h1 class="form-section-title"><?php echo $langs->trans('Type de vol'); ?></h1> |
375 | 375 | <table class="border" width="50%"> |
@@ -383,7 +383,7 @@ discard block |
||
383 | 383 | <?php endif; ?> |
384 | 384 | |
385 | 385 | <!-- Date et heures --> |
386 | - <?php if($formFlight->has('date')): ?> |
|
386 | + <?php if ($formFlight->has('date')): ?> |
|
387 | 387 | <section class="form-section"> |
388 | 388 | <h1 class="form-section-title"><?php echo $langs->trans('Date'); ?></h1> |
389 | 389 | <table class="border" width="50%"> |
@@ -395,7 +395,7 @@ discard block |
||
395 | 395 | </section> |
396 | 396 | <?php endif; ?> |
397 | 397 | |
398 | - <?php if($formFlight->has('heureD') && $formFlight->has('heureA')): ?> |
|
398 | + <?php if ($formFlight->has('heureD') && $formFlight->has('heureA')): ?> |
|
399 | 399 | <section class="form-section"> |
400 | 400 | <h1 class="form-section-title"><?php echo $langs->trans('Heures'); ?></h1> |
401 | 401 | <table class="border" width="50%"> |
@@ -415,14 +415,14 @@ discard block |
||
415 | 415 | <h1 class="form-section-title"><?php echo $langs->trans('Pilote & ballon') ?></h1> |
416 | 416 | <table class="border" width="50%"> |
417 | 417 | |
418 | - <?php if($formFlight->has('fk_pilot')): ?> |
|
418 | + <?php if ($formFlight->has('fk_pilot')): ?> |
|
419 | 419 | <tr> |
420 | 420 | <td class="fieldrequired"> Pilote </td> |
421 | - <td><?php echo $renderer->render($formFlight->getElement('fk_pilot'),['ajax' => true]); ?></td> |
|
421 | + <td><?php echo $renderer->render($formFlight->getElement('fk_pilot'), ['ajax' => true]); ?></td> |
|
422 | 422 | </tr> |
423 | 423 | <?php endif; ?> |
424 | 424 | |
425 | - <?php if($formFlight->has('BBC_ballons_idBBC_ballons')): ?> |
|
425 | + <?php if ($formFlight->has('BBC_ballons_idBBC_ballons')): ?> |
|
426 | 426 | <tr> |
427 | 427 | <td width="25%" class="fieldrequired">Ballon</td> |
428 | 428 | <td><?php echo $renderer->render($formFlight->getElement('BBC_ballons_idBBC_ballons')); ?></td> |
@@ -457,7 +457,7 @@ discard block |
||
457 | 457 | </table> |
458 | 458 | </section> |
459 | 459 | |
460 | - <?php if($formFlight->has('fk_organisateur')): ?> |
|
460 | + <?php if ($formFlight->has('fk_organisateur')): ?> |
|
461 | 461 | <section class="form-section"> |
462 | 462 | <h1 class="form-section-title"><span class="js-organisator-field">Organisateur</span></h1> |
463 | 463 | <table class="border" width="50%"> |
@@ -466,7 +466,7 @@ discard block |
||
466 | 466 | <td> |
467 | 467 | <?php |
468 | 468 | //organisateur |
469 | - print $renderer->render($formFlight->getElement('fk_organisateur'),['ajax' => true]); |
|
469 | + print $renderer->render($formFlight->getElement('fk_organisateur'), ['ajax' => true]); |
|
470 | 470 | ?> |
471 | 471 | </td> |
472 | 472 | </tr> |
@@ -478,7 +478,7 @@ discard block |
||
478 | 478 | <section class="form-section js-expensable-field"> |
479 | 479 | <h1 class="form-section-title"><?php echo $langs->trans('Déplacements') ?></h1> |
480 | 480 | <table class="border" width="50%"> |
481 | - <?php if($formFlight->has('kilometers')): ?> |
|
481 | + <?php if ($formFlight->has('kilometers')): ?> |
|
482 | 482 | <!-- number of kilometers done for the flight --> |
483 | 483 | <tr> |
484 | 484 | <td class="fieldrequired">Nombre de kilometres effectués pour le vol</td> |
@@ -488,7 +488,7 @@ discard block |
||
488 | 488 | </tr> |
489 | 489 | <?php endif; ?> |
490 | 490 | |
491 | - <?php if($formFlight->has('justif_kilometers')): ?> |
|
491 | + <?php if ($formFlight->has('justif_kilometers')): ?> |
|
492 | 492 | <!-- Justif Kilometers --> |
493 | 493 | <tr> |
494 | 494 | |
@@ -506,7 +506,7 @@ discard block |
||
506 | 506 | <section class="form-section"> |
507 | 507 | <h1 class="form-section-title"><?php echo $langs->trans('Passager') ?></h1> |
508 | 508 | <table class="border" width="50%"> |
509 | - <?php if($formFlight->has('nbrPax')): ?> |
|
509 | + <?php if ($formFlight->has('nbrPax')): ?> |
|
510 | 510 | <tr> |
511 | 511 | <td class="fieldrequired"><?php echo $langs->trans('Nombre de passagers'); ?></td> |
512 | 512 | <td> |
@@ -515,7 +515,7 @@ discard block |
||
515 | 515 | </tr> |
516 | 516 | <?php endif; ?> |
517 | 517 | |
518 | - <?php if($formFlight->has('passengerNames')): ?> |
|
518 | + <?php if ($formFlight->has('passengerNames')): ?> |
|
519 | 519 | <!-- passenger names --> |
520 | 520 | <tr> |
521 | 521 | <td width="25%" class="fieldrequired"><?php echo $langs->trans('Noms des passagers'); ?><br/>(Séparé |
@@ -525,7 +525,7 @@ discard block |
||
525 | 525 | <?php print $renderer->render($formFlight->getElement('passengerNames')); ?> |
526 | 526 | </td> |
527 | 527 | </tr> |
528 | - <?php endif;?> |
|
528 | + <?php endif; ?> |
|
529 | 529 | </table> |
530 | 530 | </section> |
531 | 531 | |
@@ -534,17 +534,17 @@ discard block |
||
534 | 534 | <h1 class="form-section-title js-billable-field"><?php echo $langs->trans('Facturation') ?></h1> |
535 | 535 | <table class="border" width="50%"> |
536 | 536 | |
537 | - <?php if($formFlight->has('fk_receiver')): ?> |
|
537 | + <?php if ($formFlight->has('fk_receiver')): ?> |
|
538 | 538 | <!-- Money receiver --> |
539 | 539 | <tr class="js-hide-order js-billable-field"> |
540 | 540 | <td class="fieldrequired"><?php echo $langs->trans('Qui a perçu l\'argent') ?></td> |
541 | 541 | <td> |
542 | - <?php print $renderer->render($formFlight->getElement('fk_receiver'),['ajax' => true]); ?> |
|
542 | + <?php print $renderer->render($formFlight->getElement('fk_receiver'), ['ajax' => true]); ?> |
|
543 | 543 | </td> |
544 | 544 | </tr> |
545 | 545 | <?php endif; ?> |
546 | 546 | |
547 | - <?php if($formFlight->has('cost')): ?> |
|
547 | + <?php if ($formFlight->has('cost')): ?> |
|
548 | 548 | <!-- Flight cost --> |
549 | 549 | <tr class="js-hide-order js-billable-field"> |
550 | 550 | <td class="fieldrequired">Montant perçu</td> |
@@ -565,7 +565,7 @@ discard block |
||
565 | 565 | <h1 class="form-section-title"><?php echo $langs->trans('Commentaires') ?></h1> |
566 | 566 | <table class="border" width="50%"> |
567 | 567 | |
568 | - <?php if($formFlight->has('remarque')): ?> |
|
568 | + <?php if ($formFlight->has('remarque')): ?> |
|
569 | 569 | <!-- commentaires --> |
570 | 570 | <tr class=""> |
571 | 571 | <td class="fieldrequired"> Commentaire</td> |
@@ -575,7 +575,7 @@ discard block |
||
575 | 575 | </tr> |
576 | 576 | <?php endif; ?> |
577 | 577 | |
578 | - <?php if($formFlight->has('incidents')): ?> |
|
578 | + <?php if ($formFlight->has('incidents')): ?> |
|
579 | 579 | <!-- incidents --> |
580 | 580 | <tr class=""> |
581 | 581 | <td class="fieldrequired"> incidents</td> |
@@ -609,7 +609,7 @@ discard block |
||
609 | 609 | $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('DeleteMyOjbect'), |
610 | 610 | $langs->trans('êtes-vous sure de vouloir supprimer ce vol ?'), 'confirm_delete', '', 0, 1); |
611 | 611 | print $formconfirm; |
612 | - } elseif ($user->rights->flightlog->vol->financial && $action == ACTION_FLAG_BILLED) { |
|
612 | + } elseif ($user->rights->flightlog->vol->financial && $action == ACTION_FLAG_BILLED) { |
|
613 | 613 | $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, |
614 | 614 | $langs->trans('Marque comme facturé'), |
615 | 615 | $langs->trans('Ce vol va être marqué comme facturé, est-ce bien le cas ?'), ACTION_CONFIRM_FLAG_BILLED, '', |
@@ -657,29 +657,29 @@ discard block |
||
657 | 657 | print '<tr><td class="fieldrequired">' . $langs->trans("Fieldfk_pilot") . '</td><td>' . $pilot->getNomUrl(1) . '</td></tr>'; |
658 | 658 | print '<tr><td class="fieldrequired">' . $langs->trans("Fieldfk_organisateur") . '</td><td>' . $organisator->getNomUrl(1) . '</td></tr>'; |
659 | 659 | |
660 | - if (! empty($conf->projet->enabled)) |
|
660 | + if (!empty($conf->projet->enabled)) |
|
661 | 661 | { |
662 | 662 | print '<tr><td class="fieldrequired">' . $langs->trans("Project") . '</td><td>'; |
663 | 663 | $morehtmlref = ''; |
664 | 664 | if ($user->rights->projet->creer) |
665 | 665 | { |
666 | 666 | if ($action !== ACTION_CLASSIFY) { |
667 | - $morehtmlref .= '<a href="' . $_SERVER['PHP_SELF'] . '?action='.ACTION_CLASSIFY.'&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> '; |
|
667 | + $morehtmlref .= '<a href="' . $_SERVER['PHP_SELF'] . '?action=' . ACTION_CLASSIFY . '&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> '; |
|
668 | 668 | } |
669 | 669 | if ($action === ACTION_CLASSIFY) { |
670 | - $morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">'; |
|
671 | - $morehtmlref.='<input type="hidden" name="action" value="'.ACTION_CLASSIN.'">'; |
|
672 | - $morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
673 | - $morehtmlref.=$formproject->select_projects((empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS)?$object->socid:-1), $object->fk_project, 'projectid', 80, 0, 1, 0, 1, 0, 0, '', 1); |
|
674 | - $morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">'; |
|
675 | - $morehtmlref.='</form>'; |
|
670 | + $morehtmlref .= '<form method="post" action="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '">'; |
|
671 | + $morehtmlref .= '<input type="hidden" name="action" value="' . ACTION_CLASSIN . '">'; |
|
672 | + $morehtmlref .= '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">'; |
|
673 | + $morehtmlref .= $formproject->select_projects((empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS) ? $object->socid : -1), $object->fk_project, 'projectid', 80, 0, 1, 0, 1, 0, 0, '', 1); |
|
674 | + $morehtmlref .= '<input type="submit" class="button valignmiddle" value="' . $langs->trans("Modify") . '">'; |
|
675 | + $morehtmlref .= '</form>'; |
|
676 | 676 | } |
677 | 677 | } |
678 | 678 | |
679 | 679 | if ($object->hasProject()) { |
680 | 680 | $proj = new Project($db); |
681 | 681 | $proj->fetch($object->fk_project); |
682 | - $morehtmlref.=$proj->getNomUrl(1); |
|
682 | + $morehtmlref .= $proj->getNomUrl(1); |
|
683 | 683 | } |
684 | 684 | print $morehtmlref . '</td>'; |
685 | 685 | } |
@@ -694,7 +694,7 @@ discard block |
||
694 | 694 | print '<div class="tabsAction">' . "\n"; |
695 | 695 | $parameters = array(); |
696 | 696 | $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, |
697 | - $action); // Note that $action and $object may have been modified by hook |
|
697 | + $action); // Note that $action and $object may have been modified by hook |
|
698 | 698 | if ($reshook < 0) { |
699 | 699 | setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
700 | 700 | } |
@@ -723,10 +723,10 @@ discard block |
||
723 | 723 | <?php endif; ?> |
724 | 724 | |
725 | 725 | <!-- Toggle static flight --> |
726 | - <?php if($user->rights->flightlog->vol->advanced || $user->rights->flightlog->pilot->edit || $user->rights->flightlog->vol->edit || ($user->rights->flightlog->vol->add && $object->fk_pilot == $user->id)): ?> |
|
726 | + <?php if ($user->rights->flightlog->vol->advanced || $user->rights->flightlog->pilot->edit || $user->rights->flightlog->vol->edit || ($user->rights->flightlog->vol->add && $object->fk_pilot == $user->id)): ?> |
|
727 | 727 | <div class="inline-block divButAction"> |
728 | 728 | <a class="butAction" href="<?php echo sprintf('%s?id=%s&action=%s', $_SERVER["PHP_SELF"], $object->id, ACTION_TOGGLE_STATIC); ?>"> |
729 | - <?php if(!$object->isStaticFlight()): ?> |
|
729 | + <?php if (!$object->isStaticFlight()): ?> |
|
730 | 730 | <?php echo $langs->trans("Vol static") ?> |
731 | 731 | <?php else: ?> |
732 | 732 | <?php echo $langs->trans("Non static") ?> |
@@ -736,10 +736,10 @@ discard block |
||
736 | 736 | <?php endif; ?> |
737 | 737 | |
738 | 738 | <!-- Toggle night flight --> |
739 | - <?php if($user->rights->flightlog->vol->advanced || $user->rights->flightlog->pilot->edit || $user->rights->flightlog->vol->edit || ($user->rights->flightlog->vol->add && $object->fk_pilot == $user->id)): ?> |
|
739 | + <?php if ($user->rights->flightlog->vol->advanced || $user->rights->flightlog->pilot->edit || $user->rights->flightlog->vol->edit || ($user->rights->flightlog->vol->add && $object->fk_pilot == $user->id)): ?> |
|
740 | 740 | <div class="inline-block divButAction"> |
741 | 741 | <a class="butAction" href="<?php echo sprintf('%s?id=%s&action=%s', $_SERVER["PHP_SELF"], $object->id, ACTION_TOGGLE_NIGHT); ?>"> |
742 | - <?php if(!$object->isNightFlight()): ?> |
|
742 | + <?php if (!$object->isNightFlight()): ?> |
|
743 | 743 | <?php echo $langs->trans("Vol de nuit") ?> |
744 | 744 | <?php else: ?> |
745 | 745 | <?php echo $langs->trans("Non nuit") ?> |
@@ -14,7 +14,7 @@ |
||
14 | 14 | final class PilotListController extends WebController |
15 | 15 | { |
16 | 16 | |
17 | - public function index(){ |
|
17 | + public function index() { |
|
18 | 18 | |
19 | 19 | $members = $this->getPilotRepository()->query(); |
20 | 20 |
@@ -24,7 +24,7 @@ |
||
24 | 24 | * |
25 | 25 | * @return Id|static |
26 | 26 | */ |
27 | - public static function create($id){ |
|
27 | + public static function create($id) { |
|
28 | 28 | return new self($id); |
29 | 29 | } |
30 | 30 |
@@ -23,7 +23,7 @@ |
||
23 | 23 | return self::no(); |
24 | 24 | } |
25 | 25 | |
26 | - if (is_numeric($value) || is_int($value) || (int)$value == $value) { |
|
26 | + if (is_numeric($value) || is_int($value) || (int) $value == $value) { |
|
27 | 27 | return new self($value == 1); |
28 | 28 | } |
29 | 29 |
@@ -16,7 +16,7 @@ |
||
16 | 16 | parent::__construct($name, FormElementInterface::TYPE_CHECKBOX, $options); |
17 | 17 | } |
18 | 18 | |
19 | - public function checkedValue(){ |
|
19 | + public function checkedValue() { |
|
20 | 20 | return 1; |
21 | 21 | } |
22 | 22 | } |
23 | 23 | \ No newline at end of file |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | public function __construct(\DoliDB $db, $tableName) |
24 | 24 | { |
25 | 25 | $this->db = $db; |
26 | - $this->tableName = strpos($tableName, MAIN_DB_PREFIX) === 0 ? $tableName : MAIN_DB_PREFIX.$tableName; |
|
26 | + $this->tableName = strpos($tableName, MAIN_DB_PREFIX) === 0 ? $tableName : MAIN_DB_PREFIX . $tableName; |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | /** |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | * |
34 | 34 | * @throws \Exception |
35 | 35 | */ |
36 | - protected function write(array $elements){ |
|
36 | + protected function write(array $elements) { |
|
37 | 37 | $columns = join(',', array_keys($elements)); |
38 | 38 | $values = join(',', array_map([$this, 'escape'], array_values($elements))); |
39 | 39 | |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | $lasterror = $this->db->lasterror(); |
45 | 45 | dol_syslog(__METHOD__ . ' ' . $lasterror, LOG_ERR); |
46 | 46 | $this->db->rollback(); |
47 | - throw new \Exception("Repository error - ".$lasterror); |
|
47 | + throw new \Exception("Repository error - " . $lasterror); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | $id = $this->db->last_insert_id($this->tableName); |
@@ -57,16 +57,16 @@ discard block |
||
57 | 57 | * |
58 | 58 | * @return int|string|null |
59 | 59 | */ |
60 | - private function escape($value){ |
|
61 | - if(is_null($value)){ |
|
60 | + private function escape($value) { |
|
61 | + if (is_null($value)) { |
|
62 | 62 | return 'NULL'; |
63 | 63 | } |
64 | 64 | |
65 | - if(is_bool($value)){ |
|
66 | - return (int)$value; |
|
65 | + if (is_bool($value)) { |
|
66 | + return (int) $value; |
|
67 | 67 | } |
68 | 68 | |
69 | - return is_string($value) ? "'".$this->db->escape($value)."'" : $value ; |
|
69 | + return is_string($value) ? "'" . $this->db->escape($value) . "'" : $value; |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | /** |
@@ -79,18 +79,18 @@ discard block |
||
79 | 79 | { |
80 | 80 | $sqlModifications = []; |
81 | 81 | |
82 | - foreach($elements as $field => $value){ |
|
82 | + foreach ($elements as $field => $value) { |
|
83 | 83 | $sqlModifications[] = sprintf('%s=%s', $field, $this->escape($value)); |
84 | 84 | } |
85 | 85 | |
86 | 86 | $this->db->begin(); |
87 | - $resql = $this->db->query(sprintf('UPDATE %s SET %s WHERE '.$idCol.' = %s ', $this->tableName, join(',',$sqlModifications), $id)); |
|
87 | + $resql = $this->db->query(sprintf('UPDATE %s SET %s WHERE ' . $idCol . ' = %s ', $this->tableName, join(',', $sqlModifications), $id)); |
|
88 | 88 | |
89 | 89 | if (!$resql) { |
90 | 90 | $lasterror = $this->db->lasterror(); |
91 | 91 | dol_syslog(__METHOD__ . ' ' . $lasterror, LOG_ERR); |
92 | 92 | $this->db->rollback(); |
93 | - throw new \Exception("Repository error - ".$lasterror); |
|
93 | + throw new \Exception("Repository error - " . $lasterror); |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | $this->db->commit(); |
@@ -104,8 +104,8 @@ discard block |
||
104 | 104 | * |
105 | 105 | * @return array|null |
106 | 106 | */ |
107 | - protected function get($id, $idCol = 'rowid'){ |
|
108 | - $sql = sprintf('SELECT * FROM %s WHERE '.$idCol.' = %s', $this->tableName, $id ); |
|
107 | + protected function get($id, $idCol = 'rowid') { |
|
108 | + $sql = sprintf('SELECT * FROM %s WHERE ' . $idCol . ' = %s', $this->tableName, $id); |
|
109 | 109 | |
110 | 110 | $resql = $this->db->query($sql); |
111 | 111 | if (!$resql) { |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | return null; |
118 | 118 | } |
119 | 119 | |
120 | - for($i = 0; $i < $num ; $i++) { |
|
120 | + for ($i = 0; $i < $num; $i++) { |
|
121 | 121 | return $this->db->fetch_array($resql); |
122 | 122 | } |
123 | 123 |
@@ -16,17 +16,17 @@ discard block |
||
16 | 16 | final class PilotEditController extends WebController |
17 | 17 | { |
18 | 18 | |
19 | - public function index(){ |
|
19 | + public function index() { |
|
20 | 20 | $id = $this->request->getParam('id'); |
21 | 21 | |
22 | - if($id === null){ |
|
22 | + if ($id === null) { |
|
23 | 23 | $this->renderHtml('<p>Paramètre ID non fournis.</p>'); |
24 | 24 | return; |
25 | 25 | } |
26 | 26 | |
27 | 27 | $command = new CreateUpdatePilotInformationCommand($id); |
28 | 28 | |
29 | - if($this->getPilotRepository()->exist(PilotId::create($id))){ |
|
29 | + if ($this->getPilotRepository()->exist(PilotId::create($id))) { |
|
30 | 30 | $command->fromPilot($this->getPilotRepository()->getById(PilotId::create($id))); |
31 | 31 | } |
32 | 32 | |
@@ -36,19 +36,19 @@ discard block |
||
36 | 36 | $user = new \User($this->db); |
37 | 37 | $user->fetch($id); |
38 | 38 | |
39 | - if($this->request->isPost()){ |
|
39 | + if ($this->request->isPost()) { |
|
40 | 40 | $form->setData($this->request->getPostParameters()); |
41 | 41 | |
42 | - if(!$form->validate()){ |
|
42 | + if (!$form->validate()) { |
|
43 | 43 | return $this->render('pilot/edit.phtml', [ |
44 | 44 | 'form' => $form, |
45 | 45 | ]); |
46 | 46 | } |
47 | 47 | |
48 | - try{ |
|
48 | + try { |
|
49 | 49 | $this->handle($form->getObject()); |
50 | - return $this->redirect($_SERVER["PHP_SELF"].'?id='.$id.'&r=list_members'); |
|
51 | - }catch(\Exception $e){ |
|
50 | + return $this->redirect($_SERVER["PHP_SELF"] . '?id=' . $id . '&r=list_members'); |
|
51 | + } catch (\Exception $e) { |
|
52 | 52 | print $e->getMessage(); |
53 | 53 | dol_syslog($e->getMessage(), LOG_ERR); |
54 | 54 | } |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | /** |
77 | 77 | * @return CreateUpdatePilotInformationCommandHandler() |
78 | 78 | */ |
79 | - private function getHandler(){ |
|
79 | + private function getHandler() { |
|
80 | 80 | return new CreateUpdatePilotInformationCommandHandler($this->getPilotRepository()); |
81 | 81 | } |
82 | 82 |