@@ -54,11 +54,11 @@ discard block |
||
54 | 54 | |
55 | 55 | |
56 | 56 | // Get parameters |
57 | -$action = GETPOST('action', 'aZ09'); |
|
57 | +$action = GETPOST('action', 'aZ09'); |
|
58 | 58 | $massaction = GETPOST('massaction', 'alpha'); |
59 | 59 | $show_files = GETPOSTINT('show_files'); |
60 | -$confirm = GETPOST('confirm', 'alpha'); |
|
61 | -$toselect = GETPOST('toselect', 'array'); |
|
60 | +$confirm = GETPOST('confirm', 'alpha'); |
|
61 | +$toselect = GETPOST('toselect', 'array'); |
|
62 | 62 | $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'thirdpartylist'; |
63 | 63 | $optioncss = GETPOST('optioncss', 'alpha'); |
64 | 64 | if ($contextpage == 'poslist') { |
@@ -130,20 +130,20 @@ discard block |
||
130 | 130 | $search_date_creation_startmonth = GETPOSTINT('search_date_creation_startmonth'); |
131 | 131 | $search_date_creation_startyear = GETPOSTINT('search_date_creation_startyear'); |
132 | 132 | $search_date_creation_startday = GETPOSTINT('search_date_creation_startday'); |
133 | -$search_date_creation_start = dol_mktime(0, 0, 0, $search_date_creation_startmonth, $search_date_creation_startday, $search_date_creation_startyear); // Use tzserver |
|
133 | +$search_date_creation_start = dol_mktime(0, 0, 0, $search_date_creation_startmonth, $search_date_creation_startday, $search_date_creation_startyear); // Use tzserver |
|
134 | 134 | $search_date_creation_endmonth = GETPOSTINT('search_date_creation_endmonth'); |
135 | 135 | $search_date_creation_endyear = GETPOSTINT('search_date_creation_endyear'); |
136 | 136 | $search_date_creation_endday = GETPOSTINT('search_date_creation_endday'); |
137 | -$search_date_creation_end = dol_mktime(23, 59, 59, $search_date_creation_endmonth, $search_date_creation_endday, $search_date_creation_endyear); // Use tzserver |
|
137 | +$search_date_creation_end = dol_mktime(23, 59, 59, $search_date_creation_endmonth, $search_date_creation_endday, $search_date_creation_endyear); // Use tzserver |
|
138 | 138 | |
139 | 139 | $search_date_modif_startmonth = GETPOSTINT('search_date_modif_startmonth'); |
140 | 140 | $search_date_modif_startyear = GETPOSTINT('search_date_modif_startyear'); |
141 | 141 | $search_date_modif_startday = GETPOSTINT('search_date_modif_startday'); |
142 | -$search_date_modif_start = dol_mktime(0, 0, 0, $search_date_modif_startmonth, $search_date_modif_startday, $search_date_modif_startyear); // Use tzserver |
|
142 | +$search_date_modif_start = dol_mktime(0, 0, 0, $search_date_modif_startmonth, $search_date_modif_startday, $search_date_modif_startyear); // Use tzserver |
|
143 | 143 | $search_date_modif_endmonth = GETPOSTINT('search_date_modif_endmonth'); |
144 | 144 | $search_date_modif_endyear = GETPOSTINT('search_date_modif_endyear'); |
145 | 145 | $search_date_modif_endday = GETPOSTINT('search_date_modif_endday'); |
146 | -$search_date_modif_end = dol_mktime(23, 59, 59, $search_date_modif_endmonth, $search_date_modif_endday, $search_date_modif_endyear); // Use tzserver |
|
146 | +$search_date_modif_end = dol_mktime(23, 59, 59, $search_date_modif_endmonth, $search_date_modif_endday, $search_date_modif_endyear); // Use tzserver |
|
147 | 147 | |
148 | 148 | |
149 | 149 | $type = GETPOST('type', 'alpha'); |
@@ -606,7 +606,7 @@ discard block |
||
606 | 606 | if ($searchCategoryCustomerOperator == 0) { |
607 | 607 | $searchCategoryCustomerSqlList[] = " EXISTS (SELECT ck.fk_soc FROM ".MAIN_DB_PREFIX."categorie_societe as ck WHERE s.rowid = ck.fk_soc AND ck.fk_categorie = ".((int) $searchCategoryCustomer).")"; |
608 | 608 | } else { |
609 | - $listofcategoryid .= ($listofcategoryid ? ', ' : '') .((int) $searchCategoryCustomer); |
|
609 | + $listofcategoryid .= ($listofcategoryid ? ', ' : '').((int) $searchCategoryCustomer); |
|
610 | 610 | } |
611 | 611 | } |
612 | 612 | } |
@@ -635,7 +635,7 @@ discard block |
||
635 | 635 | if ($searchCategorySupplierOperator == 0) { |
636 | 636 | $searchCategorySupplierSqlList[] = " EXISTS (SELECT ck.fk_soc FROM ".MAIN_DB_PREFIX."categorie_fournisseur as ck WHERE s.rowid = ck.fk_soc AND ck.fk_categorie = ".((int) $searchCategorySupplier).")"; |
637 | 637 | } else { |
638 | - $listofcategoryid .= ($listofcategoryid ? ', ' : '') .((int) $searchCategorySupplier); |
|
638 | + $listofcategoryid .= ($listofcategoryid ? ', ' : '').((int) $searchCategorySupplier); |
|
639 | 639 | } |
640 | 640 | } |
641 | 641 | } |
@@ -1072,7 +1072,7 @@ discard block |
||
1072 | 1072 | $param .= '&search_date_modif_endday='.urlencode((string) ($search_date_modif_endday)); |
1073 | 1073 | } |
1074 | 1074 | if ($search_date_modif_end) { |
1075 | - $param .= '&search_date_modif_end=' . urlencode($search_date_modif_end); |
|
1075 | + $param .= '&search_date_modif_end='.urlencode($search_date_modif_end); |
|
1076 | 1076 | } |
1077 | 1077 | |
1078 | 1078 | // Add $param from extra fields |
@@ -1140,7 +1140,7 @@ discard block |
||
1140 | 1140 | if (!empty($socid)) { |
1141 | 1141 | $url .= '&socid='.$socid; |
1142 | 1142 | } |
1143 | - $newcardbutton = ''; |
|
1143 | + $newcardbutton = ''; |
|
1144 | 1144 | $newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss' => 'reposition')); |
1145 | 1145 | $newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss' => 'reposition')); |
1146 | 1146 | $newcardbutton .= dolGetButtonTitle($langs->trans($label), '', 'fa fa-plus-circle', $url, '', $user->hasRight('societe', 'creer')); |
@@ -1682,19 +1682,19 @@ discard block |
||
1682 | 1682 | print $hookmanager->resPrint; |
1683 | 1683 | if (!empty($arrayfields['s.datec']['checked'])) { |
1684 | 1684 | print_liste_field_titre($arrayfields['s.datec']['label'], $_SERVER["PHP_SELF"], "s.datec", "", $param, '', $sortfield, $sortorder, 'center nowrap '); |
1685 | - $totalarray['nbfield']++; // For the column action |
|
1685 | + $totalarray['nbfield']++; // For the column action |
|
1686 | 1686 | } |
1687 | 1687 | if (!empty($arrayfields['s.tms']['checked'])) { |
1688 | 1688 | print_liste_field_titre($arrayfields['s.tms']['label'], $_SERVER["PHP_SELF"], "s.tms", "", $param, '', $sortfield, $sortorder, 'center nowrap '); |
1689 | - $totalarray['nbfield']++; // For the column action |
|
1689 | + $totalarray['nbfield']++; // For the column action |
|
1690 | 1690 | } |
1691 | 1691 | if (!empty($arrayfields['s.status']['checked'])) { |
1692 | 1692 | print_liste_field_titre($arrayfields['s.status']['label'], $_SERVER["PHP_SELF"], "s.status", "", $param, '', $sortfield, $sortorder, 'center '); |
1693 | - $totalarray['nbfield']++; // For the column action |
|
1693 | + $totalarray['nbfield']++; // For the column action |
|
1694 | 1694 | } |
1695 | 1695 | if (!empty($arrayfields['s.import_key']['checked'])) { |
1696 | 1696 | print_liste_field_titre($arrayfields['s.import_key']['label'], $_SERVER["PHP_SELF"], "s.import_key", "", $param, '', $sortfield, $sortorder, 'center '); |
1697 | - $totalarray['nbfield']++; // For the column action |
|
1697 | + $totalarray['nbfield']++; // For the column action |
|
1698 | 1698 | } |
1699 | 1699 | // Action column |
1700 | 1700 | if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | $refalreadyexists = 0; |
98 | 98 | |
99 | 99 | // Get parameters |
100 | -$id = GETPOSTINT('id'); |
|
100 | +$id = GETPOSTINT('id'); |
|
101 | 101 | if (getDolGlobalString('MAIN_SECURITY_ALLOW_UNSECURED_REF_LABELS')) { |
102 | 102 | $ref = (GETPOSTISSET('ref') ? GETPOST('ref', 'nohtml') : null); |
103 | 103 | } else { |
@@ -509,11 +509,11 @@ discard block |
||
509 | 509 | if (!$error) { |
510 | 510 | $units = GETPOSTINT('units'); |
511 | 511 | |
512 | - $object->entity = $conf->entity; |
|
513 | - $object->ref = $ref; |
|
514 | - $object->label = GETPOST('label', $label_security_check); |
|
515 | - $object->price_base_type = GETPOST('price_base_type', 'aZ09'); |
|
516 | - $object->mandatory_period = !empty(GETPOST("mandatoryperiod", 'alpha')) ? 1 : 0; |
|
512 | + $object->entity = $conf->entity; |
|
513 | + $object->ref = $ref; |
|
514 | + $object->label = GETPOST('label', $label_security_check); |
|
515 | + $object->price_base_type = GETPOST('price_base_type', 'aZ09'); |
|
516 | + $object->mandatory_period = !empty(GETPOST("mandatoryperiod", 'alpha')) ? 1 : 0; |
|
517 | 517 | if ($object->price_base_type == 'TTC') { |
518 | 518 | $object->price_ttc = GETPOST('price'); |
519 | 519 | } else { |
@@ -601,7 +601,7 @@ discard block |
||
601 | 601 | $object->duration_value = $duration_value; |
602 | 602 | $object->duration_unit = $duration_unit; |
603 | 603 | $object->fk_default_warehouse = GETPOSTINT('fk_default_warehouse'); |
604 | - $object->fk_default_workstation = GETPOSTINT('fk_default_workstation'); |
|
604 | + $object->fk_default_workstation = GETPOSTINT('fk_default_workstation'); |
|
605 | 605 | $object->seuil_stock_alerte = GETPOST('seuil_stock_alerte') ? GETPOST('seuil_stock_alerte') : 0; |
606 | 606 | $object->desiredstock = GETPOST('desiredstock') ? GETPOST('desiredstock') : 0; |
607 | 607 | $object->canvas = GETPOST('canvas'); |
@@ -748,7 +748,7 @@ discard block |
||
748 | 748 | $object->oldcopy = dol_clone($object, 1); |
749 | 749 | |
750 | 750 | if (!getDolGlobalString('PRODUCT_GENERATE_REF_AFTER_FORM')) { |
751 | - $object->ref = $ref; |
|
751 | + $object->ref = $ref; |
|
752 | 752 | } |
753 | 753 | $object->label = GETPOST('label', $label_security_check); |
754 | 754 | |
@@ -770,7 +770,7 @@ discard block |
||
770 | 770 | $object->status_batch = GETPOST('status_batch', 'aZ09'); |
771 | 771 | $object->sell_or_eat_by_mandatory = GETPOSTINT('sell_or_eat_by_mandatory'); |
772 | 772 | $object->batch_mask = GETPOST('batch_mask', 'alpha'); |
773 | - $object->fk_default_warehouse = GETPOSTINT('fk_default_warehouse'); |
|
773 | + $object->fk_default_warehouse = GETPOSTINT('fk_default_warehouse'); |
|
774 | 774 | $object->fk_default_workstation = GETPOSTINT('fk_default_workstation'); |
775 | 775 | // removed from update view so GETPOST always empty |
776 | 776 | /* |
@@ -870,7 +870,7 @@ discard block |
||
870 | 870 | $object->accountancy_code_buy_export = $accountancy_code_buy_export; |
871 | 871 | } |
872 | 872 | if ($object->isService()) { |
873 | - $object->mandatory_period = (!empty($checkmandatory)) ? 1 : 0 ; |
|
873 | + $object->mandatory_period = (!empty($checkmandatory)) ? 1 : 0; |
|
874 | 874 | } |
875 | 875 | |
876 | 876 | |
@@ -968,7 +968,7 @@ discard block |
||
968 | 968 | $action = ""; |
969 | 969 | |
970 | 970 | $mesg = $langs->trans("ErrorProductAlreadyExists", $clone->ref); |
971 | - $mesg .= ' <a href="' . $_SERVER["PHP_SELF"] . '?ref=' . $clone->ref . '">' . $langs->trans("ShowCardHere") . '</a>.'; |
|
971 | + $mesg .= ' <a href="'.$_SERVER["PHP_SELF"].'?ref='.$clone->ref.'">'.$langs->trans("ShowCardHere").'</a>.'; |
|
972 | 972 | setEventMessages($mesg, null, 'errors'); |
973 | 973 | } else { |
974 | 974 | if (count($clone->errors)) { |
@@ -989,7 +989,7 @@ discard block |
||
989 | 989 | } else { |
990 | 990 | $db->commit(); |
991 | 991 | $db->close(); |
992 | - header("Location: " . $_SERVER["PHP_SELF"] . "?id=" . $id); |
|
992 | + header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id); |
|
993 | 993 | exit; |
994 | 994 | } |
995 | 995 | } else { |
@@ -344,7 +344,7 @@ discard block |
||
344 | 344 | |
345 | 345 | if (!$error) { |
346 | 346 | // Insert request |
347 | - $sql = 'INSERT INTO ' . $this->db->prefix() . $this->table_element . '('; |
|
347 | + $sql = 'INSERT INTO '.$this->db->prefix().$this->table_element.'('; |
|
348 | 348 | $sql .= 'entity,'; |
349 | 349 | $sql .= 'fk_product,'; |
350 | 350 | $sql .= 'batch,'; |
@@ -361,21 +361,21 @@ discard block |
||
361 | 361 | $sql .= 'fk_user_modif,'; |
362 | 362 | $sql .= 'import_key'; |
363 | 363 | $sql .= ') VALUES ('; |
364 | - $sql .= ' ' . (!isset($this->entity) ? $conf->entity : $this->entity) . ','; |
|
365 | - $sql .= ' ' . (!isset($this->fk_product) ? 'NULL' : $this->fk_product) . ','; |
|
366 | - $sql .= ' ' . (!isset($this->batch) ? 'NULL' : "'" . $this->db->escape($this->batch) . "'") . ','; |
|
367 | - $sql .= ' ' . (!isset($this->eatby) || dol_strlen($this->eatby) == 0 ? 'NULL' : "'" . $this->db->idate($this->eatby) . "'") . ','; |
|
368 | - $sql .= ' ' . (!isset($this->sellby) || dol_strlen($this->sellby) == 0 ? 'NULL' : "'" . $this->db->idate($this->sellby) . "'") . ','; |
|
369 | - $sql .= ' ' . (!isset($this->eol_date) || dol_strlen($this->eol_date) == 0 ? 'NULL' : "'" . $this->db->idate($this->eol_date) . "'") . ','; |
|
370 | - $sql .= ' ' . (!isset($this->manufacturing_date) || dol_strlen($this->manufacturing_date) == 0 ? 'NULL' : "'" . $this->db->idate($this->manufacturing_date) . "'") . ','; |
|
371 | - $sql .= ' ' . (!isset($this->scrapping_date) || dol_strlen($this->scrapping_date) == 0 ? 'NULL' : "'" . $this->db->idate($this->scrapping_date) . "'") . ','; |
|
364 | + $sql .= ' '.(!isset($this->entity) ? $conf->entity : $this->entity).','; |
|
365 | + $sql .= ' '.(!isset($this->fk_product) ? 'NULL' : $this->fk_product).','; |
|
366 | + $sql .= ' '.(!isset($this->batch) ? 'NULL' : "'".$this->db->escape($this->batch)."'").','; |
|
367 | + $sql .= ' '.(!isset($this->eatby) || dol_strlen($this->eatby) == 0 ? 'NULL' : "'".$this->db->idate($this->eatby)."'").','; |
|
368 | + $sql .= ' '.(!isset($this->sellby) || dol_strlen($this->sellby) == 0 ? 'NULL' : "'".$this->db->idate($this->sellby)."'").','; |
|
369 | + $sql .= ' '.(!isset($this->eol_date) || dol_strlen($this->eol_date) == 0 ? 'NULL' : "'".$this->db->idate($this->eol_date)."'").','; |
|
370 | + $sql .= ' '.(!isset($this->manufacturing_date) || dol_strlen($this->manufacturing_date) == 0 ? 'NULL' : "'".$this->db->idate($this->manufacturing_date)."'").','; |
|
371 | + $sql .= ' '.(!isset($this->scrapping_date) || dol_strlen($this->scrapping_date) == 0 ? 'NULL' : "'".$this->db->idate($this->scrapping_date)."'").','; |
|
372 | 372 | //$sql .= ' '.(!isset($this->commissionning_date) || dol_strlen($this->commissionning_date) == 0 ? 'NULL' : "'".$this->db->idate($this->commissionning_date)."'").','; |
373 | 373 | $sql .= ' '.(empty($this->qc_frequency) ? 'NULL' : $this->qc_frequency).','; |
374 | 374 | $sql .= ' '.(empty($this->lifetime) ? 'NULL' : $this->lifetime).','; |
375 | - $sql .= ' ' . "'" . $this->db->idate(dol_now()) . "'" . ','; |
|
376 | - $sql .= ' ' . (!isset($this->fk_user_creat) ? 'NULL' : $this->fk_user_creat) . ','; |
|
377 | - $sql .= ' ' . (!isset($this->fk_user_modif) ? 'NULL' : $this->fk_user_modif) . ','; |
|
378 | - $sql .= ' ' . (!isset($this->import_key) ? 'NULL' : $this->import_key); |
|
375 | + $sql .= ' '."'".$this->db->idate(dol_now())."'".','; |
|
376 | + $sql .= ' '.(!isset($this->fk_user_creat) ? 'NULL' : $this->fk_user_creat).','; |
|
377 | + $sql .= ' '.(!isset($this->fk_user_modif) ? 'NULL' : $this->fk_user_modif).','; |
|
378 | + $sql .= ' '.(!isset($this->import_key) ? 'NULL' : $this->import_key); |
|
379 | 379 | $sql .= ')'; |
380 | 380 | |
381 | 381 | $this->db->begin(); |
@@ -383,11 +383,11 @@ discard block |
||
383 | 383 | $resql = $this->db->query($sql); |
384 | 384 | if (!$resql) { |
385 | 385 | $error++; |
386 | - $this->errors[] = 'Error ' . $this->db->lasterror(); |
|
386 | + $this->errors[] = 'Error '.$this->db->lasterror(); |
|
387 | 387 | } |
388 | 388 | |
389 | 389 | if (!$error) { |
390 | - $this->id = $this->db->last_insert_id($this->db->prefix() . $this->table_element); |
|
390 | + $this->id = $this->db->last_insert_id($this->db->prefix().$this->table_element); |
|
391 | 391 | |
392 | 392 | // Actions on extra fields |
393 | 393 | if (!$error) { |
@@ -416,7 +416,7 @@ discard block |
||
416 | 416 | } |
417 | 417 | |
418 | 418 | if ($error) { |
419 | - dol_syslog(__METHOD__ . ' ' . implode(',', $this->errors), LOG_ERR); |
|
419 | + dol_syslog(__METHOD__.' '.implode(',', $this->errors), LOG_ERR); |
|
420 | 420 | return -1 * $error; |
421 | 421 | } else { |
422 | 422 | return $this->id; |
@@ -565,31 +565,31 @@ discard block |
||
565 | 565 | |
566 | 566 | if (!$error) { |
567 | 567 | // Update request |
568 | - $sql = 'UPDATE ' . $this->db->prefix() . $this->table_element . ' SET'; |
|
569 | - $sql .= ' entity = ' . (isset($this->entity) ? $this->entity : "null") . ','; |
|
570 | - $sql .= ' fk_product = ' . (isset($this->fk_product) ? $this->fk_product : "null") . ','; |
|
571 | - $sql .= ' batch = ' . (isset($this->batch) ? "'" . $this->db->escape($this->batch) . "'" : "null") . ','; |
|
572 | - $sql .= ' eatby = ' . (!isset($this->eatby) || dol_strlen($this->eatby) != 0 ? "'" . $this->db->idate($this->eatby) . "'" : 'null') . ','; |
|
573 | - $sql .= ' sellby = ' . (!isset($this->sellby) || dol_strlen($this->sellby) != 0 ? "'" . $this->db->idate($this->sellby) . "'" : 'null') . ','; |
|
574 | - $sql .= ' eol_date = ' . (!isset($this->eol_date) || dol_strlen($this->eol_date) != 0 ? "'" . $this->db->idate($this->eol_date) . "'" : 'null') . ','; |
|
575 | - $sql .= ' manufacturing_date = ' . (!isset($this->manufacturing_date) || dol_strlen($this->manufacturing_date) != 0 ? "'" . $this->db->idate($this->manufacturing_date) . "'" : 'null') . ','; |
|
576 | - $sql .= ' scrapping_date = ' . (!isset($this->scrapping_date) || dol_strlen($this->scrapping_date) != 0 ? "'" . $this->db->idate($this->scrapping_date) . "'" : 'null') . ','; |
|
568 | + $sql = 'UPDATE '.$this->db->prefix().$this->table_element.' SET'; |
|
569 | + $sql .= ' entity = '.(isset($this->entity) ? $this->entity : "null").','; |
|
570 | + $sql .= ' fk_product = '.(isset($this->fk_product) ? $this->fk_product : "null").','; |
|
571 | + $sql .= ' batch = '.(isset($this->batch) ? "'".$this->db->escape($this->batch)."'" : "null").','; |
|
572 | + $sql .= ' eatby = '.(!isset($this->eatby) || dol_strlen($this->eatby) != 0 ? "'".$this->db->idate($this->eatby)."'" : 'null').','; |
|
573 | + $sql .= ' sellby = '.(!isset($this->sellby) || dol_strlen($this->sellby) != 0 ? "'".$this->db->idate($this->sellby)."'" : 'null').','; |
|
574 | + $sql .= ' eol_date = '.(!isset($this->eol_date) || dol_strlen($this->eol_date) != 0 ? "'".$this->db->idate($this->eol_date)."'" : 'null').','; |
|
575 | + $sql .= ' manufacturing_date = '.(!isset($this->manufacturing_date) || dol_strlen($this->manufacturing_date) != 0 ? "'".$this->db->idate($this->manufacturing_date)."'" : 'null').','; |
|
576 | + $sql .= ' scrapping_date = '.(!isset($this->scrapping_date) || dol_strlen($this->scrapping_date) != 0 ? "'".$this->db->idate($this->scrapping_date)."'" : 'null').','; |
|
577 | 577 | //$sql .= ' commissionning_date = '.(!isset($this->first_use_date) || dol_strlen($this->first_use_date) != 0 ? "'".$this->db->idate($this->first_use_date)."'" : 'null').','; |
578 | 578 | $sql .= ' qc_frequency = '.(!empty($this->qc_frequency) ? (int) $this->qc_frequency : 'null').','; |
579 | 579 | $sql .= ' lifetime = '.(!empty($this->lifetime) ? (int) $this->lifetime : 'null').','; |
580 | - $sql .= ' datec = ' . (!isset($this->datec) || dol_strlen($this->datec) != 0 ? "'" . $this->db->idate($this->datec) . "'" : 'null') . ','; |
|
581 | - $sql .= ' tms = ' . (dol_strlen($this->tms) != 0 ? "'" . $this->db->idate($this->tms) . "'" : "'" . $this->db->idate(dol_now()) . "'") . ','; |
|
582 | - $sql .= ' fk_user_creat = ' . (isset($this->fk_user_creat) ? $this->fk_user_creat : "null") . ','; |
|
583 | - $sql .= ' fk_user_modif = ' . (isset($this->fk_user_modif) ? $this->fk_user_modif : "null") . ','; |
|
584 | - $sql .= ' import_key = ' . (isset($this->import_key) ? $this->import_key : "null"); |
|
585 | - $sql .= ' WHERE rowid=' . ((int) $this->id); |
|
580 | + $sql .= ' datec = '.(!isset($this->datec) || dol_strlen($this->datec) != 0 ? "'".$this->db->idate($this->datec)."'" : 'null').','; |
|
581 | + $sql .= ' tms = '.(dol_strlen($this->tms) != 0 ? "'".$this->db->idate($this->tms)."'" : "'".$this->db->idate(dol_now())."'").','; |
|
582 | + $sql .= ' fk_user_creat = '.(isset($this->fk_user_creat) ? $this->fk_user_creat : "null").','; |
|
583 | + $sql .= ' fk_user_modif = '.(isset($this->fk_user_modif) ? $this->fk_user_modif : "null").','; |
|
584 | + $sql .= ' import_key = '.(isset($this->import_key) ? $this->import_key : "null"); |
|
585 | + $sql .= ' WHERE rowid='.((int) $this->id); |
|
586 | 586 | |
587 | 587 | $this->db->begin(); |
588 | 588 | |
589 | 589 | $resql = $this->db->query($sql); |
590 | 590 | if (!$resql) { |
591 | 591 | $error++; |
592 | - $this->errors[] = 'Error ' . $this->db->lasterror(); |
|
592 | + $this->errors[] = 'Error '.$this->db->lasterror(); |
|
593 | 593 | } |
594 | 594 | |
595 | 595 | // Actions on extra fields |
@@ -618,7 +618,7 @@ discard block |
||
618 | 618 | } |
619 | 619 | |
620 | 620 | if ($error) { |
621 | - dol_syslog(__METHOD__ . ' ' . implode(',', $this->errors), LOG_ERR); |
|
621 | + dol_syslog(__METHOD__.' '.implode(',', $this->errors), LOG_ERR); |
|
622 | 622 | return -1 * $error; |
623 | 623 | } else { |
624 | 624 | return 1; |
@@ -1029,7 +1029,7 @@ discard block |
||
1029 | 1029 | $obj = $this->db->fetch_object($result); |
1030 | 1030 | $this->stats_mo['customers_'.$role] = $obj->nb_customers ? $obj->nb_customers : 0; |
1031 | 1031 | $this->stats_mo['nb_'.$role] = $obj->nb ? $obj->nb : 0; |
1032 | - $this->stats_mo['qty_'.$role] = $obj->qty ? price2num($obj->qty, 'MS') : 0; // qty may be a float due to the SUM() |
|
1032 | + $this->stats_mo['qty_'.$role] = $obj->qty ? price2num($obj->qty, 'MS') : 0; // qty may be a float due to the SUM() |
|
1033 | 1033 | } else { |
1034 | 1034 | $this->error = $this->db->error(); |
1035 | 1035 | $error++; |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | $sql .= $hookmanager->resPrint; |
156 | 156 | $sql .= ' FROM '.MAIN_DB_PREFIX.'product as p'; |
157 | 157 | if (!getDolGlobalString('PRODUCT_STOCK_LIST_SHOW_WITH_PRECALCULATED_DENORMALIZED_PHYSICAL_STOCK')) { |
158 | - $sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'product_stock as s ON p.rowid = s.fk_product'; |
|
158 | + $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_stock as s ON p.rowid = s.fk_product'; |
|
159 | 159 | } |
160 | 160 | if (getDolGlobalString('PRODUCT_USE_UNITS')) { |
161 | 161 | $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_units as u on p.fk_unit = u.rowid'; |
@@ -174,48 +174,48 @@ discard block |
||
174 | 174 | } |
175 | 175 | $sql .= "("; |
176 | 176 | $sql .= " SELECT cp.fk_categorie, cp.fk_product"; |
177 | - $sql .= " FROM " . MAIN_DB_PREFIX . "categorie_product as cp"; |
|
177 | + $sql .= " FROM ".MAIN_DB_PREFIX."categorie_product as cp"; |
|
178 | 178 | $sql .= " WHERE cp.fk_product = p.rowid"; // Join for the needed table to filter by categ |
179 | 179 | if ($search_categ > 0) { |
180 | - $sql .= " AND cp.fk_categorie = " . ((int) $search_categ); |
|
180 | + $sql .= " AND cp.fk_categorie = ".((int) $search_categ); |
|
181 | 181 | } |
182 | 182 | $sql .= ")"; |
183 | 183 | } |
184 | 184 | if (!getDolGlobalString('PRODUCT_STOCK_LIST_SHOW_WITH_PRECALCULATED_DENORMALIZED_PHYSICAL_STOCK')) { |
185 | 185 | if (!getDolGlobalString('PRODUCT_STOCK_LIST_SHOW_VIRTUAL_WITH_NO_PHYSICAL')) { |
186 | - $sql .= " AND EXISTS (SELECT e.rowid FROM " . MAIN_DB_PREFIX . "entrepot as e WHERE e.rowid = s.fk_entrepot AND e.entity IN (" . getEntity('stock') . "))"; |
|
186 | + $sql .= " AND EXISTS (SELECT e.rowid FROM ".MAIN_DB_PREFIX."entrepot as e WHERE e.rowid = s.fk_entrepot AND e.entity IN (".getEntity('stock')."))"; |
|
187 | 187 | } else { |
188 | 188 | $sql .= " AND |
189 | 189 | ( |
190 | 190 | EXISTS |
191 | 191 | (SELECT e.rowid |
192 | - FROM " . MAIN_DB_PREFIX . "entrepot as e |
|
193 | - WHERE e.rowid = s.fk_entrepot AND e.entity IN (" . getEntity('stock') . ")) |
|
192 | + FROM " . MAIN_DB_PREFIX."entrepot as e |
|
193 | + WHERE e.rowid = s.fk_entrepot AND e.entity IN (" . getEntity('stock').")) |
|
194 | 194 | OR ( |
195 | 195 | SELECT SUM(cd1.qty) as qty |
196 | - FROM " . MAIN_DB_PREFIX . "commande_fournisseurdet as cd1 |
|
197 | - LEFT JOIN " . MAIN_DB_PREFIX . "commande_fournisseur as c1 |
|
196 | + FROM " . MAIN_DB_PREFIX."commande_fournisseurdet as cd1 |
|
197 | + LEFT JOIN " . MAIN_DB_PREFIX."commande_fournisseur as c1 |
|
198 | 198 | ON c1.rowid = cd1.fk_commande |
199 | 199 | WHERE c1.entity IN (1) AND cd1.fk_product = p.rowid AND c1.fk_statut in (3,4) AND cd1.qty <> 0 |
200 | 200 | ) IS NOT NULL |
201 | 201 | OR ( |
202 | 202 | SELECT SUM(cd2.qty) as qty |
203 | - FROM " . MAIN_DB_PREFIX . "commandedet as cd2 |
|
204 | - LEFT JOIN " . MAIN_DB_PREFIX . "commande as c2 ON c2.rowid = cd2.fk_commande |
|
203 | + FROM " . MAIN_DB_PREFIX."commandedet as cd2 |
|
204 | + LEFT JOIN " . MAIN_DB_PREFIX."commande as c2 ON c2.rowid = cd2.fk_commande |
|
205 | 205 | WHERE c2.entity IN (1) AND cd2.fk_product = p.rowid AND c2.fk_statut in (1,2) AND cd2.qty <> 0 |
206 | 206 | ) IS NOT NULL |
207 | 207 | OR ( |
208 | 208 | SELECT SUM(ed3.qty) as qty |
209 | - FROM " . MAIN_DB_PREFIX . "expeditiondet as ed3 |
|
210 | - LEFT JOIN " . MAIN_DB_PREFIX . "expedition as e3 ON e3.rowid = ed3.fk_expedition |
|
211 | - LEFT JOIN " . MAIN_DB_PREFIX . "commandedet as cd3 ON ed3.fk_origin_line = cd3.rowid |
|
212 | - LEFT JOIN " . MAIN_DB_PREFIX . "commande as c3 ON c3.rowid = cd3.fk_commande |
|
209 | + FROM " . MAIN_DB_PREFIX."expeditiondet as ed3 |
|
210 | + LEFT JOIN " . MAIN_DB_PREFIX."expedition as e3 ON e3.rowid = ed3.fk_expedition |
|
211 | + LEFT JOIN " . MAIN_DB_PREFIX."commandedet as cd3 ON ed3.fk_origin_line = cd3.rowid |
|
212 | + LEFT JOIN " . MAIN_DB_PREFIX."commande as c3 ON c3.rowid = cd3.fk_commande |
|
213 | 213 | WHERE e3.entity IN (1) AND cd3.fk_product = p.rowid AND c3.fk_statut IN (1,2) AND e3.fk_statut IN (1,2) AND ed3.qty <> 0 |
214 | 214 | ) IS NOT NULL |
215 | 215 | OR ( |
216 | 216 | SELECT SUM(mp4.qty) as qty |
217 | - FROM " . MAIN_DB_PREFIX . "mrp_production as mp4 |
|
218 | - LEFT JOIN " . MAIN_DB_PREFIX . "mrp_mo as m4 ON m4.rowid = mp4.fk_mo AND m4.entity IN (1) AND m4.status IN (1,2) |
|
217 | + FROM " . MAIN_DB_PREFIX."mrp_production as mp4 |
|
218 | + LEFT JOIN " . MAIN_DB_PREFIX."mrp_mo as m4 ON m4.rowid = mp4.fk_mo AND m4.entity IN (1) AND m4.status IN (1,2) |
|
219 | 219 | WHERE mp4.fk_product = p.rowid AND mp4.qty <> 0 |
220 | 220 | ) IS NOT NULL |
221 | 221 | ) "; |
@@ -278,12 +278,12 @@ discard block |
||
278 | 278 | $sql_having = ''; |
279 | 279 | if (!getDolGlobalString('PRODUCT_STOCK_LIST_SHOW_WITH_PRECALCULATED_DENORMALIZED_PHYSICAL_STOCK')) { |
280 | 280 | if ($search_toolowstock) { |
281 | - $sql_having .= " HAVING SUM(" . $db->ifsql('s.reel IS NULL', '0', 's.reel') . ") < p.seuil_stock_alerte"; |
|
281 | + $sql_having .= " HAVING SUM(".$db->ifsql('s.reel IS NULL', '0', 's.reel').") < p.seuil_stock_alerte"; |
|
282 | 282 | } |
283 | 283 | if ($search_stock_physique != '') { |
284 | 284 | //$natural_search_physique = natural_search('HAVING SUM(' . $db->ifsql('s.reel IS NULL', '0', 's.reel') . ')', $search_stock_physique, 1, 1); |
285 | - $natural_search_physique = natural_search('SUM(' . $db->ifsql('s.reel IS NULL', '0', 's.reel') . ')', $search_stock_physique, 1, 1); |
|
286 | - $natural_search_physique = " " . substr($natural_search_physique, 1, -1); // remove first "(" and last ")" characters |
|
285 | + $natural_search_physique = natural_search('SUM('.$db->ifsql('s.reel IS NULL', '0', 's.reel').')', $search_stock_physique, 1, 1); |
|
286 | + $natural_search_physique = " ".substr($natural_search_physique, 1, -1); // remove first "(" and last ")" characters |
|
287 | 287 | if (!empty($sql_having)) { |
288 | 288 | $sql_having .= " AND"; |
289 | 289 | } else { |
@@ -384,7 +384,7 @@ discard block |
||
384 | 384 | $param .= "&sbarcode=".urlencode((string) ($sbarcode)); |
385 | 385 | } |
386 | 386 | if ($search_stock_physique) { |
387 | - $param .= '&search_stock_physique=' . urlencode($search_stock_physique); |
|
387 | + $param .= '&search_stock_physique='.urlencode($search_stock_physique); |
|
388 | 388 | } |
389 | 389 | |
390 | 390 | llxHeader("", $texte, $helpurl); |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | |
94 | 94 | // Default sort order (if not yet defined by previous GETPOST) |
95 | 95 | if (!$sortfield) { |
96 | - reset($object->fields); // Reset is required to avoid key() to return null. |
|
96 | + reset($object->fields); // Reset is required to avoid key() to return null. |
|
97 | 97 | $sortfield = "p.".key($object->fields); // Set here default search field. By default 1st field in definition. |
98 | 98 | } |
99 | 99 | if (!$sortorder) { |
@@ -268,10 +268,10 @@ discard block |
||
268 | 268 | } |
269 | 269 | $sql .= "("; |
270 | 270 | $sql .= " SELECT cp.fk_categorie, cp.fk_product"; |
271 | - $sql .= " FROM " . MAIN_DB_PREFIX . "categorie_product as cp"; |
|
271 | + $sql .= " FROM ".MAIN_DB_PREFIX."categorie_product as cp"; |
|
272 | 272 | $sql .= " WHERE cp.fk_product = p.rowid"; // Join for the needed table to filter by categ |
273 | 273 | if ($search_categ > 0) { |
274 | - $sql .= " AND cp.fk_categorie = " . ((int) $search_categ); |
|
274 | + $sql .= " AND cp.fk_categorie = ".((int) $search_categ); |
|
275 | 275 | } |
276 | 276 | $sql .= ")"; |
277 | 277 | } |
@@ -284,10 +284,10 @@ discard block |
||
284 | 284 | } |
285 | 285 | $sql .= "("; |
286 | 286 | $sql .= " SELECT cp.fk_categorie, cp.fk_warehouse"; |
287 | - $sql .= " FROM " . MAIN_DB_PREFIX . "categorie_warehouse as cp"; |
|
287 | + $sql .= " FROM ".MAIN_DB_PREFIX."categorie_warehouse as cp"; |
|
288 | 288 | $sql .= " WHERE cp.fk_warehouse = e.rowid"; // Join for the needed table to filter by categ |
289 | 289 | if ($search_warehouse_categ > 0) { |
290 | - $sql .= " AND cp.fk_categorie = " . ((int) $search_warehouse_categ); |
|
290 | + $sql .= " AND cp.fk_categorie = ".((int) $search_warehouse_categ); |
|
291 | 291 | } |
292 | 292 | $sql .= ")"; |
293 | 293 | } |
@@ -383,8 +383,8 @@ discard block |
||
383 | 383 | $sql_having .= " HAVING SUM(".$db->ifsql('ps.reel IS NULL', '0', 'ps.reel').") < p.seuil_stock_alerte"; // Not used yet |
384 | 384 | } |
385 | 385 | if ($search_stock_physique != '') { |
386 | - $natural_search_physique = natural_search('SUM(' . $db->ifsql('pb.qty IS NULL', $db->ifsql('ps.reel IS NULL', '0', 'ps.reel'), 'pb.qty') . ')', $search_stock_physique, 1, 1); |
|
387 | - $natural_search_physique = " " . substr($natural_search_physique, 1, -1); // remove first "(" and last ")" characters |
|
386 | + $natural_search_physique = natural_search('SUM('.$db->ifsql('pb.qty IS NULL', $db->ifsql('ps.reel IS NULL', '0', 'ps.reel'), 'pb.qty').')', $search_stock_physique, 1, 1); |
|
387 | + $natural_search_physique = " ".substr($natural_search_physique, 1, -1); // remove first "(" and last ")" characters |
|
388 | 388 | if (!empty($sql_having)) { |
389 | 389 | $sql_having .= " AND"; |
390 | 390 | } else { |
@@ -525,7 +525,7 @@ discard block |
||
525 | 525 | $param .= "&search_warehouse_categ=".urlencode((string) ($search_warehouse_categ)); |
526 | 526 | } |
527 | 527 | if ($search_stock_physique) { |
528 | - $param .= '&search_stock_physique=' . urlencode($search_stock_physique); |
|
528 | + $param .= '&search_stock_physique='.urlencode($search_stock_physique); |
|
529 | 529 | } |
530 | 530 | /*if ($eatby) $param.="&eatby=".$eatby; |
531 | 531 | if ($sellby) $param.="&sellby=".$sellby;*/ |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | 'typent.code' => array('label' => "ThirdPartyType", 'checked' => $checkedtypetiers, 'position' => 55), |
196 | 196 | 'c.date_commande' => array('label' => "OrderDateShort", 'checked' => 1, 'position' => 60), |
197 | 197 | 'c.date_delivery' => array('label' => "DateDeliveryPlanned", 'checked' => 1, 'enabled' => !getDolGlobalString('ORDER_DISABLE_DELIVERY_DATE'), 'position' => 65), |
198 | - 'c.fk_shipping_method' => array('label' => "SendingMethod", 'checked' => -1, 'position' => 66 , 'enabled' => isModEnabled('shipping')), |
|
198 | + 'c.fk_shipping_method' => array('label' => "SendingMethod", 'checked' => -1, 'position' => 66, 'enabled' => isModEnabled('shipping')), |
|
199 | 199 | 'c.fk_cond_reglement' => array('label' => "PaymentConditionsShort", 'checked' => -1, 'position' => 67), |
200 | 200 | 'c.fk_mode_reglement' => array('label' => "PaymentMode", 'checked' => -1, 'position' => 68), |
201 | 201 | 'c.fk_input_reason' => array('label' => "Channel", 'checked' => -1, 'position' => 69), |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | 'c.date_cloture' => array('label' => "DateClosing", 'checked' => 0, 'position' => 130), |
220 | 220 | 'c.note_public' => array('label' => 'NotePublic', 'checked' => 0, 'enabled' => (!getDolGlobalString('MAIN_LIST_ALLOW_PUBLIC_NOTES')), 'position' => 135), |
221 | 221 | 'c.note_private' => array('label' => 'NotePrivate', 'checked' => 0, 'enabled' => (!getDolGlobalString('MAIN_LIST_ALLOW_PRIVATE_NOTES')), 'position' => 140), |
222 | - 'shippable' => array('label' => "Shippable", 'checked' => 1,'enabled' => (isModEnabled('shipping')), 'position' => 990), |
|
222 | + 'shippable' => array('label' => "Shippable", 'checked' => 1, 'enabled' => (isModEnabled('shipping')), 'position' => 990), |
|
223 | 223 | 'c.facture' => array('label' => "Billed", 'checked' => 1, 'enabled' => (!getDolGlobalString('WORKFLOW_BILL_ON_SHIPMENT')), 'position' => 995), |
224 | 224 | 'c.import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => 1, 'visible' => -2, 'position' => 999), |
225 | 225 | 'c.fk_statut' => array('label' => "Status", 'checked' => 1, 'position' => 1000) |
@@ -454,7 +454,7 @@ discard block |
||
454 | 454 | $sql .= natural_search('pr.ref', $search_refProduct); |
455 | 455 | } |
456 | 456 | if ($search_descProduct) { |
457 | - $sql .= natural_search(array('pr.label','cdet.description'), $search_descProduct); |
|
457 | + $sql .= natural_search(array('pr.label', 'cdet.description'), $search_descProduct); |
|
458 | 458 | } |
459 | 459 | if ($search_ref) { |
460 | 460 | $sql .= natural_search('c.ref', $search_ref); |
@@ -606,7 +606,7 @@ discard block |
||
606 | 606 | if ($searchCategoryProductOperator == 0) { |
607 | 607 | $searchCategoryProjectSqlList[] = " EXISTS (SELECT cp.fk_product FROM ".MAIN_DB_PREFIX."categorie_product as cp WHERE cdet.fk_product = cp.fk_product AND cp.fk_categorie = ".((int) $searchCategoryProject).")"; |
608 | 608 | } else { |
609 | - $listofcategoryid .= ($listofcategoryid ? ', ' : '') .((int) $searchCategoryProject); |
|
609 | + $listofcategoryid .= ($listofcategoryid ? ', ' : '').((int) $searchCategoryProject); |
|
610 | 610 | } |
611 | 611 | } |
612 | 612 | } |
@@ -876,7 +876,7 @@ discard block |
||
876 | 876 | if (!empty($socid)) { |
877 | 877 | $url .= '&socid='.$socid; |
878 | 878 | } |
879 | - $newcardbutton = '';//dolGetButtonTitle($langs->trans('NewOrder'), '', 'fa fa-plus-circle', $url, '', $contextpage == 'orderlistdet' && $permissiontoadd); |
|
879 | + $newcardbutton = ''; //dolGetButtonTitle($langs->trans('NewOrder'), '', 'fa fa-plus-circle', $url, '', $contextpage == 'orderlistdet' && $permissiontoadd); |
|
880 | 880 | |
881 | 881 | // Lines of title fields |
882 | 882 | print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'; |
@@ -2086,10 +2086,10 @@ discard block |
||
2086 | 2086 | print '<td class="center">'; |
2087 | 2087 | if (!empty($show_shippable_command) && isModEnabled('stock')) { |
2088 | 2088 | if (($obj->fk_statut > $generic_commande::STATUS_DRAFT) && ($obj->fk_statut < $generic_commande::STATUS_CLOSED)) { |
2089 | - $generic_commande->loadExpeditions(); // Load array ->expeditions |
|
2089 | + $generic_commande->loadExpeditions(); // Load array ->expeditions |
|
2090 | 2090 | |
2091 | 2091 | if (isset($generic_commande->expeditions[$obj->rowid])) { |
2092 | - $reliquat = $obj->qty - $generic_commande->expeditions[$obj->rowid]; |
|
2092 | + $reliquat = $obj->qty - $generic_commande->expeditions[$obj->rowid]; |
|
2093 | 2093 | } else { |
2094 | 2094 | $reliquat = $obj->qty; |
2095 | 2095 | } |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | 'typent.code' => array('label' => "ThirdPartyType", 'checked' => $checkedtypetiers, 'position' => 55), |
185 | 185 | 'c.date_commande' => array('label' => "OrderDateShort", 'checked' => 1, 'position' => 60, 'csslist' => 'nowraponall'), |
186 | 186 | 'c.date_delivery' => array('label' => "DateDeliveryPlanned", 'checked' => 1, 'enabled' => !getDolGlobalString('ORDER_DISABLE_DELIVERY_DATE'), 'position' => 65, 'csslist' => 'nowraponall'), |
187 | - 'c.fk_shipping_method' => array('label' => "SendingMethod", 'checked' => -1, 'position' => 66 , 'enabled' => isModEnabled("shipping")), |
|
187 | + 'c.fk_shipping_method' => array('label' => "SendingMethod", 'checked' => -1, 'position' => 66, 'enabled' => isModEnabled("shipping")), |
|
188 | 188 | 'c.fk_cond_reglement' => array('label' => "PaymentConditionsShort", 'checked' => -1, 'position' => 67), |
189 | 189 | 'c.fk_mode_reglement' => array('label' => "PaymentMode", 'checked' => -1, 'position' => 68), |
190 | 190 | 'c.fk_input_reason' => array('label' => "Channel", 'checked' => -1, 'position' => 69), |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | 'c.date_cloture' => array('label' => "DateClosing", 'checked' => 0, 'position' => 130), |
208 | 208 | 'c.note_public' => array('label' => 'NotePublic', 'checked' => 0, 'enabled' => (!getDolGlobalInt('MAIN_LIST_HIDE_PUBLIC_NOTES')), 'position' => 135, 'searchall' => 1), |
209 | 209 | 'c.note_private' => array('label' => 'NotePrivate', 'checked' => 0, 'enabled' => (!getDolGlobalInt('MAIN_LIST_HIDE_PRIVATE_NOTES')), 'position' => 140), |
210 | - 'shippable' => array('label' => "Shippable", 'checked' => 1,'enabled' => (isModEnabled("shipping")), 'position' => 990), |
|
210 | + 'shippable' => array('label' => "Shippable", 'checked' => 1, 'enabled' => (isModEnabled("shipping")), 'position' => 990), |
|
211 | 211 | 'c.facture' => array('label' => "Billed", 'checked' => 1, 'enabled' => (!getDolGlobalString('WORKFLOW_BILL_ON_SHIPMENT')), 'position' => 995), |
212 | 212 | 'c.import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => 1, 'visible' => -2, 'position' => 999), |
213 | 213 | 'c.fk_statut' => array('label' => "Status", 'checked' => 1, 'position' => 1000) |
@@ -1040,7 +1040,7 @@ discard block |
||
1040 | 1040 | if ($searchCategoryCustomerOperator == 0) { |
1041 | 1041 | $searchCategoryCustomerSqlList[] = " EXISTS (SELECT cs.fk_soc FROM ".MAIN_DB_PREFIX."categorie_societe as cs WHERE s.rowid = cs.fk_soc AND cs.fk_categorie = ".((int) $searchCategoryCustomer).")"; |
1042 | 1042 | } else { |
1043 | - $listofcategoryid .= ($listofcategoryid ? ', ' : '') .((int) $searchCategoryCustomer); |
|
1043 | + $listofcategoryid .= ($listofcategoryid ? ', ' : '').((int) $searchCategoryCustomer); |
|
1044 | 1044 | } |
1045 | 1045 | } |
1046 | 1046 | } |
@@ -1070,7 +1070,7 @@ discard block |
||
1070 | 1070 | if ($searchCategoryProductOperator == 0) { |
1071 | 1071 | $searchCategoryProductSqlList[] = " EXISTS (SELECT ck.fk_product FROM ".MAIN_DB_PREFIX."categorie_product as ck, ".MAIN_DB_PREFIX."commandedet as cd WHERE cd.fk_commande = c.rowid AND cd.fk_product = ck.fk_product AND ck.fk_categorie = ".((int) $searchCategoryProduct).")"; |
1072 | 1072 | } else { |
1073 | - $listofcategoryid .= ($listofcategoryid ? ', ' : '') .((int) $searchCategoryProduct); |
|
1073 | + $listofcategoryid .= ($listofcategoryid ? ', ' : '').((int) $searchCategoryProduct); |
|
1074 | 1074 | } |
1075 | 1075 | } |
1076 | 1076 | } |
@@ -2637,13 +2637,13 @@ discard block |
||
2637 | 2637 | print '<td class="center">'; |
2638 | 2638 | if (!empty($show_shippable_command) && isModEnabled('stock')) { |
2639 | 2639 | if (($obj->fk_statut > $generic_commande::STATUS_DRAFT) && ($obj->fk_statut < $generic_commande::STATUS_CLOSED)) { |
2640 | - $generic_commande->getLinesArray(); // Load array ->lines |
|
2641 | - $generic_commande->loadExpeditions(); // Load array ->expeditions |
|
2640 | + $generic_commande->getLinesArray(); // Load array ->lines |
|
2641 | + $generic_commande->loadExpeditions(); // Load array ->expeditions |
|
2642 | 2642 | |
2643 | 2643 | $numlines = count($generic_commande->lines); // Loop on each line of order |
2644 | 2644 | for ($lig = 0; $lig < $numlines; $lig++) { |
2645 | 2645 | if (isset($generic_commande->expeditions[$generic_commande->lines[$lig]->id])) { |
2646 | - $reliquat = $generic_commande->lines[$lig]->qty - $generic_commande->expeditions[$generic_commande->lines[$lig]->id]; |
|
2646 | + $reliquat = $generic_commande->lines[$lig]->qty - $generic_commande->expeditions[$generic_commande->lines[$lig]->id]; |
|
2647 | 2647 | } else { |
2648 | 2648 | $reliquat = $generic_commande->lines[$lig]->qty; |
2649 | 2649 | } |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | $attribute_id = GETPOSTINT('attribute'); |
119 | 119 | $attribute_value_id = GETPOSTINT('value'); |
120 | 120 | if ($attribute_id > 0 && $attribute_value_id > 0) { |
121 | - $feature = $attribute_id . '-' . $attribute_value_id; |
|
121 | + $feature = $attribute_id.'-'.$attribute_value_id; |
|
122 | 122 | $selectedvariant[$feature] = $feature; |
123 | 123 | $_SESSION['addvariant_'.$object->id] = $selectedvariant; |
124 | 124 | } |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | if (!$error) { |
333 | 333 | $db->commit(); |
334 | 334 | setEventMessages($langs->trans('RecordSaved'), null, 'mesgs'); |
335 | - header('Location: ' . dol_buildpath('/variants/combinations.php?id=' . $id, 2)); |
|
335 | + header('Location: '.dol_buildpath('/variants/combinations.php?id='.$id, 2)); |
|
336 | 336 | exit(); |
337 | 337 | } else { |
338 | 338 | $db->rollback(); |
@@ -512,10 +512,10 @@ discard block |
||
512 | 512 | if ($prodattr->fetch($explode[0]) <= 0 || $prodattr_val->fetch($explode[1]) <= 0) { |
513 | 513 | continue; |
514 | 514 | } |
515 | - $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #ddd;">' . $prodattr->label.' : '.$prodattr_val->value . |
|
516 | - ' <a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=create&subaction=delete&feature='.urlencode($feature).'">' . img_delete() . '</a></li>'; |
|
515 | + $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #ddd;">'.$prodattr->label.' : '.$prodattr_val->value. |
|
516 | + ' <a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=create&subaction=delete&feature='.urlencode($feature).'">'.img_delete().'</a></li>'; |
|
517 | 517 | } |
518 | - $listofvariantselected .= '<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">' . implode(' ', $toprint) . '</ul></div>'; |
|
518 | + $listofvariantselected .= '<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">'.implode(' ', $toprint).'</ul></div>'; |
|
519 | 519 | } |
520 | 520 | $listofvariantselected .= '</div>'; |
521 | 521 | //print dol_get_fiche_end(); |
@@ -611,7 +611,7 @@ discard block |
||
611 | 611 | |
612 | 612 | print load_fiche_titre($title); |
613 | 613 | |
614 | - print '<form method="post" id="combinationform" action="'.$_SERVER["PHP_SELF"] .'?id='.$object->id.'">'."\n"; |
|
614 | + print '<form method="post" id="combinationform" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'">'."\n"; |
|
615 | 615 | print '<input type="hidden" name="token" value="'.newToken().'">'; |
616 | 616 | print '<input type="hidden" name="action" value="'.(($valueid > 0) ? "update" : "create").'">'."\n"; |
617 | 617 | if ($valueid > 0) { |
@@ -855,7 +855,7 @@ discard block |
||
855 | 855 | |
856 | 856 | |
857 | 857 | // List of variants |
858 | - print '<form method="POST" action="'.$_SERVER["PHP_SELF"] .'?id='.$object->id.'">'; |
|
858 | + print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'">'; |
|
859 | 859 | print '<input type="hidden" name="token" value="'.newToken().'">'; |
860 | 860 | print '<input type="hidden" name="action" value="massaction">'; |
861 | 861 | print '<input type="hidden" name="backtopage" value="'.$backtopage.'">'; |
@@ -160,32 +160,32 @@ discard block |
||
160 | 160 | $error++; |
161 | 161 | } |
162 | 162 | if ($error) { |
163 | - dol_syslog(__METHOD__ . ' ' . $this->errorsToString(), LOG_ERR); |
|
163 | + dol_syslog(__METHOD__.' '.$this->errorsToString(), LOG_ERR); |
|
164 | 164 | return -1; |
165 | 165 | } |
166 | 166 | |
167 | 167 | $this->db->begin(); |
168 | 168 | |
169 | - $sql = "INSERT INTO " . MAIN_DB_PREFIX . $this->table_element . " ("; |
|
169 | + $sql = "INSERT INTO ".MAIN_DB_PREFIX.$this->table_element." ("; |
|
170 | 170 | $sql .= " fk_product_attribute, ref, value, entity, position"; |
171 | 171 | $sql .= ")"; |
172 | 172 | $sql .= " VALUES ("; |
173 | - $sql .= " " . ((int) $this->fk_product_attribute); |
|
174 | - $sql .= ", '" . $this->db->escape($this->ref) . "'"; |
|
175 | - $sql .= ", '" . $this->db->escape($this->value) . "'"; |
|
176 | - $sql .= ", " . ((int) $this->entity); |
|
177 | - $sql .= ", " . ((int) $this->position); |
|
173 | + $sql .= " ".((int) $this->fk_product_attribute); |
|
174 | + $sql .= ", '".$this->db->escape($this->ref)."'"; |
|
175 | + $sql .= ", '".$this->db->escape($this->value)."'"; |
|
176 | + $sql .= ", ".((int) $this->entity); |
|
177 | + $sql .= ", ".((int) $this->position); |
|
178 | 178 | $sql .= ")"; |
179 | 179 | |
180 | 180 | dol_syslog(__METHOD__, LOG_DEBUG); |
181 | 181 | $resql = $this->db->query($sql); |
182 | 182 | if (!$resql) { |
183 | - $this->errors[] = "Error " . $this->db->lasterror(); |
|
183 | + $this->errors[] = "Error ".$this->db->lasterror(); |
|
184 | 184 | $error++; |
185 | 185 | } |
186 | 186 | |
187 | 187 | if (!$error) { |
188 | - $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . $this->table_element); |
|
188 | + $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.$this->table_element); |
|
189 | 189 | } |
190 | 190 | |
191 | 191 | if (!$error && !$notrigger) { |
@@ -226,20 +226,20 @@ discard block |
||
226 | 226 | $error++; |
227 | 227 | } |
228 | 228 | if ($error) { |
229 | - dol_syslog(__METHOD__ . ' ' . $this->errorsToString(), LOG_ERR); |
|
229 | + dol_syslog(__METHOD__.' '.$this->errorsToString(), LOG_ERR); |
|
230 | 230 | return -1; |
231 | 231 | } |
232 | 232 | |
233 | 233 | $sql = "SELECT rowid, fk_product_attribute, ref, value"; |
234 | - $sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element; |
|
235 | - $sql .= " WHERE rowid = " . ((int) $id); |
|
236 | - $sql .= " AND entity IN (" . getEntity('product') . ")"; |
|
234 | + $sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element; |
|
235 | + $sql .= " WHERE rowid = ".((int) $id); |
|
236 | + $sql .= " AND entity IN (".getEntity('product').")"; |
|
237 | 237 | |
238 | 238 | dol_syslog(__METHOD__, LOG_DEBUG); |
239 | 239 | $resql = $this->db->query($sql); |
240 | 240 | if (!$resql) { |
241 | - $this->errors[] = "Error " . $this->db->lasterror(); |
|
242 | - dol_syslog(__METHOD__ . ' ' . $this->errorsToString(), LOG_ERR); |
|
241 | + $this->errors[] = "Error ".$this->db->lasterror(); |
|
242 | + dol_syslog(__METHOD__.' '.$this->errorsToString(), LOG_ERR); |
|
243 | 243 | return -1; |
244 | 244 | } |
245 | 245 | |
@@ -275,15 +275,15 @@ discard block |
||
275 | 275 | $sql .= "DISTINCT "; |
276 | 276 | } |
277 | 277 | |
278 | - $sql .= "v.fk_product_attribute, v.rowid, v.ref, v.value FROM " . MAIN_DB_PREFIX . "product_attribute_value v "; |
|
278 | + $sql .= "v.fk_product_attribute, v.rowid, v.ref, v.value FROM ".MAIN_DB_PREFIX."product_attribute_value v "; |
|
279 | 279 | |
280 | 280 | if ($only_used) { |
281 | - $sql .= "LEFT JOIN " . MAIN_DB_PREFIX . "product_attribute_combination2val c2v ON c2v.fk_prod_attr_val = v.rowid "; |
|
282 | - $sql .= "LEFT JOIN " . MAIN_DB_PREFIX . "product_attribute_combination c ON c.rowid = c2v.fk_prod_combination "; |
|
283 | - $sql .= "LEFT JOIN " . MAIN_DB_PREFIX . "product p ON p.rowid = c.fk_product_child "; |
|
281 | + $sql .= "LEFT JOIN ".MAIN_DB_PREFIX."product_attribute_combination2val c2v ON c2v.fk_prod_attr_val = v.rowid "; |
|
282 | + $sql .= "LEFT JOIN ".MAIN_DB_PREFIX."product_attribute_combination c ON c.rowid = c2v.fk_prod_combination "; |
|
283 | + $sql .= "LEFT JOIN ".MAIN_DB_PREFIX."product p ON p.rowid = c.fk_product_child "; |
|
284 | 284 | } |
285 | 285 | |
286 | - $sql .= "WHERE v.fk_product_attribute = " . ((int) $prodattr_id); |
|
286 | + $sql .= "WHERE v.fk_product_attribute = ".((int) $prodattr_id); |
|
287 | 287 | |
288 | 288 | if ($only_used) { |
289 | 289 | $sql .= " AND c2v.rowid IS NOT NULL AND p.tosell = 1"; |
@@ -342,25 +342,25 @@ discard block |
||
342 | 342 | $error++; |
343 | 343 | } |
344 | 344 | if ($error) { |
345 | - dol_syslog(__METHOD__ . ' ' . $this->errorsToString(), LOG_ERR); |
|
345 | + dol_syslog(__METHOD__.' '.$this->errorsToString(), LOG_ERR); |
|
346 | 346 | return -1; |
347 | 347 | } |
348 | 348 | |
349 | 349 | $this->db->begin(); |
350 | 350 | |
351 | - $sql = "UPDATE " . MAIN_DB_PREFIX . $this->table_element . " SET"; |
|
351 | + $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element." SET"; |
|
352 | 352 | |
353 | - $sql .= " fk_product_attribute = " . ((int) $this->fk_product_attribute); |
|
354 | - $sql .= ", ref = '" . $this->db->escape($this->ref) . "'"; |
|
355 | - $sql .= ", value = '" . $this->db->escape($this->value) . "'"; |
|
356 | - $sql .= ", position = " . ((int) $this->position); |
|
353 | + $sql .= " fk_product_attribute = ".((int) $this->fk_product_attribute); |
|
354 | + $sql .= ", ref = '".$this->db->escape($this->ref)."'"; |
|
355 | + $sql .= ", value = '".$this->db->escape($this->value)."'"; |
|
356 | + $sql .= ", position = ".((int) $this->position); |
|
357 | 357 | |
358 | - $sql .= " WHERE rowid = " . ((int) $this->id); |
|
358 | + $sql .= " WHERE rowid = ".((int) $this->id); |
|
359 | 359 | |
360 | 360 | dol_syslog(__METHOD__, LOG_DEBUG); |
361 | 361 | $resql = $this->db->query($sql); |
362 | 362 | if (!$resql) { |
363 | - $this->errors[] = "Error " . $this->db->lasterror(); |
|
363 | + $this->errors[] = "Error ".$this->db->lasterror(); |
|
364 | 364 | $error++; |
365 | 365 | } |
366 | 366 | |
@@ -403,7 +403,7 @@ discard block |
||
403 | 403 | $error++; |
404 | 404 | } |
405 | 405 | if ($error) { |
406 | - dol_syslog(__METHOD__ . ' ' . $this->errorsToString(), LOG_ERR); |
|
406 | + dol_syslog(__METHOD__.' '.$this->errorsToString(), LOG_ERR); |
|
407 | 407 | return -1; |
408 | 408 | } |
409 | 409 | |
@@ -427,12 +427,12 @@ discard block |
||
427 | 427 | } |
428 | 428 | |
429 | 429 | if (!$error) { |
430 | - $sql = "DELETE FROM " . MAIN_DB_PREFIX . $this->table_element . " WHERE rowid = " . ((int) $this->id); |
|
430 | + $sql = "DELETE FROM ".MAIN_DB_PREFIX.$this->table_element." WHERE rowid = ".((int) $this->id); |
|
431 | 431 | |
432 | 432 | dol_syslog(__METHOD__, LOG_DEBUG); |
433 | 433 | $resql = $this->db->query($sql); |
434 | 434 | if (!$resql) { |
435 | - $this->errors[] = "Error " . $this->db->lasterror(); |
|
435 | + $this->errors[] = "Error ".$this->db->lasterror(); |
|
436 | 436 | $error++; |
437 | 437 | } |
438 | 438 | } |
@@ -465,16 +465,16 @@ discard block |
||
465 | 465 | $error++; |
466 | 466 | } |
467 | 467 | if ($error) { |
468 | - dol_syslog(__METHOD__ . ' ' . $this->errorsToString(), LOG_ERR); |
|
468 | + dol_syslog(__METHOD__.' '.$this->errorsToString(), LOG_ERR); |
|
469 | 469 | return -1; |
470 | 470 | } |
471 | 471 | |
472 | - $sql = "SELECT COUNT(*) AS nb FROM " . MAIN_DB_PREFIX . "product_attribute_combination2val WHERE fk_prod_attr_val = " . ((int) $this->id); |
|
472 | + $sql = "SELECT COUNT(*) AS nb FROM ".MAIN_DB_PREFIX."product_attribute_combination2val WHERE fk_prod_attr_val = ".((int) $this->id); |
|
473 | 473 | |
474 | 474 | dol_syslog(__METHOD__, LOG_DEBUG); |
475 | 475 | $resql = $this->db->query($sql); |
476 | 476 | if (!$resql) { |
477 | - $this->errors[] = "Error " . $this->db->lasterror(); |
|
477 | + $this->errors[] = "Error ".$this->db->lasterror(); |
|
478 | 478 | return -1; |
479 | 479 | } |
480 | 480 |