@@ -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; |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | $vol->cost = $_POST['cost']; |
49 | 49 | $vol->fk_receiver = $_POST['fk_receiver']; |
50 | 50 | $vol->justif_kilometers = $_POST['justif_kilometers']; |
51 | - $isGroupedFlight = (int)GETPOST('grouped_flight', 'int',2) === 1; |
|
51 | + $isGroupedFlight = (int) GETPOST('grouped_flight', 'int', 2) === 1; |
|
52 | 52 | |
53 | 53 | //verification des heures |
54 | 54 | $patern = '#[0-9]{4}#'; |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | $msg = '<div class="error">Erreur ce type de vol doit être payant.</div>'; |
88 | 88 | $error++; |
89 | 89 | } |
90 | - if($vol->getFlightType()->isBillingRequired() && !$vol->hasReceiver()){ |
|
90 | + if ($vol->getFlightType()->isBillingRequired() && !$vol->hasReceiver()) { |
|
91 | 91 | $msg = '<div class="error">Erreur ce type de vol doit être payant, mais personne n\'a été signalé comme recepteur d\'argent.</div>'; |
92 | 92 | $error++; |
93 | 93 | } |