@@ -613,9 +613,12 @@  | 
                                                    ||
| 613 | 613 | |
| 614 | 614 | <?php if ($year >= $currentYear || !$t1->service || !$t2->service || !$t3->service || !$t4->service || !$t5->service || !$t6->service || !$t7->service) : ?>  | 
                                                        
| 615 | 615 | <a class="butActionRefused" href="#">Générer</a>  | 
                                                        
| 616 | - <?php else: ?>  | 
                                                        |
| 616 | +        <?php else { | 
                                                        |
| 617 | + : ?>  | 
                                                        |
| 617 | 618 | <button class="butAction" type="submit">Générer</button>  | 
                                                        
| 618 | - <?php endif; ?>  | 
                                                        |
| 619 | + <?php endif;  | 
                                                        |
| 620 | +}  | 
                                                        |
| 621 | +?>  | 
                                                        |
| 619 | 622 | |
| 620 | 623 | </form>  | 
                                                        
| 621 | 624 | |
@@ -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;  | 
                                                        
@@ -25,15 +25,15 @@ discard block  | 
                                                    ||
| 25 | 25 | * Actions  | 
                                                        
| 26 | 26 | */  | 
                                                        
| 27 | 27 | // Save  | 
                                                        
| 28 | -if($action === ACTION_SAVE){ | 
                                                        |
| 29 | -    foreach($services as $flightTypeId => $serviceId){ | 
                                                        |
| 28 | +if ($action === ACTION_SAVE) { | 
                                                        |
| 29 | +    foreach ($services as $flightTypeId => $serviceId) { | 
                                                        |
| 30 | 30 | $res = $flightType->fetch($flightTypeId);  | 
                                                        
| 31 | -        if($res > 0 ){ | 
                                                        |
| 31 | +        if ($res > 0) { | 
                                                        |
| 32 | 32 | $flightType->fkService = $serviceId;  | 
                                                        
| 33 | 33 | $flightType->update($user);  | 
                                                        
| 34 | 34 | }  | 
                                                        
| 35 | 35 | |
| 36 | -        dolibarr_set_const($db, 'BBC_POINTS_BONUS_'.$flightTypeId, GETPOST('points_bonus_'.$flightTypeId), 'chaine', 0, 'Points pour le vol T'.$flightTypeId, $conf->entity); | 
                                                        |
| 36 | +        dolibarr_set_const($db, 'BBC_POINTS_BONUS_' . $flightTypeId, GETPOST('points_bonus_' . $flightTypeId), 'chaine', 0, 'Points pour le vol T' . $flightTypeId, $conf->entity); | 
                                                        |
| 37 | 37 | }  | 
                                                        
| 38 | 38 | |
| 39 | 39 |      dolibarr_set_const($db, 'BBC_FLIGHT_TYPE_CUSTOMER', GETPOST('customer_product'), 'chaine', 0, '', $conf->entity); | 
                                                        
@@ -71,7 +71,7 @@ discard block  | 
                                                    ||
| 71 | 71 | <tr class="<?= $flightTypeLine->id % 2 == 0 ? "pair" : "impair" ?>">  | 
                                                        
| 72 | 72 | <td>(T<?= $flightTypeLine->numero ?>) - <?= $flightTypeLine->nom ?></td>  | 
                                                        
| 73 | 73 | <td>  | 
                                                        
| 74 | - <?php $form->select_produits($flightTypeLine->fkService, 'idprod['.$flightTypeLine->id.']', $filtertype, $conf->product->limit_size, $buyer->price_level, 1, 2, '', 1, array(),$buyer->id); ?>  | 
                                                        |
| 74 | + <?php $form->select_produits($flightTypeLine->fkService, 'idprod[' . $flightTypeLine->id . ']', $filtertype, $conf->product->limit_size, $buyer->price_level, 1, 2, '', 1, array(), $buyer->id); ?>  | 
                                                        |
| 75 | 75 | </td>  | 
                                                        
| 76 | 76 | </tr>  | 
                                                        
| 77 | 77 | <?php endforeach; ?>  | 
                                                        
@@ -83,7 +83,7 @@ discard block  | 
                                                    ||
| 83 | 83 | </td>  | 
                                                        
| 84 | 84 | <td>  | 
                                                        
| 85 | 85 | <?php $form->select_produits($conf->global->BBC_FLIGHT_TYPE_CUSTOMER, 'customer_product',  | 
                                                        
| 86 | - $filtertype, $conf->product->limit_size, $buyer->price_level, 1, 2, '', 1, array(),$buyer->id); ?>  | 
                                                        |
| 86 | + $filtertype, $conf->product->limit_size, $buyer->price_level, 1, 2, '', 1, array(), $buyer->id); ?>  | 
                                                        |
| 87 | 87 | </td>  | 
                                                        
| 88 | 88 | </tr>  | 
                                                        
| 89 | 89 | |
@@ -106,7 +106,7 @@ discard block  | 
                                                    ||
| 106 | 106 | <label for="points_bonus_<?php echo $flightTypeLine->numero; ?>">  | 
                                                        
| 107 | 107 | (T<?php echo $flightTypeLine->numero ?>) - <?php echo $flightTypeLine->nom ?>  | 
                                                        
| 108 | 108 | </label>  | 
                                                        
| 109 | - <?php $prop = 'BBC_POINTS_BONUS_'.$flightTypeLine->numero; ?>  | 
                                                        |
| 109 | + <?php $prop = 'BBC_POINTS_BONUS_' . $flightTypeLine->numero; ?>  | 
                                                        |
| 110 | 110 | <input type="number" id="points_bonus_<?php echo $flightTypeLine->numero; ?>" name="points_bonus_<?php echo $flightTypeLine->numero; ?>" value="<?php echo $conf->global->$prop?>" />  | 
                                                        
| 111 | 111 | <br/>  | 
                                                        
| 112 | 112 | <?php endforeach; ?>  | 
                                                        
@@ -1,7 +1,7 @@ discard block  | 
                                                    ||
| 1 | 1 | <?php  | 
                                                        
| 2 | 2 | |
| 3 | -require_once __DIR__.'/CreateFlightBillCommandHandler.php';  | 
                                                        |
| 4 | -require_once __DIR__.'/CreateFlightBillTransactionalCommandHandler.php';  | 
                                                        |
| 3 | +require_once __DIR__ . '/CreateFlightBillCommandHandler.php';  | 
                                                        |
| 4 | +require_once __DIR__ . '/CreateFlightBillTransactionalCommandHandler.php';  | 
                                                        |
| 5 | 5 | |
| 6 | 6 | /**  | 
                                                        
| 7 | 7 | * @author Laurent De Coninck <[email protected]>  | 
                                                        
@@ -11,7 +11,7 @@ discard block  | 
                                                    ||
| 11 | 11 | /**  | 
                                                        
| 12 | 12 | * @return CreateFlightBillCommandHandler  | 
                                                        
| 13 | 13 | */  | 
                                                        
| 14 | -    public static function factory($db, $conf, $user, $langs){ | 
                                                        |
| 14 | +    public static function factory($db, $conf, $user, $langs) { | 
                                                        |
| 15 | 15 | return new CreateFlightBillTransactionalCommandHandler($db, $conf, $user, $langs);  | 
                                                        
| 16 | 16 | }  | 
                                                        
| 17 | 17 | |
@@ -239,9 +239,12 @@  | 
                                                    ||
| 239 | 239 |                      <?php echo $langs->trans('La periode demandée n\'est pas cloturée.') ?> | 
                                                        
| 240 | 240 | </p>  | 
                                                        
| 241 | 241 | <a class="butActionRefused" href="#">Générer</a>  | 
                                                        
| 242 | - <?php else: ?>  | 
                                                        |
| 242 | +            <?php else { | 
                                                        |
| 243 | + : ?>  | 
                                                        |
| 243 | 244 | <button class="butAction" type="submit">Générer</button>  | 
                                                        
| 244 | - <?php endif; ?>  | 
                                                        |
| 245 | + <?php endif;  | 
                                                        |
| 246 | +}  | 
                                                        |
| 247 | +?>  | 
                                                        |
| 245 | 248 | |
| 246 | 249 | </form>  | 
                                                        
| 247 | 250 | </section>  | 
                                                        
@@ -95,7 +95,7 @@  | 
                                                    ||
| 95 | 95 |  if ($action == EXPENSE_REPORT_GENERATOR_ACTION_GENERATE) { | 
                                                        
| 96 | 96 |      try { | 
                                                        
| 97 | 97 | |
| 98 | - $command = new CreateMonthBillCommand( $type, $publicNote, $privateNote, $year, $month);  | 
                                                        |
| 98 | + $command = new CreateMonthBillCommand($type, $publicNote, $privateNote, $year, $month);  | 
                                                        |
| 99 | 99 | $handler->handle($command);  | 
                                                        
| 100 | 100 |          dol_htmloutput_mesg('Génération : OK'); | 
                                                        
| 101 | 101 |      } catch (Exception $e) { | 
                                                        
@@ -53,7 +53,7 @@  | 
                                                    ||
| 53 | 53 | |
| 54 | 54 |          try { | 
                                                        
| 55 | 55 | |
| 56 | -            if(date('d')>=15){ | 
                                                        |
| 56 | +            if (date('d') >= 15) { | 
                                                        |
| 57 | 57 |                  dol_syslog('Monthly bill generation : date over'); | 
                                                        
| 58 | 58 | return -2;  | 
                                                        
| 59 | 59 | }  | 
                                                        
@@ -232,7 +232,7 @@  | 
                                                    ||
| 232 | 232 | <?php echo !empty($flight->linkedObjectsIds) && in_array($currentTask->id,  | 
                                                        
| 233 | 233 | $flight->linkedObjectsIds[$currentTask->table_element]) ? 'checked' : '' ?>  | 
                                                        
| 234 | 234 | />  | 
                                                        
| 235 | - <?php else: ?>  | 
                                                        |
| 235 | + <?php else : ?>  | 
                                                        |
| 236 | 236 | |
| 237 | 237 | <?php if (!empty($flight->linkedObjectsIds) && in_array($currentTask->id,  | 
                                                        
| 238 | 238 | $flight->linkedObjectsIds[$currentTask->table_element])): ?>  | 
                                                        
@@ -211,8 +211,11 @@ discard block  | 
                                                    ||
| 211 | 211 | <?php if ($userWrite): ?>  | 
                                                        
| 212 | 212 | <?php echo $formOther->select_percent($currentTask->progress,  | 
                                                        
| 213 | 213 |                                  sprintf('progression[%s]', $currentTask->id, false, 10)); ?> | 
                                                        
| 214 | - <?php else: ?>  | 
                                                        |
| 215 | - <span><?php echo $currentTask->progress; ?> %</span>  | 
                                                        |
| 214 | +                        <?php else { | 
                                                        |
| 215 | + : ?>  | 
                                                        |
| 216 | + <span><?php echo $currentTask->progress;  | 
                                                        |
| 217 | +}  | 
                                                        |
| 218 | +?> %</span>  | 
                                                        |
| 216 | 219 | <?php endif; ?>  | 
                                                        
| 217 | 220 | |
| 218 | 221 | </td>  | 
                                                        
@@ -232,14 +235,17 @@ discard block  | 
                                                    ||
| 232 | 235 | <?php echo !empty($flight->linkedObjectsIds) && in_array($currentTask->id,  | 
                                                        
| 233 | 236 | $flight->linkedObjectsIds[$currentTask->table_element]) ? 'checked' : '' ?>  | 
                                                        
| 234 | 237 | />  | 
                                                        
| 235 | - <?php else: ?>  | 
                                                        |
| 238 | +                            <?php else { | 
                                                        |
| 239 | + : ?>  | 
                                                        |
| 236 | 240 | |
| 237 | 241 | <?php if (!empty($flight->linkedObjectsIds) && in_array($currentTask->id,  | 
                                                        
| 238 | 242 | $flight->linkedObjectsIds[$currentTask->table_element])): ?>  | 
                                                        
| 239 | 243 | <span class="fa fa-check"></span>  | 
                                                        
| 240 | 244 | <?php else: ?>  | 
                                                        
| 241 | 245 | <span class="fa fa-times"></span>  | 
                                                        
| 242 | - <?php endif; ?>  | 
                                                        |
| 246 | + <?php endif;  | 
                                                        |
| 247 | +}  | 
                                                        |
| 248 | +?>  | 
                                                        |
| 243 | 249 | |
| 244 | 250 | <?php endif; ?>  | 
                                                        
| 245 | 251 | |
@@ -111,7 +111,7 @@  | 
                                                    ||
| 111 | 111 | |
| 112 | 112 | /**  | 
                                                        
| 113 | 113 | * @param Product $flightProduct  | 
                                                        
| 114 | - * @param float|int $pricePerPax  | 
                                                        |
| 114 | + * @param integer $pricePerPax  | 
                                                        |
| 115 | 115 | *  | 
                                                        
| 116 | 116 | * @return float|int  | 
                                                        
| 117 | 117 | */  | 
                                                        
@@ -132,7 +132,7 @@  | 
                                                    ||
| 132 | 132 | $name = $command->getName() . ' ' . $command->getFirstname();  | 
                                                        
| 133 | 133 | |
| 134 | 134 | $existingCustomers = $this->societe->fetch(null, $name);  | 
                                                        
| 135 | -        if($existingCustomers > 0){ | 
                                                        |
| 135 | +        if ($existingCustomers > 0) { | 
                                                        |
| 136 | 136 | $this->societe = $existingCustomers[0];  | 
                                                        
| 137 | 137 | return $this->societe;  | 
                                                        
| 138 | 138 | }  |