Completed
Push — feature/graph_stat_flight ( ed413f )
by Laurent
01:27
created
class/bbcvols.class.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
         $sql .= ' ' . (!isset($this->justif_kilometers) ? 'NULL' : "'" . $this->db->escape($this->justif_kilometers) . "'") . ',';
260 260
         $sql .= ' ' . "'" . date('Y-m-d H:i:s') . "'" . ',';
261 261
         $sql .= ' ' . "'" . date('Y-m-d H:i:s') . "'" . ',';
262
-        $sql .= ' ' . "'" . $this->passengerNames . "'" ;
262
+        $sql .= ' ' . "'" . $this->passengerNames . "'";
263 263
         $sql .= ')';
264 264
 
265 265
         $this->db->begin();
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
 
274 274
         if (!$error) {
275 275
             $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . $this->table_element);
276
-            if(!$this->insertOrders()){
276
+            if (!$this->insertOrders()) {
277 277
                 $error++;
278 278
             }
279 279
 
@@ -299,9 +299,9 @@  discard block
 block discarded – undo
299 299
     /**
300 300
      * Inserts the order linked to the flight
301 301
      */
302
-    private function insertOrders(){
302
+    private function insertOrders() {
303 303
 
304
-        if(empty($this->orderIds)){
304
+        if (empty($this->orderIds)) {
305 305
             return true;
306 306
         }
307 307
 
@@ -316,12 +316,12 @@  discard block
 block discarded – undo
316 316
         
317 317
         $values = [];
318 318
 
319
-        foreach($this->orderIds as $orderId=>$nbrPassengers){
319
+        foreach ($this->orderIds as $orderId=>$nbrPassengers) {
320 320
             $values[] = sprintf(
321 321
                 $valueTemplate,
322 322
                 $orderId,
323 323
                 $this->db->escape($this->id),
324
-                (!isset($nbrPassengers) ? '0' :  $this->db->escape($nbrPassengers))
324
+                (!isset($nbrPassengers) ? '0' : $this->db->escape($nbrPassengers))
325 325
             );
326 326
         }
327 327
 
@@ -339,9 +339,9 @@  discard block
 block discarded – undo
339 339
     /**
340 340
      * Inserts the order linked to the flight
341 341
      */
342
-    private function updateOrders(){
342
+    private function updateOrders() {
343 343
 
344
-        if(empty($this->orderIds)){
344
+        if (empty($this->orderIds)) {
345 345
             return true;
346 346
         }
347 347
 
@@ -352,9 +352,9 @@  discard block
 block discarded – undo
352 352
     /**
353 353
      * Inserts the order linked to the flight
354 354
      */
355
-    private function deleteOrders(){
355
+    private function deleteOrders() {
356 356
 
357
-        if(empty($this->orderIds)){
357
+        if (empty($this->orderIds)) {
358 358
             return true;
359 359
         }
360 360
 
@@ -559,7 +559,7 @@  discard block
 block discarded – undo
559 559
         $sql .= ' fk_receiver = ' . (isset($this->fk_receiver) && (int) $this->fk_receiver > 0 ? $this->fk_receiver : "null") . ',';
560 560
         $sql .= ' justif_kilometers = ' . (isset($this->justif_kilometers) ? "'" . $this->db->escape($this->justif_kilometers) . "'," : "'',");
561 561
         $sql .= ' date_update = ' . "'" . date('Y-m-d H:i:s') . "',";
562
-        $sql .= ' passenger_names = ' . "'" . trim($this->passengerNames)."'";
562
+        $sql .= ' passenger_names = ' . "'" . trim($this->passengerNames) . "'";
563 563
 
564 564
         $sql .= ' WHERE idBBC_vols=' . $this->idBBC_vols;
565 565
 
@@ -1022,8 +1022,8 @@  discard block
 block discarded – undo
1022 1022
      * @param int $orderId
1023 1023
      * @param int $nbrPassengers
1024 1024
      */
1025
-    public function addOrderId($orderId, $nbrPassengers){
1026
-        if(!isset($this->orderIds)){
1025
+    public function addOrderId($orderId, $nbrPassengers) {
1026
+        if (!isset($this->orderIds)) {
1027 1027
             $this->orderIds = [];
1028 1028
         }
1029 1029
 
@@ -1063,7 +1063,7 @@  discard block
 block discarded – undo
1063 1063
         if ($resql) {
1064 1064
             $numrows = $this->db->num_rows($resql);
1065 1065
             if ($numrows) {
1066
-                for($i = 0 ; $i < $numrows ; $i++){
1066
+                for ($i = 0; $i < $numrows; $i++) {
1067 1067
                     $obj = $this->db->fetch_object($resql);
1068 1068
                     $this->orderIds[$obj->order_id] = $obj->nbr_passengers;
1069 1069
 
@@ -1084,7 +1084,7 @@  discard block
 block discarded – undo
1084 1084
      */
1085 1085
     public function getOrders()
1086 1086
     {
1087
-        if(!isset($this->orders) || empty($this->orders)){
1087
+        if (!isset($this->orders) || empty($this->orders)) {
1088 1088
             $this->fetchOrder();
1089 1089
         }
1090 1090
         return $this->orders;
Please login to merge, or discard this patch.
class/missions/QuarterPilotMissionCollection.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
         $numberOfKilometers
42 42
     )
43 43
     {
44
-        $pilotId = (int)$pilotId;
44
+        $pilotId = (int) $pilotId;
45 45
 
46 46
         if (!isset($this->items[$pilotId])) {
47 47
             $this->items[$pilotId] = new PilotMissions($pilotId, $pilotFirstname, $pilotLastname);
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
      */
58 58
     public function addPilot($pilotId, $pilotFirstname, $pilotLastname)
59 59
     {
60
-        $pilotId = (int)$pilotId;
60
+        $pilotId = (int) $pilotId;
61 61
 
62 62
         if (isset($this->items[$pilotId])) {
63 63
             return;
Please login to merge, or discard this patch.
class/missions/PilotMissions.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
      */
39 39
     public function __construct($pilotId, $pilotFirstname, $pilotLastname)
40 40
     {
41
-        $this->pilotId = (int)$pilotId;
41
+        $this->pilotId = (int) $pilotId;
42 42
         $this->pilotFirstname = $pilotFirstname;
43 43
         $this->pilotLastname = $pilotLastname;
44 44
 
@@ -51,8 +51,8 @@  discard block
 block discarded – undo
51 51
      * @param int $numberOfFlights
52 52
      * @param int $numberOfKilometers
53 53
      */
54
-    public function addQuarter($quarter, $numberOfFlights, $numberOfKilometers){
55
-        $quarter = (int)$quarter;
54
+    public function addQuarter($quarter, $numberOfFlights, $numberOfKilometers) {
55
+        $quarter = (int) $quarter;
56 56
         $this->quarterMissions[$quarter] = new QuarterMission($quarter, $numberOfFlights, $numberOfKilometers);
57 57
     }
58 58
 
@@ -107,9 +107,9 @@  discard block
 block discarded – undo
107 107
      *
108 108
      * @return QuarterMission
109 109
      */
110
-    private function getQuarterMission($quarter){
111
-        if(!isset($this->quarterMissions[$quarter])){
112
-            return new QuarterMission($quarter,0,0);
110
+    private function getQuarterMission($quarter) {
111
+        if (!isset($this->quarterMissions[$quarter])) {
112
+            return new QuarterMission($quarter, 0, 0);
113 113
         }
114 114
 
115 115
         return $this->quarterMissions[$quarter];
@@ -120,6 +120,6 @@  discard block
 block discarded – undo
120 120
      */
121 121
     public function getPilotName()
122 122
     {
123
-        return $this->pilotFirstname.' '.$this->pilotLastname;
123
+        return $this->pilotFirstname . ' ' . $this->pilotLastname;
124 124
     }
125 125
 }
126 126
\ No newline at end of file
Please login to merge, or discard this patch.
class/missions/FlightMission.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@
 block discarded – undo
57 57
      */
58 58
     public function __construct($id, $startPoint, $endPoint, $kilometersComment, $numberOfKilometers, DateTime $date)
59 59
     {
60
-        $this->id = (int)$id;
60
+        $this->id = (int) $id;
61 61
         $this->startPoint = $startPoint;
62 62
         $this->endPoint = $endPoint;
63 63
         $this->kilometersComment = $kilometersComment;
Please login to merge, or discard this patch.
Http/Web/Form/DamageCreationForm.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@
 block discarded – undo
32 32
     }
33 33
 
34 34
     /**
35
-     * @return CreateDamageCommand|\stdClass|null
35
+     * @return CreateDamageCommand
36 36
      */
37 37
     public function getObject()
38 38
     {
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@
 block discarded – undo
41 41
         return $obj;
42 42
     }
43 43
 
44
-    private function addAmount(){
44
+    private function addAmount() {
45 45
         $field = new Number('amount');
46 46
         $field->required();
47 47
         $field->setMin(1);
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
@@ -23,7 +23,7 @@
 block discarded – undo
23 23
 
24 24
     <?php echo $renderer->render($form->getElement('flight_id')); ?>
25 25
 
26
-    <?php if($form->has('amount')): ?>
26
+    <?php if ($form->has('amount')): ?>
27 27
         <section class="form-section">
28 28
             <h1 class="form-section-title"><?php echo $langs->trans('Ajout de dégâts'); ?></h1>
29 29
             <table class="border" width="50%">
Please login to merge, or discard this patch.
Http/Web/Requests/Request.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -13,12 +13,12 @@  discard block
 block discarded – undo
13 13
      *
14 14
      * @return mixed
15 15
      */
16
-    public function getParam($name, $defaultValue = null){
17
-        if($_POST[$name]){
16
+    public function getParam($name, $defaultValue = null) {
17
+        if ($_POST[$name]) {
18 18
             return $_POST[$name];
19 19
         }
20 20
 
21
-        if($_GET[$name]){
21
+        if ($_GET[$name]) {
22 22
             return $_GET[$name];
23 23
         }
24 24
 
@@ -28,14 +28,14 @@  discard block
 block discarded – undo
28 28
     /**
29 29
      * @return bool
30 30
      */
31
-    public function isPost(){
31
+    public function isPost() {
32 32
         return strtoupper($_SERVER['REQUEST_METHOD']) === 'POST';
33 33
     }
34 34
 
35 35
     /**
36 36
      * @return array
37 37
      */
38
-    public function getPostParameters(){
38
+    public function getPostParameters() {
39 39
         return $_POST;
40 40
     }
41 41
 }
42 42
\ No newline at end of file
Please login to merge, or discard this patch.
Http/Web/Form/SupplierBillSelect.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -36,9 +36,9 @@
 block discarded – undo
36 36
         }
37 37
 
38 38
         $sql = 'SELECT f.rowid, f.ref as ref_supplier, f.total_ttc, society.nom';
39
-        $sql.= ' FROM '.MAIN_DB_PREFIX.'facture_fourn as f';
40
-        $sql.= ' INNER JOIN '.MAIN_DB_PREFIX.'societe as society ON society.rowid = f.fk_soc';
41
-        $sql.= ' ORDER BY f.datec DESC';
39
+        $sql .= ' FROM ' . MAIN_DB_PREFIX . 'facture_fourn as f';
40
+        $sql .= ' INNER JOIN ' . MAIN_DB_PREFIX . 'societe as society ON society.rowid = f.fk_soc';
41
+        $sql .= ' ORDER BY f.datec DESC';
42 42
 
43 43
         $resql = $this->db->query($sql);
44 44
         if ($resql) {
Please login to merge, or discard this patch.
Http/Web/Controller/AddFlightDamageController.php 2 patches
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@
 block discarded – undo
48 48
 
49 49
             try{
50 50
                 $this->handle($form->getObject());
51
-            }catch(\Exception $e){
51
+            } catch(\Exception $e){
52 52
                 print $e->getMessage();
53 53
                 dol_syslog($e->getMessage(), LOG_ERR);
54 54
             }
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -19,16 +19,16 @@  discard block
 block discarded – undo
19 19
     /**
20 20
      * Display the form.
21 21
      */
22
-    public function view(){
22
+    public function view() {
23 23
         $id = $this->request->getParam('id');
24 24
 
25
-        if($id === null){
25
+        if ($id === null) {
26 26
             print '<p>Paramètre non fournis.</p>';
27 27
             return;
28 28
         }
29 29
 
30 30
         $flight = new \Bbcvols($this->db);
31
-        if($flight->fetch($id) <= 0){
31
+        if ($flight->fetch($id) <= 0) {
32 32
             print '<p>Vol non trouvé</p>';
33 33
             return;
34 34
         }
@@ -39,24 +39,24 @@  discard block
 block discarded – undo
39 39
         $form = new DamageCreationForm('damage_creation', $this->db);
40 40
         $form->bind($command);
41 41
 
42
-        if($this->request->isPost()){
42
+        if ($this->request->isPost()) {
43 43
             $form->setData($this->request->getPostParameters());
44 44
 
45
-            if(!$form->validate()){
45
+            if (!$form->validate()) {
46 46
                 return $this->render('flight_damage/form.php', [
47 47
                     'form' => $form,
48 48
                 ]);
49 49
             }
50 50
 
51
-            try{
51
+            try {
52 52
                 $this->handle($form->getObject());
53
-            }catch(\Exception $e){
53
+            } catch (\Exception $e) {
54 54
                 print $e->getMessage();
55 55
                 dol_syslog($e->getMessage(), LOG_ERR);
56 56
             }
57 57
 
58 58
 
59
-            return $this->redirect($_SERVER["PHP_SELF"].'?id='.$id);
59
+            return $this->redirect($_SERVER["PHP_SELF"] . '?id=' . $id);
60 60
         }
61 61
 
62 62
         return $this->render('flight_damage/form.php', [
@@ -77,14 +77,14 @@  discard block
 block discarded – undo
77 77
     /**
78 78
      * @return CreateDamageCommandHandler
79 79
      */
80
-    private function getHandler(){
80
+    private function getHandler() {
81 81
         return new CreateDamageCommandHandler($this->db, $this->getDamageRepository());
82 82
     }
83 83
 
84 84
     /**
85 85
      * @return FlightDamageRepository
86 86
      */
87
-    private function getDamageRepository(){
87
+    private function getDamageRepository() {
88 88
         return new FlightDamageRepository($this->db);
89 89
     }
90 90
 
Please login to merge, or discard this patch.