Passed
Push — GENERAL_BUG_REVIEW_240911 ( 8cbbee...d4fdcf )
by Rafael
64:20
created
public/htdocs/fourn/facture/card.php 1 patch
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
     // Action clone object
198 198
     if ($action == 'confirm_clone' && $confirm == 'yes' && $permissiontoadd) {
199 199
         $objectutil = dol_clone($object, 1); // To avoid to denaturate loaded object when setting some properties for clone. We use native clone to keep this->db valid.
200
-        '@phan-var-force FactureFournisseur $objectutil';  // Same object type for cloned object
200
+        '@phan-var-force FactureFournisseur $objectutil'; // Same object type for cloned object
201 201
 
202 202
         if (GETPOST('newsupplierref', 'alphanohtml')) {
203 203
             $objectutil->ref_supplier = GETPOST('newsupplierref', 'alphanohtml');
@@ -672,7 +672,7 @@  discard block
 block discarded – undo
672 672
                 $sql = 'SELECT SUM(pf.amount) as total_paiements';
673 673
                 $sql .= ' FROM ' . MAIN_DB_PREFIX . 'paiementfourn_facturefourn as pf, ' . MAIN_DB_PREFIX . 'paiementfourn as p';
674 674
                 $sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'c_paiement as c ON p.fk_paiement = c.id AND c.entity IN (' . getEntity('c_paiement') . ')';
675
-                $sql .= ' WHERE pf.fk_facturefourn = ' . ((int)$object->id);
675
+                $sql .= ' WHERE pf.fk_facturefourn = ' . ((int) $object->id);
676 676
                 $sql .= ' AND pf.fk_paiementfourn = p.rowid';
677 677
                 $sql .= ' AND p.entity IN (' . getEntity('invoice') . ')';
678 678
 
@@ -689,7 +689,7 @@  discard block
 block discarded – undo
689 689
                 $sql = "SELECT re.rowid, re.amount_ht, re.amount_tva, re.amount_ttc,";
690 690
                 $sql .= " re.description, re.fk_invoice_supplier_source";
691 691
                 $sql .= " FROM " . MAIN_DB_PREFIX . "societe_remise_except as re";
692
-                $sql .= " WHERE fk_invoice_supplier = " . ((int)$object->id);
692
+                $sql .= " WHERE fk_invoice_supplier = " . ((int) $object->id);
693 693
                 $resql = $db->query($sql);
694 694
                 if (!empty($resql)) {
695 695
                     while ($obj = $db->fetch_object($resql)) {
@@ -711,12 +711,12 @@  discard block
 block discarded – undo
711 711
             }
712 712
             if ($object->type == FactureFournisseur::TYPE_CREDIT_NOTE || $object->type == FactureFournisseur::TYPE_DEPOSIT) {
713 713
                 foreach ($amount_ht as $tva_tx => $xxx) {
714
-                    $discount->amount_ht = abs((float)$amount_ht[$tva_tx]);
715
-                    $discount->amount_tva = abs((float)$amount_tva[$tva_tx]);
716
-                    $discount->amount_ttc = abs((float)$amount_ttc[$tva_tx]);
717
-                    $discount->multicurrency_amount_ht = abs((float)$multicurrency_amount_ht[$tva_tx]);
718
-                    $discount->multicurrency_amount_tva = abs((float)$multicurrency_amount_tva[$tva_tx]);
719
-                    $discount->multicurrency_amount_ttc = abs((float)$multicurrency_amount_ttc[$tva_tx]);
714
+                    $discount->amount_ht = abs((float) $amount_ht[$tva_tx]);
715
+                    $discount->amount_tva = abs((float) $amount_tva[$tva_tx]);
716
+                    $discount->amount_ttc = abs((float) $amount_ttc[$tva_tx]);
717
+                    $discount->multicurrency_amount_ht = abs((float) $multicurrency_amount_ht[$tva_tx]);
718
+                    $discount->multicurrency_amount_tva = abs((float) $multicurrency_amount_tva[$tva_tx]);
719
+                    $discount->multicurrency_amount_ttc = abs((float) $multicurrency_amount_ttc[$tva_tx]);
720 720
 
721 721
                     // Clean vat code
722 722
                     $reg = array();
@@ -726,7 +726,7 @@  discard block
 block discarded – undo
726 726
                         $tva_tx = preg_replace('/\s*\(.*\)/', '', $tva_tx); // Remove code into vatrate.
727 727
                     }
728 728
 
729
-                    $discount->tva_tx = abs((float)$tva_tx);
729
+                    $discount->tva_tx = abs((float) $tva_tx);
730 730
                     $discount->vat_src_code = $vat_src_code;
731 731
 
732 732
                     $result = $discount->create($user);
@@ -782,7 +782,7 @@  discard block
 block discarded – undo
782 782
         $db->begin();
783 783
 
784 784
         $error = 0;
785
-        $tmpproject = 0;  // Ensure a value
785
+        $tmpproject = 0; // Ensure a value
786 786
 
787 787
         // Fill array 'array_options' with data from add form
788 788
         $ret = $extrafields->setOptionalsFromPost(null, $object);
@@ -790,7 +790,7 @@  discard block
 block discarded – undo
790 790
             $error++;
791 791
         }
792 792
 
793
-        $dateinvoice = dol_mktime(0, 0, 0, GETPOSTINT('remonth'), GETPOSTINT('reday'), GETPOSTINT('reyear'), 'tzserver');   // If we enter the 02 january, we need to save the 02 january for server
793
+        $dateinvoice = dol_mktime(0, 0, 0, GETPOSTINT('remonth'), GETPOSTINT('reday'), GETPOSTINT('reyear'), 'tzserver'); // If we enter the 02 january, we need to save the 02 january for server
794 794
         $datedue = dol_mktime(0, 0, 0, GETPOSTINT('echmonth'), GETPOSTINT('echday'), GETPOSTINT('echyear'), 'tzserver');
795 795
         //var_dump($dateinvoice.' '.dol_print_date($dateinvoice, 'dayhour'));
796 796
         //var_dump(dol_now('tzuserrel').' '.dol_get_last_hour(dol_now('tzuserrel')).' '.dol_print_date(dol_now('tzuserrel'),'dayhour').' '.dol_print_date(dol_get_last_hour(dol_now('tzuserrel')), 'dayhour'));
@@ -829,7 +829,7 @@  discard block
 block discarded – undo
829 829
                 $object->ref_supplier = GETPOST('ref_supplier', 'alpha');
830 830
                 $object->socid = GETPOSTINT('socid');
831 831
                 $object->label = GETPOST('label', 'alphanohtml');
832
-                $object->libelle = $object->label;  // deprecated
832
+                $object->libelle = $object->label; // deprecated
833 833
                 $object->date = $dateinvoice;
834 834
                 $object->date_echeance = $datedue;
835 835
                 $object->note_public = GETPOST('note_public', 'restricthtml');
@@ -903,7 +903,7 @@  discard block
 block discarded – undo
903 903
                 $object->subtype = GETPOST('subtype', 'alphanohtml');
904 904
                 $object->socid = GETPOSTINT('socid');
905 905
                 $object->label = GETPOST('label', 'alphanohtml');
906
-                $object->libelle = $object->label;  // Deprecated
906
+                $object->libelle = $object->label; // Deprecated
907 907
                 $object->date = $dateinvoice;
908 908
                 $object->date_echeance = $datedue;
909 909
                 $object->note_public = GETPOST('note_public', 'restricthtml');
@@ -1013,7 +1013,7 @@  discard block
 block discarded – undo
1013 1013
                 $object->cond_reglement_id = (GETPOSTINT('type') == 3 ? 1 : GETPOST('cond_reglement_id'));
1014 1014
                 $object->mode_reglement_id = GETPOSTINT('mode_reglement_id');
1015 1015
                 $object->fk_account = GETPOSTINT('fk_account');
1016
-                $object->amount = (float)price2num(GETPOST('amount'));  // FIXME: FactureFournisseur::$amount is deprecated and not used?
1016
+                $object->amount = (float) price2num(GETPOST('amount')); // FIXME: FactureFournisseur::$amount is deprecated and not used?
1017 1017
                 //$object->remise_absolue       = price2num(GETPOST('remise_absolue'), 'MU');
1018 1018
                 //$object->remise_percent       = price2num(GETPOST('remise_percent'), '', 2);
1019 1019
                 $object->fk_incoterms = GETPOSTINT('incoterm_id');
@@ -1073,7 +1073,7 @@  discard block
 block discarded – undo
1073 1073
                 $object->ref_supplier = GETPOST('ref_supplier', 'alphanohtml');
1074 1074
                 $object->socid = GETPOSTINT('socid');
1075 1075
                 $object->label = GETPOST('label', 'alphanohtml');
1076
-                $object->libelle = $object->label;   // deprecated
1076
+                $object->libelle = $object->label; // deprecated
1077 1077
                 $object->date = $dateinvoice;
1078 1078
                 $object->date_echeance = $datedue;
1079 1079
                 $object->note_public = GETPOST('note_public', 'restricthtml');
@@ -1176,7 +1176,7 @@  discard block
 block discarded – undo
1176 1176
                                 if ($typeamount == 'amount') {
1177 1177
                                     $amount = $valuedeposit;
1178 1178
                                 } else {
1179
-                                    $amount = $srcobject->total_ttc * ((float)$valuedeposit / 100);
1179
+                                    $amount = $srcobject->total_ttc * ((float) $valuedeposit / 100);
1180 1180
                                 }
1181 1181
 
1182 1182
                                 $TTotalByTva = array();
@@ -1214,7 +1214,7 @@  discard block
 block discarded – undo
1214 1214
                                             if ($qualified) {
1215 1215
                                                 $totalamount += $lines[$i]->total_ht; // Fixme : is it not for the customer ? Shouldn't we take total_ttc ?
1216 1216
                                                 $tva_tx = $lines[$i]->tva_tx;
1217
-                                                $amountdeposit[$tva_tx] += ($lines[$i]->total_ht * (float)$valuedeposit) / 100;
1217
+                                                $amountdeposit[$tva_tx] += ($lines[$i]->total_ht * (float) $valuedeposit) / 100;
1218 1218
                                             }
1219 1219
                                         }
1220 1220
 
@@ -1299,7 +1299,7 @@  discard block
 block discarded – undo
1299 1299
                                     0,
1300 1300
                                     $object->lines[0]->date_start,
1301 1301
                                     $object->lines[0]->date_end,
1302
-                                    array(),  // array_options
1302
+                                    array(), // array_options
1303 1303
                                     0,
1304 1304
                                     0,
1305 1305
                                     '',
@@ -1584,7 +1584,7 @@  discard block
 block discarded – undo
1584 1584
             $idprod = GETPOSTINT('idprod');
1585 1585
         }
1586 1586
 
1587
-        $tva_tx = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0);      // Can be '1.2' or '1.2 (CODE)'
1587
+        $tva_tx = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0); // Can be '1.2' or '1.2 (CODE)'
1588 1588
 
1589 1589
         $price_ht = price2num(GETPOST('price_ht'), 'MU', 2);
1590 1590
         $price_ht_devise = price2num(GETPOST('multicurrency_price_ht'), 'CU', 2);
@@ -1808,7 +1808,7 @@  discard block
 block discarded – undo
1808 1808
                 $pu_ht = price2num($price_ht, 'MU'); // $pu_ht must be rounded according to settings
1809 1809
             } else {
1810 1810
                 $pu_ttc = price2num(GETPOST('price_ttc'), 'MU');
1811
-                $pu_ht = price2num((float)$pu_ttc / (1 + ((float)$tva_tx / 100)), 'MU'); // $pu_ht must be rounded according to settings
1811
+                $pu_ht = price2num((float) $pu_ttc / (1 + ((float) $tva_tx / 100)), 'MU'); // $pu_ht must be rounded according to settings
1812 1812
             }
1813 1813
             $price_base_type = 'HT';
1814 1814
             $pu_devise = price2num($price_ht_devise, 'CU');
@@ -2082,7 +2082,7 @@  discard block
 block discarded – undo
2082 2082
 // Mode creation
2083 2083
 if ($action == 'create') {
2084 2084
     $facturestatic = new FactureFournisseur($db);
2085
-    $selectedLines = array();  // Ensure initialised
2085
+    $selectedLines = array(); // Ensure initialised
2086 2086
 
2087 2087
     print load_fiche_titre($langs->trans('NewSupplierInvoice'), '', 'supplier_invoice');
2088 2088
 
@@ -2277,7 +2277,7 @@  discard block
 block discarded – undo
2277 2277
     print '<form name="add" action="' . $_SERVER["PHP_SELF"] . '" method="post">';
2278 2278
     print '<input type="hidden" name="token" value="' . newToken() . '">';
2279 2279
     print '<input type="hidden" name="action" value="add">';
2280
-    print '<input type="hidden" name="changecompany" value="0">';   // will be set to 1 by javascript so we know post is done after a company change
2280
+    print '<input type="hidden" name="changecompany" value="0">'; // will be set to 1 by javascript so we know post is done after a company change
2281 2281
 
2282 2282
     if (!empty($societe->id) && $societe->id > 0) {
2283 2283
         print '<input type="hidden" name="socid" value="' . $societe->id . '">' . "\n";
@@ -2361,7 +2361,7 @@  discard block
 block discarded – undo
2361 2361
 
2362 2362
             $sql = 'SELECT r.rowid, r.titre as title, r.total_ttc';
2363 2363
             $sql .= ' FROM ' . MAIN_DB_PREFIX . 'facture_fourn_rec as r';
2364
-            $sql .= ' WHERE r.fk_soc = ' . (int)$invoice_predefined->socid;
2364
+            $sql .= ' WHERE r.fk_soc = ' . (int) $invoice_predefined->socid;
2365 2365
 
2366 2366
             $resql = $db->query($sql);
2367 2367
             if ($resql) {
@@ -2941,7 +2941,7 @@  discard block
 block discarded – undo
2941 2941
             // TODO We should not need this. Also data comes from not reliable value of $object->multicurrency_total_ttc that may be wrong if it was
2942 2942
             // calculated by summing lines that were in a currency for some of them and into another for others (lines from discount/down payment into another currency for example)
2943 2943
             if ($resteapayer == 0 && $multicurrency_resteapayer != 0 && $object->multicurrency_code != $conf->currency) {
2944
-                $resteapayer = price2num((float)$multicurrency_resteapayer / $object->multicurrency_tx, 'MT');
2944
+                $resteapayer = price2num((float) $multicurrency_resteapayer / $object->multicurrency_tx, 'MT');
2945 2945
             }
2946 2946
         }
2947 2947
 
@@ -3229,7 +3229,7 @@  discard block
 block discarded – undo
3229 3229
         // Thirdparty
3230 3230
         $morehtmlref .= '<br>' . $object->thirdparty->getNomUrl(1, 'supplier');
3231 3231
         if (!getDolGlobalString('MAIN_DISABLE_OTHER_LINK') && $object->thirdparty->id > 0) {
3232
-            $morehtmlref .= ' <div class="inline-block valignmiddle">(<a class="valignmiddle" href="' . constant('BASE_URL') . '/fourn/facture/list.php?socid=' . ((int)$object->thirdparty->id) . '&search_company=' . urlencode($object->thirdparty->name) . '">' . $langs->trans("OtherBills") . '</a>)</div>';
3232
+            $morehtmlref .= ' <div class="inline-block valignmiddle">(<a class="valignmiddle" href="' . constant('BASE_URL') . '/fourn/facture/list.php?socid=' . ((int) $object->thirdparty->id) . '&search_company=' . urlencode($object->thirdparty->name) . '">' . $langs->trans("OtherBills") . '</a>)</div>';
3233 3233
         }
3234 3234
         // Project
3235 3235
         if (isModEnabled('project')) {
@@ -3238,7 +3238,7 @@  discard block
 block discarded – undo
3238 3238
             if ($permissiontoadd) {
3239 3239
                 $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"');
3240 3240
                 if ($action != 'classify') {
3241
-                    $morehtmlref .= '<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&token=' . newToken() . '&id=' . ((int)$object->id) . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> ';
3241
+                    $morehtmlref .= '<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&token=' . newToken() . '&id=' . ((int) $object->id) . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> ';
3242 3242
                 }
3243 3243
                 $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, (!getDolGlobalString('PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS') ? $object->socid : -1), $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300');
3244 3244
             } else {
@@ -3672,7 +3672,7 @@  discard block
 block discarded – undo
3672 3672
             $sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'bank_account as ba ON b.fk_account = ba.rowid';
3673 3673
             $sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'c_paiement as c ON p.fk_paiement = c.id';
3674 3674
             $sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'paiementfourn_facturefourn as pf ON pf.fk_paiementfourn = p.rowid';
3675
-            $sql .= ' WHERE pf.fk_facturefourn = ' . ((int)$object->id);
3675
+            $sql .= ' WHERE pf.fk_facturefourn = ' . ((int) $object->id);
3676 3676
             $sql .= ' ORDER BY p.datep, p.tms';
3677 3677
 
3678 3678
             $result = $db->query($sql);
@@ -3793,7 +3793,7 @@  discard block
 block discarded – undo
3793 3793
                 $sql = "SELECT re.rowid, re.amount_ht, re.amount_tva, re.amount_ttc,";
3794 3794
                 $sql .= " re.description, re.fk_invoice_supplier_source";
3795 3795
                 $sql .= " FROM " . MAIN_DB_PREFIX . "societe_remise_except as re";
3796
-                $sql .= " WHERE fk_invoice_supplier = " . ((int)$object->id);
3796
+                $sql .= " WHERE fk_invoice_supplier = " . ((int) $object->id);
3797 3797
                 $resql = $db->query($sql);
3798 3798
                 if ($resql) {
3799 3799
                     $num = $db->num_rows($resql);
Please login to merge, or discard this patch.