Passed
Push — GENERAL_BUG_REVIEW_240911 ( 6dbc7d...fb375d )
by Rafael
53:50
created
Dolibarr/Code/Compta/Classes/RejetPrelevement.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -180,7 +180,7 @@
 block discarded – undo
180 180
             // Make a negative payment
181 181
             // Amount must be an array (id of invoice -> amount)
182 182
             $pai->amounts = array();
183
-            $pai->amounts[$facs[$i][0]] = price2num($amountrejected * -1);      // The payment must be negative because it is a refund
183
+            $pai->amounts[$facs[$i][0]] = price2num($amountrejected * -1); // The payment must be negative because it is a refund
184 184
 
185 185
             $pai->datepaye = $date_rejet;
186 186
             $pai->paiementid = 3; // type of payment: withdrawal
Please login to merge, or discard this patch.
Dolibarr/Code/Compta/Classes/PaymentVarious.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -342,7 +342,7 @@  discard block
 block discarded – undo
342 342
                 $this->type_payment         = $obj->fk_typepayment;
343 343
                 $this->num_payment          = $obj->num_payment;
344 344
                 $this->label                = $obj->label;
345
-                $this->note                 = $obj->note_private;   // For backward compatibility
345
+                $this->note                 = $obj->note_private; // For backward compatibility
346 346
                 $this->note_private         = $obj->note_private;
347 347
                 $this->subledger_account    = $obj->subledger_account;
348 348
                 $this->accountancy_code     = $obj->accountancy_code;
@@ -523,7 +523,7 @@  discard block
 block discarded – undo
523 523
         $sql .= ", " . ($this->fk_project > 0 ? ((int) $this->fk_project) : 0);
524 524
         $sql .= ", " . ((int) $user->id);
525 525
         $sql .= ", '" . $this->db->idate($now) . "'";
526
-        $sql .= ", NULL";   // Filled later
526
+        $sql .= ", NULL"; // Filled later
527 527
         $sql .= ", " . ((int) $conf->entity);
528 528
         $sql .= ")";
529 529
 
Please login to merge, or discard this patch.
Dolibarr/Code/Compta/Classes/FactureRec.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1358,7 +1358,7 @@
 block discarded – undo
1358 1358
 
1359 1359
                     $facture->type = self::TYPE_STANDARD;
1360 1360
                     $facture->subtype = $facturerec->subtype;
1361
-                    $facture->statut = self::STATUS_DRAFT;  // deprecated
1361
+                    $facture->statut = self::STATUS_DRAFT; // deprecated
1362 1362
                     $facture->status = self::STATUS_DRAFT;
1363 1363
                     $facture->date = (empty($facturerec->date_when) ? $now : $facturerec->date_when); // We could also use dol_now here but we prefer date_when so invoice has real date when we would like even if we generate later.
1364 1364
                     $facture->socid = $facturerec->socid;
Please login to merge, or discard this patch.
Dolibarr/Code/Compta/Classes/Account.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -501,13 +501,13 @@  discard block
 block discarded – undo
501 501
         $sql = "INSERT INTO " . MAIN_DB_PREFIX . "bank_url (";
502 502
         $sql .= "fk_bank";
503 503
         $sql .= ", url_id";
504
-        $sql .= ", url";        // deprecated
504
+        $sql .= ", url"; // deprecated
505 505
         $sql .= ", label";
506 506
         $sql .= ", type";
507 507
         $sql .= ") VALUES (";
508 508
         $sql .= ((int) $line_id);
509 509
         $sql .= ", " . ((int) $url_id);
510
-        $sql .= ", '" . $this->db->escape($url) . "'";      // deprecated
510
+        $sql .= ", '" . $this->db->escape($url) . "'"; // deprecated
511 511
         $sql .= ", '" . $this->db->escape($label) . "'";
512 512
         $sql .= ", '" . $this->db->escape($type) . "'";
513 513
         $sql .= ")";
@@ -1634,7 +1634,7 @@  discard block
 block discarded – undo
1634 1634
             $this->error = 'SwiftNotValid';
1635 1635
         }
1636 1636
 
1637
-        if (! $error) {
1637
+        if (!$error) {
1638 1638
             return 1;
1639 1639
         } else {
1640 1640
             return 0;
Please login to merge, or discard this patch.
Dolibarr/Code/Compta/Classes/Facture.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -532,7 +532,7 @@  discard block
 block discarded – undo
532 532
             if (!empty($_facrec->frequency)) {  // Invoice are created on same thirdparty than template when there is a recurrence, but not necessarily when there is no recurrence.
533 533
                 $this->socid = $_facrec->socid;
534 534
             }
535
-            $this->entity            = $_facrec->entity; // Invoice created in same entity than template
535
+            $this->entity = $_facrec->entity; // Invoice created in same entity than template
536 536
 
537 537
             // Fields coming from GUI.
538 538
             // @TODO Value of template should be used as default value on the form on the GUI, and we should here always use the value from GUI
@@ -815,7 +815,7 @@  discard block
 block discarded – undo
815 815
 
816 816
                         // Complete vat rate with code
817 817
                         $vatrate = $newinvoiceline->tva_tx;
818
-                        if ($newinvoiceline->vat_src_code && ! preg_match('/\(.*\)/', (string) $vatrate)) {
818
+                        if ($newinvoiceline->vat_src_code && !preg_match('/\(.*\)/', (string) $vatrate)) {
819 819
                             $vatrate .= ' (' . $newinvoiceline->vat_src_code . ')';
820 820
                         }
821 821
 
@@ -1047,7 +1047,7 @@  discard block
 block discarded – undo
1047 1047
                         $buyprice,
1048 1048
                         $_facrec->lines[$i]->label,
1049 1049
                         empty($_facrec->lines[$i]->array_options) ? null : $_facrec->lines[$i]->array_options,
1050
-                        100,    // situation percent is undefined on recurring invoice lines
1050
+                        100, // situation percent is undefined on recurring invoice lines
1051 1051
                         '',
1052 1052
                         $_facrec->lines[$i]->fk_unit,
1053 1053
                         $_facrec->lines[$i]->multicurrency_subprice,
@@ -1157,7 +1157,7 @@  discard block
 block discarded – undo
1157 1157
 
1158 1158
         $facture->origin            = $this->origin;
1159 1159
         $facture->origin_id         = $this->origin_id;
1160
-        $facture->fk_account         = $this->fk_account;
1160
+        $facture->fk_account = $this->fk_account;
1161 1161
 
1162 1162
         $facture->lines = $this->lines; // Array of lines of invoice
1163 1163
         $facture->situation_counter = $this->situation_counter;
@@ -1631,7 +1631,7 @@  discard block
 block discarded – undo
1631 1631
     {
1632 1632
         global $conf, $langs, $hookmanager, $action;
1633 1633
 
1634
-        if (! in_array($origin->element, array('propal', 'commande'))) {
1634
+        if (!in_array($origin->element, array('propal', 'commande'))) {
1635 1635
             $origin->error = 'ErrorCanOnlyAutomaticallyGenerateADepositFromProposalOrOrder';
1636 1636
             return null;
1637 1637
         }
@@ -2192,7 +2192,7 @@  discard block
 block discarded – undo
2192 2192
                 $this->fk_project = $obj->fk_project;
2193 2193
                 $this->project = null; // Clear if another value was already set by fetch_projet
2194 2194
 
2195
-                $this->statut = $obj->status;   // deprecated
2195
+                $this->statut = $obj->status; // deprecated
2196 2196
                 $this->status = $obj->status;
2197 2197
 
2198 2198
                 $this->date_lim_reglement = $this->db->jdate($obj->dlr);
@@ -3202,7 +3202,7 @@  discard block
 block discarded – undo
3202 3202
             return -1;
3203 3203
         }
3204 3204
         if (
3205
-            (preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref)) &&   // empty should not happened, but when it occurs, the test save life
3205
+            (preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref)) && // empty should not happened, but when it occurs, the test save life
3206 3206
             getDolGlobalString('FAC_FORCE_DATE_VALIDATION')                     // If option enabled, we force invoice date
3207 3207
         ) {
3208 3208
             $this->date = dol_now();
@@ -5695,14 +5695,14 @@  discard block
 block discarded – undo
5695 5695
         if (!empty($paymentmode) && $paymentmode != 'all') {
5696 5696
             $sql .= ", " . MAIN_DB_PREFIX . "c_paiement as cp";
5697 5697
         }
5698
-        $sql .= " WHERE f.paye = 0";    // Only unpaid
5699
-        $sql .= " AND f.fk_statut = " . self::STATUS_VALIDATED;   // Only validated status
5698
+        $sql .= " WHERE f.paye = 0"; // Only unpaid
5699
+        $sql .= " AND f.fk_statut = " . self::STATUS_VALIDATED; // Only validated status
5700 5700
         if ($datetouse == 'invoicedate') {
5701 5701
             $sql .= " AND f.datef = '" . $this->db->idate($tmpidate, 'gmt') . "'";
5702 5702
         } else {
5703 5703
             $sql .= " AND f.date_lim_reglement = '" . $this->db->idate($tmpidate, 'gmt') . "'";
5704 5704
         }
5705
-        $sql .= " AND f.entity IN (" . getEntity('facture', 0) . ")";   // One batch process only one company (no sharing)
5705
+        $sql .= " AND f.entity IN (" . getEntity('facture', 0) . ")"; // One batch process only one company (no sharing)
5706 5706
         if (!empty($paymentmode) && $paymentmode != 'all') {
5707 5707
             $sql .= " AND f.fk_mode_reglement = cp.id AND cp.code = '" . $this->db->escape($paymentmode) . "'";
5708 5708
         }
@@ -5920,7 +5920,7 @@  discard block
 block discarded – undo
5920 5920
                                 $actioncomm->create($user);
5921 5921
                             }
5922 5922
 
5923
-                            $this->db->commit();    // We always commit
5923
+                            $this->db->commit(); // We always commit
5924 5924
                         }
5925 5925
 
5926 5926
                         if ($errormesg) {
@@ -5962,7 +5962,7 @@  discard block
 block discarded – undo
5962 5962
         // get date of last validated invoices of same type
5963 5963
         $sql  = "SELECT datef";
5964 5964
         $sql .= " FROM " . MAIN_DB_PREFIX . "facture";
5965
-        $sql .= " WHERE type = " . (int) $this->type ;
5965
+        $sql .= " WHERE type = " . (int) $this->type;
5966 5966
         $sql .= " AND date_valid IS NOT NULL";
5967 5967
         $sql .= " AND entity IN (" . getEntity('invoice') . ")";
5968 5968
         $sql .= " ORDER BY datef DESC LIMIT 1";
Please login to merge, or discard this patch.
Dolibarr/Code/Compta/Classes/Paiement.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -738,8 +738,8 @@
 block discarded – undo
738 738
 
739 739
             // if dolibarr currency != bank currency then we received an amount in customer currency (currently I don't manage the case : my currency is USD, the customer currency is EUR and he paid me in GBP. Seems no sense for me)
740 740
             if (isModEnabled('multicurrency') && $conf->currency != $acc->currency_code) {
741
-                $totalamount = $this->multicurrency_amount;     // We will insert into llx_bank.amount in foreign currency
742
-                $totalamount_main_currency = $this->amount;     // We will also save the amount in main currency into column llx_bank.amount_main_currency
741
+                $totalamount = $this->multicurrency_amount; // We will insert into llx_bank.amount in foreign currency
742
+                $totalamount_main_currency = $this->amount; // We will also save the amount in main currency into column llx_bank.amount_main_currency
743 743
             }
744 744
 
745 745
             if ($mode == 'payment_supplier') {
Please login to merge, or discard this patch.
Dolibarr/Code/Comm/Classes/CActionComm.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
                             }
264 264
                         }
265 265
                         // For the case type is not 'system...' neither 'module', we just check module is on
266
-                        if (! in_array($obj->type, array('system', 'systemauto', 'module', 'moduleauto'))) {
266
+                        if (!in_array($obj->type, array('system', 'systemauto', 'module', 'moduleauto'))) {
267 267
                             $tmpmodule = $obj->module;
268 268
                             //var_dump($tmpmodule);
269 269
                             if ($tmpmodule && isset($conf->$tmpmodule) && isModEnabled($tmpmodule)) {
@@ -351,10 +351,10 @@  discard block
 block discarded – undo
351 351
                 $idorcode = 'all';
352 352
             }
353 353
             $TType = $TSystem[$idorcode];
354
-            if (! empty($TSystemAuto[$idorcode])) {
354
+            if (!empty($TSystemAuto[$idorcode])) {
355 355
                 $TType = array_merge($TType, $TSystemAuto[$idorcode]);
356 356
             }
357
-            if (! empty($TModule[$idorcode])) {
357
+            if (!empty($TModule[$idorcode])) {
358 358
                 $TType = array_merge($TType, $TModule[$idorcode]);
359 359
             }
360 360
             $this->liste_array = $TType;
Please login to merge, or discard this patch.
Dolibarr/Code/Comm/Classes/Propal.php 1 patch
Spacing   +73 added lines, -73 removed lines patch added patch discarded remove patch
@@ -191,23 +191,23 @@  discard block
 block discarded – undo
191 191
      * @var integer|string $delivery_date ;
192 192
      */
193 193
     public $delivery_date;
194
-    public $fin_validite;    // code
195
-        public $user_author_id;         // label
194
+    public $fin_validite; // code
195
+        public $user_author_id; // label
196 196
         /**
197 197
      * @deprecated
198 198
      * @see $total_ht
199 199
      */
200
-    public $price;     // label doc
200
+    public $price; // label doc
201 201
     /**
202 202
      * @deprecated
203 203
      * @see $total_tva
204 204
      */
205
-    public $tva;    // code
205
+    public $tva; // code
206 206
         /**
207 207
      * @deprecated
208 208
      * @see $total_ttc
209 209
      */
210
-    public $total;         // label
210
+    public $total; // label
211 211
 public $cond_reglement_code;
212 212
 public $cond_reglement;
213 213
 public $cond_reglement_doc;
@@ -224,17 +224,17 @@  discard block
 block discarded – undo
224 224
     /**
225 225
      * @var int availability ID
226 226
      */
227
-    public $availability_id;       // id
227
+    public $availability_id; // id
228 228
         /**
229 229
      * @var int availability ID
230 230
      * @deprecated
231 231
      * @see $availability_id
232 232
      */
233
-    public $fk_availability;     // code
233
+    public $fk_availability; // code
234 234
         /**
235 235
      * @var string availability code
236 236
      */
237
-    public $availability_code;          // label
237
+    public $availability_code; // label
238 238
     /**
239 239
      * @var string availability label
240 240
      */
@@ -513,14 +513,14 @@  discard block
 block discarded – undo
513 513
 
514 514
         if (!empty($ref)) {
515 515
             if (!empty($forceentity)) {
516
-                $sql .= " WHERE p.entity = " . (int)$forceentity; // Check only the current entity because we may have the same reference in several entities
516
+                $sql .= " WHERE p.entity = " . (int) $forceentity; // Check only the current entity because we may have the same reference in several entities
517 517
             } else {
518 518
                 $sql .= " WHERE p.entity IN (" . getEntity('propal') . ")";
519 519
             }
520 520
             $sql .= " AND p.ref='" . $this->db->escape($ref) . "'";
521 521
         } else {
522 522
             // Don't use entity if you use rowid
523
-            $sql .= " WHERE p.rowid = " . ((int)$rowid);
523
+            $sql .= " WHERE p.rowid = " . ((int) $rowid);
524 524
         }
525 525
 
526 526
         dol_syslog(get_class($this) . "::fetch", LOG_DEBUG);
@@ -537,7 +537,7 @@  discard block
 block discarded – undo
537 537
                 $this->ref_customer = $obj->ref_client;
538 538
                 $this->ref_ext = $obj->ref_ext;
539 539
 
540
-                $this->total = $obj->total_ttc;          // TODO deprecated
540
+                $this->total = $obj->total_ttc; // TODO deprecated
541 541
                 $this->total_ttc = $obj->total_ttc;
542 542
                 $this->total_ht = $obj->total_ht;
543 543
                 $this->total_tva = $obj->total_tva;
@@ -556,7 +556,7 @@  discard block
 block discarded – undo
556 556
                 $this->note_private = $obj->note_private;
557 557
                 $this->note_public = $obj->note_public;
558 558
 
559
-                $this->status = (int)$obj->fk_statut;
559
+                $this->status = (int) $obj->fk_statut;
560 560
                 $this->statut = $this->status; // deprecated
561 561
 
562 562
                 $this->datec = $this->db->jdate($obj->datec); // TODO deprecated
@@ -589,7 +589,7 @@  discard block
 block discarded – undo
589 589
                 $this->cond_reglement_doc = $obj->cond_reglement_libelle_doc;
590 590
                 $this->deposit_percent = $obj->deposit_percent;
591 591
 
592
-                $this->extraparams = !empty($obj->extraparams) ? (array)json_decode($obj->extraparams, true) : array();
592
+                $this->extraparams = !empty($obj->extraparams) ? (array) json_decode($obj->extraparams, true) : array();
593 593
 
594 594
                 $this->user_author_id = $obj->fk_user_author;
595 595
                 $this->user_validation_id = $obj->fk_user_valid;
@@ -655,7 +655,7 @@  discard block
 block discarded – undo
655 655
         $sql .= ' d.fk_multicurrency, d.multicurrency_code, d.multicurrency_subprice, d.multicurrency_total_ht, d.multicurrency_total_tva, d.multicurrency_total_ttc';
656 656
         $sql .= ' FROM ' . MAIN_DB_PREFIX . 'propaldet as d';
657 657
         $sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'product as p ON (d.fk_product = p.rowid)';
658
-        $sql .= ' WHERE d.fk_propal = ' . ((int)$this->id);
658
+        $sql .= ' WHERE d.fk_propal = ' . ((int) $this->id);
659 659
         if ($only_product) {
660 660
             $sql .= ' AND p.fk_product_type = 0';
661 661
         }
@@ -875,10 +875,10 @@  discard block
 block discarded – undo
875 875
 
876 876
         // Clean parameters
877 877
         $remise_percent = price2num($remise_percent);
878
-        $qty = (float)price2num($qty);
878
+        $qty = (float) price2num($qty);
879 879
         $pu = price2num($pu);
880 880
         $pu_ht_devise = price2num($pu_ht_devise);
881
-        if (!preg_match('/\((.*)\)/', (string)$txtva)) {
881
+        if (!preg_match('/\((.*)\)/', (string) $txtva)) {
882 882
             $txtva = price2num($txtva); // $txtva can have format '5.0(XXX)' or '5'
883 883
         }
884 884
         $txlocaltax1 = price2num($txlocaltax1);
@@ -939,9 +939,9 @@  discard block
 block discarded – undo
939 939
             // Anciens indicateurs: $price, $remise (a ne plus utiliser)
940 940
             $price = $pu;
941 941
             $remise = 0;
942
-            if ((float)$remise_percent > 0) {
943
-                $remise = round(((float)$pu * (float)$remise_percent / 100), 2);
944
-                $price = (float)$pu - $remise;
942
+            if ((float) $remise_percent > 0) {
943
+                $remise = round(((float) $pu * (float) $remise_percent / 100), 2);
944
+                $price = (float) $pu - $remise;
945 945
             }
946 946
 
947 947
             //Fetch current line from the database and then clone the object and set it in $oldline property
@@ -1099,7 +1099,7 @@  discard block
 block discarded – undo
1099 1099
         $sql .= " note_public=" . (isset($this->note_public) ? "'" . $this->db->escape($this->note_public) . "'" : "null") . ",";
1100 1100
         $sql .= " model_pdf=" . (isset($this->model_pdf) ? "'" . $this->db->escape($this->model_pdf) . "'" : "null") . ",";
1101 1101
         $sql .= " import_key=" . (isset($this->import_key) ? "'" . $this->db->escape($this->import_key) . "'" : "null");
1102
-        $sql .= " WHERE rowid=" . ((int)$this->id);
1102
+        $sql .= " WHERE rowid=" . ((int) $this->id);
1103 1103
 
1104 1104
         $this->db->begin();
1105 1105
 
@@ -1218,8 +1218,8 @@  discard block
 block discarded – undo
1218 1218
         // Delete extrafields of lines and lines
1219 1219
         if (!$error && !empty($this->table_element_line)) {
1220 1220
             $tabletodelete = $this->table_element_line;
1221
-            $sqlef = "DELETE FROM " . MAIN_DB_PREFIX . $tabletodelete . "_extrafields WHERE fk_object IN (SELECT rowid FROM " . MAIN_DB_PREFIX . $tabletodelete . " WHERE " . $this->fk_element . " = " . ((int)$this->id) . ")";
1222
-            $sql = "DELETE FROM " . MAIN_DB_PREFIX . $tabletodelete . " WHERE " . $this->fk_element . " = " . ((int)$this->id);
1221
+            $sqlef = "DELETE FROM " . MAIN_DB_PREFIX . $tabletodelete . "_extrafields WHERE fk_object IN (SELECT rowid FROM " . MAIN_DB_PREFIX . $tabletodelete . " WHERE " . $this->fk_element . " = " . ((int) $this->id) . ")";
1222
+            $sql = "DELETE FROM " . MAIN_DB_PREFIX . $tabletodelete . " WHERE " . $this->fk_element . " = " . ((int) $this->id);
1223 1223
             if (!$this->db->query($sqlef) || !$this->db->query($sql)) {
1224 1224
                 $error++;
1225 1225
                 $this->error = $this->db->lasterror();
@@ -1255,7 +1255,7 @@  discard block
 block discarded – undo
1255 1255
 
1256 1256
         // Delete main record
1257 1257
         if (!$error) {
1258
-            $sql = "DELETE FROM " . MAIN_DB_PREFIX . $this->table_element . " WHERE rowid = " . ((int)$this->id);
1258
+            $sql = "DELETE FROM " . MAIN_DB_PREFIX . $this->table_element . " WHERE rowid = " . ((int) $this->id);
1259 1259
             $res = $this->db->query($sql);
1260 1260
             if (!$res) {
1261 1261
                 $error++;
@@ -1291,7 +1291,7 @@  discard block
 block discarded – undo
1291 1291
                     }
1292 1292
                 }
1293 1293
                 if (file_exists($dir)) {
1294
-                    $res = @dol_delete_dir_recursive($dir);     // delete files physically + into ecm tables
1294
+                    $res = @dol_delete_dir_recursive($dir); // delete files physically + into ecm tables
1295 1295
                     if (!$res) {
1296 1296
                         $this->error = 'ErrorFailToDeleteDir';
1297 1297
                         $this->errors[] = $this->error;
@@ -1612,15 +1612,15 @@  discard block
 block discarded – undo
1612 1612
         $sql .= ", '" . $this->db->idate($this->date) . "'";
1613 1613
         $sql .= ", '" . $this->db->idate($now) . "'";
1614 1614
         $sql .= ", '(PROV)'";
1615
-        $sql .= ", " . ($user->id > 0 ? ((int)$user->id) : "NULL");
1615
+        $sql .= ", " . ($user->id > 0 ? ((int) $user->id) : "NULL");
1616 1616
         $sql .= ", '" . $this->db->escape($this->note_private) . "'";
1617 1617
         $sql .= ", '" . $this->db->escape($this->note_public) . "'";
1618 1618
         $sql .= ", '" . $this->db->escape($this->model_pdf) . "'";
1619 1619
         $sql .= ", " . ($this->fin_validite != '' ? "'" . $this->db->idate($this->fin_validite) . "'" : "NULL");
1620
-        $sql .= ", " . ($this->cond_reglement_id > 0 ? ((int)$this->cond_reglement_id) : 'NULL');
1620
+        $sql .= ", " . ($this->cond_reglement_id > 0 ? ((int) $this->cond_reglement_id) : 'NULL');
1621 1621
         $sql .= ", " . (!empty($this->deposit_percent) ? "'" . $this->db->escape($this->deposit_percent) . "'" : 'NULL');
1622
-        $sql .= ", " . ($this->mode_reglement_id > 0 ? ((int)$this->mode_reglement_id) : 'NULL');
1623
-        $sql .= ", " . ($this->fk_account > 0 ? ((int)$this->fk_account) : 'NULL');
1622
+        $sql .= ", " . ($this->mode_reglement_id > 0 ? ((int) $this->mode_reglement_id) : 'NULL');
1623
+        $sql .= ", " . ($this->fk_account > 0 ? ((int) $this->fk_account) : 'NULL');
1624 1624
         $sql .= ", '" . $this->db->escape($this->ref_client) . "'";
1625 1625
         $sql .= ", '" . $this->db->escape($this->ref_ext) . "'";
1626 1626
         $sql .= ", " . (empty($delivery_date) ? "NULL" : "'" . $this->db->idate($delivery_date) . "'");
@@ -1629,12 +1629,12 @@  discard block
 block discarded – undo
1629 1629
         $sql .= ", " . $this->availability_id;
1630 1630
         $sql .= ", " . $this->demand_reason_id;
1631 1631
         $sql .= ", " . ($this->fk_project ? $this->fk_project : "null");
1632
-        $sql .= ", " . (int)$this->fk_incoterms;
1632
+        $sql .= ", " . (int) $this->fk_incoterms;
1633 1633
         $sql .= ", '" . $this->db->escape($this->location_incoterms) . "'";
1634 1634
         $sql .= ", " . setEntity($this);
1635
-        $sql .= ", " . (int)$this->fk_multicurrency;
1635
+        $sql .= ", " . (int) $this->fk_multicurrency;
1636 1636
         $sql .= ", '" . $this->db->escape($this->multicurrency_code) . "'";
1637
-        $sql .= ", " . (float)$this->multicurrency_tx;
1637
+        $sql .= ", " . (float) $this->multicurrency_tx;
1638 1638
         $sql .= ")";
1639 1639
 
1640 1640
         dol_syslog(get_class($this) . "::create", LOG_DEBUG);
@@ -1644,7 +1644,7 @@  discard block
 block discarded – undo
1644 1644
 
1645 1645
             if ($this->id) {
1646 1646
                 $this->ref = '(PROV' . $this->id . ')';
1647
-                $sql = 'UPDATE ' . MAIN_DB_PREFIX . "propal SET ref='" . $this->db->escape($this->ref) . "' WHERE rowid=" . ((int)$this->id);
1647
+                $sql = 'UPDATE ' . MAIN_DB_PREFIX . "propal SET ref='" . $this->db->escape($this->ref) . "' WHERE rowid=" . ((int) $this->id);
1648 1648
 
1649 1649
                 dol_syslog(get_class($this) . "::create", LOG_DEBUG);
1650 1650
                 $resql = $this->db->query($sql);
@@ -1689,7 +1689,7 @@  discard block
 block discarded – undo
1689 1689
                     for ($i = 0; $i < $num; $i++) {
1690 1690
                         if (!is_object($this->lines[$i])) { // If this->lines is not array of objects, coming from REST API
1691 1691
                             // Convert into object this->lines[$i].
1692
-                            $line = (object)$this->lines[$i];
1692
+                            $line = (object) $this->lines[$i];
1693 1693
                         } else {
1694 1694
                             $line = $this->lines[$i];
1695 1695
                         }
@@ -1882,11 +1882,11 @@  discard block
 block discarded – undo
1882 1882
             }
1883 1883
 
1884 1884
             $remise_percent = price2num($remise_percent);
1885
-            $qty = (float)price2num($qty);
1885
+            $qty = (float) price2num($qty);
1886 1886
             $pu_ht = price2num($pu_ht);
1887 1887
             $pu_ht_devise = price2num($pu_ht_devise);
1888 1888
             $pu_ttc = price2num($pu_ttc);
1889
-            if (!preg_match('/\((.*)\)/', (string)$txtva)) {
1889
+            if (!preg_match('/\((.*)\)/', (string) $txtva)) {
1890 1890
                 $txtva = price2num($txtva); // $txtva can have format '5,1' or '5.1' or '5.1(XXX)', we must clean only if '5,1'
1891 1891
             }
1892 1892
             $txlocaltax1 = price2num($txlocaltax1);
@@ -1968,9 +1968,9 @@  discard block
 block discarded – undo
1968 1968
             // Anciens indicateurs: $price, $remise (a ne plus utiliser)
1969 1969
             $price = $pu;
1970 1970
             $remise = 0;
1971
-            if ((float)$remise_percent > 0) {
1972
-                $remise = round(((float)$pu * (float)$remise_percent / 100), 2);
1973
-                $price = (float)$pu - $remise;
1971
+            if ((float) $remise_percent > 0) {
1972
+                $remise = round(((float) $pu * (float) $remise_percent / 100), 2);
1973
+                $price = (float) $pu - $remise;
1974 1974
             }
1975 1975
 
1976 1976
             // Insert line
@@ -2121,8 +2121,8 @@  discard block
 block discarded – undo
2121 2121
 
2122 2122
         $sql = "UPDATE " . MAIN_DB_PREFIX . "propal";
2123 2123
         $sql .= " SET ref = '" . $this->db->escape($num) . "',";
2124
-        $sql .= " fk_statut = " . self::STATUS_VALIDATED . ", date_valid='" . $this->db->idate($now) . "', fk_user_valid=" . ((int)$user->id);
2125
-        $sql .= " WHERE rowid = " . ((int)$this->id) . " AND fk_statut = " . self::STATUS_DRAFT;
2124
+        $sql .= " fk_statut = " . self::STATUS_VALIDATED . ", date_valid='" . $this->db->idate($now) . "', fk_user_valid=" . ((int) $user->id);
2125
+        $sql .= " WHERE rowid = " . ((int) $this->id) . " AND fk_statut = " . self::STATUS_DRAFT;
2126 2126
 
2127 2127
         dol_syslog(get_class($this) . "::valid", LOG_DEBUG);
2128 2128
         $resql = $this->db->query($sql);
@@ -2148,7 +2148,7 @@  discard block
 block discarded – undo
2148 2148
             if (preg_match('/^[\(]?PROV/i', $this->ref)) {
2149 2149
                 // Now we rename also files into index
2150 2150
                 $sql = 'UPDATE ' . MAIN_DB_PREFIX . "ecm_files set filename = CONCAT('" . $this->db->escape($this->newref) . "', SUBSTR(filename, " . (strlen($this->ref) + 1) . ")), filepath = 'propale/" . $this->db->escape($this->newref) . "'";
2151
-                $sql .= " WHERE filename LIKE '" . $this->db->escape($this->ref) . "%' AND filepath = 'propale/" . $this->db->escape($this->ref) . "' and entity = " . ((int)$conf->entity);
2151
+                $sql .= " WHERE filename LIKE '" . $this->db->escape($this->ref) . "%' AND filepath = 'propale/" . $this->db->escape($this->ref) . "' and entity = " . ((int) $conf->entity);
2152 2152
                 $resql = $this->db->query($sql);
2153 2153
                 if (!$resql) {
2154 2154
                     $error++;
@@ -2219,12 +2219,12 @@  discard block
 block discarded – undo
2219 2219
             $file = $classname . ".php";
2220 2220
 
2221 2221
             // Include file with class
2222
-            $dirmodels = array_merge(array('/'), (array)$conf->modules_parts['models']);
2222
+            $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
2223 2223
             foreach ($dirmodels as $reldir) {
2224 2224
                 $dir = dol_buildpath($reldir . "core/modules/propale/");
2225 2225
 
2226 2226
                 // Load file with numbering class (if found)
2227
-                $mybool = ((bool)@include_once $dir . $file) || $mybool;
2227
+                $mybool = ((bool) @include_once $dir . $file) || $mybool;
2228 2228
             }
2229 2229
 
2230 2230
             if (!$mybool) {
@@ -2275,7 +2275,7 @@  discard block
 block discarded – undo
2275 2275
             $this->db->begin();
2276 2276
 
2277 2277
             $sql = "UPDATE " . MAIN_DB_PREFIX . "propal SET datep = '" . $this->db->idate($date) . "'";
2278
-            $sql .= " WHERE rowid = " . ((int)$this->id);
2278
+            $sql .= " WHERE rowid = " . ((int) $this->id);
2279 2279
 
2280 2280
             dol_syslog(__METHOD__, LOG_DEBUG);
2281 2281
             $resql = $this->db->query($sql);
@@ -2334,7 +2334,7 @@  discard block
 block discarded – undo
2334 2334
             $this->db->begin();
2335 2335
 
2336 2336
             $sql = "UPDATE " . MAIN_DB_PREFIX . "propal SET fin_validite = " . ($date_end_validity != '' ? "'" . $this->db->idate($date_end_validity) . "'" : 'null');
2337
-            $sql .= " WHERE rowid = " . ((int)$this->id);
2337
+            $sql .= " WHERE rowid = " . ((int) $this->id);
2338 2338
 
2339 2339
             dol_syslog(__METHOD__, LOG_DEBUG);
2340 2340
 
@@ -2409,7 +2409,7 @@  discard block
 block discarded – undo
2409 2409
 
2410 2410
             $sql = "UPDATE " . MAIN_DB_PREFIX . "propal ";
2411 2411
             $sql .= " SET date_livraison = " . ($delivery_date != '' ? "'" . $this->db->idate($delivery_date) . "'" : 'null');
2412
-            $sql .= " WHERE rowid = " . ((int)$this->id);
2412
+            $sql .= " WHERE rowid = " . ((int) $this->id);
2413 2413
 
2414 2414
             dol_syslog(__METHOD__, LOG_DEBUG);
2415 2415
             $resql = $this->db->query($sql);
@@ -2465,8 +2465,8 @@  discard block
 block discarded – undo
2465 2465
             $this->db->begin();
2466 2466
 
2467 2467
             $sql = "UPDATE " . MAIN_DB_PREFIX . "propal";
2468
-            $sql .= " SET fk_availability = " . ((int)$id);
2469
-            $sql .= " WHERE rowid = " . ((int)$this->id);
2468
+            $sql .= " SET fk_availability = " . ((int) $id);
2469
+            $sql .= " WHERE rowid = " . ((int) $this->id);
2470 2470
 
2471 2471
             dol_syslog(__METHOD__ . ' availability(' . $id . ')', LOG_DEBUG);
2472 2472
             $resql = $this->db->query($sql);
@@ -2527,8 +2527,8 @@  discard block
 block discarded – undo
2527 2527
             $this->db->begin();
2528 2528
 
2529 2529
             $sql = "UPDATE " . MAIN_DB_PREFIX . "propal ";
2530
-            $sql .= " SET fk_input_reason = " . ((int)$id);
2531
-            $sql .= " WHERE rowid = " . ((int)$this->id);
2530
+            $sql .= " SET fk_input_reason = " . ((int) $id);
2531
+            $sql .= " WHERE rowid = " . ((int) $this->id);
2532 2532
 
2533 2533
             dol_syslog(__METHOD__, LOG_DEBUG);
2534 2534
             $resql = $this->db->query($sql);
@@ -2591,7 +2591,7 @@  discard block
 block discarded – undo
2591 2591
             $this->db->begin();
2592 2592
 
2593 2593
             $sql = "UPDATE " . MAIN_DB_PREFIX . "propal SET ref_client = " . (empty($ref_client) ? 'NULL' : "'" . $this->db->escape($ref_client) . "'");
2594
-            $sql .= " WHERE rowid = " . ((int)$this->id);
2594
+            $sql .= " WHERE rowid = " . ((int) $this->id);
2595 2595
 
2596 2596
             dol_syslog(__METHOD__ . ' $this->id=' . $this->id . ', ref_client=' . $ref_client, LOG_DEBUG);
2597 2597
             $resql = $this->db->query($sql);
@@ -2646,12 +2646,12 @@  discard block
 block discarded – undo
2646 2646
         $error = 0;
2647 2647
 
2648 2648
         $sql = "UPDATE " . MAIN_DB_PREFIX . "propal";
2649
-        $sql .= " SET fk_statut = " . ((int)$status) . ",";
2649
+        $sql .= " SET fk_statut = " . ((int) $status) . ",";
2650 2650
         if (!empty($note)) {
2651 2651
             $sql .= " note_private = '" . $this->db->escape($note) . "',";
2652 2652
         }
2653 2653
         $sql .= " date_cloture=NULL, fk_user_cloture=NULL";
2654
-        $sql .= " WHERE rowid = " . ((int)$this->id);
2654
+        $sql .= " WHERE rowid = " . ((int) $this->id);
2655 2655
 
2656 2656
         $this->db->begin();
2657 2657
 
@@ -2729,17 +2729,17 @@  discard block
 block discarded – undo
2729 2729
         }
2730 2730
 
2731 2731
         $sql = "UPDATE " . MAIN_DB_PREFIX . "propal";
2732
-        $sql .= " SET fk_statut = " . ((int)$status) . ", note_private = '" . $this->db->escape($newprivatenote) . "', date_signature='" . $this->db->idate($date_signature) . "', fk_user_signature=" . $fk_user_signature;
2733
-        $sql .= " WHERE rowid = " . ((int)$this->id);
2732
+        $sql .= " SET fk_statut = " . ((int) $status) . ", note_private = '" . $this->db->escape($newprivatenote) . "', date_signature='" . $this->db->idate($date_signature) . "', fk_user_signature=" . $fk_user_signature;
2733
+        $sql .= " WHERE rowid = " . ((int) $this->id);
2734 2734
 
2735 2735
         $resql = $this->db->query($sql);
2736 2736
         if ($resql) {
2737 2737
             // Status self::STATUS_REFUSED by default
2738 2738
             $modelpdf = getDolGlobalString('PROPALE_ADDON_PDF_ODT_CLOSED', $this->model_pdf);
2739
-            $trigger_name = 'PROPAL_CLOSE_REFUSED';     // used later in call_trigger()
2739
+            $trigger_name = 'PROPAL_CLOSE_REFUSED'; // used later in call_trigger()
2740 2740
 
2741 2741
             if ($status == self::STATUS_SIGNED) {   // Status self::STATUS_SIGNED
2742
-                $trigger_name = 'PROPAL_CLOSE_SIGNED';  // used later in call_trigger()
2742
+                $trigger_name = 'PROPAL_CLOSE_SIGNED'; // used later in call_trigger()
2743 2743
                 $modelpdf = getDolGlobalString('PROPALE_ADDON_PDF_ODT_TOBILL') ? $conf->global->PROPALE_ADDON_PDF_ODT_TOBILL : $this->model_pdf;
2744 2744
 
2745 2745
                 // The connected company is classified as a client
@@ -2820,7 +2820,7 @@  discard block
 block discarded – undo
2820 2820
         $sql .= " c.datec, c.date_valid as datev, c.date_signature, c.date_cloture,";
2821 2821
         $sql .= " c.fk_user_author, c.fk_user_valid, c.fk_user_signature, c.fk_user_cloture";
2822 2822
         $sql .= " FROM " . MAIN_DB_PREFIX . "propal as c";
2823
-        $sql .= " WHERE c.rowid = " . ((int)$id);
2823
+        $sql .= " WHERE c.rowid = " . ((int) $id);
2824 2824
 
2825 2825
         $result = $this->db->query($sql);
2826 2826
 
@@ -2911,8 +2911,8 @@  discard block
 block discarded – undo
2911 2911
         $newprivatenote = dol_concatdesc($this->note_private, $note);
2912 2912
 
2913 2913
         $sql = 'UPDATE ' . MAIN_DB_PREFIX . 'propal SET fk_statut = ' . self::STATUS_BILLED . ", ";
2914
-        $sql .= " note_private = '" . $this->db->escape($newprivatenote) . "', date_cloture='" . $this->db->idate($now) . "', fk_user_cloture=" . ((int)$user->id);
2915
-        $sql .= ' WHERE rowid = ' . ((int)$this->id) . ' AND fk_statut = ' . ((int)self::STATUS_SIGNED);
2914
+        $sql .= " note_private = '" . $this->db->escape($newprivatenote) . "', date_cloture='" . $this->db->idate($now) . "', fk_user_cloture=" . ((int) $user->id);
2915
+        $sql .= ' WHERE rowid = ' . ((int) $this->id) . ' AND fk_statut = ' . ((int) self::STATUS_SIGNED);
2916 2916
 
2917 2917
         dol_syslog(__METHOD__, LOG_DEBUG);
2918 2918
         $resql = $this->db->query($sql);
@@ -2986,8 +2986,8 @@  discard block
 block discarded – undo
2986 2986
 
2987 2987
         $sql = "UPDATE " . MAIN_DB_PREFIX . "propal";
2988 2988
         $sql .= " SET fk_statut = " . self::STATUS_CANCELED . ",";
2989
-        $sql .= " fk_user_modif = " . ((int)$user->id);
2990
-        $sql .= " WHERE rowid = " . ((int)$this->id);
2989
+        $sql .= " fk_user_modif = " . ((int) $user->id);
2990
+        $sql .= " WHERE rowid = " . ((int) $this->id);
2991 2991
 
2992 2992
         dol_syslog(get_class($this) . "::cancel", LOG_DEBUG);
2993 2993
         if ($this->db->query($sql)) {
@@ -3045,7 +3045,7 @@  discard block
 block discarded – undo
3045 3045
         $sql = "UPDATE " . MAIN_DB_PREFIX . "propal";
3046 3046
         $sql .= " SET fk_statut = " . self::STATUS_DRAFT;
3047 3047
         $sql .= ",  online_sign_ip = NULL , online_sign_name = NULL";
3048
-        $sql .= " WHERE rowid = " . ((int)$this->id);
3048
+        $sql .= " WHERE rowid = " . ((int) $this->id);
3049 3049
 
3050 3050
         $resql = $this->db->query($sql);
3051 3051
         if (!$resql) {
@@ -3120,18 +3120,18 @@  discard block
 block discarded – undo
3120 3120
             if ($search_sale == -2) {
3121 3121
                 $sql .= " AND NOT EXISTS (SELECT sc.fk_soc FROM " . MAIN_DB_PREFIX . "societe_commerciaux as sc WHERE sc.fk_soc = p.fk_soc)";
3122 3122
             } elseif ($search_sale > 0) {
3123
-                $sql .= " AND EXISTS (SELECT sc.fk_soc FROM " . MAIN_DB_PREFIX . "societe_commerciaux as sc WHERE sc.fk_soc = p.fk_soc AND sc.fk_user = " . ((int)$search_sale) . ")";
3123
+                $sql .= " AND EXISTS (SELECT sc.fk_soc FROM " . MAIN_DB_PREFIX . "societe_commerciaux as sc WHERE sc.fk_soc = p.fk_soc AND sc.fk_user = " . ((int) $search_sale) . ")";
3124 3124
             }
3125 3125
         }
3126 3126
         // Search on socid
3127 3127
         if ($socid) {
3128
-            $sql .= " AND p.fk_soc = " . ((int)$socid);
3128
+            $sql .= " AND p.fk_soc = " . ((int) $socid);
3129 3129
         }
3130 3130
         if ($draft) {
3131
-            $sql .= " AND p.fk_statut = " . ((int)self::STATUS_DRAFT);
3131
+            $sql .= " AND p.fk_statut = " . ((int) self::STATUS_DRAFT);
3132 3132
         }
3133 3133
         if ($notcurrentuser > 0) {
3134
-            $sql .= " AND p.fk_user_author <> " . ((int)$user->id);
3134
+            $sql .= " AND p.fk_user_author <> " . ((int) $user->id);
3135 3135
         }
3136 3136
         $sql .= $this->db->order($sortfield, $sortorder);
3137 3137
         $sql .= $this->db->plimit($limit, $offset);
@@ -3269,8 +3269,8 @@  discard block
 block discarded – undo
3269 3269
             $this->db->begin();
3270 3270
 
3271 3271
             $sql = 'UPDATE ' . MAIN_DB_PREFIX . 'propal';
3272
-            $sql .= ' SET fk_availability = ' . ((int)$availability_id);
3273
-            $sql .= ' WHERE rowid=' . ((int)$this->id);
3272
+            $sql .= ' SET fk_availability = ' . ((int) $availability_id);
3273
+            $sql .= ' WHERE rowid=' . ((int) $this->id);
3274 3274
 
3275 3275
             dol_syslog(__METHOD__ . ' availability(' . $availability_id . ')', LOG_DEBUG);
3276 3276
             $resql = $this->db->query($sql);
@@ -3332,8 +3332,8 @@  discard block
 block discarded – undo
3332 3332
             $this->db->begin();
3333 3333
 
3334 3334
             $sql = 'UPDATE ' . MAIN_DB_PREFIX . 'propal';
3335
-            $sql .= ' SET fk_input_reason = ' . ((int)$demand_reason_id);
3336
-            $sql .= ' WHERE rowid=' . ((int)$this->id);
3335
+            $sql .= ' SET fk_input_reason = ' . ((int) $demand_reason_id);
3336
+            $sql .= ' WHERE rowid=' . ((int) $this->id);
3337 3337
 
3338 3338
             dol_syslog(__METHOD__ . ' demand_reason(' . $demand_reason_id . ')', LOG_DEBUG);
3339 3339
             $resql = $this->db->query($sql);
@@ -3409,7 +3409,7 @@  discard block
 block discarded – undo
3409 3409
             if ($search_sale == -2) {
3410 3410
                 $sql .= " AND NOT EXISTS (SELECT sc.fk_soc FROM " . MAIN_DB_PREFIX . "societe_commerciaux as sc WHERE sc.fk_soc = p.fk_soc)";
3411 3411
             } elseif ($search_sale > 0) {
3412
-                $sql .= " AND EXISTS (SELECT sc.fk_soc FROM " . MAIN_DB_PREFIX . "societe_commerciaux as sc WHERE sc.fk_soc = p.fk_soc AND sc.fk_user = " . ((int)$search_sale) . ")";
3412
+                $sql .= " AND EXISTS (SELECT sc.fk_soc FROM " . MAIN_DB_PREFIX . "societe_commerciaux as sc WHERE sc.fk_soc = p.fk_soc AND sc.fk_user = " . ((int) $search_sale) . ")";
3413 3413
             }
3414 3414
         }
3415 3415
 
@@ -3585,7 +3585,7 @@  discard block
 block discarded – undo
3585 3585
             if ($search_sale == -2) {
3586 3586
                 $sql .= " AND NOT EXISTS (SELECT sc.fk_soc FROM " . MAIN_DB_PREFIX . "societe_commerciaux as sc WHERE sc.fk_soc = p.fk_soc)";
3587 3587
             } elseif ($search_sale > 0) {
3588
-                $sql .= " AND EXISTS (SELECT sc.fk_soc FROM " . MAIN_DB_PREFIX . "societe_commerciaux as sc WHERE sc.fk_soc = p.fk_soc AND sc.fk_user = " . ((int)$search_sale) . ")";
3588
+                $sql .= " AND EXISTS (SELECT sc.fk_soc FROM " . MAIN_DB_PREFIX . "societe_commerciaux as sc WHERE sc.fk_soc = p.fk_soc AND sc.fk_user = " . ((int) $search_sale) . ")";
3589 3589
             }
3590 3590
         }
3591 3591
 
Please login to merge, or discard this patch.
Dolibarr/Code/Comm/Classes/Mailing.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -384,7 +384,7 @@  discard block
 block discarded – undo
384 384
                 $this->title = $obj->title;
385 385
                 $this->messtype = $obj->messtype;
386 386
 
387
-                $this->statut = $obj->status;   // deprecated
387
+                $this->statut = $obj->status; // deprecated
388 388
                 $this->status = $obj->status;
389 389
 
390 390
                 $this->nbemail = $obj->nbemail;
@@ -727,7 +727,7 @@  discard block
 block discarded – undo
727 727
                 $sql .= ' WHERE rowid = ' . ((int) $this->id);
728 728
 
729 729
                 $resqlupdate = $this->db->query($sql);
730
-                if (! $resqlupdate) {
730
+                if (!$resqlupdate) {
731 731
                     $this->error = $this->db->lasterror();
732 732
                     return -1;
733 733
                 } else {
Please login to merge, or discard this patch.