Completed
Push — feature/damages ( 8f70f7...06d026 )
by Laurent
31s
created
Http/Web/Controller/StatisticalGraphController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -136,7 +136,7 @@
 block discarded – undo
136 136
         $graphByTypeAndYear->type = [];
137 137
         foreach (fetchBbcFlightTypes() as $flightType) {
138 138
 
139
-            if (!in_array($flightType->numero, [1, 2, 3,4, 6])) {
139
+            if (!in_array($flightType->numero, [1, 2, 3, 4, 6])) {
140 140
                 continue;
141 141
             }
142 142
 
Please login to merge, or discard this patch.
class/YearGraphicalData.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@
 block discarded – undo
69 69
         $result = [$this->year];
70 70
 
71 71
         foreach ($this->graphData as $typeId => $data) {
72
-            if (!in_array($typeId, [1, 2, 3,4, 6])) {
72
+            if (!in_array($typeId, [1, 2, 3, 4, 6])) {
73 73
                 continue;
74 74
             }
75 75
 
Please login to merge, or discard this patch.
core/triggers/interface_50001_modFlightLog_mailOnIncident.class.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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(!$object->hasIncidents() && !$object->hasComment()){
93
+        if (!$object->hasIncidents() && !$object->hasComment()) {
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
 
@@ -102,11 +102,11 @@  discard block
 block discarded – undo
102 102
         $message .= sprintf("<p>Vous recevez cet e-mail car un vol a été encodé avec un incident/ une remarque sur le ballon : %s dont vous êtes titulaire ou co-titulaire.</p>", $object->getBalloon()->immat);
103 103
         $message .= sprintf("<p><b>Vol id :</b> %d</p>", $object->getId());
104 104
         $message .= sprintf("<p><b>Réalisé par :</b> %s </p>", $object->getPilot()->getFullName($langs));
105
-        if($object->hasComment()){
105
+        if ($object->hasComment()) {
106 106
             $message .= sprintf("<p><b>Commentaire :</b> %s </p>", $object->getComment());
107 107
         }
108 108
 
109
-        if($object->hasIncidents()){
109
+        if ($object->hasIncidents()) {
110 110
             $message .= sprintf("<p><b>Incident :</b> %s </p>", $object->getIncident());
111 111
         }
112 112
 
@@ -118,18 +118,18 @@  discard block
 block discarded – undo
118 118
 
119 119
         $responsable = new User($user->db);
120 120
         $res = $responsable->fetch($object->getBalloon()->fk_responsable);
121
-        if($res > 0){
121
+        if ($res > 0) {
122 122
             $to[] = $responsable->email;
123 123
         }
124 124
 
125 125
 
126 126
         $backup = new User($user->db);
127 127
         $res = $backup->fetch($object->getBalloon()->fk_co_responsable);
128
-        if($res > 0){
128
+        if ($res > 0) {
129 129
             $to[] = $backup->email;
130 130
         }
131 131
 
132
-        if(empty($to)){
132
+        if (empty($to)) {
133 133
             return 0;
134 134
         }
135 135
 
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
         );
150 150
 
151 151
 
152
-        if (! $mailfile->sendfile())
152
+        if (!$mailfile->sendfile())
153 153
         {
154 154
             dol_syslog("Error while sending mail in flight log module : incident", LOG_ERR);
155 155
         }
Please login to merge, or discard this patch.
Http/Web/Form/DamageCreationForm.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@
 block discarded – undo
45 45
         return $obj;
46 46
     }
47 47
 
48
-    private function addAmount(){
48
+    private function addAmount() {
49 49
         $field = new Number('amount');
50 50
         $field->required();
51 51
         $field->setStep(0.01);
Please login to merge, or discard this patch.
Http/Web/templates/flight_damage/form.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@
 block discarded – undo
24 24
     <?php echo $renderer->render($form->getElement('flight_id')); ?>
25 25
     <?php echo $renderer->render($form->getElement('token')); ?>
26 26
 
27
-    <?php if($form->has('amount')): ?>
27
+    <?php if ($form->has('amount')): ?>
28 28
         <section class="form-section">
29 29
             <h1 class="form-section-title"><?php echo $langs->trans('Ajout de dégâts'); ?></h1>
30 30
             <table class="border" width="50%">
Please login to merge, or discard this patch.
Http/Web/templates/flight_damage/view.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -16,21 +16,21 @@
 block discarded – undo
16 16
         <td colspan="2">&nbsp;</td>
17 17
     </tr>
18 18
     <?php $total = 0; ?>
19
-    <?php foreach($damages as $currentDamage):?>
19
+    <?php foreach ($damages as $currentDamage):?>
20 20
         <?php $total += $currentDamage->getAmount(); ?>
21 21
         <tr>
22
-            <td><?php echo $currentDamage->getAuthorName();?></td>
23
-            <td><?php echo $currentDamage->getLabel();?></td>
24
-            <td><?php echo $currentDamage->getAmount();?>€</td>
22
+            <td><?php echo $currentDamage->getAuthorName(); ?></td>
23
+            <td><?php echo $currentDamage->getLabel(); ?></td>
24
+            <td><?php echo $currentDamage->getAmount(); ?>€</td>
25 25
             <td>
26
-                <?php if($currentDamage->isInvoiced()): ?>
26
+                <?php if ($currentDamage->isInvoiced()): ?>
27 27
                     <i class="fas fa-check"></i>
28 28
                 <?php else: ?>
29 29
                     <i class="fas fa-times"></i>
30 30
                 <?php endif; ?>
31 31
             </td>
32 32
             <td>
33
-                <a href="<?php print sprintf('%s/flightlog/index.php?r=get_one_damage&id=%s', DOL_URL_ROOT, $currentDamage->getId());?>"><i class="fas fa-link"></i></a>
33
+                <a href="<?php print sprintf('%s/flightlog/index.php?r=get_one_damage&id=%s', DOL_URL_ROOT, $currentDamage->getId()); ?>"><i class="fas fa-link"></i></a>
34 34
             </td>
35 35
         </tr>
36 36
     <?php endforeach; ?>
Please login to merge, or discard this patch.
Damage/Query/Repository/GetDamagesForFlightQueryRepository.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -31,15 +31,15 @@
 block discarded – undo
31 31
     public function __invoke($flightId)
32 32
     {
33 33
         $sql = 'SELECT damage.author_id as author_id, damage.rowid as id, damage.amount, damage.label, CONCAT(author.firstname, " " , author.lastname) as author_name, damage.billed as invoiced';
34
-        $sql.=' FROM '.MAIN_DB_PREFIX.'bbc_flight_damages as damage';
35
-        $sql.=' INNER JOIN '.MAIN_DB_PREFIX.'user as author ON author.rowid = damage.author_id';
36
-        $sql.=' WHERE damage.flight_id = '.$this->db->escape($flightId);
34
+        $sql .= ' FROM ' . MAIN_DB_PREFIX . 'bbc_flight_damages as damage';
35
+        $sql .= ' INNER JOIN ' . MAIN_DB_PREFIX . 'user as author ON author.rowid = damage.author_id';
36
+        $sql .= ' WHERE damage.flight_id = ' . $this->db->escape($flightId);
37 37
 
38 38
         $resql = $this->db->query($sql);
39 39
         if ($resql) {
40 40
             $num = $this->db->num_rows($resql);
41 41
             if ($num) {
42
-                for($i = 0; $i < $num ; $i++) {
42
+                for ($i = 0; $i < $num; $i++) {
43 43
                     $properties = $this->db->fetch_array($resql);
44 44
                     yield Damage::fromArray($properties);
45 45
                 }
Please login to merge, or discard this patch.
Infrastructure/Damage/Repository/FlightDamageRepository.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
             'label' => $flightDamage->getLabel()->value(),
38 38
         ];
39 39
 
40
-        if($flightDamage->getId()){
40
+        if ($flightDamage->getId()) {
41 41
             $this->update($flightDamage->getId()->getId(), $fields);
42 42
             return $flightDamage->getId()->getId();
43 43
         }
@@ -52,10 +52,10 @@  discard block
 block discarded – undo
52 52
      *
53 53
      * @throws \Exception
54 54
      */
55
-    public function getById(DamageId $id){
55
+    public function getById(DamageId $id) {
56 56
         $damage = $this->get($id->getId());
57 57
 
58
-        if(null === $damage){
58
+        if (null === $damage) {
59 59
             throw new \Exception('Damage not found');
60 60
         }
61 61
 
Please login to merge, or discard this patch.
Application/Damage/Command/CreateDamageCommandHandler.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
     public function __invoke(CreateDamageCommand $command)
43 43
     {
44 44
         $damage = FlightDamage::waiting(new DamageAmount($command->getAmount()), AuthorId::create($command->getAuthorId()), new DamageLabel($command->getLabel()));
45
-        if(null !== $command->getFlightId()){
45
+        if (null !== $command->getFlightId()) {
46 46
             $damage = FlightDamage::damage(FlightId::create($command->getFlightId()), new DamageLabel($command->getLabel()), new DamageAmount($command->getAmount()), AuthorId::create($command->getAuthorId()));
47 47
         }
48 48
 
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
      */
61 61
     private function linkSupplierInvoice($damageId, $invoiceId)
62 62
     {
63
-        if($invoiceId <= 0){
63
+        if ($invoiceId <= 0) {
64 64
             return;
65 65
         }
66 66
 
@@ -81,8 +81,8 @@  discard block
 block discarded – undo
81 81
      * @param int $targetId
82 82
      * @param string $targetType
83 83
      */
84
-    private function insertLinks($damageId, $targetId, $targetType){
85
-        $sql = "INSERT INTO ".MAIN_DB_PREFIX."element_element (";
84
+    private function insertLinks($damageId, $targetId, $targetType) {
85
+        $sql = "INSERT INTO " . MAIN_DB_PREFIX . "element_element (";
86 86
         $sql .= "fk_source";
87 87
         $sql .= ", sourcetype";
88 88
         $sql .= ", fk_target";
@@ -90,8 +90,8 @@  discard block
 block discarded – undo
90 90
         $sql .= ") VALUES (";
91 91
         $sql .= $damageId;
92 92
         $sql .= ", 'flightlog_damage'";
93
-        $sql .= ", ".$targetId;
94
-        $sql .= ", '".$targetType."'";
93
+        $sql .= ", " . $targetId;
94
+        $sql .= ", '" . $targetType . "'";
95 95
         $sql .= ")";
96 96
 
97 97
         if ($this->db->query($sql))
Please login to merge, or discard this patch.