@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | |
38 | 38 | // Load Dolibarr environment |
39 | 39 | require '../../main.inc.php'; |
40 | -require DOL_DOCUMENT_ROOT . '/variants/class/ProductAttribute.class.php'; |
|
40 | +require DOL_DOCUMENT_ROOT.'/variants/class/ProductAttribute.class.php'; |
|
41 | 41 | |
42 | 42 | // Security check |
43 | 43 | if (!isModEnabled('variants')) { |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | if (GETPOST('roworder', 'alpha', 3)) { |
62 | 62 | $roworder = GETPOST('roworder', 'alpha', 3); |
63 | 63 | |
64 | - dol_syslog("AjaxOrderAttribute roworder=" . $roworder, LOG_DEBUG); |
|
64 | + dol_syslog("AjaxOrderAttribute roworder=".$roworder, LOG_DEBUG); |
|
65 | 65 | |
66 | 66 | $rowordertab = explode(',', $roworder); |
67 | 67 | $newrowordertab = array(); |
@@ -1317,9 +1317,12 @@ |
||
1317 | 1317 | |
1318 | 1318 | $parameters = array(); |
1319 | 1319 | $reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook |
1320 | - if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
1321 | - if (empty($reshook)) |
|
1322 | - $object->formAddObjectLine(1, $mysoc, $buyer); |
|
1320 | + if ($reshook < 0) { |
|
1321 | + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
1322 | + } |
|
1323 | + if (empty($reshook)) { |
|
1324 | + $object->formAddObjectLine(1, $mysoc, $buyer); |
|
1325 | + } |
|
1323 | 1326 | } |
1324 | 1327 | } |
1325 | 1328 | } |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | /** |
99 | 99 | * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. |
100 | 100 | */ |
101 | - public $fields=array( |
|
101 | + public $fields = array( |
|
102 | 102 | 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"), |
103 | 103 | 'ref' => array('type'=>'varchar(255)', 'label'=>'Ref', 'visible'=>1, 'enabled'=>1, 'position'=>10, 'notnull'=>1, 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of object", 'css'=>''), |
104 | 104 | 'ref_ext' => array('type' => 'varchar(255)', 'label' => 'ExternalRef', 'enabled' => 1, 'visible' => 0, 'position' => 20, 'searchall'=>1), |
@@ -224,32 +224,32 @@ discard block |
||
224 | 224 | $error++; |
225 | 225 | } |
226 | 226 | if ($error) { |
227 | - dol_syslog(__METHOD__ . ' ' . $this->errorsToString(), LOG_ERR); |
|
227 | + dol_syslog(__METHOD__.' '.$this->errorsToString(), LOG_ERR); |
|
228 | 228 | return -1; |
229 | 229 | } |
230 | 230 | |
231 | 231 | $this->db->begin(); |
232 | 232 | |
233 | - $sql = "INSERT INTO " . MAIN_DB_PREFIX . $this->table_element . " ("; |
|
233 | + $sql = "INSERT INTO ".MAIN_DB_PREFIX.$this->table_element." ("; |
|
234 | 234 | $sql .= " ref, ref_ext, label, entity, position"; |
235 | 235 | $sql .= ")"; |
236 | 236 | $sql .= " VALUES ("; |
237 | - $sql .= " '" . $this->db->escape($this->ref) . "'"; |
|
238 | - $sql .= ", '" . $this->db->escape($this->ref_ext) . "'"; |
|
239 | - $sql .= ", '" . $this->db->escape($this->label) . "'"; |
|
240 | - $sql .= ", " . ((int) $this->entity); |
|
241 | - $sql .= ", " . ((int) $this->position); |
|
237 | + $sql .= " '".$this->db->escape($this->ref)."'"; |
|
238 | + $sql .= ", '".$this->db->escape($this->ref_ext)."'"; |
|
239 | + $sql .= ", '".$this->db->escape($this->label)."'"; |
|
240 | + $sql .= ", ".((int) $this->entity); |
|
241 | + $sql .= ", ".((int) $this->position); |
|
242 | 242 | $sql .= ")"; |
243 | 243 | |
244 | 244 | dol_syslog(__METHOD__, LOG_DEBUG); |
245 | 245 | $resql = $this->db->query($sql); |
246 | 246 | if (!$resql) { |
247 | - $this->errors[] = "Error " . $this->db->lasterror(); |
|
247 | + $this->errors[] = "Error ".$this->db->lasterror(); |
|
248 | 248 | $error++; |
249 | 249 | } |
250 | 250 | |
251 | 251 | if (!$error) { |
252 | - $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . $this->table_element); |
|
252 | + $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.$this->table_element); |
|
253 | 253 | } |
254 | 254 | |
255 | 255 | if (!$error && !$notrigger) { |
@@ -290,20 +290,20 @@ discard block |
||
290 | 290 | $error++; |
291 | 291 | } |
292 | 292 | if ($error) { |
293 | - dol_syslog(__METHOD__ . ' ' . $this->errorsToString(), LOG_ERR); |
|
293 | + dol_syslog(__METHOD__.' '.$this->errorsToString(), LOG_ERR); |
|
294 | 294 | return -1; |
295 | 295 | } |
296 | 296 | |
297 | 297 | $sql = "SELECT rowid, ref, ref_ext, label, position"; |
298 | - $sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element; |
|
299 | - $sql .= " WHERE rowid = " . ((int) $id); |
|
300 | - $sql .= " AND entity IN (" . getEntity('product') . ")"; |
|
298 | + $sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element; |
|
299 | + $sql .= " WHERE rowid = ".((int) $id); |
|
300 | + $sql .= " AND entity IN (".getEntity('product').")"; |
|
301 | 301 | |
302 | 302 | dol_syslog(__METHOD__, LOG_DEBUG); |
303 | 303 | $resql = $this->db->query($sql); |
304 | 304 | if (!$resql) { |
305 | - $this->errors[] = "Error " . $this->db->lasterror(); |
|
306 | - dol_syslog(__METHOD__ . ' ' . $this->errorsToString(), LOG_ERR); |
|
305 | + $this->errors[] = "Error ".$this->db->lasterror(); |
|
306 | + dol_syslog(__METHOD__.' '.$this->errorsToString(), LOG_ERR); |
|
307 | 307 | return -1; |
308 | 308 | } |
309 | 309 | |
@@ -333,14 +333,14 @@ discard block |
||
333 | 333 | $return = array(); |
334 | 334 | |
335 | 335 | $sql = "SELECT rowid, ref, ref_ext, label, position"; |
336 | - $sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element; |
|
337 | - $sql .= " WHERE entity IN (" . getEntity('product') . ")"; |
|
336 | + $sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element; |
|
337 | + $sql .= " WHERE entity IN (".getEntity('product').")"; |
|
338 | 338 | $sql .= $this->db->order("position", "asc"); |
339 | 339 | |
340 | 340 | dol_syslog(__METHOD__, LOG_DEBUG); |
341 | 341 | $resql = $this->db->query($sql); |
342 | 342 | if (!$resql) { |
343 | - $this->errors[] = "Error " . $this->db->lasterror(); |
|
343 | + $this->errors[] = "Error ".$this->db->lasterror(); |
|
344 | 344 | dol_print_error($this->db); |
345 | 345 | return $return; |
346 | 346 | } |
@@ -392,25 +392,25 @@ discard block |
||
392 | 392 | $error++; |
393 | 393 | } |
394 | 394 | if ($error) { |
395 | - dol_syslog(__METHOD__ . ' ' . $this->errorsToString(), LOG_ERR); |
|
395 | + dol_syslog(__METHOD__.' '.$this->errorsToString(), LOG_ERR); |
|
396 | 396 | return -1; |
397 | 397 | } |
398 | 398 | |
399 | 399 | $this->db->begin(); |
400 | 400 | |
401 | - $sql = "UPDATE " . MAIN_DB_PREFIX . $this->table_element . " SET"; |
|
401 | + $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element." SET"; |
|
402 | 402 | |
403 | - $sql .= " ref = '" . $this->db->escape($this->ref) . "'"; |
|
404 | - $sql .= ", ref_ext = '" . $this->db->escape($this->ref_ext) . "'"; |
|
405 | - $sql .= ", label = '" . $this->db->escape($this->label) . "'"; |
|
406 | - $sql .= ", position = " . ((int) $this->position); |
|
403 | + $sql .= " ref = '".$this->db->escape($this->ref)."'"; |
|
404 | + $sql .= ", ref_ext = '".$this->db->escape($this->ref_ext)."'"; |
|
405 | + $sql .= ", label = '".$this->db->escape($this->label)."'"; |
|
406 | + $sql .= ", position = ".((int) $this->position); |
|
407 | 407 | |
408 | - $sql .= " WHERE rowid = " . ((int) $this->id); |
|
408 | + $sql .= " WHERE rowid = ".((int) $this->id); |
|
409 | 409 | |
410 | 410 | dol_syslog(__METHOD__, LOG_DEBUG); |
411 | 411 | $resql = $this->db->query($sql); |
412 | 412 | if (!$resql) { |
413 | - $this->errors[] = "Error " . $this->db->lasterror(); |
|
413 | + $this->errors[] = "Error ".$this->db->lasterror(); |
|
414 | 414 | $error++; |
415 | 415 | } |
416 | 416 | |
@@ -453,7 +453,7 @@ discard block |
||
453 | 453 | $error++; |
454 | 454 | } |
455 | 455 | if ($error) { |
456 | - dol_syslog(__METHOD__ . ' ' . $this->errorsToString(), LOG_ERR); |
|
456 | + dol_syslog(__METHOD__.' '.$this->errorsToString(), LOG_ERR); |
|
457 | 457 | return -1; |
458 | 458 | } |
459 | 459 | |
@@ -478,25 +478,25 @@ discard block |
||
478 | 478 | |
479 | 479 | if (!$error) { |
480 | 480 | // Delete values |
481 | - $sql = "DELETE FROM " . MAIN_DB_PREFIX . $this->table_element_line; |
|
482 | - $sql .= " WHERE " . $this->fk_element . " = " . ((int) $this->id); |
|
481 | + $sql = "DELETE FROM ".MAIN_DB_PREFIX.$this->table_element_line; |
|
482 | + $sql .= " WHERE ".$this->fk_element." = ".((int) $this->id); |
|
483 | 483 | |
484 | - dol_syslog(__METHOD__ . ' - Delete values', LOG_DEBUG); |
|
484 | + dol_syslog(__METHOD__.' - Delete values', LOG_DEBUG); |
|
485 | 485 | $resql = $this->db->query($sql); |
486 | 486 | if (!$resql) { |
487 | - $this->errors[] = "Error " . $this->db->lasterror(); |
|
487 | + $this->errors[] = "Error ".$this->db->lasterror(); |
|
488 | 488 | $error++; |
489 | 489 | } |
490 | 490 | } |
491 | 491 | |
492 | 492 | if (!$error) { |
493 | - $sql = "DELETE FROM " . MAIN_DB_PREFIX . $this->table_element; |
|
494 | - $sql .= " WHERE rowid = " . ((int) $this->id); |
|
493 | + $sql = "DELETE FROM ".MAIN_DB_PREFIX.$this->table_element; |
|
494 | + $sql .= " WHERE rowid = ".((int) $this->id); |
|
495 | 495 | |
496 | - dol_syslog(__METHOD__ . ' - Delete attribute', LOG_DEBUG); |
|
496 | + dol_syslog(__METHOD__.' - Delete attribute', LOG_DEBUG); |
|
497 | 497 | $resql = $this->db->query($sql); |
498 | 498 | if (!$resql) { |
499 | - $this->errors[] = "Error " . $this->db->lasterror(); |
|
499 | + $this->errors[] = "Error ".$this->db->lasterror(); |
|
500 | 500 | $error++; |
501 | 501 | } |
502 | 502 | } |
@@ -535,15 +535,15 @@ discard block |
||
535 | 535 | $error++; |
536 | 536 | } |
537 | 537 | if ($error) { |
538 | - dol_syslog(__METHOD__ . ' ' . $this->errorsToString(), LOG_ERR); |
|
538 | + dol_syslog(__METHOD__.' '.$this->errorsToString(), LOG_ERR); |
|
539 | 539 | return -1; |
540 | 540 | } |
541 | 541 | |
542 | 542 | $sql = "SELECT td.rowid, td.fk_product_attribute, td.ref, td.value, td.position"; |
543 | - $sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element_line . " AS td"; |
|
544 | - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . $this->table_element . " AS t ON t.rowid = td." . $this->fk_element; |
|
545 | - $sql .= " WHERE t.rowid = " . ((int) $this->id); |
|
546 | - $sql .= " AND t.entity IN (" . getEntity('product') . ")"; |
|
543 | + $sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element_line." AS td"; |
|
544 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$this->table_element." AS t ON t.rowid = td.".$this->fk_element; |
|
545 | + $sql .= " WHERE t.rowid = ".((int) $this->id); |
|
546 | + $sql .= " AND t.entity IN (".getEntity('product').")"; |
|
547 | 547 | if ($filters) { |
548 | 548 | $sql .= $filters; |
549 | 549 | } |
@@ -552,8 +552,8 @@ discard block |
||
552 | 552 | dol_syslog(__METHOD__, LOG_DEBUG); |
553 | 553 | $resql = $this->db->query($sql); |
554 | 554 | if (!$resql) { |
555 | - $this->errors[] = "Error " . $this->db->lasterror(); |
|
556 | - dol_syslog(__METHOD__ . ' ' . $this->errorsToString(), LOG_ERR); |
|
555 | + $this->errors[] = "Error ".$this->db->lasterror(); |
|
556 | + dol_syslog(__METHOD__.' '.$this->errorsToString(), LOG_ERR); |
|
557 | 557 | return -3; |
558 | 558 | } |
559 | 559 | |
@@ -607,7 +607,7 @@ discard block |
||
607 | 607 | public function addLine($ref, $value, $position = -1, $notrigger = 0) |
608 | 608 | { |
609 | 609 | global $langs, $user; |
610 | - dol_syslog(__METHOD__ . " id=".$this->id.", ref=".$ref.", value=".$value.", notrigger=".$notrigger); |
|
610 | + dol_syslog(__METHOD__." id=".$this->id.", ref=".$ref.", value=".$value.", notrigger=".$notrigger); |
|
611 | 611 | $error = 0; |
612 | 612 | |
613 | 613 | // Clean parameters |
@@ -619,7 +619,7 @@ discard block |
||
619 | 619 | $error++; |
620 | 620 | } |
621 | 621 | if ($error) { |
622 | - dol_syslog(__METHOD__ . ' ' . $this->errorsToString(), LOG_ERR); |
|
622 | + dol_syslog(__METHOD__.' '.$this->errorsToString(), LOG_ERR); |
|
623 | 623 | return -1; |
624 | 624 | } |
625 | 625 | |
@@ -668,7 +668,7 @@ discard block |
||
668 | 668 | { |
669 | 669 | global $user; |
670 | 670 | |
671 | - dol_syslog(__METHOD__ . " lineid=$lineid, ref=$ref, value=$value, notrigger=$notrigger"); |
|
671 | + dol_syslog(__METHOD__." lineid=$lineid, ref=$ref, value=$value, notrigger=$notrigger"); |
|
672 | 672 | |
673 | 673 | // Clean parameters |
674 | 674 | $lineid = $lineid > 0 ? $lineid : 0; |
@@ -709,7 +709,7 @@ discard block |
||
709 | 709 | */ |
710 | 710 | public function deleteLine(User $user, $lineid, $notrigger = 0) |
711 | 711 | { |
712 | - dol_syslog(__METHOD__ . " lineid=$lineid, notrigger=$notrigger"); |
|
712 | + dol_syslog(__METHOD__." lineid=$lineid, notrigger=$notrigger"); |
|
713 | 713 | |
714 | 714 | // Clean parameters |
715 | 715 | $lineid = $lineid > 0 ? $lineid : 0; |
@@ -756,19 +756,19 @@ discard block |
||
756 | 756 | $error++; |
757 | 757 | } |
758 | 758 | if ($error) { |
759 | - dol_syslog(__METHOD__ . ' ' . $this->errorsToString(), LOG_ERR); |
|
759 | + dol_syslog(__METHOD__.' '.$this->errorsToString(), LOG_ERR); |
|
760 | 760 | return -1; |
761 | 761 | } |
762 | 762 | |
763 | 763 | $sql = "SELECT COUNT(*) AS count"; |
764 | - $sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element_line; |
|
765 | - $sql .= " WHERE " . $this->fk_element . " = " . ((int) $this->id); |
|
764 | + $sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element_line; |
|
765 | + $sql .= " WHERE ".$this->fk_element." = ".((int) $this->id); |
|
766 | 766 | |
767 | 767 | dol_syslog(__METHOD__, LOG_DEBUG); |
768 | 768 | $resql = $this->db->query($sql); |
769 | 769 | if (!$resql) { |
770 | - $this->errors[] = "Error " . $this->db->lasterror(); |
|
771 | - dol_syslog(__METHOD__ . ' ' . $this->errorsToString(), LOG_ERR); |
|
770 | + $this->errors[] = "Error ".$this->db->lasterror(); |
|
771 | + dol_syslog(__METHOD__.' '.$this->errorsToString(), LOG_ERR); |
|
772 | 772 | return -1; |
773 | 773 | } |
774 | 774 | |
@@ -799,21 +799,21 @@ discard block |
||
799 | 799 | $error++; |
800 | 800 | } |
801 | 801 | if ($error) { |
802 | - dol_syslog(__METHOD__ . ' ' . $this->errorsToString(), LOG_ERR); |
|
802 | + dol_syslog(__METHOD__.' '.$this->errorsToString(), LOG_ERR); |
|
803 | 803 | return -1; |
804 | 804 | } |
805 | 805 | |
806 | 806 | $sql = "SELECT COUNT(*) AS count"; |
807 | - $sql .= " FROM " . MAIN_DB_PREFIX . "product_attribute_combination2val AS pac2v"; |
|
808 | - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_attribute_combination AS pac ON pac2v.fk_prod_combination = pac.rowid"; |
|
809 | - $sql .= " WHERE pac2v.fk_prod_attr = " . ((int) $this->id); |
|
810 | - $sql .= " AND pac.entity IN (" . getEntity('product') . ")"; |
|
807 | + $sql .= " FROM ".MAIN_DB_PREFIX."product_attribute_combination2val AS pac2v"; |
|
808 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_attribute_combination AS pac ON pac2v.fk_prod_combination = pac.rowid"; |
|
809 | + $sql .= " WHERE pac2v.fk_prod_attr = ".((int) $this->id); |
|
810 | + $sql .= " AND pac.entity IN (".getEntity('product').")"; |
|
811 | 811 | |
812 | 812 | dol_syslog(__METHOD__, LOG_DEBUG); |
813 | 813 | $resql = $this->db->query($sql); |
814 | 814 | if (!$resql) { |
815 | - $this->errors[] = "Error " . $this->db->lasterror(); |
|
816 | - dol_syslog(__METHOD__ . ' ' . $this->errorsToString(), LOG_ERR); |
|
815 | + $this->errors[] = "Error ".$this->db->lasterror(); |
|
816 | + dol_syslog(__METHOD__.' '.$this->errorsToString(), LOG_ERR); |
|
817 | 817 | return -1; |
818 | 818 | } |
819 | 819 | |
@@ -843,16 +843,16 @@ discard block |
||
843 | 843 | $error++; |
844 | 844 | } |
845 | 845 | if ($error) { |
846 | - dol_syslog(__METHOD__ . ' ' . $this->errorsToString(), LOG_ERR); |
|
846 | + dol_syslog(__METHOD__.' '.$this->errorsToString(), LOG_ERR); |
|
847 | 847 | return -1; |
848 | 848 | } |
849 | 849 | |
850 | - $sql = "SELECT COUNT(*) AS nb FROM " . MAIN_DB_PREFIX . "product_attribute_combination2val WHERE fk_prod_attr = " . ((int) $this->id); |
|
850 | + $sql = "SELECT COUNT(*) AS nb FROM ".MAIN_DB_PREFIX."product_attribute_combination2val WHERE fk_prod_attr = ".((int) $this->id); |
|
851 | 851 | |
852 | 852 | dol_syslog(__METHOD__, LOG_DEBUG); |
853 | 853 | $resql = $this->db->query($sql); |
854 | 854 | if (!$resql) { |
855 | - $this->errors[] = "Error " . $this->db->lasterror(); |
|
855 | + $this->errors[] = "Error ".$this->db->lasterror(); |
|
856 | 856 | return -1; |
857 | 857 | } |
858 | 858 | |
@@ -876,8 +876,8 @@ discard block |
||
876 | 876 | { |
877 | 877 | // Count number of attributes to reorder (according to choice $renum) |
878 | 878 | $nl = 0; |
879 | - $sql = "SELECT count(rowid) FROM " . MAIN_DB_PREFIX . $this->table_element; |
|
880 | - $sql .= " WHERE entity IN (" . getEntity('product') . ")"; |
|
879 | + $sql = "SELECT count(rowid) FROM ".MAIN_DB_PREFIX.$this->table_element; |
|
880 | + $sql .= " WHERE entity IN (".getEntity('product').")"; |
|
881 | 881 | if (!$renum) { |
882 | 882 | $sql .= " AND position = 0"; |
883 | 883 | } else { |
@@ -897,11 +897,11 @@ discard block |
||
897 | 897 | $rows = array(); |
898 | 898 | |
899 | 899 | // We first search all attributes |
900 | - $sql = "SELECT rowid FROM " . MAIN_DB_PREFIX . $this->table_element; |
|
901 | - $sql .= " WHERE entity IN (" . getEntity('product') . ")"; |
|
902 | - $sql .= " ORDER BY position ASC, rowid " . $rowidorder; |
|
900 | + $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX.$this->table_element; |
|
901 | + $sql .= " WHERE entity IN (".getEntity('product').")"; |
|
902 | + $sql .= " ORDER BY position ASC, rowid ".$rowidorder; |
|
903 | 903 | |
904 | - dol_syslog(__METHOD__ . " search all attributes", LOG_DEBUG); |
|
904 | + dol_syslog(__METHOD__." search all attributes", LOG_DEBUG); |
|
905 | 905 | $resql = $this->db->query($sql); |
906 | 906 | if ($resql) { |
907 | 907 | $i = 0; |
@@ -936,8 +936,8 @@ discard block |
||
936 | 936 | { |
937 | 937 | global $hookmanager; |
938 | 938 | |
939 | - $sql = "UPDATE " . MAIN_DB_PREFIX . $this->table_element . " SET position = " . ((int) $position); |
|
940 | - $sql .= " WHERE rowid = " . ((int) $rowid); |
|
939 | + $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element." SET position = ".((int) $position); |
|
940 | + $sql .= " WHERE rowid = ".((int) $rowid); |
|
941 | 941 | |
942 | 942 | dol_syslog(__METHOD__, LOG_DEBUG); |
943 | 943 | if (!$this->db->query($sql)) { |
@@ -959,8 +959,8 @@ discard block |
||
959 | 959 | */ |
960 | 960 | public function getPositionOfAttribute($rowid) |
961 | 961 | { |
962 | - $sql = "SELECT position FROM " . MAIN_DB_PREFIX . $this->table_element; |
|
963 | - $sql .= " WHERE entity IN (" . getEntity('product') . ")"; |
|
962 | + $sql = "SELECT position FROM ".MAIN_DB_PREFIX.$this->table_element; |
|
963 | + $sql .= " WHERE entity IN (".getEntity('product').")"; |
|
964 | 964 | |
965 | 965 | dol_syslog(__METHOD__, LOG_DEBUG); |
966 | 966 | $resql = $this->db->query($sql); |
@@ -1023,12 +1023,12 @@ discard block |
||
1023 | 1023 | public function updateAttributePositionUp($rowid, $position) |
1024 | 1024 | { |
1025 | 1025 | if ($position > 1) { |
1026 | - $sql = "UPDATE " . MAIN_DB_PREFIX . $this->table_element . " SET position = " . ((int) $position); |
|
1027 | - $sql .= " WHERE entity IN (" . getEntity('product') . ")"; |
|
1028 | - $sql .= " AND position = " . ((int) ($position - 1)); |
|
1026 | + $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element." SET position = ".((int) $position); |
|
1027 | + $sql .= " WHERE entity IN (".getEntity('product').")"; |
|
1028 | + $sql .= " AND position = ".((int) ($position - 1)); |
|
1029 | 1029 | if ($this->db->query($sql)) { |
1030 | - $sql = "UPDATE " . MAIN_DB_PREFIX . $this->table_element . " SET position = " . ((int) ($position - 1)); |
|
1031 | - $sql .= " WHERE rowid = " . ((int) $rowid); |
|
1030 | + $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element." SET position = ".((int) ($position - 1)); |
|
1031 | + $sql .= " WHERE rowid = ".((int) $rowid); |
|
1032 | 1032 | if (!$this->db->query($sql)) { |
1033 | 1033 | dol_print_error($this->db); |
1034 | 1034 | } |
@@ -1049,12 +1049,12 @@ discard block |
||
1049 | 1049 | public function updateAttributePositionDown($rowid, $position, $max) |
1050 | 1050 | { |
1051 | 1051 | if ($position < $max) { |
1052 | - $sql = "UPDATE " . MAIN_DB_PREFIX . $this->table_element . " SET position = " . ((int) $position); |
|
1053 | - $sql .= " WHERE entity IN (" . getEntity('product') . ")"; |
|
1054 | - $sql .= " AND position = " . ((int) ($position + 1)); |
|
1052 | + $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element." SET position = ".((int) $position); |
|
1053 | + $sql .= " WHERE entity IN (".getEntity('product').")"; |
|
1054 | + $sql .= " AND position = ".((int) ($position + 1)); |
|
1055 | 1055 | if ($this->db->query($sql)) { |
1056 | - $sql = "UPDATE " . MAIN_DB_PREFIX . $this->table_element . " SET position = " . ((int) ($position + 1)); |
|
1057 | - $sql .= " WHERE rowid = " . ((int) $rowid); |
|
1056 | + $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element." SET position = ".((int) ($position + 1)); |
|
1057 | + $sql .= " WHERE rowid = ".((int) $rowid); |
|
1058 | 1058 | if (!$this->db->query($sql)) { |
1059 | 1059 | dol_print_error($this->db); |
1060 | 1060 | } |
@@ -1072,8 +1072,8 @@ discard block |
||
1072 | 1072 | public function getMaxAttributesPosition() |
1073 | 1073 | { |
1074 | 1074 | // Search the last position of attributes |
1075 | - $sql = "SELECT max(position) FROM " . MAIN_DB_PREFIX . $this->table_element; |
|
1076 | - $sql .= " WHERE entity IN (" . getEntity('product') . ")"; |
|
1075 | + $sql = "SELECT max(position) FROM ".MAIN_DB_PREFIX.$this->table_element; |
|
1076 | + $sql .= " WHERE entity IN (".getEntity('product').")"; |
|
1077 | 1077 | |
1078 | 1078 | dol_syslog(__METHOD__, LOG_DEBUG); |
1079 | 1079 | $resql = $this->db->query($sql); |
@@ -1119,17 +1119,17 @@ discard block |
||
1119 | 1119 | |
1120 | 1120 | $result = ''; |
1121 | 1121 | |
1122 | - $label = img_picto('', $this->picto) . ' <u>' . $langs->trans("ProductAttribute") . '</u>'; |
|
1122 | + $label = img_picto('', $this->picto).' <u>'.$langs->trans("ProductAttribute").'</u>'; |
|
1123 | 1123 | if (isset($this->status)) { |
1124 | - $label .= ' ' . $this->getLibStatut(5); |
|
1124 | + $label .= ' '.$this->getLibStatut(5); |
|
1125 | 1125 | } |
1126 | 1126 | $label .= '<br>'; |
1127 | - $label .= '<b>' . $langs->trans('Ref') . ':</b> ' . $this->ref; |
|
1127 | + $label .= '<b>'.$langs->trans('Ref').':</b> '.$this->ref; |
|
1128 | 1128 | if (!empty($this->label)) { |
1129 | - $label .= '<br><b>' . $langs->trans('Label') . ':</b> ' . $this->label; |
|
1129 | + $label .= '<br><b>'.$langs->trans('Label').':</b> '.$this->label; |
|
1130 | 1130 | } |
1131 | 1131 | |
1132 | - $url = dol_buildpath('/variants/card.php', 1) . '?id=' . $this->id; |
|
1132 | + $url = dol_buildpath('/variants/card.php', 1).'?id='.$this->id; |
|
1133 | 1133 | |
1134 | 1134 | if ($option != 'nolink') { |
1135 | 1135 | // Add param to save lastsearch_values or not |
@@ -1146,20 +1146,20 @@ discard block |
||
1146 | 1146 | if (empty($notooltip)) { |
1147 | 1147 | if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { |
1148 | 1148 | $label = $langs->trans("ShowProductAttribute"); |
1149 | - $linkclose .= ' alt="' . dol_escape_htmltag($label, 1) . '"'; |
|
1149 | + $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; |
|
1150 | 1150 | } |
1151 | - $linkclose .= ' title="' . dol_escape_htmltag($label, 1) . '"'; |
|
1152 | - $linkclose .= ' class="classfortooltip' . ($morecss ? ' ' . $morecss : '') . '"'; |
|
1151 | + $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; |
|
1152 | + $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"'; |
|
1153 | 1153 | } else { |
1154 | - $linkclose = ($morecss ? ' class="' . $morecss . '"' : ''); |
|
1154 | + $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); |
|
1155 | 1155 | } |
1156 | 1156 | |
1157 | 1157 | if ($option == 'nolink' || empty($url)) { |
1158 | 1158 | $linkstart = '<span'; |
1159 | 1159 | } else { |
1160 | - $linkstart = '<a href="' . $url . '"'; |
|
1160 | + $linkstart = '<a href="'.$url.'"'; |
|
1161 | 1161 | } |
1162 | - $linkstart .= $linkclose . '>'; |
|
1162 | + $linkstart .= $linkclose.'>'; |
|
1163 | 1163 | if ($option == 'nolink' || empty($url)) { |
1164 | 1164 | $linkend = '</span>'; |
1165 | 1165 | } else { |
@@ -1170,29 +1170,29 @@ discard block |
||
1170 | 1170 | |
1171 | 1171 | if (empty($this->showphoto_on_popup)) { |
1172 | 1172 | if ($withpicto) { |
1173 | - $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="' . (($withpicto != 2) ? 'paddingright ' : '') . 'classfortooltip"'), 0, 0, $notooltip ? 0 : 1); |
|
1173 | + $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1); |
|
1174 | 1174 | } |
1175 | 1175 | } else { |
1176 | 1176 | if ($withpicto) { |
1177 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; |
|
1177 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
|
1178 | 1178 | |
1179 | 1179 | list($class, $module) = explode('@', $this->picto); |
1180 | - $upload_dir = $conf->$module->multidir_output[$conf->entity] . "/$class/" . dol_sanitizeFileName($this->ref); |
|
1180 | + $upload_dir = $conf->$module->multidir_output[$conf->entity]."/$class/".dol_sanitizeFileName($this->ref); |
|
1181 | 1181 | $filearray = dol_dir_list($upload_dir, "files"); |
1182 | 1182 | $filename = $filearray[0]['name']; |
1183 | 1183 | if (!empty($filename)) { |
1184 | 1184 | $pospoint = strpos($filearray[0]['name'], '.'); |
1185 | 1185 | |
1186 | - $pathtophoto = $class . '/' . $this->ref . '/thumbs/' . substr($filename, 0, $pospoint) . '_mini' . substr($filename, $pospoint); |
|
1187 | - if (!getDolGlobalString(strtoupper($module . '_' . $class) . '_FORMATLISTPHOTOSASUSERS')) { |
|
1188 | - $result .= '<div class="floatleft inline-block valignmiddle divphotoref"><div class="photoref"><img class="photo' . $module . '" alt="No photo" border="0" src="' . DOL_URL_ROOT . '/viewimage.php?modulepart=' . $module . '&entity=' . $conf->entity . '&file=' . urlencode($pathtophoto) . '"></div></div>'; |
|
1186 | + $pathtophoto = $class.'/'.$this->ref.'/thumbs/'.substr($filename, 0, $pospoint).'_mini'.substr($filename, $pospoint); |
|
1187 | + if (!getDolGlobalString(strtoupper($module.'_'.$class).'_FORMATLISTPHOTOSASUSERS')) { |
|
1188 | + $result .= '<div class="floatleft inline-block valignmiddle divphotoref"><div class="photoref"><img class="photo'.$module.'" alt="No photo" border="0" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$module.'&entity='.$conf->entity.'&file='.urlencode($pathtophoto).'"></div></div>'; |
|
1189 | 1189 | } else { |
1190 | - $result .= '<div class="floatleft inline-block valignmiddle divphotoref"><img class="photouserphoto userphoto" alt="No photo" border="0" src="' . DOL_URL_ROOT . '/viewimage.php?modulepart=' . $module . '&entity=' . $conf->entity . '&file=' . urlencode($pathtophoto) . '"></div>'; |
|
1190 | + $result .= '<div class="floatleft inline-block valignmiddle divphotoref"><img class="photouserphoto userphoto" alt="No photo" border="0" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$module.'&entity='.$conf->entity.'&file='.urlencode($pathtophoto).'"></div>'; |
|
1191 | 1191 | } |
1192 | 1192 | |
1193 | 1193 | $result .= '</div>'; |
1194 | 1194 | } else { |
1195 | - $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="' . (($withpicto != 2) ? 'paddingright ' : '') . 'classfortooltip"'), 0, 0, $notooltip ? 0 : 1); |
|
1195 | + $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1); |
|
1196 | 1196 | } |
1197 | 1197 | } |
1198 | 1198 | } |
@@ -1279,9 +1279,9 @@ discard block |
||
1279 | 1279 | $dirtpls = array_merge($conf->modules_parts['tpl'], array($defaulttpldir)); |
1280 | 1280 | foreach ($dirtpls as $module => $reldir) { |
1281 | 1281 | if (!empty($module)) { |
1282 | - $tpl = dol_buildpath($reldir . '/productattributevalueline_create.tpl.php'); |
|
1282 | + $tpl = dol_buildpath($reldir.'/productattributevalueline_create.tpl.php'); |
|
1283 | 1283 | } else { |
1284 | - $tpl = DOL_DOCUMENT_ROOT . $reldir . '/productattributevalueline_create.tpl.php'; |
|
1284 | + $tpl = DOL_DOCUMENT_ROOT.$reldir.'/productattributevalueline_create.tpl.php'; |
|
1285 | 1285 | } |
1286 | 1286 | |
1287 | 1287 | if (empty($conf->file->strict_mode)) { |
@@ -1330,9 +1330,9 @@ discard block |
||
1330 | 1330 | $dirtpls = array_merge($conf->modules_parts['tpl'], array($defaulttpldir)); |
1331 | 1331 | foreach ($dirtpls as $module => $reldir) { |
1332 | 1332 | if (!empty($module)) { |
1333 | - $tpl = dol_buildpath($reldir . '/productattributevalueline_title.tpl.php'); |
|
1333 | + $tpl = dol_buildpath($reldir.'/productattributevalueline_title.tpl.php'); |
|
1334 | 1334 | } else { |
1335 | - $tpl = DOL_DOCUMENT_ROOT . $reldir . '/productattributevalueline_title.tpl.php'; |
|
1335 | + $tpl = DOL_DOCUMENT_ROOT.$reldir.'/productattributevalueline_title.tpl.php'; |
|
1336 | 1336 | } |
1337 | 1337 | if (empty($conf->file->strict_mode)) { |
1338 | 1338 | $res = @include $tpl; |
@@ -1411,9 +1411,9 @@ discard block |
||
1411 | 1411 | $dirtpls = array_merge($conf->modules_parts['tpl'], array($defaulttpldir)); |
1412 | 1412 | foreach ($dirtpls as $module => $reldir) { |
1413 | 1413 | if (!empty($module)) { |
1414 | - $tpl = dol_buildpath($reldir . '/productattributevalueline_view.tpl.php'); |
|
1414 | + $tpl = dol_buildpath($reldir.'/productattributevalueline_view.tpl.php'); |
|
1415 | 1415 | } else { |
1416 | - $tpl = DOL_DOCUMENT_ROOT . $reldir . '/productattributevalueline_view.tpl.php'; |
|
1416 | + $tpl = DOL_DOCUMENT_ROOT.$reldir.'/productattributevalueline_view.tpl.php'; |
|
1417 | 1417 | } |
1418 | 1418 | |
1419 | 1419 | if (empty($conf->file->strict_mode)) { |
@@ -1435,9 +1435,9 @@ discard block |
||
1435 | 1435 | $dirtpls = array_merge($conf->modules_parts['tpl'], array($defaulttpldir)); |
1436 | 1436 | foreach ($dirtpls as $module => $reldir) { |
1437 | 1437 | if (!empty($module)) { |
1438 | - $tpl = dol_buildpath($reldir . '/productattributevalueline_edit.tpl.php'); |
|
1438 | + $tpl = dol_buildpath($reldir.'/productattributevalueline_edit.tpl.php'); |
|
1439 | 1439 | } else { |
1440 | - $tpl = DOL_DOCUMENT_ROOT . $reldir . '/productattributevalueline_edit.tpl.php'; |
|
1440 | + $tpl = DOL_DOCUMENT_ROOT.$reldir.'/productattributevalueline_edit.tpl.php'; |
|
1441 | 1441 | } |
1442 | 1442 | |
1443 | 1443 | if (empty($conf->file->strict_mode)) { |
@@ -40,7 +40,7 @@ |
||
40 | 40 | $idc = GETPOST('c', 'int'); |
41 | 41 | $ids = GETPOST('s', 'int'); |
42 | 42 | $ida = GETPOST('a', 'int'); |
43 | -$action = GETPOST('action', 'aZ09'); // 1 or 2 |
|
43 | +$action = GETPOST('action', 'aZ09'); // 1 or 2 |
|
44 | 44 | $l = GETPOST('l', 'alpha'); |
45 | 45 | $securitykey = GETPOST('key', 'alpha'); |
46 | 46 |
@@ -47,7 +47,9 @@ |
||
47 | 47 | $forceall = 0; |
48 | 48 | } |
49 | 49 | |
50 | -if (empty($filtertype)) $filtertype = 0; |
|
50 | +if (empty($filtertype)) { |
|
51 | + $filtertype = 0; |
|
52 | +} |
|
51 | 53 | |
52 | 54 | $formproduct = new FormProduct($object->db); |
53 | 55 |
@@ -129,21 +129,21 @@ |
||
129 | 129 | if (getDolGlobalInt('PRODUCT_USE_UNITS')) { |
130 | 130 | $coldisplay++; |
131 | 131 | print '<td class="nobottom nowrap linecolunit right">'; |
132 | - print $formproduct->selectMeasuringUnits("fk_unit", '', (($line->fk_unit) ? $line->fk_unit : ''), 0, 0); |
|
132 | + print $formproduct->selectMeasuringUnits("fk_unit", '', (($line->fk_unit) ? $line->fk_unit : ''), 0, 0); |
|
133 | 133 | print '</td>'; |
134 | 134 | } |
135 | 135 | |
136 | 136 | $coldisplay++; |
137 | - print '<td class="nobottom linecolqtyfrozen right"><input type="checkbox" name="qty_frozen" id="qty_frozen" class="flat right" value="1"' . (GETPOSTISSET("qty_frozen") ? (GETPOST('qty_frozen', 'int') ? ' checked="checked"' : '') : ($line->qty_frozen ? ' checked="checked"' : '')) . '>'; |
|
137 | + print '<td class="nobottom linecolqtyfrozen right"><input type="checkbox" name="qty_frozen" id="qty_frozen" class="flat right" value="1"'.(GETPOSTISSET("qty_frozen") ? (GETPOST('qty_frozen', 'int') ? ' checked="checked"' : '') : ($line->qty_frozen ? ' checked="checked"' : '')).'>'; |
|
138 | 138 | print '</td>'; |
139 | 139 | |
140 | 140 | $coldisplay++; |
141 | - print '<td class="nobottom linecoldisablestockchange right"><input type="checkbox" name="disable_stock_change" id="disable_stock_change" class="flat right" value="1"' . (GETPOSTISSET('disablestockchange') ? (GETPOST("disable_stock_change", 'int') ? ' checked="checked"' : '') : ($line->disable_stock_change ? ' checked="checked"' : '')) . '">'; |
|
141 | + print '<td class="nobottom linecoldisablestockchange right"><input type="checkbox" name="disable_stock_change" id="disable_stock_change" class="flat right" value="1"'.(GETPOSTISSET('disablestockchange') ? (GETPOST("disable_stock_change", 'int') ? ' checked="checked"' : '') : ($line->disable_stock_change ? ' checked="checked"' : '')).'">'; |
|
142 | 142 | print '</td>'; |
143 | 143 | |
144 | 144 | $coldisplay++; |
145 | 145 | print '<td class="nobottom nowrap linecollost right">'; |
146 | - print '<input type="text" size="2" name="efficiency" id="efficiency" class="flat right" value="' . $line->efficiency . '"></td>'; |
|
146 | + print '<input type="text" size="2" name="efficiency" id="efficiency" class="flat right" value="'.$line->efficiency.'"></td>'; |
|
147 | 147 | |
148 | 148 | $coldisplay++; |
149 | 149 | print '<td class="nobottom nowrap linecolcostprice right">'; |
@@ -40,7 +40,9 @@ discard block |
||
40 | 40 | } |
41 | 41 | |
42 | 42 | global $filtertype; |
43 | -if (empty($filtertype)) $filtertype = 0; |
|
43 | +if (empty($filtertype)) { |
|
44 | + $filtertype = 0; |
|
45 | +} |
|
44 | 46 | |
45 | 47 | print "<!-- BEGIN PHP TEMPLATE objectline_title.tpl.php -->\n"; |
46 | 48 | |
@@ -85,7 +87,9 @@ discard block |
||
85 | 87 | } else { |
86 | 88 | print '<td class="linecolunit right">' . $form->textwithpicto($langs->trans('Unit'), '').'</td>'; |
87 | 89 | |
88 | - if (isModEnabled('workstation')) print '<td class="linecolworkstation right">' . $form->textwithpicto($langs->trans('DefaultWorkstation'), '') . '</td>'; |
|
90 | + if (isModEnabled('workstation')) { |
|
91 | + print '<td class="linecolworkstation right">' . $form->textwithpicto($langs->trans('DefaultWorkstation'), '') . '</td>'; |
|
92 | + } |
|
89 | 93 | |
90 | 94 | // Cost |
91 | 95 | print '<td class="linecolcost right">'.$form->textwithpicto($langs->trans("TotalCost"), $langs->trans("BOMTotalCostService")).'</td>'; |
@@ -68,24 +68,24 @@ |
||
68 | 68 | |
69 | 69 | if ($filtertype != 1) { |
70 | 70 | if (getDolGlobalInt('PRODUCT_USE_UNITS')) { |
71 | - print '<td class="linecoluseunit left">' . $langs->trans('Unit') . '</td>'; |
|
71 | + print '<td class="linecoluseunit left">'.$langs->trans('Unit').'</td>'; |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | // Qty frozen |
75 | - print '<td class="linecolqtyfrozen right">' . $form->textwithpicto($langs->trans('QtyFrozen'), $langs->trans("QuantityConsumedInvariable")) . '</td>'; |
|
75 | + print '<td class="linecolqtyfrozen right">'.$form->textwithpicto($langs->trans('QtyFrozen'), $langs->trans("QuantityConsumedInvariable")).'</td>'; |
|
76 | 76 | |
77 | 77 | // Disable stock change |
78 | - print '<td class="linecoldisablestockchange right">' . $form->textwithpicto($langs->trans('DisableStockChange'), $langs->trans('DisableStockChangeHelp')) . '</td>'; |
|
78 | + print '<td class="linecoldisablestockchange right">'.$form->textwithpicto($langs->trans('DisableStockChange'), $langs->trans('DisableStockChangeHelp')).'</td>'; |
|
79 | 79 | |
80 | 80 | // Efficiency |
81 | - print '<td class="linecolefficiency right">' . $form->textwithpicto($langs->trans('ManufacturingEfficiency'), $langs->trans('ValueOfMeansLoss')) . '</td>'; |
|
81 | + print '<td class="linecolefficiency right">'.$form->textwithpicto($langs->trans('ManufacturingEfficiency'), $langs->trans('ValueOfMeansLoss')).'</td>'; |
|
82 | 82 | |
83 | 83 | // Cost |
84 | 84 | print '<td class="linecolcost right">'.$form->textwithpicto($langs->trans("TotalCost"), $langs->trans("BOMTotalCost")).'</td>'; |
85 | 85 | } else { |
86 | - print '<td class="linecolunit right">' . $form->textwithpicto($langs->trans('Unit'), '').'</td>'; |
|
86 | + print '<td class="linecolunit right">'.$form->textwithpicto($langs->trans('Unit'), '').'</td>'; |
|
87 | 87 | |
88 | - if (isModEnabled('workstation')) print '<td class="linecolworkstation right">' . $form->textwithpicto($langs->trans('DefaultWorkstation'), '') . '</td>'; |
|
88 | + if (isModEnabled('workstation')) print '<td class="linecolworkstation right">'.$form->textwithpicto($langs->trans('DefaultWorkstation'), '').'</td>'; |
|
89 | 89 | |
90 | 90 | // Cost |
91 | 91 | print '<td class="linecolcost right">'.$form->textwithpicto($langs->trans("TotalCost"), $langs->trans("BOMTotalCostService")).'</td>'; |
@@ -44,7 +44,9 @@ discard block |
||
44 | 44 | $forceall = 0; |
45 | 45 | } |
46 | 46 | |
47 | -if (empty($filtertype)) $filtertype = 0; |
|
47 | +if (empty($filtertype)) { |
|
48 | + $filtertype = 0; |
|
49 | +} |
|
48 | 50 | if (!empty($object->element) && $object->element == 'contrat' && empty($conf->global->STOCK_SUPPORT_SERVICES)) { |
49 | 51 | $filtertype = -1; |
50 | 52 | } |
@@ -84,7 +86,9 @@ discard block |
||
84 | 86 | print '<td class="linecollost right">' . $form->textwithpicto($langs->trans('ManufacturingEfficiency'), $langs->trans('ValueOfMeansLoss')) . '</td>'; |
85 | 87 | } else { |
86 | 88 | print '<td class="linecolunit right">' . $form->textwithpicto($langs->trans('Unit'), '').'</td>'; |
87 | - if (isModEnabled('workstation')) print '<td class="linecolworkstation right">' . $form->textwithpicto($langs->trans('Workstation'), '') . '</td>'; |
|
89 | + if (isModEnabled('workstation')) { |
|
90 | + print '<td class="linecolworkstation right">' . $form->textwithpicto($langs->trans('Workstation'), '') . '</td>'; |
|
91 | + } |
|
88 | 92 | print '<td class="linecoltotalcost right">' . $form->textwithpicto($langs->trans('TotalCost'), '') . '</td>'; |
89 | 93 | } |
90 | 94 |
@@ -79,16 +79,16 @@ discard block |
||
79 | 79 | print $langs->trans('Unit'); |
80 | 80 | print '</span></td>'; |
81 | 81 | } |
82 | - print '<td class="linecolqtyfrozen right">' . $form->textwithpicto($langs->trans('QtyFrozen'), $langs->trans("QuantityConsumedInvariable")) . '</td>'; |
|
83 | - print '<td class="linecoldisablestockchange right">' . $form->textwithpicto($langs->trans('DisableStockChange'), $langs->trans('DisableStockChangeHelp')) . '</td>'; |
|
84 | - print '<td class="linecollost right">' . $form->textwithpicto($langs->trans('ManufacturingEfficiency'), $langs->trans('ValueOfMeansLoss')) . '</td>'; |
|
82 | + print '<td class="linecolqtyfrozen right">'.$form->textwithpicto($langs->trans('QtyFrozen'), $langs->trans("QuantityConsumedInvariable")).'</td>'; |
|
83 | + print '<td class="linecoldisablestockchange right">'.$form->textwithpicto($langs->trans('DisableStockChange'), $langs->trans('DisableStockChangeHelp')).'</td>'; |
|
84 | + print '<td class="linecollost right">'.$form->textwithpicto($langs->trans('ManufacturingEfficiency'), $langs->trans('ValueOfMeansLoss')).'</td>'; |
|
85 | 85 | } else { |
86 | - print '<td class="linecolunit right">' . $form->textwithpicto($langs->trans('Unit'), '').'</td>'; |
|
87 | - if (isModEnabled('workstation')) print '<td class="linecolworkstation right">' . $form->textwithpicto($langs->trans('Workstation'), '') . '</td>'; |
|
88 | - print '<td class="linecoltotalcost right">' . $form->textwithpicto($langs->trans('TotalCost'), '') . '</td>'; |
|
86 | + print '<td class="linecolunit right">'.$form->textwithpicto($langs->trans('Unit'), '').'</td>'; |
|
87 | + if (isModEnabled('workstation')) print '<td class="linecolworkstation right">'.$form->textwithpicto($langs->trans('Workstation'), '').'</td>'; |
|
88 | + print '<td class="linecoltotalcost right">'.$form->textwithpicto($langs->trans('TotalCost'), '').'</td>'; |
|
89 | 89 | } |
90 | 90 | |
91 | - print '<td class="linecoledit" colspan="' . $colspan . '"> </td>'; |
|
91 | + print '<td class="linecoledit" colspan="'.$colspan.'"> </td>'; |
|
92 | 92 | print '</tr>'; |
93 | 93 | } |
94 | 94 | print '<tr class="pair nodrag nodrop nohoverpair'.(($nolinesbefore || $object->element == 'contrat') ? '' : ' liste_titre_create').'">'; |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | |
124 | 124 | echo '</span>'; |
125 | 125 | } |
126 | -if (!empty($conf->global->BOM_SUB_BOM) && $filtertype!=1) { |
|
126 | +if (!empty($conf->global->BOM_SUB_BOM) && $filtertype != 1) { |
|
127 | 127 | print '<br><span class="opacitymedium">'.$langs->trans("or").'</span><br>'.$langs->trans("BOM"); |
128 | 128 | print $form->select_bom('', 'bom_id', 0, 1, 0, '1', '', 1); |
129 | 129 | } |
@@ -153,17 +153,17 @@ discard block |
||
153 | 153 | } |
154 | 154 | |
155 | 155 | $coldisplay++; |
156 | - print '<td class="bordertop nobottom linecolqtyfrozen right"><input type="checkbox" name="qty_frozen" id="qty_frozen" class="flat right" value="1"' . (GETPOST("qty_frozen", 'alpha') ? ' checked="checked"' : '') . '>'; |
|
156 | + print '<td class="bordertop nobottom linecolqtyfrozen right"><input type="checkbox" name="qty_frozen" id="qty_frozen" class="flat right" value="1"'.(GETPOST("qty_frozen", 'alpha') ? ' checked="checked"' : '').'>'; |
|
157 | 157 | print '</td>'; |
158 | 158 | |
159 | 159 | |
160 | 160 | $coldisplay++; |
161 | - print '<td class="bordertop nobottom linecoldisablestockchange right"><input type="checkbox" name="disable_stock_change" id="disable_stock_change" class="flat right" value="1"' . (GETPOST("disable_stock_change", 'alpha') ? ' checked="checked"' : '') . '">'; |
|
161 | + print '<td class="bordertop nobottom linecoldisablestockchange right"><input type="checkbox" name="disable_stock_change" id="disable_stock_change" class="flat right" value="1"'.(GETPOST("disable_stock_change", 'alpha') ? ' checked="checked"' : '').'">'; |
|
162 | 162 | print '</td>'; |
163 | 163 | |
164 | 164 | $coldisplay++; |
165 | 165 | print '<td class="bordertop nobottom nowrap linecollost right">'; |
166 | - print '<input type="text" size="2" name="efficiency" id="efficiency" class="flat right" value="' . ((GETPOSTISSET("efficiency") && $action == 'addline') ? GETPOST("efficiency", 'alpha') : 1) . '">'; |
|
166 | + print '<input type="text" size="2" name="efficiency" id="efficiency" class="flat right" value="'.((GETPOSTISSET("efficiency") && $action == 'addline') ? GETPOST("efficiency", 'alpha') : 1).'">'; |
|
167 | 167 | print '</td>'; |
168 | 168 | |
169 | 169 | $coldisplay++; |
@@ -191,8 +191,8 @@ discard block |
||
191 | 191 | } |
192 | 192 | |
193 | 193 | $coldisplay += $colspan; |
194 | - print '<td class="bordertop nobottom linecoledit center valignmiddle" colspan="' . $colspan . '">'; |
|
195 | - print '<input type="submit" class="button button-add" name="addline" id="addline" value="' . $langs->trans('Add') . '">'; |
|
194 | + print '<td class="bordertop nobottom linecoledit center valignmiddle" colspan="'.$colspan.'">'; |
|
195 | + print '<input type="submit" class="button button-add" name="addline" id="addline" value="'.$langs->trans('Add').'">'; |
|
196 | 196 | print '</td>'; |
197 | 197 | print '</tr>'; |
198 | 198 |
@@ -77,7 +77,9 @@ |
||
77 | 77 | $k = 0; |
78 | 78 | if ($resql) { |
79 | 79 | $obj = $db->fetch_object($resql); |
80 | - if ($obj->rowid && $obj->rowid > 0) $k = $obj->rowid; |
|
80 | + if ($obj->rowid && $obj->rowid > 0) { |
|
81 | + $k = $obj->rowid; |
|
82 | + } |
|
81 | 83 | } |
82 | 84 | echo '<a class="reposition" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=dellink&token=' . newToken() . '&dellinkid=' . $k . '">' . img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink') . '</a>'; |
83 | 85 | echo '</td>'; |
@@ -53,25 +53,25 @@ discard block |
||
53 | 53 | |
54 | 54 | $trclass = 'oddeven'; |
55 | 55 | |
56 | - echo '<tr class="' . $trclass . '" >'; |
|
57 | - echo '<td class="linkedcol-element tdoverflowmax100">' . $langs->trans("ManufacturingOrder"); |
|
56 | + echo '<tr class="'.$trclass.'" >'; |
|
57 | + echo '<td class="linkedcol-element tdoverflowmax100">'.$langs->trans("ManufacturingOrder"); |
|
58 | 58 | if (!empty($showImportButton) && $conf->global->MAIN_ENABLE_IMPORT_LINKED_OBJECT_LINES) { |
59 | - print '<a class="objectlinked_importbtn" href="' . $objectlink->getNomUrl(0, '', 0, 1) . '&action=selectlines" data-element="' . $objectlink->element . '" data-id="' . $objectlink->id . '" > <i class="fa fa-indent"></i> </a'; |
|
59 | + print '<a class="objectlinked_importbtn" href="'.$objectlink->getNomUrl(0, '', 0, 1).'&action=selectlines" data-element="'.$objectlink->element.'" data-id="'.$objectlink->id.'" > <i class="fa fa-indent"></i> </a'; |
|
60 | 60 | } |
61 | 61 | echo '</td>'; |
62 | - echo '<td class="linkedcol-name nowraponall" >' . $objectlink->getNomUrl(1) . '</td>'; |
|
62 | + echo '<td class="linkedcol-name nowraponall" >'.$objectlink->getNomUrl(1).'</td>'; |
|
63 | 63 | |
64 | 64 | echo '<td class="linkedcol-ref center">'; |
65 | 65 | // $result = $product_static->fetch($objectlink->fk_product); |
66 | 66 | print '</td>'; |
67 | - echo '<td class="linkedcol-date center">' . dol_print_date($objectlink->date_creation, 'day') . '</td>'; |
|
67 | + echo '<td class="linkedcol-date center">'.dol_print_date($objectlink->date_creation, 'day').'</td>'; |
|
68 | 68 | echo '<td class="linkedcol-amount right">-</td>'; |
69 | - echo '<td class="linkedcol-statut right">' . $objectlink->getLibStatut(3) . '</td>'; |
|
69 | + echo '<td class="linkedcol-statut right">'.$objectlink->getLibStatut(3).'</td>'; |
|
70 | 70 | echo '<td class="linkedcol-action right">'; |
71 | 71 | |
72 | 72 | // we want to make the link via element_element for delete action |
73 | - $sql = " Select rowid from " . MAIN_DB_PREFIX . "element_element"; |
|
74 | - $sql .= " WHERE fk_source = " . (int) $object->id . " and fk_target = '" . dol_escape_htmltag($key) . "'"; |
|
73 | + $sql = " Select rowid from ".MAIN_DB_PREFIX."element_element"; |
|
74 | + $sql .= " WHERE fk_source = ".(int) $object->id." and fk_target = '".dol_escape_htmltag($key)."'"; |
|
75 | 75 | |
76 | 76 | $resql = $db->query($sql); |
77 | 77 | $k = 0; |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | $obj = $db->fetch_object($resql); |
80 | 80 | if ($obj->rowid && $obj->rowid > 0) $k = $obj->rowid; |
81 | 81 | } |
82 | - echo '<a class="reposition" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=dellink&token=' . newToken() . '&dellinkid=' . $k . '">' . img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink') . '</a>'; |
|
82 | + echo '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&token='.newToken().'&dellinkid='.$k.'">'.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink').'</a>'; |
|
83 | 83 | echo '</td>'; |
84 | 84 | echo "</tr>\n"; |
85 | 85 | } |
@@ -393,7 +393,7 @@ |
||
393 | 393 | print '<td class="right">'.$val['nb'].'</td>'; |
394 | 394 | print '<td class="right opacitylow" style="'.($greennb ? 'color: green;' : 'color: red;').'">'.(!empty($val['nb_diff']) && $val['nb_diff'] < 0 ? '' : '+').round(!empty($val['nb_diff']) ? $val['nb_diff'] : 0).'%</td>'; |
395 | 395 | print '<td class="right"><span class="amount">'.price(price2num($val['total'], 'MT'), 1).'</span></td>'; |
396 | - print '<td class="right opacitylow" style="'.($greentotal ? 'color: green;' : 'color: red;').'">'.( !empty($val['total_diff']) && $val['total_diff'] < 0 ? '' : '+').round(!empty($val['total_diff']) ? $val['total_diff'] : 0).'%</td>'; |
|
396 | + print '<td class="right opacitylow" style="'.($greentotal ? 'color: green;' : 'color: red;').'">'.(!empty($val['total_diff']) && $val['total_diff'] < 0 ? '' : '+').round(!empty($val['total_diff']) ? $val['total_diff'] : 0).'%</td>'; |
|
397 | 397 | print '<td class="right"><span class="amount">'.price(price2num($val['avg'], 'MT'), 1).'</span></td>'; |
398 | 398 | print '<td class="right opacitylow" style="'.($greenavg ? 'color: green;' : 'color: red;').'">'.(!empty($val['avg_diff']) && $val['avg_diff'] < 0 ? '' : '+').round(!empty($val['avg_diff']) ? $val['avg_diff'] : 0).'%</td>'; |
399 | 399 | print '</tr>'; |
@@ -89,8 +89,8 @@ discard block |
||
89 | 89 | $month_current = dol_print_date(dol_now(), '%m'); |
90 | 90 | $year_start = $year; |
91 | 91 | } |
92 | -$date_start = dol_mktime(0, 0, 0, GETPOST("date_startmonth"), GETPOST("date_startday"), GETPOST("date_startyear"), 'tzserver'); // We use timezone of server so report is same from everywhere |
|
93 | -$date_end = dol_mktime(23, 59, 59, GETPOST("date_endmonth"), GETPOST("date_endday"), GETPOST("date_endyear"), 'tzserver'); // We use timezone of server so report is same from everywhere |
|
92 | +$date_start = dol_mktime(0, 0, 0, GETPOST("date_startmonth"), GETPOST("date_startday"), GETPOST("date_startyear"), 'tzserver'); // We use timezone of server so report is same from everywhere |
|
93 | +$date_end = dol_mktime(23, 59, 59, GETPOST("date_endmonth"), GETPOST("date_endday"), GETPOST("date_endyear"), 'tzserver'); // We use timezone of server so report is same from everywhere |
|
94 | 94 | // Quarter |
95 | 95 | if (empty($date_start) || empty($date_end)) { // We define date_start and date_end |
96 | 96 | $q = GETPOST("q", "int") ?GETPOST("q", "int") : 0; |
@@ -336,7 +336,7 @@ discard block |
||
336 | 336 | $address_town[$obj->socid] = $obj->town; |
337 | 337 | $address_pays[$obj->socid] = getCountry($obj->fk_pays); |
338 | 338 | |
339 | - $catotal_ht += (empty($obj->amount) ? 0 : $obj->amount); |
|
339 | + $catotal_ht += (empty($obj->amount) ? 0 : $obj->amount); |
|
340 | 340 | $catotal += $obj->amount_ttc; |
341 | 341 | |
342 | 342 | $i++; |