@@ -25,7 +25,7 @@ |
||
25 | 25 | * |
26 | 26 | * @return Redirect |
27 | 27 | */ |
28 | - public static function create($url){ |
|
28 | + public static function create($url) { |
|
29 | 29 | return new self($url); |
30 | 30 | } |
31 | 31 |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | */ |
251 | 251 | private function addOrderDiscount($order, $pilotFlightCount, $service, $year) |
252 | 252 | { |
253 | - $price = $pilotFlightCount->getCost()->getValue()/(1+$service->tva_tx/100); |
|
253 | + $price = $pilotFlightCount->getCost()->getValue() / (1 + $service->tva_tx / 100); |
|
254 | 254 | $pu_ht = price2num($price, 'MU'); |
255 | 255 | $desc = $year . " - " . $service->label . " - (" . $pilotFlightCount->getCount() . " * " . $pilotFlightCount->getFactor() . ")"; |
256 | 256 | |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | return; |
282 | 282 | } |
283 | 283 | |
284 | - $pointsHt = $command->getAdditionalBonus()/(1+6/100); |
|
284 | + $pointsHt = $command->getAdditionalBonus() / (1 + 6 / 100); |
|
285 | 285 | $desc = sprintf("%s - %s", $command->getYear(), $command->getBonusAdditionalMessage()); |
286 | 286 | |
287 | 287 | $discountid = $this->getCompany($object->socid)->set_remise_except($pointsHt, $this->user, $desc, 6); |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | { |
302 | 302 | $price = $damage->getCost()->addCost($invoicedDamage->getCost())->getValue(); |
303 | 303 | |
304 | - if($price <= 0 ){ |
|
304 | + if ($price <= 0) { |
|
305 | 305 | return; |
306 | 306 | } |
307 | 307 |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | |
50 | 50 | $id = GETPOST('id', 'int') ?: GETPOST('idBBC_vols', 'int'); |
51 | 51 | $action = GETPOST('action', 'alpha'); |
52 | -$permissiondellink=$user->rights->flightlog->vol->financial; |
|
52 | +$permissiondellink = $user->rights->flightlog->vol->financial; |
|
53 | 53 | |
54 | 54 | $object = new Bbcvols($db); |
55 | 55 | |
@@ -57,8 +57,8 @@ discard block |
||
57 | 57 | $extralabels = $extrafields->fetch_name_optionals_label($object->table_element); |
58 | 58 | |
59 | 59 | // Load object |
60 | -include DOL_DOCUMENT_ROOT . '/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals |
|
61 | -include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; |
|
60 | +include DOL_DOCUMENT_ROOT . '/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals |
|
61 | +include DOL_DOCUMENT_ROOT . '/core/actions_dellink.inc.php'; |
|
62 | 62 | |
63 | 63 | // Initialize technical object to manage hooks of modules. Note that conf->hooks_modules contains array array |
64 | 64 | $hookmanager->initHooks(array('bbcvols')); |
@@ -85,13 +85,13 @@ discard block |
||
85 | 85 | FLIGHTLOG_ACTION_HANDLE_ADD_DAMAGE => [AddFlightDamageController::class, 'view'], |
86 | 86 | ]; |
87 | 87 | |
88 | - if(isset($routes[$action])){ |
|
88 | + if (isset($routes[$action])) { |
|
89 | 89 | $controllerName = $routes[$action][0]; |
90 | 90 | $actionName = $routes[$action][1]; |
91 | 91 | |
92 | 92 | $response = call_user_func([new $controllerName($db), $actionName]); |
93 | 93 | |
94 | - if($response instanceof \FlightLog\Http\Web\Response\Redirect){ |
|
94 | + if ($response instanceof \FlightLog\Http\Web\Response\Redirect) { |
|
95 | 95 | if (headers_sent()) { |
96 | 96 | echo(sprintf("<script>location.href='%s'</script>", $response->getUrl())); |
97 | 97 | exit; |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | } |
103 | 103 | |
104 | 104 | include $response->getTemplate(); |
105 | - }else{ |
|
105 | + } else { |
|
106 | 106 | echo 'Route non trouvée.'; |
107 | 107 | } |
108 | 108 | ?> |
@@ -114,13 +114,13 @@ discard block |
||
114 | 114 | // Buttons |
115 | 115 | print '<div class="tabsAction">' . "\n"; |
116 | 116 | |
117 | -if($user->rights->flightlog->vol->financial){ |
|
118 | - print '<div class="inline-block divButAction"><a class="butAction" href="' . DOL_URL_ROOT . '/flightlog/card_tab_damage.php?id=' . $object->id.'&action='.FLIGHTLOG_ACTION_ADD_DAMAGE.'">' . $langs->trans("Ajouter") . '</a></div>' . "\n"; |
|
117 | +if ($user->rights->flightlog->vol->financial) { |
|
118 | + print '<div class="inline-block divButAction"><a class="butAction" href="' . DOL_URL_ROOT . '/flightlog/card_tab_damage.php?id=' . $object->id . '&action=' . FLIGHTLOG_ACTION_ADD_DAMAGE . '">' . $langs->trans("Ajouter") . '</a></div>' . "\n"; |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | print '</div>' . "\n"; |
122 | 122 | |
123 | -if($user->rights->flightlog->vol->financial){ |
|
123 | +if ($user->rights->flightlog->vol->financial) { |
|
124 | 124 | print '<div class="fichecenter"><div class="fichehalfleft">'; |
125 | 125 | $form->showLinkedObjectBlock($object); |
126 | 126 | print '</div></div>'; |
@@ -102,7 +102,7 @@ |
||
102 | 102 | } |
103 | 103 | |
104 | 104 | include $response->getTemplate(); |
105 | - }else{ |
|
105 | + } else{ |
|
106 | 106 | echo 'Route non trouvée.'; |
107 | 107 | } |
108 | 108 | ?> |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | $routesGuards = require './Infrastructure/Common/Routes/guards.conf.php'; |
54 | 54 | |
55 | 55 | $response = null; |
56 | -try{ |
|
56 | +try { |
|
57 | 57 | $routeName = GETPOST('r'); |
58 | 58 | |
59 | 59 | $routeManager = new \FlightLog\Infrastructure\Common\Routes\RouteManager($db); |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | |
63 | 63 | $response = $routeManager->__invoke($routeName, $user); |
64 | 64 | |
65 | - if($response instanceof \FlightLog\Http\Web\Response\Redirect){ |
|
65 | + if ($response instanceof \FlightLog\Http\Web\Response\Redirect) { |
|
66 | 66 | if (headers_sent()) { |
67 | 67 | echo(sprintf("<script>location.href='%s'</script>", $response->getUrl())); |
68 | 68 | exit; |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | exit; |
73 | 73 | } |
74 | 74 | |
75 | -}catch (\Exception $e){ |
|
75 | +} catch (\Exception $e) { |
|
76 | 76 | dol_syslog($e->getMessage(), LOG_ERR); |
77 | 77 | $response = new \FlightLog\Http\Web\Response\Response($e->getMessage()); |
78 | 78 | } |
@@ -72,7 +72,7 @@ |
||
72 | 72 | exit; |
73 | 73 | } |
74 | 74 | |
75 | -}catch (\Exception $e){ |
|
75 | +} catch (\Exception $e){ |
|
76 | 76 | dol_syslog($e->getMessage(), LOG_ERR); |
77 | 77 | $response = new \FlightLog\Http\Web\Response\Response($e->getMessage()); |
78 | 78 | } |
@@ -38,8 +38,8 @@ discard block |
||
38 | 38 | * |
39 | 39 | * @throws \Exception |
40 | 40 | */ |
41 | - public function add(Route $route){ |
|
42 | - if(isset($this->routes[$route->getName()])){ |
|
41 | + public function add(Route $route) { |
|
42 | + if (isset($this->routes[$route->getName()])) { |
|
43 | 43 | throw new \Exception('Route exists'); |
44 | 44 | } |
45 | 45 | |
@@ -51,8 +51,8 @@ discard block |
||
51 | 51 | * |
52 | 52 | * @throws \Exception |
53 | 53 | */ |
54 | - public function load(array $routes){ |
|
55 | - foreach($routes as $currentRoute){ |
|
54 | + public function load(array $routes) { |
|
55 | + foreach ($routes as $currentRoute) { |
|
56 | 56 | $this->add($currentRoute); |
57 | 57 | } |
58 | 58 | } |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | */ |
63 | 63 | public function loadGuards($routesGuards) |
64 | 64 | { |
65 | - foreach($routesGuards as $guard){ |
|
65 | + foreach ($routesGuards as $guard) { |
|
66 | 66 | $this->guards[$guard->getRouteName()] = $guard; |
67 | 67 | } |
68 | 68 | } |
@@ -73,8 +73,8 @@ discard block |
||
73 | 73 | * @param $routeName |
74 | 74 | * @return bool |
75 | 75 | */ |
76 | - public function isAuthorized(User $user, $routeName){ |
|
77 | - if(!isset($this->guards[$routeName])){ |
|
76 | + public function isAuthorized(User $user, $routeName) { |
|
77 | + if (!isset($this->guards[$routeName])) { |
|
78 | 78 | return true; |
79 | 79 | } |
80 | 80 | |
@@ -92,11 +92,11 @@ discard block |
||
92 | 92 | */ |
93 | 93 | public function __invoke($name, User $user) |
94 | 94 | { |
95 | - if(!isset($this->routes[$name])){ |
|
95 | + if (!isset($this->routes[$name])) { |
|
96 | 96 | throw new \Exception('Route not found'); |
97 | 97 | } |
98 | 98 | |
99 | - if(!$this->isAuthorized($user, $name)){ |
|
99 | + if (!$this->isAuthorized($user, $name)) { |
|
100 | 100 | throw new \Exception('Action not allowed'); |
101 | 101 | } |
102 | 102 |
@@ -58,8 +58,8 @@ discard block |
||
58 | 58 | * |
59 | 59 | * @return int |
60 | 60 | */ |
61 | - public function showLinkedObjectBlock(array $params = [], $object){ |
|
62 | - if(!isset($object->linkedObjectsIds) || !isset($object->linkedObjectsIds['flightlog_damage'])){ |
|
61 | + public function showLinkedObjectBlock(array $params = [], $object) { |
|
62 | + if (!isset($object->linkedObjectsIds) || !isset($object->linkedObjectsIds['flightlog_damage'])) { |
|
63 | 63 | return 0; |
64 | 64 | } |
65 | 65 | |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | dol_include_once('/flightlog/flightlog.inc.php'); |
70 | 70 | $queryRepository = new \FlightLog\Infrastructure\Damage\Query\Repository\GetDamageQueryRepository($db); |
71 | 71 | |
72 | - foreach($object->linkedObjectsIds['flightlog_damage'] as $damageId){ |
|
72 | + foreach ($object->linkedObjectsIds['flightlog_damage'] as $damageId) { |
|
73 | 73 | try { |
74 | 74 | $object->linkedObjects['flightlog_damage'][$damageId] = $queryRepository->query($damageId); |
75 | 75 | } catch (Exception $e) { |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | return $sql; |
100 | 100 | } |
101 | 101 | |
102 | - public function completeListOfReferent(){ |
|
102 | + public function completeListOfReferent() { |
|
103 | 103 | dol_include_once('/flightlog/class/bbcvols.class.php'); |
104 | 104 | |
105 | 105 | $this->results['flightlog'] = [ |
@@ -47,7 +47,7 @@ |
||
47 | 47 | ?> |
48 | 48 | <tr <?php echo $GLOBALS['bc'][$var]; ?> > |
49 | 49 | <td><?php echo $langs->trans("Dégâts"); ?></td> |
50 | - <td><a href="<?php echo sprintf(DOL_URL_ROOT.'/flightlog/index.php?id=%s&r=%s', $damage->getId(), 'get_one_damage');?>"><?php echo $damage->getId()?></a></td> |
|
50 | + <td><a href="<?php echo sprintf(DOL_URL_ROOT . '/flightlog/index.php?id=%s&r=%s', $damage->getId(), 'get_one_damage'); ?>"><?php echo $damage->getId()?></a></td> |
|
51 | 51 | <td align="center"><?php echo $damage->getAuthorName(); ?></td> |
52 | 52 | <td align="center"></td> |
53 | 53 | <td align="right"><?echo price($damage->getAmount()) ?>€</td> |