@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | $this->results["flightlog"] = [ |
| 30 | 30 | 'label' => $langs->trans("Search flight"), |
| 31 | 31 | 'text' => $langs->trans("Search flight"), |
| 32 | - 'url' => DOL_URL_ROOT . '/flightlog/list.php?mainmenu=flightlog&sall='.$searchInfo['search_boxvalue'] |
|
| 32 | + 'url' => DOL_URL_ROOT . '/flightlog/list.php?mainmenu=flightlog&sall=' . $searchInfo['search_boxvalue'] |
|
| 33 | 33 | ]; |
| 34 | 34 | } |
| 35 | 35 | |
@@ -38,8 +38,8 @@ discard block |
||
| 38 | 38 | * @param $object |
| 39 | 39 | * @param $action |
| 40 | 40 | */ |
| 41 | - public function showLinkToObjectBlock($parameter, $object, $action){ |
|
| 42 | - $this->results["flightlog_bbcvols"]= array('enabled'=>1, 'perms'=>1, 'label'=>'LinkToFlight', 'sql'=>"SELECT f.idBBC_vols as rowid, CONCAT('(ID : ',f.idBBC_vols, ') -',f.date, '-',f.lieuD, ' ; ', f.lieuA) as ref FROM ".MAIN_DB_PREFIX."bbc_vols as f WHERE YEAR(f.date) = (YEAR(NOW())) ORDER BY date DESC"); |
|
| 41 | + public function showLinkToObjectBlock($parameter, $object, $action) { |
|
| 42 | + $this->results["flightlog_bbcvols"] = array('enabled'=>1, 'perms'=>1, 'label'=>'LinkToFlight', 'sql'=>"SELECT f.idBBC_vols as rowid, CONCAT('(ID : ',f.idBBC_vols, ') -',f.date, '-',f.lieuD, ' ; ', f.lieuA) as ref FROM " . MAIN_DB_PREFIX . "bbc_vols as f WHERE YEAR(f.date) = (YEAR(NOW())) ORDER BY date DESC"); |
|
| 43 | 43 | |
| 44 | 44 | } |
| 45 | 45 | } |
| 46 | 46 | \ No newline at end of file |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | |
| 44 | 44 | $id = GETPOST('id', 'int') ?: GETPOST('idBBC_vols', 'int'); |
| 45 | 45 | $action = GETPOST('action', 'alpha'); |
| 46 | -$permissiondellink=$user->rights->flightlog->vol->financial; |
|
| 46 | +$permissiondellink = $user->rights->flightlog->vol->financial; |
|
| 47 | 47 | |
| 48 | 48 | $object = new Bbcvols($db); |
| 49 | 49 | $extrafields = new ExtraFields($db); |
@@ -62,8 +62,8 @@ discard block |
||
| 62 | 62 | $extralabels = $extrafields->fetch_name_optionals_label($object->table_element); |
| 63 | 63 | |
| 64 | 64 | // Load object |
| 65 | -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 |
|
| 66 | -include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; |
|
| 65 | +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 |
|
| 66 | +include DOL_DOCUMENT_ROOT . '/core/actions_dellink.inc.php'; |
|
| 67 | 67 | |
| 68 | 68 | // Initialize technical object to manage hooks of modules. Note that conf->hooks_modules contains array array |
| 69 | 69 | $hookmanager->initHooks(array('bbcvols')); |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | print '<div class="tabsAction">' . "\n"; |
| 100 | 100 | print '</div>' . "\n"; |
| 101 | 101 | |
| 102 | -if($user->rights->flightlog->vol->financial){ |
|
| 102 | +if ($user->rights->flightlog->vol->financial) { |
|
| 103 | 103 | print '<div class="fichecenter"><div class="fichehalfleft">'; |
| 104 | 104 | $form->showLinkedObjectBlock($object); |
| 105 | 105 | print '</div></div>'; |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | |
| 44 | 44 | $id = GETPOST('id', 'int') ?: GETPOST('idBBC_vols', 'int'); |
| 45 | 45 | $action = GETPOST('action', 'alpha'); |
| 46 | -$permissiondellink=$user->rights->flightlog->vol->financial; |
|
| 46 | +$permissiondellink = $user->rights->flightlog->vol->financial; |
|
| 47 | 47 | |
| 48 | 48 | $object = new Bbcvols($db); |
| 49 | 49 | $extrafields = new ExtraFields($db); |
@@ -62,8 +62,8 @@ discard block |
||
| 62 | 62 | $extralabels = $extrafields->fetch_name_optionals_label($object->table_element); |
| 63 | 63 | |
| 64 | 64 | // Load object |
| 65 | -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 |
|
| 66 | -include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; |
|
| 65 | +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 |
|
| 66 | +include DOL_DOCUMENT_ROOT . '/core/actions_dellink.inc.php'; |
|
| 67 | 67 | |
| 68 | 68 | // Initialize technical object to manage hooks of modules. Note that conf->hooks_modules contains array array |
| 69 | 69 | $hookmanager->initHooks(array('bbcvols')); |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | print '<tr><td class="fieldrequired">' . $langs->trans("Fielddate") . '</td><td>' . dol_print_date($object->date) . '</td></tr>'; |
| 94 | 94 | |
| 95 | 95 | if ($user->rights->flightlog->vol->financial) { |
| 96 | - print '<tr><td class="fieldrequired">' . $langs->trans("Fieldis_facture") . '</td><td>' . $object->getLibStatut(5). '</td></tr>'; |
|
| 96 | + print '<tr><td class="fieldrequired">' . $langs->trans("Fieldis_facture") . '</td><td>' . $object->getLibStatut(5) . '</td></tr>'; |
|
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | print '<tr><td class="fieldrequired">' . $langs->trans("Fieldkilometers") . '</td><td>' . $object->kilometers . ' KM</td></tr>'; |
@@ -107,13 +107,13 @@ discard block |
||
| 107 | 107 | // Buttons |
| 108 | 108 | print '<div class="tabsAction">' . "\n"; |
| 109 | 109 | |
| 110 | -if($user->rights->flightlog->vol->financial && $object->fk_type == 2 && !$object->hasFacture()){ |
|
| 111 | - print '<div class="inline-block divButAction"><a class="butAction" href="' . DOL_URL_ROOT . '/flightlog/facture.php?id=' . $object->id.'">' . $langs->trans("Facturer") . '</a></div>' . "\n"; |
|
| 110 | +if ($user->rights->flightlog->vol->financial && $object->fk_type == 2 && !$object->hasFacture()) { |
|
| 111 | + print '<div class="inline-block divButAction"><a class="butAction" href="' . DOL_URL_ROOT . '/flightlog/facture.php?id=' . $object->id . '">' . $langs->trans("Facturer") . '</a></div>' . "\n"; |
|
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | print '</div>' . "\n"; |
| 115 | 115 | |
| 116 | -if($user->rights->flightlog->vol->financial){ |
|
| 116 | +if ($user->rights->flightlog->vol->financial) { |
|
| 117 | 117 | print '<div class="fichecenter"><div class="fichehalfleft">'; |
| 118 | 118 | $form->showLinkedObjectBlock($object); |
| 119 | 119 | print '</div></div>'; |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | |
| 44 | 44 | $id = GETPOST('id', 'int') ?: GETPOST('idBBC_vols', 'int'); |
| 45 | 45 | $action = GETPOST('action', 'alpha'); |
| 46 | -$permissiondellink=$user->rights->flightlog->vol->financial; |
|
| 46 | +$permissiondellink = $user->rights->flightlog->vol->financial; |
|
| 47 | 47 | |
| 48 | 48 | $object = new Bbcvols($db); |
| 49 | 49 | $extrafields = new ExtraFields($db); |
@@ -62,8 +62,8 @@ discard block |
||
| 62 | 62 | $extralabels = $extrafields->fetch_name_optionals_label($object->table_element); |
| 63 | 63 | |
| 64 | 64 | // Load object |
| 65 | -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 |
|
| 66 | -include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; |
|
| 65 | +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 |
|
| 66 | +include DOL_DOCUMENT_ROOT . '/core/actions_dellink.inc.php'; |
|
| 67 | 67 | |
| 68 | 68 | // Initialize technical object to manage hooks of modules. Note that conf->hooks_modules contains array array |
| 69 | 69 | $hookmanager->initHooks(array('bbcvols')); |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | print '<div class="tabsAction">' . "\n"; |
| 100 | 100 | print '</div>' . "\n"; |
| 101 | 101 | |
| 102 | -if($user->rights->flightlog->vol->financial){ |
|
| 102 | +if ($user->rights->flightlog->vol->financial) { |
|
| 103 | 103 | print '<div class="fichecenter"><div class="fichehalfleft">'; |
| 104 | 104 | $form->showLinkedObjectBlock($object); |
| 105 | 105 | print '</div></div>'; |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | private $pilot; |
| 87 | 87 | |
| 88 | 88 | /** |
| 89 | - * @return int |
|
| 89 | + * @return string |
|
| 90 | 90 | */ |
| 91 | 91 | public function getIdBBCVols() |
| 92 | 92 | { |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | /** |
| 97 | - * @return int |
|
| 97 | + * @return string |
|
| 98 | 98 | */ |
| 99 | 99 | public function getId() |
| 100 | 100 | { |
@@ -149,10 +149,10 @@ discard block |
||
| 149 | 149 | $this->lieuA = trim($this->lieuA); |
| 150 | 150 | } |
| 151 | 151 | if (isset($this->heureD)) { |
| 152 | - $this->heureD = trim($this->heureD).'00'; |
|
| 152 | + $this->heureD = trim($this->heureD) . '00'; |
|
| 153 | 153 | } |
| 154 | 154 | if (isset($this->heureA)) { |
| 155 | - $this->heureA = trim($this->heureA).'00'; |
|
| 155 | + $this->heureA = trim($this->heureA) . '00'; |
|
| 156 | 156 | } |
| 157 | 157 | if (isset($this->BBC_ballons_idBBC_ballons)) { |
| 158 | 158 | $this->BBC_ballons_idBBC_ballons = trim($this->BBC_ballons_idBBC_ballons); |
@@ -891,7 +891,7 @@ discard block |
||
| 891 | 891 | */ |
| 892 | 892 | public function hasPax() |
| 893 | 893 | { |
| 894 | - return (int)$this->nbrPax > 0; |
|
| 894 | + return (int) $this->nbrPax > 0; |
|
| 895 | 895 | } |
| 896 | 896 | |
| 897 | 897 | /** |
@@ -26,58 +26,58 @@ discard block |
||
| 26 | 26 | */ |
| 27 | 27 | class InterfaceMailOnIncident extends DolibarrTriggers |
| 28 | 28 | { |
| 29 | - /** |
|
| 30 | - * @var DoliDB Database handler |
|
| 31 | - */ |
|
| 32 | - protected $db; |
|
| 33 | - |
|
| 34 | - /** |
|
| 35 | - * Constructor |
|
| 36 | - * |
|
| 37 | - * @param DoliDB $db Database handler |
|
| 38 | - */ |
|
| 39 | - public function __construct($db) |
|
| 40 | - { |
|
| 41 | - $this->db = $db; |
|
| 42 | - |
|
| 43 | - $this->name = preg_replace('/^Interface/i', '', get_class($this)); |
|
| 44 | - $this->family = "Belgian balloon club"; |
|
| 45 | - $this->description = "Trigger that send an e-mail on flight incident."; |
|
| 46 | - $this->version = '1.0'; |
|
| 47 | - $this->picto = 'flightlog@flightlog'; |
|
| 48 | - } |
|
| 49 | - |
|
| 50 | - /** |
|
| 51 | - * Trigger name |
|
| 52 | - * |
|
| 53 | - * @return string Name of trigger file |
|
| 54 | - */ |
|
| 55 | - public function getName() |
|
| 56 | - { |
|
| 57 | - return $this->name; |
|
| 58 | - } |
|
| 59 | - |
|
| 60 | - /** |
|
| 61 | - * Trigger description |
|
| 62 | - * |
|
| 63 | - * @return string Description of trigger file |
|
| 64 | - */ |
|
| 65 | - public function getDesc() |
|
| 66 | - { |
|
| 67 | - return $this->description; |
|
| 68 | - } |
|
| 69 | - |
|
| 70 | - |
|
| 71 | - /** |
|
| 72 | - * @param string $action Event action code |
|
| 73 | - * @param Bbcvols $object Object |
|
| 74 | - * @param User $user Object user |
|
| 75 | - * @param Translate $langs Object langs |
|
| 76 | - * @param Conf $conf Object conf |
|
| 77 | - * @return int <0 if KO, 0 if no triggered ran, >0 if OK |
|
| 78 | - */ |
|
| 79 | - public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf) |
|
| 80 | - { |
|
| 29 | + /** |
|
| 30 | + * @var DoliDB Database handler |
|
| 31 | + */ |
|
| 32 | + protected $db; |
|
| 33 | + |
|
| 34 | + /** |
|
| 35 | + * Constructor |
|
| 36 | + * |
|
| 37 | + * @param DoliDB $db Database handler |
|
| 38 | + */ |
|
| 39 | + public function __construct($db) |
|
| 40 | + { |
|
| 41 | + $this->db = $db; |
|
| 42 | + |
|
| 43 | + $this->name = preg_replace('/^Interface/i', '', get_class($this)); |
|
| 44 | + $this->family = "Belgian balloon club"; |
|
| 45 | + $this->description = "Trigger that send an e-mail on flight incident."; |
|
| 46 | + $this->version = '1.0'; |
|
| 47 | + $this->picto = 'flightlog@flightlog'; |
|
| 48 | + } |
|
| 49 | + |
|
| 50 | + /** |
|
| 51 | + * Trigger name |
|
| 52 | + * |
|
| 53 | + * @return string Name of trigger file |
|
| 54 | + */ |
|
| 55 | + public function getName() |
|
| 56 | + { |
|
| 57 | + return $this->name; |
|
| 58 | + } |
|
| 59 | + |
|
| 60 | + /** |
|
| 61 | + * Trigger description |
|
| 62 | + * |
|
| 63 | + * @return string Description of trigger file |
|
| 64 | + */ |
|
| 65 | + public function getDesc() |
|
| 66 | + { |
|
| 67 | + return $this->description; |
|
| 68 | + } |
|
| 69 | + |
|
| 70 | + |
|
| 71 | + /** |
|
| 72 | + * @param string $action Event action code |
|
| 73 | + * @param Bbcvols $object Object |
|
| 74 | + * @param User $user Object user |
|
| 75 | + * @param Translate $langs Object langs |
|
| 76 | + * @param Conf $conf Object conf |
|
| 77 | + * @return int <0 if KO, 0 if no triggered ran, >0 if OK |
|
| 78 | + */ |
|
| 79 | + public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf) |
|
| 80 | + { |
|
| 81 | 81 | if (empty($conf->flightlog->enabled) || empty($conf->workflow->enabled)){ |
| 82 | 82 | return 0; |
| 83 | 83 | } |
@@ -132,6 +132,6 @@ discard block |
||
| 132 | 132 | dol_syslog("Error while sending mail in flight log module : incident", LOG_ERR); |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | - return 0; |
|
| 136 | - } |
|
| 135 | + return 0; |
|
| 136 | + } |
|
| 137 | 137 | } |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | */ |
| 17 | 17 | |
| 18 | 18 | |
| 19 | -require_once DOL_DOCUMENT_ROOT.'/core/triggers/dolibarrtriggers.class.php'; |
|
| 19 | +require_once DOL_DOCUMENT_ROOT . '/core/triggers/dolibarrtriggers.class.php'; |
|
| 20 | 20 | dol_include_once('/flightlog/class/bbcvols.class.php'); |
| 21 | 21 | dol_include_once('/core/class/CMailFile.class.php'); |
| 22 | 22 | |
@@ -78,23 +78,23 @@ discard block |
||
| 78 | 78 | */ |
| 79 | 79 | public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf) |
| 80 | 80 | { |
| 81 | - if (empty($conf->flightlog->enabled) || empty($conf->workflow->enabled)){ |
|
| 81 | + if (empty($conf->flightlog->enabled) || empty($conf->workflow->enabled)) { |
|
| 82 | 82 | return 0; |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | - if(empty($conf->global->WORKFLOW_BBC_FLIGHTLOG_SEND_MAIL_ON_INCIDENT)){ |
|
| 85 | + if (empty($conf->global->WORKFLOW_BBC_FLIGHTLOG_SEND_MAIL_ON_INCIDENT)) { |
|
| 86 | 86 | return 0; |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | - if($action !== 'BBC_FLIGHT_LOG_ADD_FLIGHT'){ |
|
| 89 | + if ($action !== 'BBC_FLIGHT_LOG_ADD_FLIGHT') { |
|
| 90 | 90 | return 0; |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | - if(empty(trim($object->incidents)) && empty(trim($object->remarque))){ |
|
| 93 | + if (empty(trim($object->incidents)) && empty(trim($object->remarque))) { |
|
| 94 | 94 | return 0; |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | - if(!empty($conf->global->MAIN_DISABLE_ALL_MAILS)){ |
|
| 97 | + if (!empty($conf->global->MAIN_DISABLE_ALL_MAILS)) { |
|
| 98 | 98 | return 0; |
| 99 | 99 | } |
| 100 | 100 | |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | ); |
| 128 | 128 | |
| 129 | 129 | |
| 130 | - if (! $mailfile->sendfile()) |
|
| 130 | + if (!$mailfile->sendfile()) |
|
| 131 | 131 | { |
| 132 | 132 | dol_syslog("Error while sending mail in flight log module : incident", LOG_ERR); |
| 133 | 133 | } |
@@ -341,7 +341,7 @@ |
||
| 341 | 341 | */ |
| 342 | 342 | private function initPermissions() |
| 343 | 343 | { |
| 344 | - $this->rights = array(); // Permission array used by this module |
|
| 344 | + $this->rights = array(); // Permission array used by this module |
|
| 345 | 345 | $r = 0; |
| 346 | 346 | |
| 347 | 347 | $this->rights[$r][0] = 9993; |
@@ -271,7 +271,7 @@ |
||
| 271 | 271 | */ |
| 272 | 272 | private function addAdditionalBonusToOrder(CreatePilotYearBillCommand $command, $object) |
| 273 | 273 | { |
| 274 | - if ((int)$command->getAdditionalBonus() <= 0) { |
|
| 274 | + if ((int) $command->getAdditionalBonus() <= 0) { |
|
| 275 | 275 | return; |
| 276 | 276 | } |
| 277 | 277 | |
@@ -256,7 +256,7 @@ discard block |
||
| 256 | 256 | } |
| 257 | 257 | |
| 258 | 258 | if (is_int($value)) { |
| 259 | - $sqlwhere [] = $key . ' = ' . (int)$value; |
|
| 259 | + $sqlwhere [] = $key . ' = ' . (int) $value; |
|
| 260 | 260 | continue; |
| 261 | 261 | } |
| 262 | 262 | } |
@@ -599,7 +599,7 @@ discard block |
||
| 599 | 599 | */ |
| 600 | 600 | public function isPaxRequired() |
| 601 | 601 | { |
| 602 | - switch ((int)$this->idType) { |
|
| 602 | + switch ((int) $this->idType) { |
|
| 603 | 603 | case 1: |
| 604 | 604 | case 2: |
| 605 | 605 | return true; |
@@ -615,7 +615,7 @@ discard block |
||
| 615 | 615 | */ |
| 616 | 616 | public function isBillingRequired() |
| 617 | 617 | { |
| 618 | - return (int)$this->idType === 2; |
|
| 618 | + return (int) $this->idType === 2; |
|
| 619 | 619 | } |
| 620 | 620 | |
| 621 | 621 | /** |