Test Setup Failed
Push — dependabot/github_actions/mdew... ( 6edcb7 )
by
unknown
55:37
created
htdocs/product/stock/productlot_card.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 
154 154
     $backurlforlist = dol_buildpath('/product/stock/productlot_list.php', 1);
155 155
 
156
-    if ($action == 'seteatby' && $user->hasRight('stock', 'creer') && ! GETPOST('cancel', 'alpha')) {
156
+    if ($action == 'seteatby' && $user->hasRight('stock', 'creer') && !GETPOST('cancel', 'alpha')) {
157 157
         $newvalue = dol_mktime(12, 0, 0, GETPOSTINT('eatbymonth'), GETPOSTINT('eatbyday'), GETPOSTINT('eatbyyear'));
158 158
 
159 159
         // check parameters
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
         }
179 179
     }
180 180
 
181
-    if ($action == 'setsellby' && $user->hasRight('stock', 'creer') && ! GETPOST('cancel', 'alpha')) {
181
+    if ($action == 'setsellby' && $user->hasRight('stock', 'creer') && !GETPOST('cancel', 'alpha')) {
182 182
         $newvalue = dol_mktime(12, 0, 0, GETPOSTINT('sellbymonth'), GETPOSTINT('sellbyday'), GETPOSTINT('sellbyyear'));
183 183
 
184 184
         // check parameters
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
         }
204 204
     }
205 205
 
206
-    if ($action == 'seteol_date' && $user->hasRight('stock', 'creer') && ! GETPOST('cancel', 'alpha')) {
206
+    if ($action == 'seteol_date' && $user->hasRight('stock', 'creer') && !GETPOST('cancel', 'alpha')) {
207 207
         $newvalue = dol_mktime(12, 0, 0, GETPOSTINT('eol_datemonth'), GETPOSTINT('eol_dateday'), GETPOSTINT('eol_dateyear'));
208 208
         $result = $object->setValueFrom('eol_date', $newvalue, '', null, 'date', '', $user, 'PRODUCTLOT_MODIFY');
209 209
         if ($result < 0) {
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
         }
215 215
     }
216 216
 
217
-    if ($action == 'setmanufacturing_date' && $user->hasRight('stock', 'creer') && ! GETPOST('cancel', 'alpha')) {
217
+    if ($action == 'setmanufacturing_date' && $user->hasRight('stock', 'creer') && !GETPOST('cancel', 'alpha')) {
218 218
         $newvalue = dol_mktime(12, 0, 0, GETPOSTINT('manufacturing_datemonth'), GETPOSTINT('manufacturing_dateday'), GETPOSTINT('manufacturing_dateyear'));
219 219
         $result = $object->setValueFrom('manufacturing_date', $newvalue, '', null, 'date', '', $user, 'PRODUCTLOT_MODIFY');
220 220
         if ($result < 0) {
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
         }
226 226
     }
227 227
 
228
-    if ($action == 'setscrapping_date' && $user->hasRight('stock', 'creer') && ! GETPOST('cancel', 'alpha')) {
228
+    if ($action == 'setscrapping_date' && $user->hasRight('stock', 'creer') && !GETPOST('cancel', 'alpha')) {
229 229
         $newvalue = dol_mktime(12, 0, 0, GETPOSTINT('scrapping_datemonth'), GETPOSTINT('scrapping_dateday'), GETPOSTINT('scrapping_dateyear'));
230 230
         $result = $object->setValueFrom('scrapping_date', $newvalue, '', null, 'date', '', $user, 'PRODUCTLOT_MODIFY');
231 231
         if ($result < 0) {
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
         }
248 248
     } */
249 249
 
250
-    if ($action == 'setqc_frequency' && $user->hasRight('stock', 'creer') && ! GETPOST('cancel', 'alpha')) {
250
+    if ($action == 'setqc_frequency' && $user->hasRight('stock', 'creer') && !GETPOST('cancel', 'alpha')) {
251 251
         $result = $object->setValueFrom('qc_frequency', GETPOST('qc_frequency'), '', null, 'int', '', $user, 'PRODUCT_MODIFY');
252 252
         if ($result < 0) { // Prévoir un test de format de durée
253 253
             setEventMessages($object->error, null, 'errors');
Please login to merge, or discard this patch.
htdocs/product/stock/massstockmove.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -579,7 +579,7 @@
 block discarded – undo
579 579
 $maxfilesizearray = getMaxFileSizeArray();
580 580
 $maxmin = $maxfilesizearray['maxmin'];
581 581
 if ($maxmin > 0) {
582
-    print '<input type="hidden" name="MAX_FILE_SIZE" value="' . ($maxmin * 1024) . '">';    // MAX_FILE_SIZE must precede the field type=file
582
+    print '<input type="hidden" name="MAX_FILE_SIZE" value="' . ($maxmin * 1024) . '">'; // MAX_FILE_SIZE must precede the field type=file
583 583
 }
584 584
 print '<input type="file" name="userfile" size="20" maxlength="80"> &nbsp; &nbsp; ';
585 585
 $out = (!getDolGlobalString('MAIN_UPLOAD_DOC') ? ' disabled' : '');
Please login to merge, or discard this patch.
htdocs/product/stock/stockatdate.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
     if ($productid > 0) {
156 156
         $sql .= " AND ps.fk_product = " . ((int) $productid);
157 157
     }
158
-    if (! empty($search_fk_warehouse)) {
158
+    if (!empty($search_fk_warehouse)) {
159 159
         $sql .= " AND ps.fk_entrepot IN (" . $db->sanitize(implode(",", $search_fk_warehouse)) . ")";
160 160
     }
161 161
     if ($search_ref) {
@@ -565,7 +565,7 @@  discard block
 block discarded – undo
565 565
 
566 566
         if ($mode == 'future') {
567 567
             $prod->load_stock('warehouseopen,warehouseinternal,nobatch', 0, $dateendofday);
568
-            $stock = $prod->stock_theorique;        // virtual stock at a date
568
+            $stock = $prod->stock_theorique; // virtual stock at a date
569 569
             $prod->load_stock('warehouseopen,warehouseinternal,nobatch', 0);
570 570
             $virtualstock = $prod->stock_theorique; // virtual stock in infinite future
571 571
         } else {
Please login to merge, or discard this patch.
htdocs/product/stock/stocktransfer/stocktransfer_list.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 
76 76
 // Default sort order (if not yet defined by previous GETPOST)
77 77
 if (!$sortfield) {
78
-    reset($object->fields);                 // Reset is required to avoid key() to return null.
78
+    reset($object->fields); // Reset is required to avoid key() to return null.
79 79
     $sortfield = "t." . key($object->fields); // Set here default search field. By default 1st field in definition.
80 80
 }
81 81
 if (!$sortorder) {
@@ -345,7 +345,7 @@  discard block
 block discarded – undo
345 345
 // Output page
346 346
 // --------------------------------------------------------------------
347 347
 
348
-llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'bodyforlist');   // Can use also classforhorizontalscrolloftabs instead of bodyforlist for no horizontal scroll
348
+llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'bodyforlist'); // Can use also classforhorizontalscrolloftabs instead of bodyforlist for no horizontal scroll
349 349
 
350 350
 // Example : Adding jquery code
351 351
 // print '<script type="text/javascript">
@@ -563,7 +563,7 @@  discard block
 block discarded – undo
563 563
     } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('id', 'rowid', 'ref', 'status')) && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) {
564 564
         $cssforfield .= ($cssforfield ? ' ' : '') . 'right';
565 565
     }
566
-    $cssforfield = preg_replace('/small\s*/', '', $cssforfield);    // the 'small' css must not be used for the title label
566
+    $cssforfield = preg_replace('/small\s*/', '', $cssforfield); // the 'small' css must not be used for the title label
567 567
     if (!empty($arrayfields['t.' . $key]['checked'])) {
568 568
         print getTitleFieldOfList($arrayfields['t.' . $key]['label'], 0, $_SERVER['PHP_SELF'], 't.' . $key, '', $param, ($cssforfield ? 'class="' . $cssforfield . '"' : ''), $sortfield, $sortorder, ($cssforfield ? $cssforfield . ' ' : ''), 0, (empty($val['helplist']) ? '' : $val['helplist'])) . "\n";
569 569
         $totalarray['nbfield']++;
Please login to merge, or discard this patch.
htdocs/product/stock/stocktransfer/stocktransfer_card.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 $confirm    = GETPOST('confirm', 'alpha');
52 52
 $cancel     = GETPOST('cancel', 'aZ09');
53 53
 $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : str_replace('_', '', basename(dirname(__FILE__)) . basename(__FILE__, '.php')); // To manage different context of search
54
-$backtopage = GETPOST('backtopage', 'alpha');                   // if not set, a default page will be used
54
+$backtopage = GETPOST('backtopage', 'alpha'); // if not set, a default page will be used
55 55
 $backtopageforcancel = GETPOST('backtopageforcancel', 'alpha'); // if not set, $backtopage will be used
56 56
 $qty = GETPOSTINT('qty');
57 57
 $fk_product = GETPOSTINT('fk_product');
@@ -538,28 +538,28 @@  discard block
 block discarded – undo
538 538
         $formconfirm = $form->formconfirm($_SERVER['PHP_SELF'] . '?id=' . $object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneAsk', $object->ref), 'confirm_clone', $formquestion, 'yes', 1);
539 539
     } elseif ($action == 'destock') { // Destock confirmation
540 540
         // Create an array for form
541
-        $formquestion = array(  'text' => '',
541
+        $formquestion = array('text' => '',
542 542
             0 => array('type' => 'text', 'name' => 'label', 'label' => $langs->trans("Label"), 'value' => $langs->trans('ConfirmDestock', $object->ref), 'size' => 40),
543 543
             1 => array('type' => 'text', 'name' => 'inventorycode', 'label' => $langs->trans("InventoryCode"), 'value' => dol_print_date(dol_now(), '%y%m%d%H%M%S'), 'size' => 25)
544 544
         );
545 545
         $formconfirm = $form->formconfirm($_SERVER['PHP_SELF'] . '?id=' . $object->id, $langs->trans('DestockAllProduct'), '', 'confirm_destock', $formquestion, 'yes', 1);
546 546
     } elseif ($action == 'destockcancel') { // Destock confirmation cancel
547 547
         // Create an array for form
548
-        $formquestion = array(  'text' => '',
548
+        $formquestion = array('text' => '',
549 549
             0 => array('type' => 'text', 'name' => 'label', 'label' => $langs->trans("Label"), 'value' => $langs->trans('ConfirmDestockCancel', $object->ref), 'size' => 40),
550 550
             1 => array('type' => 'text', 'name' => 'inventorycode', 'label' => $langs->trans("InventoryCode"), 'value' => dol_print_date(dol_now(), '%y%m%d%H%M%S'), 'size' => 25)
551 551
         );
552 552
         $formconfirm = $form->formconfirm($_SERVER['PHP_SELF'] . '?id=' . $object->id, $langs->trans('DestockAllProductCancel'), '', 'confirm_destockcancel', $formquestion, 'yes', 1);
553 553
     } elseif ($action == 'addstock') { // Addstock confirmation
554 554
         // Create an array for form
555
-        $formquestion = array(  'text' => '',
555
+        $formquestion = array('text' => '',
556 556
             0 => array('type' => 'text', 'name' => 'label', 'label' => $langs->trans("Label") . '&nbsp;:', 'value' => $langs->trans('ConfirmAddStock', $object->ref), 'size' => 40),
557 557
             1 => array('type' => 'text', 'name' => 'inventorycode', 'label' => $langs->trans("InventoryCode"), 'value' => dol_print_date(dol_now(), '%y%m%d%H%M%S'), 'size' => 25)
558 558
         );
559 559
         $formconfirm = $form->formconfirm($_SERVER['PHP_SELF'] . '?id=' . $object->id, $langs->trans('AddStockAllProduct'), '', 'confirm_addstock', $formquestion, 'yes', 1);
560 560
     } elseif ($action == 'addstockcancel') { // Addstock confirmation cancel
561 561
         // Create an array for form
562
-        $formquestion = array(  'text' => '',
562
+        $formquestion = array('text' => '',
563 563
             0 => array('type' => 'text', 'name' => 'label', 'label' => $langs->trans("Label") . '&nbsp;:', 'value' => $langs->trans('ConfirmAddStockCancel', $object->ref), 'size' => 40),
564 564
             1 => array('type' => 'text', 'name' => 'inventorycode', 'label' => $langs->trans("InventoryCode"), 'value' => dol_print_date(dol_now(), '%y%m%d%H%M%S'), 'size' => 25)
565 565
         );
Please login to merge, or discard this patch.
htdocs/product/stock/class/productlot.class.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1030,7 +1030,7 @@
 block discarded – undo
1030 1030
                 $obj = $this->db->fetch_object($result);
1031 1031
                 $this->stats_mo['customers_' . $role] = $obj->nb_customers ? $obj->nb_customers : 0;
1032 1032
                 $this->stats_mo['nb_' . $role] = $obj->nb ? $obj->nb : 0;
1033
-                $this->stats_mo['qty_' . $role] = $obj->qty ? price2num($obj->qty, 'MS') : 0;     // qty may be a float due to the SUM()
1033
+                $this->stats_mo['qty_' . $role] = $obj->qty ? price2num($obj->qty, 'MS') : 0; // qty may be a float due to the SUM()
1034 1034
             } else {
1035 1035
                 $this->error = $this->db->error();
1036 1036
                 $error++;
Please login to merge, or discard this patch.
htdocs/product/stock/class/entrepot.class.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -166,7 +166,7 @@
 block discarded – undo
166 166
     /**
167 167
      * Warehouse open and any operations are allowed, but warehouse is not included into calculation of stock.
168 168
      */
169
-    const STATUS_OPENEXT_ALL = 3;   // TODO Implement this
169
+    const STATUS_OPENEXT_ALL = 3; // TODO Implement this
170 170
 
171 171
 
172 172
 
Please login to merge, or discard this patch.
htdocs/product/stock/class/mouvementstock.class.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
                 'skip_batch'       => &$skip_batch,
220 220
                 'id_product_batch' => &$id_product_batch
221 221
             );
222
-            $reshook = $hookmanager->executeHooks('stockMovementCreate', $parameters, $this, $action);    // Note that $action and $object may have been modified by some hooks
222
+            $reshook = $hookmanager->executeHooks('stockMovementCreate', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
223 223
 
224 224
             if ($reshook < 0) {
225 225
                 if (!empty($hookmanager->resPrint)) {
@@ -708,8 +708,8 @@  discard block
 block discarded – undo
708 708
                 $this->price = $obj->price;
709 709
                 $this->fk_user_author = $obj->fk_user_author;
710 710
                 $this->label = $obj->label;
711
-                $this->fk_origin = $obj->origin_id;     // For backward compatibility
712
-                $this->origintype = $obj->origin_type;  // For backward compatibility
711
+                $this->fk_origin = $obj->origin_id; // For backward compatibility
712
+                $this->origintype = $obj->origin_type; // For backward compatibility
713 713
                 $this->origin_id = $obj->origin_id;
714 714
                 $this->origin_type = $obj->origin_type;
715 715
                 $this->inventorycode = $obj->inventorycode;
@@ -944,8 +944,8 @@  discard block
 block discarded – undo
944 944
             } else {                    // product_batch record not found
945 945
                 $pdluo->fk_product_stock = $vfk_product_stock;
946 946
                 $pdluo->qty = $qty;
947
-                $pdluo->eatby = empty($dluo['eatby']) ? '' : $dluo['eatby'];        // No more used. Now eatby date is store in table of lot, no more into prouct_batch table.
948
-                $pdluo->sellby = empty($dluo['sellby']) ? '' : $dluo['sellby'];     // No more used. Now sellby date is store in table of lot, no more into prouct_batch table.
947
+                $pdluo->eatby = empty($dluo['eatby']) ? '' : $dluo['eatby']; // No more used. Now eatby date is store in table of lot, no more into prouct_batch table.
948
+                $pdluo->sellby = empty($dluo['sellby']) ? '' : $dluo['sellby']; // No more used. Now sellby date is store in table of lot, no more into prouct_batch table.
949 949
                 $pdluo->batch = $vbatchnumber;
950 950
 
951 951
                 $result = $pdluo->create($user, 1);
Please login to merge, or discard this patch.
htdocs/product/class/product.class.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
      */
157 157
     public $price;
158 158
 
159
-    public $price_formated;         // used by takepos/ajax/ajax.php
159
+    public $price_formated; // used by takepos/ajax/ajax.php
160 160
 
161 161
     /**
162 162
      * Selling price with tax
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
      */
166 166
     public $price_ttc;
167 167
 
168
-    public $price_ttc_formated;     // used by takepos/ajax/ajax.php
168
+    public $price_ttc_formated; // used by takepos/ajax/ajax.php
169 169
 
170 170
     /**
171 171
      * Minimum price net
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
     public $packaging;
246 246
 
247 247
 
248
-    public $lifetime;   // In seconds
248
+    public $lifetime; // In seconds
249 249
 
250 250
     public $qc_frequency;
251 251
 
@@ -406,20 +406,20 @@  discard block
 block discarded – undo
406 406
 
407 407
     //! Metric of products
408 408
     public $weight;
409
-    public $weight_units;   // scale -3, 0, 3, 6
409
+    public $weight_units; // scale -3, 0, 3, 6
410 410
     public $length;
411
-    public $length_units;   // scale -3, 0, 3, 6
411
+    public $length_units; // scale -3, 0, 3, 6
412 412
     public $width;
413
-    public $width_units;    // scale -3, 0, 3, 6
413
+    public $width_units; // scale -3, 0, 3, 6
414 414
     public $height;
415
-    public $height_units;   // scale -3, 0, 3, 6
415
+    public $height_units; // scale -3, 0, 3, 6
416 416
     public $surface;
417
-    public $surface_units;  // scale -3, 0, 3, 6
417
+    public $surface_units; // scale -3, 0, 3, 6
418 418
     public $volume;
419
-    public $volume_units;   // scale -3, 0, 3, 6
419
+    public $volume_units; // scale -3, 0, 3, 6
420 420
 
421 421
     public $net_measure;
422
-    public $net_measure_units;  // scale -3, 0, 3, 6
422
+    public $net_measure_units; // scale -3, 0, 3, 6
423 423
 
424 424
     public $accountancy_code_sell;
425 425
     public $accountancy_code_sell_intra;
@@ -611,7 +611,7 @@  discard block
 block discarded – undo
611 611
         'import_key'    => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => 1, 'visible' => -2, 'notnull' => -1, 'index' => 0, 'position' => 1000),
612 612
         //'tosell'       =>array('type'=>'integer',      'label'=>'Status',           'enabled'=>1, 'visible'=>1,  'notnull'=>1, 'default'=>'0', 'index'=>1,  'position'=>1000, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Active', -1=>'Cancel')),
613 613
         //'tobuy'        =>array('type'=>'integer',      'label'=>'Status',           'enabled'=>1, 'visible'=>1,  'notnull'=>1, 'default'=>'0', 'index'=>1,  'position'=>1000, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Active', -1=>'Cancel')),
614
-        'mandatory_period' => array('type' => 'integer', 'label' => 'mandatoryperiod', 'enabled' => 1, 'visible' => 1,  'notnull' => 1, 'default' => '0', 'index' => 1,  'position' => 1000),
614
+        'mandatory_period' => array('type' => 'integer', 'label' => 'mandatoryperiod', 'enabled' => 1, 'visible' => 1, 'notnull' => 1, 'default' => '0', 'index' => 1, 'position' => 1000),
615 615
     );
616 616
 
617 617
     /**
@@ -1176,7 +1176,7 @@  discard block
 block discarded – undo
1176 1176
             $result = $this->verify(); // We don't check when update called during a create because verify was already done
1177 1177
         } else {
1178 1178
             // we can continue
1179
-            $result = 0;  // @phan-suppress-current-line PhanPluginRedundantAssignment
1179
+            $result = 0; // @phan-suppress-current-line PhanPluginRedundantAssignment
1180 1180
         }
1181 1181
 
1182 1182
         if ($result >= 0) {
@@ -1923,7 +1923,7 @@  discard block
 block discarded – undo
1923 1923
      */
1924 1924
     private function getArrayForPriceCompare($level = 0)
1925 1925
     {
1926
-        $testExit = array('multiprices','multiprices_ttc','multiprices_base_type','multiprices_min','multiprices_min_ttc','multiprices_tva_tx','multiprices_recuperableonly');
1926
+        $testExit = array('multiprices', 'multiprices_ttc', 'multiprices_base_type', 'multiprices_min', 'multiprices_min_ttc', 'multiprices_tva_tx', 'multiprices_recuperableonly');
1927 1927
 
1928 1928
         foreach ($testExit as $field) {
1929 1929
             if (!isset($this->$field)) {
@@ -2567,8 +2567,8 @@  discard block
 block discarded – undo
2567 2567
 
2568 2568
         //For MultiCompany
2569 2569
         //PMP per entity & Stocks Sharings stock_reel includes only stocks shared with this entity
2570
-        $separatedEntityPMP = false;    // Set to true to get the AWP from table llx_product_perentity instead of field 'pmp' into llx_product.
2571
-        $separatedStock = false;        // Set to true will count stock from subtable llx_product_stock. It is slower than using denormalized field 'stock', but it is required when using multientity and shared warehouses.
2570
+        $separatedEntityPMP = false; // Set to true to get the AWP from table llx_product_perentity instead of field 'pmp' into llx_product.
2571
+        $separatedStock = false; // Set to true will count stock from subtable llx_product_stock. It is slower than using denormalized field 'stock', but it is required when using multientity and shared warehouses.
2572 2572
         $visibleWarehousesEntities = $conf->entity;
2573 2573
         if (getDolGlobalString('MULTICOMPANY_PRODUCT_SHARING_ENABLED')) {
2574 2574
             if (getDolGlobalString('MULTICOMPANY_PMP_PER_ENTITY_ENABLED')) {
@@ -2760,15 +2760,15 @@  discard block
 block discarded – undo
2760 2760
                         $sql .= " WHERE entity IN (" . getEntity('productprice') . ")";
2761 2761
                         $sql .= " AND price_level=" . ((int) $i);
2762 2762
                         $sql .= " AND fk_product = " . ((int) $this->id);
2763
-                        $sql .= " ORDER BY date_price DESC, rowid DESC";    // Get the most recent line
2764
-                        $sql .= " LIMIT 1";                                 // Only the first one
2763
+                        $sql .= " ORDER BY date_price DESC, rowid DESC"; // Get the most recent line
2764
+                        $sql .= " LIMIT 1"; // Only the first one
2765 2765
                         $resql = $this->db->query($sql);
2766 2766
                         if ($resql) {
2767 2767
                             $result = $this->db->fetch_array($resql);
2768 2768
 
2769 2769
                             $this->multiprices[$i] = $result ? $result["price"] : null;
2770 2770
                             $this->multiprices_ttc[$i] = $result ? $result["price_ttc"] : null;
2771
-                            $this->multiprices_min[$i] =  $result ? $result["price_min"] : null;
2771
+                            $this->multiprices_min[$i] = $result ? $result["price_min"] : null;
2772 2772
                             $this->multiprices_min_ttc[$i] = $result ? $result["price_min_ttc"] : null;
2773 2773
                             $this->multiprices_base_type[$i] = $result ? $result["price_base_type"] : null;
2774 2774
                             // Next two fields are used only if PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL is on
@@ -2988,7 +2988,7 @@  discard block
 block discarded – undo
2988 2988
                 $obj = $this->db->fetch_object($result);
2989 2989
                 $this->stats_mo['customers_' . $role] = $obj->nb_customers ? $obj->nb_customers : 0;
2990 2990
                 $this->stats_mo['nb_' . $role] = $obj->nb ? $obj->nb : 0;
2991
-                $this->stats_mo['qty_' . $role] = $obj->qty ? price2num($obj->qty, 'MS') : 0;     // qty may be a float due to the SUM()
2991
+                $this->stats_mo['qty_' . $role] = $obj->qty ? price2num($obj->qty, 'MS') : 0; // qty may be a float due to the SUM()
2992 2992
             } else {
2993 2993
                 $this->error = $this->db->error();
2994 2994
                 $error++;
@@ -4492,7 +4492,7 @@  discard block
 block discarded – undo
4492 4492
                 //Addition of a product with the highest rank +1
4493 4493
                 $sql = "INSERT INTO " . $this->db->prefix() . "product_association(fk_product_pere,fk_product_fils,qty,incdec,rang)";
4494 4494
                 $sql .= " VALUES (" . ((int) $id_pere) . ", " . ((int) $id_fils) . ", " . price2num($qty, 'MS') . ", " . price2num($incdec, 'MS') . ", " . ((int) $rank) . ")";
4495
-                if (! $this->db->query($sql)) {
4495
+                if (!$this->db->query($sql)) {
4496 4496
                     dol_print_error($this->db);
4497 4497
                     return -1;
4498 4498
                 } else {
@@ -4613,7 +4613,7 @@  discard block
 block discarded – undo
4613 4613
                 $sql = "UPDATE " . $this->db->prefix() . "product_association";
4614 4614
                 $sql .= " SET rang = " . ((int) $cpt);
4615 4615
                 $sql .= " WHERE rowid = " . ((int) $objrank->rowid);
4616
-                if (! $this->db->query($sql)) {
4616
+                if (!$this->db->query($sql)) {
4617 4617
                     dol_print_error($this->db);
4618 4618
                     return -1;
4619 4619
                 }
@@ -6680,7 +6680,7 @@  discard block
 block discarded – undo
6680 6680
      */
6681 6681
     public function getKanbanView($option = '', $arraydata = null)
6682 6682
     {
6683
-        global $langs,$conf;
6683
+        global $langs, $conf;
6684 6684
 
6685 6685
         $selected = (empty($arraydata['selected']) ? 0 : $arraydata['selected']);
6686 6686
 
Please login to merge, or discard this patch.