diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index 4129992b167..c463e8d3ebd 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -782,8 +782,8 @@ class BOM extends CommonObject $line->array_options[$key] = $array_options[$key]; } } - if ($fk_default_workstation >= 0 && $line->fk_default_workstation != $fk_default_workstation) { - $line->fk_default_workstation = $fk_default_workstation; + if ($line->fk_default_workstation != $fk_default_workstation) { + $line->fk_default_workstation = ($fk_default_workstation > 0 ? $fk_default_workstation : 0); } $result = $line->update($user); diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index cf1ba00ba66..a91f063dee4 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -363,7 +363,8 @@ if (empty($reshook) && $action == 'add') { $object->label = GETPOST('label', 'alphanohtml'); if (GETPOST("elementtype", 'alpha')) { - $modulecodetouseforpermissioncheck = GETPOST("elementtype", 'alpha'); + $elProp = getElementProperties(GETPOST("elementtype", 'alpha')); + $modulecodetouseforpermissioncheck = $elProp['module']; $hasPermissionOnLinkedObject = 0; if ($user->hasRight($modulecodetouseforpermissioncheck, 'read')) { @@ -820,7 +821,8 @@ if (empty($reshook) && $action == 'update') { $object->note_private = trim(GETPOST("note", "restricthtml")); if (GETPOST("elementtype", 'alpha')) { - $modulecodetouseforpermissioncheck = GETPOST("elementtype", 'alpha'); + $elProp = getElementProperties(GETPOST("elementtype", 'alpha')); + $modulecodetouseforpermissioncheck = $elProp['module']; $hasPermissionOnLinkedObject = 0; if ($user->hasRight($modulecodetouseforpermissioncheck, 'read')) { @@ -1577,7 +1579,9 @@ if ($action == 'create') { include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; $hasPermissionOnLinkedObject = 0; - if ($user->hasRight($origin, 'read')) { + + $elProp = getElementProperties($origin); + if ($user->hasRight($elProp['module'], 'read')) { $hasPermissionOnLinkedObject = 1; } //var_dump('origin='.$origin.' originid='.$originid.' hasPermissionOnLinkedObject='.$hasPermissionOnLinkedObject); diff --git a/htdocs/compta/bank/releve.php b/htdocs/compta/bank/releve.php index d780eff0d41..ef5d98f2d93 100644 --- a/htdocs/compta/bank/releve.php +++ b/htdocs/compta/bank/releve.php @@ -125,6 +125,7 @@ $foundnext = ''; $sql = "SELECT b.num_releve as num"; $sql .= " FROM ".MAIN_DB_PREFIX."bank as b"; $sql .= " WHERE b.num_releve < '".$db->escape($numref)."'"; +$sql .= " AND b.num_releve <> ''"; $sql .= " AND b.fk_account = ".((int) $object->id); $sql .= " ORDER BY b.num_releve DESC"; $sql .= $db->plimit(1); @@ -380,6 +381,7 @@ if (empty($numref)) { $sql = "SELECT sum(b.amount) as amount"; $sql .= " FROM ".MAIN_DB_PREFIX."bank as b"; $sql .= " WHERE b.num_releve < '".$db->escape($objp->numr)."'"; + $sql .= " AND b.num_releve <> ''"; $sql .= " AND b.fk_account = ".((int) $object->id); $resql = $db->query($sql); if ($resql) { @@ -464,6 +466,7 @@ if (empty($numref)) { $sql = "SELECT sum(b.amount) as amount"; $sql .= " FROM ".MAIN_DB_PREFIX."bank as b"; $sql .= " WHERE b.num_releve < '".$db->escape($numref)."'"; + $sql .= " AND b.num_releve <> ''"; $sql .= " AND b.fk_account = ".((int) $object->id); $resql = $db->query($sql); diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index 1b863941b27..33cc5ba295a 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -390,6 +390,7 @@ abstract class CommonDocGenerator 'company_juridicalstatus' => $object->forme_juridique, 'company_outstanding_limit' => $object->outstanding_limit, 'company_capital' => $object->capital, + 'company_capital_formated'=> price($object->capital, 0, '', 1, -1), 'company_idprof1' => $object->idprof1, 'company_idprof2' => $object->idprof2, 'company_idprof3' => $object->idprof3, diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 7c96c34a295..547fca6e2ea 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -834,13 +834,16 @@ class Form $parameters = array(); $reshook = $hookmanager->executeHooks('addMoreMassActions', $parameters); // Note that $action and $object may have been modified by hook // check if there is a mass action - if (count($arrayofaction) == 0 && empty($hookmanager->resPrint)) { + + if (is_array($arrayofaction) && count($arrayofaction) == 0 && empty($hookmanager->resPrint)) { return; } if (empty($reshook)) { $ret .= ''; - foreach ($arrayofaction as $code => $label) { - $ret .= ''; + if (is_array($arrayofaction)) { + foreach ($arrayofaction as $code => $label) { + $ret .= ''; + } } } $ret .= $hookmanager->resPrint; @@ -8171,8 +8174,8 @@ class Form ); if (!is_object($objecttmp)) { - dol_syslog('selectForForms: Error bad setup of field objectdescorig=' . $objectdescorig.', objectfield='.$objectfield, LOG_WARNING); - return 'selectForForms: Error bad setup of field objectdescorig=' . $objectdescorig.', objectfield='.$objectfield; + dol_syslog('selectForForms: Error bad setup of field objectdescorig=' . $objectdescorig.', objectfield='.$objectfield.', objectdesc='.$objectdesc, LOG_WARNING); + return 'selectForForms: Error bad setup of field objectdescorig=' . $objectdescorig.', objectfield='.$objectfield.', objectdesc='.$objectdesc; } '@phan-var-force CommonObject $objecttmp'; diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 4fc41c64749..b92a06b5e72 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -876,7 +876,7 @@ function show_projects($conf, $langs, $db, $object, $backtopage = '', $nocreatel print ''.$langs->trans("Status").''; if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print ''; - $selectedfields = (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); + $selectedfields = (is_array($arrayofmassactions) && count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); print $selectedfields; print ''; } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 98935dec7bf..401f9c6e6d5 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -12321,7 +12321,8 @@ function getElementProperties($elementType) } elseif ($elementType == 'inventory') { $module = 'product'; $classpath = 'product/inventory/class'; - } elseif ($elementType == 'stock') { + } elseif ($element_type == 'stock' || $element_type == 'entrepot') { + $module = 'stock'; $classpath = 'product/stock/class'; $classfile = 'entrepot'; $classname = 'Entrepot'; @@ -12429,6 +12430,14 @@ function getElementProperties($elementType) $subelement = ''; $classname = 'CommandeFournisseur'; $table_element = 'commande_fournisseur'; + } elseif ($elementType == 'commande_fournisseurdet') { + $classpath = 'fourn/class'; + $module = 'fournisseur'; + $classfile = 'fournisseur.commande'; + $element = 'commande_fournisseurdet'; + $subelement = ''; + $classname = 'CommandeFournisseurLigne'; + $table_element = 'commande_fournisseurdet'; } elseif ($elementType == 'invoice_supplier') { $classpath = 'fourn/class'; $module = 'fournisseur'; @@ -13941,8 +13950,8 @@ function show_actions_messaging($conf, $langs, $db, $filterobj, $objcon = null, && $actionstatic->code != 'AC_TICKET_CREATE' && $actionstatic->code != 'AC_TICKET_MODIFY' ) { - $out .= '
'; - $out .= dolGetFirstLineOfText($histo[$key]['message'], 3); + $out .= '
'; + $out .= $histo[$key]['message']; $out .= '
'; } diff --git a/htdocs/core/modules/facture/mod_facture_terre.php b/htdocs/core/modules/facture/mod_facture_terre.php index eef74993761..66e3af0e033 100644 --- a/htdocs/core/modules/facture/mod_facture_terre.php +++ b/htdocs/core/modules/facture/mod_facture_terre.php @@ -75,7 +75,7 @@ class mod_facture_terre extends ModeleNumRefFactures { global $conf, $mysoc; - if ((float) $conf->global->MAIN_VERSION_LAST_INSTALL >= 16.0 && $mysoc->country_code != 'FR') { + if (((float) getDolGlobalString('MAIN_VERSION_LAST_INSTALL')) >= 16.0 && $mysoc->country_code != 'FR') { $this->prefixinvoice = 'IN'; // We use correct standard code "IN = Invoice" $this->prefixreplacement = 'IR'; $this->prefixdeposit = 'ID'; diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php index 818801f638d..eb134d3a0e1 100644 --- a/htdocs/core/tpl/objectline_view.tpl.php +++ b/htdocs/core/tpl/objectline_view.tpl.php @@ -143,7 +143,11 @@ if (($line->info_bits & 2) == 2) { $format = (getDolGlobalString('MAIN_USE_HOURMIN_IN_DATE_RANGE') ? 'dayhour' : 'day'); if ($line->fk_product > 0) { - print $form->textwithtooltip($text, $description, 3, 0, '', $i, 0, (!empty($line->fk_parent_line) ? img_picto('', 'rightarrow') : '')); + if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { + print (!empty($line->fk_parent_line) ? img_picto('', 'rightarrow') : '') . $text; + } else { + print $form->textwithtooltip($text, $description, 3, 0, '', $i, 0, (!empty($line->fk_parent_line) ? img_picto('', 'rightarrow') : '')); + } } else { $type = (!empty($line->product_type) ? $line->product_type : $line->fk_product_type); if ($type == 1) { diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 1593f25e08c..d72deef561b 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -12,7 +12,8 @@ * Copyright (C) 2022 Gauthier VERDOL * Copyright (C) 2022 Charlene Benke * Copyright (C) 2023 Joachim Kueter - * Copyright (C) 2024 MDW + * Copyright (C) 2024 MDW + * Copyright (C) 2024 Nick Fragoulis * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -1331,10 +1332,35 @@ if (empty($reshook)) { $product_fourn_price_id = 0; if ($origin == "commande") { $productsupplier = new ProductFournisseur($db); - $result = $productsupplier->find_min_price_product_fournisseur($lines[$i]->fk_product, $lines[$i]->qty, $srcobject->socid); + $result = $productsupplier->find_min_price_product_fournisseur($lines[$i]->fk_product, $lines[$i]->qty, $object->socid); + $lines[$i]->subprice = 0; if ($result > 0) { $ref_supplier = $productsupplier->ref_supplier; $product_fourn_price_id = $productsupplier->product_fourn_price_id; + // we need supplier subprice + foreach ($srcobject->lines as $li) { + $sql = 'SELECT price, unitprice, tva_tx, remise_percent, entity, ref_fourn'; + $sql .= ' FROM '.MAIN_DB_PREFIX.'product_fournisseur_price'; + $sql .= ' WHERE fk_product = '.((int) $li->fk_product); + $sql .= ' AND entity IN ('.getEntity('product_fournisseur_price').')'; + $sql .= ' AND fk_soc = '.((int) $object->socid); + $sql .= ' ORDER BY unitprice ASC'; + + $resql = $db->query($sql); + if ($resql) { + $num_row = $db->num_rows($resql); + if (empty($num_row)) { + $li->remise_percent = 0; + } else { + $obj = $db->fetch_object($resql); + $li->subprice = $obj->unitprice; + $li->remise_percent = $obj->remise_percent; + } + } else { + dol_print_error($db); + } + $db->free($resql); + } } } else { $ref_supplier = $lines[$i]->ref_fourn; @@ -1623,35 +1649,52 @@ if ($action == 'create') { $projectid = (!empty($objectsrc->fk_project) ? $objectsrc->fk_project : ''); $ref_client = (!empty($objectsrc->ref_client) ? $objectsrc->ref_client : ''); - - $soc = $objectsrc->thirdparty; - - $cond_reglement_id = (!empty($objectsrc->cond_reglement_id) ? $objectsrc->cond_reglement_id : (!empty($soc->cond_reglement_id) ? $soc->cond_reglement_id : 0)); - $mode_reglement_id = (!empty($objectsrc->mode_reglement_id) ? $objectsrc->mode_reglement_id : (!empty($soc->mode_reglement_id) ? $soc->mode_reglement_id : 0)); - $fk_account = (!empty($objectsrc->fk_account) ? $objectsrc->fk_account : (!empty($soc->fk_account) ? $soc->fk_account : 0)); - $availability_id = (!empty($objectsrc->availability_id) ? $objectsrc->availability_id : (!empty($soc->availability_id) ? $soc->availability_id : 0)); - $shipping_method_id = (!empty($objectsrc->shipping_method_id) ? $objectsrc->shipping_method_id : (!empty($soc->shipping_method_id) ? $soc->shipping_method_id : 0)); - $demand_reason_id = (!empty($objectsrc->demand_reason_id) ? $objectsrc->demand_reason_id : (!empty($soc->demand_reason_id) ? $soc->demand_reason_id : 0)); - //$remise_percent = (!empty($objectsrc->remise_percent) ? $objectsrc->remise_percent : (!empty($soc->remise_supplier_percent) ? $soc->remise_supplier_percent : 0)); - //$remise_absolue = (!empty($objectsrc->remise_absolue) ? $objectsrc->remise_absolue : (!empty($soc->remise_absolue) ? $soc->remise_absolue : 0)); - $dateinvoice = !getDolGlobalString('MAIN_AUTOFILL_DATE') ? -1 : ''; - - $datedelivery = (!empty($objectsrc->delivery_date) ? $objectsrc->delivery_date : ''); - - if (isModEnabled("multicurrency")) { - if (!empty($objectsrc->multicurrency_code)) { - $currency_code = $objectsrc->multicurrency_code; + if ($origin == "commande") { + $cond_reglement_id = 0; + $mode_reglement_id = 0; + $delivery_date = ''; + $objectsrc->note_private = ''; + $objectsrc->note_public = ''; + if ($societe = $object->thirdparty) { + $cond_reglement_id = $societe->cond_reglement_supplier_id; + $mode_reglement_id = $societe->mode_reglement_supplier_id; + if (isModEnabled("multicurrency")) { + $currency_code = $societe->multicurrency_code; + if (getDolGlobalString('MULTICURRENCY_USE_ORIGIN_TX')) { + $currency_tx = $societe->multicurrency_tx; + } + } } - if (getDolGlobalString('MULTICURRENCY_USE_ORIGIN_TX') && !empty($objectsrc->multicurrency_tx)) { - $currency_tx = $objectsrc->multicurrency_tx; + } else { + $soc = $objectsrc->thirdparty; + + $cond_reglement_id = (!empty($objectsrc->cond_reglement_id) ? $objectsrc->cond_reglement_id : (!empty($soc->cond_reglement_id) ? $soc->cond_reglement_id : 0)); + $mode_reglement_id = (!empty($objectsrc->mode_reglement_id) ? $objectsrc->mode_reglement_id : (!empty($soc->mode_reglement_id) ? $soc->mode_reglement_id : 0)); + $fk_account = (!empty($objectsrc->fk_account) ? $objectsrc->fk_account : (!empty($soc->fk_account) ? $soc->fk_account : 0)); + $availability_id = (!empty($objectsrc->availability_id) ? $objectsrc->availability_id : (!empty($soc->availability_id) ? $soc->availability_id : 0)); + $shipping_method_id = (!empty($objectsrc->shipping_method_id) ? $objectsrc->shipping_method_id : (!empty($soc->shipping_method_id) ? $soc->shipping_method_id : 0)); + $demand_reason_id = (!empty($objectsrc->demand_reason_id) ? $objectsrc->demand_reason_id : (!empty($soc->demand_reason_id) ? $soc->demand_reason_id : 0)); + //$remise_percent = (!empty($objectsrc->remise_percent) ? $objectsrc->remise_percent : (!empty($soc->remise_supplier_percent) ? $soc->remise_supplier_percent : 0)); + //$remise_absolue = (!empty($objectsrc->remise_absolue) ? $objectsrc->remise_absolue : (!empty($soc->remise_absolue) ? $soc->remise_absolue : 0)); + $dateinvoice = !getDolGlobalString('MAIN_AUTOFILL_DATE') ? -1 : ''; + + $datedelivery = (!empty($objectsrc->delivery_date) ? $objectsrc->delivery_date : ''); + + if (isModEnabled("multicurrency")) { + if (!empty($objectsrc->multicurrency_code)) { + $currency_code = $objectsrc->multicurrency_code; + } + if (getDolGlobalString('MULTICURRENCY_USE_ORIGIN_TX') && !empty($objectsrc->multicurrency_tx)) { + $currency_tx = $objectsrc->multicurrency_tx; + } } + + $note_private = $object->getDefaultCreateValueFor('note_private', (!empty($objectsrc->note_private) ? $objectsrc->note_private : null)); + $note_public = $object->getDefaultCreateValueFor('note_public', (!empty($objectsrc->note_public) ? $objectsrc->note_public : null)); + + // Object source contacts list + $srccontactslist = $objectsrc->liste_contact(-1, 'external', 1); } - - $note_private = $object->getDefaultCreateValueFor('note_private', (!empty($objectsrc->note_private) ? $objectsrc->note_private : null)); - $note_public = $object->getDefaultCreateValueFor('note_public', (!empty($objectsrc->note_public) ? $objectsrc->note_public : null)); - - // Object source contacts list - $srccontactslist = $objectsrc->liste_contact(-1, 'external', 1); } else { $cond_reglement_id = !empty($societe->cond_reglement_supplier_id) ? $societe->cond_reglement_supplier_id : 0; $mode_reglement_id = !empty($societe->mode_reglement_supplier_id) ? $societe->mode_reglement_supplier_id : 0; diff --git a/htdocs/install/mysql/data/llx_c_units.sql b/htdocs/install/mysql/data/llx_c_units.sql index 475020aabaf..523e1a9ebc4 100644 --- a/htdocs/install/mysql/data/llx_c_units.sql +++ b/htdocs/install/mysql/data/llx_c_units.sql @@ -54,7 +54,7 @@ INSERT INTO llx_c_units (code, sortorder, scale, label, short_label, unit_type, INSERT INTO llx_c_units (code, sortorder, scale, label, short_label, unit_type, active) VALUES ('P', '500', '0','Piece','p', 'qty', 1); INSERT INTO llx_c_units (code, sortorder, scale, label, short_label, unit_type, active) VALUES ('SET','510', '0','Set','set', 'qty', 1); -INSERT INTO llx_c_units (code, sortorder, scale, label, short_label, unit_type, active) VALUES ('S', '600', '0','second','s', 'time', 1); +INSERT INTO llx_c_units (code, sortorder, scale, label, short_label, unit_type, active) VALUES ('S', '600', '1','second','s', 'time', 1); INSERT INTO llx_c_units (code, sortorder, scale, label, short_label, unit_type, active) VALUES ('MI','610', '60','minute','i', 'time', 1); INSERT INTO llx_c_units (code, sortorder, scale, label, short_label, unit_type, active) VALUES ('H', '620', '3600','hour','h', 'time', 1); INSERT INTO llx_c_units (code, sortorder, scale, label, short_label, unit_type, active) VALUES ('D', '630', '86400','day','d', 'time', 1); diff --git a/htdocs/install/mysql/migration/19.0.0-20.0.0.sql b/htdocs/install/mysql/migration/19.0.0-20.0.0.sql index 11c972958fb..a583d9dd648 100644 --- a/htdocs/install/mysql/migration/19.0.0-20.0.0.sql +++ b/htdocs/install/mysql/migration/19.0.0-20.0.0.sql @@ -50,6 +50,9 @@ UPDATE llx_c_type_contact SET element = 'stocktransfer' WHERE element = 'StockTr DELETE FROM llx_boxes WHERE box_id IN (SELECT rowid FROM llx_boxes_def WHERE file = 'box_members.php'); DELETE FROM llx_boxes_def WHERE file = 'box_members.php'; +UPDATE llx_c_units SET scale = 1 WHERE code = 'S'; + + -- Use unique keys for extrafields ALTER TABLE llx_actioncomm_extrafields DROP INDEX idx_actioncomm_extrafields; ALTER TABLE llx_actioncomm_extrafields ADD UNIQUE INDEX uk_actioncomm_extrafields (fk_object); diff --git a/htdocs/langs/en_US/users.lang b/htdocs/langs/en_US/users.lang index c4695d86791..e7d0395e661 100644 --- a/htdocs/langs/en_US/users.lang +++ b/htdocs/langs/en_US/users.lang @@ -134,3 +134,4 @@ UserPublicPageDesc=You can enable a virtual card for this user. An url with the EnablePublicVirtualCard=Enable the user's virtual business card UserEnabledDisabled=User status changed: %s AlternativeEmailForOAuth2=Alternative Email for OAuth2 login +ErrorUpdateCanceledDueToDuplicatedUniqueValue=Error, The update was canceled because one of the pieces of data, that should be unique, already exists diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php index a6a64fb2dae..2f70cd3a963 100644 --- a/htdocs/product/stock/replenish.php +++ b/htdocs/product/stock/replenish.php @@ -30,11 +30,11 @@ // Load Dolibarr environment require '../../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php'; -require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; -require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; +require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; +require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php'; +require_once DOL_DOCUMENT_ROOT . '/core/class/html.form.class.php'; +require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.commande.class.php'; +require_once DOL_DOCUMENT_ROOT . '/product/class/html.formproduct.class.php'; require_once './lib/replenishment.lib.php'; // Load translation files required by the page @@ -68,7 +68,7 @@ $fk_supplier = GETPOSTINT('fk_supplier'); $fk_entrepot = GETPOSTINT('fk_entrepot'); // List all visible warehouses -$resWar = $db->query("SELECT rowid FROM " . MAIN_DB_PREFIX . "entrepot WHERE entity IN (" . $db->sanitize(getEntity('stock')) .")"); +$resWar = $db->query("SELECT rowid FROM " . MAIN_DB_PREFIX . "entrepot WHERE entity IN (" . $db->sanitize(getEntity('stock')) . ")"); $listofqualifiedwarehousesid = ""; $count = 0; while ($tmpobj = $db->fetch_object($resWar)) { @@ -161,7 +161,7 @@ if ($action == 'order' && GETPOST('valid')) { $db->begin(); $suppliers = array(); - require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php'; + require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.product.class.php'; $productsupplier = new ProductFournisseur($db); for ($i = 0; $i < $linecount; $i++) { if (GETPOST('choose'.$i) === 'on' && GETPOSTINT('fourn'.$i) > 0) { @@ -215,7 +215,7 @@ if ($action == 'order' && GETPOST('valid')) { dol_print_error($db); } - unset($_POST['fourn'.$i]); + unset($_POST['fourn' . $i]); } unset($_POST[$i]); } @@ -229,10 +229,10 @@ if ($action == 'order' && GETPOST('valid')) { $order = new CommandeFournisseur($db); // Check if an order for the supplier exists - $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."commande_fournisseur"; - $sql .= " WHERE fk_soc = ".((int) $suppliersid[$i]); - $sql .= " AND source = ".((int) $order::SOURCE_ID_REPLENISHMENT)." AND fk_statut = ".((int) $order::STATUS_DRAFT); - $sql .= " AND entity IN (".getEntity('commande_fournisseur').")"; + $sql = "SELECT rowid FROM " . MAIN_DB_PREFIX . "commande_fournisseur"; + $sql .= " WHERE fk_soc = " . ((int) $suppliersid[$i]); + $sql .= " AND source = " . ((int) $order::SOURCE_ID_REPLENISHMENT) . " AND fk_statut = " . ((int) $order::STATUS_DRAFT); + $sql .= " AND entity IN (" . getEntity('commande_fournisseur') . ")"; $sql .= " ORDER BY date_creation DESC"; $resql = $db->query($sql); if ($resql && $db->num_rows($resql) > 0) { @@ -269,7 +269,7 @@ if ($action == 'order' && GETPOST('valid')) { } if ($result < 0) { $fail++; - $msg = $langs->trans('OrderFail')." : "; + $msg = $langs->trans('OrderFail') . " : "; $msg .= $order->error; setEventMessages($msg, null, 'errors'); } else { @@ -294,7 +294,7 @@ if ($action == 'order' && GETPOST('valid')) { $id = $order->create($user); if ($id < 0) { $fail++; - $msg = $langs->trans('OrderFail')." : "; + $msg = $langs->trans('OrderFail') . " : "; $msg .= $order->error; setEventMessages($msg, null, 'errors'); } @@ -347,11 +347,11 @@ $sql .= ' p.desiredstock, p.seuil_stock_alerte,'; if (getDolGlobalString('STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE') && $fk_entrepot > 0) { $sql .= ' pse.desiredstock as desiredstockpse, pse.seuil_stock_alerte as seuil_stock_alertepse,'; } -$sql .= " ".$sqldesiredtock." as desiredstockcombined, ".$sqlalertstock." as seuil_stock_alertecombined,"; +$sql .= " " . $sqldesiredtock . " as desiredstockcombined, " . $sqlalertstock . " as seuil_stock_alertecombined,"; $sql .= ' s.fk_product,'; $sql .= " SUM(".$db->ifsql("s.reel IS NULL", "0", "s.reel").') as stock_physique'; if (getDolGlobalString('STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE') && $fk_entrepot > 0) { - $sql .= ", SUM(".$db->ifsql("s.reel IS NULL OR s.fk_entrepot <> ".$fk_entrepot, "0", "s.reel").') as stock_real_warehouse'; + $sql .= ", SUM(".$db->ifsql("s.reel IS NULL OR s.fk_entrepot <> ".((int) $fk_entrepot), "0", "s.reel").') as stock_real_warehouse'; } // Add fields from hooks @@ -359,10 +359,15 @@ $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; -$sql .= ' FROM '.MAIN_DB_PREFIX.'product as p'; -$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_stock as s ON p.rowid = s.fk_product'; $list_warehouse = (empty($listofqualifiedwarehousesid) ? '0' : $listofqualifiedwarehousesid); -$sql .= ' AND s.fk_entrepot IN ('.$db->sanitize($list_warehouse) .')'; + +$sql .= ' FROM ' . MAIN_DB_PREFIX . 'product as p'; +$sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'product_stock as s ON p.rowid = s.fk_product'; +$sql .= ' AND s.fk_entrepot IN (' . $db->sanitize($list_warehouse) . ')'; + +$list_warehouse_selected = ($fk_entrepot < 0) ? '0' : $fk_entrepot; +$sql .= ' AND s.fk_entrepot IN (' . $db->sanitize($list_warehouse_selected) . ')'; + //$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'entrepot AS ent ON s.fk_entrepot = ent.rowid AND ent.entity IN('.getEntity('stock').')'; if (getDolGlobalString('STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE') && $fk_entrepot > 0) { @@ -373,7 +378,7 @@ $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldListJoin', $parameters); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; -$sql .= ' WHERE p.entity IN ('.getEntity('product').')'; +$sql .= ' WHERE p.entity IN (' . getEntity('product') . ')'; if ($sall) { $sql .= natural_search(array('p.ref', 'p.label', 'p.description', 'p.note'), $sall); } @@ -396,7 +401,7 @@ if (isModEnabled('variants') && !getDolGlobalString('VARIANT_ALLOW_STOCK_MOVEMEN $sql .= ' AND p.rowid NOT IN (SELECT pac.fk_product_parent FROM '.MAIN_DB_PREFIX.'product_attribute_combination as pac WHERE pac.entity IN ('.getEntity('product').'))'; } if ($fk_supplier > 0) { - $sql .= ' AND EXISTS (SELECT pfp.rowid FROM '.MAIN_DB_PREFIX.'product_fournisseur_price as pfp WHERE pfp.fk_product = p.rowid AND pfp.fk_soc = '.((int) $fk_supplier).' AND pfp.entity IN ('.getEntity('product_fournisseur_price').'))'; + $sql .= ' AND EXISTS (SELECT pfp.rowid FROM ' . MAIN_DB_PREFIX . 'product_fournisseur_price as pfp WHERE pfp.fk_product = p.rowid AND pfp.fk_soc = ' . ((int) $fk_supplier) . ' AND pfp.entity IN (' . getEntity('product_fournisseur_price') . '))'; } // Add where from hooks $parameters = array(); @@ -441,9 +446,9 @@ if ($usevirtualstock) { } if (isModEnabled("supplier_order")) { - $sqlCommandesFourn = "(SELECT ".$db->ifsql("SUM(cd3.qty) IS NULL", "0", "SUM(cd3.qty)")." as qty"; // We need the ifsql because if result is 0 for product p.rowid, we must return 0 and not NULL - $sqlCommandesFourn .= " FROM ".MAIN_DB_PREFIX."commande_fournisseurdet as cd3,"; - $sqlCommandesFourn .= " ".MAIN_DB_PREFIX."commande_fournisseur as c3"; + $sqlCommandesFourn = "(SELECT " . $db->ifsql("SUM(cd3.qty) IS NULL", "0", "SUM(cd3.qty)") . " as qty"; // We need the ifsql because if result is 0 for product p.rowid, we must return 0 and not NULL + $sqlCommandesFourn .= " FROM " . MAIN_DB_PREFIX . "commande_fournisseurdet as cd3,"; + $sqlCommandesFourn .= " " . MAIN_DB_PREFIX . "commande_fournisseur as c3"; $sqlCommandesFourn .= " WHERE c3.rowid = cd3.fk_commande"; $sqlCommandesFourn .= " AND c3.entity IN (".getEntity(getDolGlobalString('STOCK_CALCULATE_VIRTUAL_STOCK_TRANSVERSE_MODE') ? 'stock' : 'supplier_order').")"; $sqlCommandesFourn .= " AND cd3.fk_product = p.rowid"; @@ -482,45 +487,53 @@ if ($usevirtualstock) { } $sql .= ' HAVING ('; - $sql .= " (".$sqldesiredtock." >= 0 AND (".$sqldesiredtock." > SUM(".$db->ifsql("s.reel IS NULL", "0", "s.reel").')'; - $sql .= " - (".$sqlCommandesCli." - ".$sqlExpeditionsCli.") + (".$sqlCommandesFourn." - ".$sqlReceptionFourn.") + (".$sqlProductionToProduce." - ".$sqlProductionToConsume.")))"; + $sql .= " (" . $sqldesiredtock . " >= 0 AND (" . $sqldesiredtock . " > SUM(" . $db->ifsql("s.reel IS NULL", "0", "s.reel") . ')'; + $sql .= " - (" . $sqlCommandesCli . " - " . $sqlExpeditionsCli . ") + (" . $sqlCommandesFourn . " - " . $sqlReceptionFourn . ") + (" . $sqlProductionToProduce . " - " . $sqlProductionToConsume . ")))"; $sql .= ' OR'; if ($includeproductswithoutdesiredqty == 'on') { - $sql .= " ((".$sqlalertstock." >= 0 OR ".$sqlalertstock." IS NULL) AND (".$db->ifsql($sqlalertstock." IS NULL", "0", $sqlalertstock)." > SUM(".$db->ifsql("s.reel IS NULL", "0", "s.reel").")"; + $sql .= " ((" . $sqlalertstock . " >= 0 OR " . $sqlalertstock . " IS NULL) AND (" . $db->ifsql($sqlalertstock . " IS NULL", "0", $sqlalertstock) . " > SUM(" . $db->ifsql("s.reel IS NULL", "0", "s.reel") . ")"; } else { - $sql .= " (".$sqlalertstock." >= 0 AND (".$sqlalertstock." > SUM(".$db->ifsql("s.reel IS NULL", "0", "s.reel").')'; + $sql .= " (" . $sqlalertstock . " >= 0 AND (" . $sqlalertstock . " > SUM(" . $db->ifsql("s.reel IS NULL", "0", "s.reel") . ')'; } - $sql .= " - (".$sqlCommandesCli." - ".$sqlExpeditionsCli.") + (".$sqlCommandesFourn." - ".$sqlReceptionFourn.") + (".$sqlProductionToProduce." - ".$sqlProductionToConsume.")))"; + $sql .= " - (" . $sqlCommandesCli . " - " . $sqlExpeditionsCli . ") + (" . $sqlCommandesFourn . " - " . $sqlReceptionFourn . ") + (" . $sqlProductionToProduce . " - " . $sqlProductionToConsume . ")))"; $sql .= ")"; + if (!empty($conf->global->STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE) && $fk_entrepot > 0) { + $sql .= " AND ("; + $sql .= " pse.desiredstock > 0)"; + } - if ($salert == 'on') { // Option to see when stock is lower than alert + if ($salert == 'on') { // Option to see when stock is lower than alert $sql .= ' AND ('; if ($includeproductswithoutdesiredqty == 'on') { - $sql .= "(".$sqlalertstock." >= 0 OR ".$sqlalertstock." IS NULL) AND (".$db->ifsql($sqlalertstock." IS NULL", "0", $sqlalertstock)." > SUM(".$db->ifsql("s.reel IS NULL", "0", "s.reel").")"; + $sql .= "(" . $sqlalertstock . " >= 0 OR " . $sqlalertstock . " IS NULL) AND (" . $db->ifsql($sqlalertstock . " IS NULL", "0", $sqlalertstock) . " > SUM(" . $db->ifsql("s.reel IS NULL", "0", "s.reel") . ")"; } else { - $sql .= $sqlalertstock." >= 0 AND (".$sqlalertstock." > SUM(".$db->ifsql("s.reel IS NULL", "0", "s.reel").")"; + $sql .= $sqlalertstock . " >= 0 AND (" . $sqlalertstock . " > SUM(" . $db->ifsql("s.reel IS NULL", "0", "s.reel") . ")"; } - $sql .= " - (".$sqlCommandesCli." - ".$sqlExpeditionsCli.") + (".$sqlCommandesFourn." - ".$sqlReceptionFourn.") + (".$sqlProductionToProduce." - ".$sqlProductionToConsume."))"; + $sql .= " - (" . $sqlCommandesCli . " - " . $sqlExpeditionsCli . ") + (" . $sqlCommandesFourn . " - " . $sqlReceptionFourn . ") + (" . $sqlProductionToProduce . " - " . $sqlProductionToConsume . "))"; $sql .= ")"; $alertchecked = 'checked'; } } else { $sql .= ' HAVING ('; - $sql .= "(".$sqldesiredtock." >= 0 AND (".$sqldesiredtock." > SUM(".$db->ifsql("s.reel IS NULL", "0", "s.reel").")))"; + $sql .= "(" . $sqldesiredtock . " >= 0 AND (" . $sqldesiredtock . " > SUM(" . $db->ifsql("s.reel IS NULL", "0", "s.reel") . ")))"; $sql .= ' OR'; if ($includeproductswithoutdesiredqty == 'on') { - $sql .= " ((".$sqlalertstock." >= 0 OR ".$sqlalertstock." IS NULL) AND (".$db->ifsql($sqlalertstock." IS NULL", "0", $sqlalertstock)." > SUM(".$db->ifsql("s.reel IS NULL", "0", "s.reel").')))'; + $sql .= " ((" . $sqlalertstock . " >= 0 OR " . $sqlalertstock . " IS NULL) AND (" . $db->ifsql($sqlalertstock . " IS NULL", "0", $sqlalertstock) . " > SUM(" . $db->ifsql("s.reel IS NULL", "0", "s.reel") . ')))'; } else { - $sql .= " (".$sqlalertstock." >= 0 AND (".$sqlalertstock." > SUM(".$db->ifsql("s.reel IS NULL", "0", "s.reel").')))'; + $sql .= " (" . $sqlalertstock . " >= 0 AND (" . $sqlalertstock . " > SUM(" . $db->ifsql("s.reel IS NULL", "0", "s.reel") . ')))'; } $sql .= ')'; + if (!empty($conf->global->STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE) && $fk_entrepot > 0) { + $sql .= " AND ("; + $sql .= " pse.desiredstock > 0)"; + } - if ($salert == 'on') { // Option to see when stock is lower than alert + if ($salert == 'on') { // Option to see when stock is lower than alert $sql .= " AND ("; if ($includeproductswithoutdesiredqty == 'on') { - $sql .= " (".$sqlalertstock." >= 0 OR ".$sqlalertstock." IS NULL) AND (".$db->ifsql($sqlalertstock." IS NULL", "0", $sqlalertstock)." > SUM(".$db->ifsql("s.reel IS NULL", "0", "s.reel")."))"; + $sql .= " (" . $sqlalertstock . " >= 0 OR " . $sqlalertstock . " IS NULL) AND (" . $db->ifsql($sqlalertstock . " IS NULL", "0", $sqlalertstock) . " > SUM(" . $db->ifsql("s.reel IS NULL", "0", "s.reel") . "))"; } else { - $sql .= " ".$sqlalertstock." >= 0 AND (".$sqlalertstock." > SUM(".$db->ifsql("s.reel IS NULL", "0", "s.reel").'))'; + $sql .= " " . $sqlalertstock . " >= 0 AND (" . $sqlalertstock . " > SUM(" . $db->ifsql("s.reel IS NULL", "0", "s.reel") . '))'; } $sql .= ')'; $alertchecked = 'checked'; @@ -562,11 +575,11 @@ llxHeader('', $title, $helpurl, ''); $head = array(); -$head[0][0] = DOL_URL_ROOT.'/product/stock/replenish.php'; +$head[0][0] = DOL_URL_ROOT . '/product/stock/replenish.php'; $head[0][1] = $title; $head[0][2] = 'replenish'; -$head[1][0] = DOL_URL_ROOT.'/product/stock/replenishorders.php'; +$head[1][0] = DOL_URL_ROOT . '/product/stock/replenishorders.php'; $head[1][1] = $langs->trans("ReplenishmentOrders"); $head[1][2] = 'replenishorders'; @@ -575,7 +588,7 @@ print load_fiche_titre($langs->trans('Replenishment'), '', 'stock'); print dol_get_fiche_head($head, 'replenish', '', -1, ''); -print ''.$langs->trans("ReplenishmentStatusDesc").''."\n"; +print '' . $langs->trans("ReplenishmentStatusDesc") . '' . "\n"; //$link = ''.$langs->trans("MenuNewWarehouse").''; @@ -584,39 +597,39 @@ if (empty($fk_entrepot) && getDolGlobalString('STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WA } print '

'; if ($usevirtualstock == 1) { - print $langs->trans("CurentSelectionMode").': '; - print ''.$langs->trans("UseVirtualStock").''; - print ' 0 ? '&fk_supplier='.$fk_supplier : '').($fk_entrepot > 0 ? '&fk_entrepot='.$fk_entrepot : '').'">'.$langs->trans("UsePhysicalStock").''; + print $langs->trans("CurentSelectionMode") . ': '; + print '' . $langs->trans("UseVirtualStock") . ''; + print ' 0 ? '&fk_supplier=' . $fk_supplier : '') . ($fk_entrepot > 0 ? '&fk_entrepot=' . $fk_entrepot : '') . '">' . $langs->trans("UsePhysicalStock") . ''; print '
'; } if ($usevirtualstock == 0) { - print $langs->trans("CurentSelectionMode").': '; - print ' 0 ? '&fk_supplier='.$fk_supplier : '').($fk_entrepot > 0 ? '&fk_entrepot='.$fk_entrepot : '').'">'.$langs->trans("UseVirtualStock").''; - print ' '.$langs->trans("UsePhysicalStock").''; + print $langs->trans("CurentSelectionMode") . ': '; + print ' 0 ? '&fk_supplier=' . $fk_supplier : '') . ($fk_entrepot > 0 ? '&fk_entrepot=' . $fk_entrepot : '') . '">' . $langs->trans("UseVirtualStock") . ''; + print ' ' . $langs->trans("UsePhysicalStock") . ''; print '
'; } -print '
'."\n"; +print '
' . "\n"; -print '
'; -print ''; +print ''; +print ''; print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; if ($limit > 0 && $limit != $conf->liste_limit) { - print ''; + print ''; } if (getDolGlobalString('STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE')) { print '
'; - print $langs->trans('Warehouse').' '.$formproduct->selectWarehouses($fk_entrepot, 'fk_entrepot', '', 1); + print $langs->trans('Warehouse') . ' ' . $formproduct->selectWarehouses($fk_entrepot, 'fk_entrepot', '', 1); print '
'; } print '
'; $filter = '(fournisseur:=:1)'; -print $langs->trans('Supplier').' '.$form->select_company($fk_supplier, 'fk_supplier', $filter, 1); +print $langs->trans('Supplier') . ' ' . $form->select_company($fk_supplier, 'fk_supplier', $filter, 1); print '
'; $parameters = array(); @@ -626,29 +639,29 @@ if (empty($reshook)) { } print '
'; -print ''; +print ''; print '
'; print '
'; -print '
'; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; print ''; -print ''; +print ''; if ($search_ref || $search_label || $sall || $salert || $draftorder || GETPOST('search', 'alpha')) { - $filters = '&search_ref='.urlencode($search_ref).'&search_label='.urlencode($search_label); - $filters .= '&sall='.urlencode($sall); - $filters .= '&salert='.urlencode($salert); - $filters .= '&draftorder='.urlencode($draftorder); - $filters .= '&mode='.urlencode($mode); + $filters = '&search_ref=' . urlencode($search_ref) . '&search_label=' . urlencode($search_label); + $filters .= '&sall=' . urlencode($sall); + $filters .= '&salert=' . urlencode($salert); + $filters .= '&draftorder=' . urlencode($draftorder); + $filters .= '&mode=' . urlencode($mode); if ($fk_supplier > 0) { $filters .= '&fk_supplier='.urlencode((string) ($fk_supplier)); } @@ -659,7 +672,7 @@ if ($search_ref || $search_label || $sall || $salert || $draftorder || GETPOST(' $filters = '&search_ref='.urlencode($search_ref).'&search_label='.urlencode($search_label); $filters .= '&fourn_id='.urlencode((string) ($fourn_id)); $filters .= (isset($type) ? '&type='.urlencode((string) ($type)) : ''); - $filters .= '&='.urlencode($salert); + $filters .= '&salert='.urlencode($salert); $filters .= '&draftorder='.urlencode($draftorder); $filters .= '&mode='.urlencode($mode); if ($fk_supplier > 0) { @@ -670,7 +683,7 @@ if ($search_ref || $search_label || $sall || $salert || $draftorder || GETPOST(' } } if ($limit > 0 && $limit != $conf->liste_limit) { - $filters .= '&limit='.((int) $limit); + $filters .= '&limit=' . ((int) $limit); } if (!empty($includeproductswithoutdesiredqty)) { $filters .= '&includeproductswithoutdesiredqty='.urlencode($includeproductswithoutdesiredqty); @@ -750,12 +763,12 @@ print ''; // Fields title search print ''; print ''; -print ''; -print ''; +print ''; +print ''; if (isModEnabled("service") && $type == 1) { print ''; } -print ''; +print ''; print ''; print ''; if (getDolGlobalString('STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE') && $fk_entrepot > 0) { @@ -818,9 +831,9 @@ while ($i < ($limit ? min($num, $limit) : $num)) { // Multilangs if (getDolGlobalInt('MAIN_MULTILANGS')) { $sql = 'SELECT label,description'; - $sql .= ' FROM '.MAIN_DB_PREFIX.'product_lang'; - $sql .= ' WHERE fk_product = '.((int) $objp->rowid); - $sql .= " AND lang = '".$db->escape($langs->getDefaultLang())."'"; + $sql .= ' FROM ' . MAIN_DB_PREFIX . 'product_lang'; + $sql .= ' WHERE fk_product = ' . ((int) $objp->rowid); + $sql .= " AND lang = '" . $db->escape($langs->getDefaultLang()) . "'"; $sql .= ' LIMIT 1'; $resqlm = $db->query($sql); @@ -872,11 +885,11 @@ while ($i < ($limit ? min($num, $limit) : $num)) { $warning = ''; if ($alertstock && ($stock < $alertstock)) { - $warning = img_warning($langs->trans('StockTooLow')).' '; + $warning = img_warning($langs->trans('StockTooLow')) . ' '; } $warningwarehouse = ''; if ($alertstockwarehouse && ($stockwarehouse < $alertstockwarehouse)) { - $warningwarehouse = img_warning($langs->trans('StockTooLow')).' '; + $warningwarehouse = img_warning($langs->trans('StockTooLow')) . ' '; } //depending on conf, use either physical stock or @@ -909,27 +922,27 @@ while ($i < ($limit ? min($num, $limit) : $num)) { print ''; // Select field - print ''; + print ''; - print ''; + print ''; - print ''; if (isModEnabled("service") && $type == 1) { $regs = array(); if (preg_match('/([0-9]+)y/i', $objp->duration, $regs)) { - $duration = $regs[1].' '.$langs->trans('DurationYear'); + $duration = $regs[1] . ' ' . $langs->trans('DurationYear'); } elseif (preg_match('/([0-9]+)m/i', $objp->duration, $regs)) { - $duration = $regs[1].' '.$langs->trans('DurationMonth'); + $duration = $regs[1] . ' ' . $langs->trans('DurationMonth'); } elseif (preg_match('/([0-9]+)d/i', $objp->duration, $regs)) { - $duration = $regs[1].' '.$langs->trans('DurationDay'); + $duration = $regs[1] . ' ' . $langs->trans('DurationDay'); } else { $duration = $objp->duration; } - print ''; + print ''; } // Desired stock @@ -939,8 +952,8 @@ while ($i < ($limit ? min($num, $limit) : $num)) { print ''; // Current stock (all warehouses) - print ''; // Current stock (warehouse selected only) @@ -949,7 +962,7 @@ while ($i < ($limit ? min($num, $limit) : $num)) { } // Already ordered - print ''; + print ''; // To order $tobuy = ((getDolGlobalString('STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE') && $fk_entrepot > 0) > 0 ? $stocktobuywarehouse : $stocktobuy); @@ -957,7 +970,7 @@ while ($i < ($limit ? min($num, $limit) : $num)) { // Supplier print ''; // Fields from hook @@ -978,7 +991,7 @@ if ($num == 0) { if (getDolGlobalString('STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE') && $fk_entrepot > 0) { $colspan++; } - print '
  '.$form->textwithpicto($langs->trans('IncludeEmptyDesiredStock'), $langs->trans('IncludeProductWithUndefinedAlerts')).' ' . $form->textwithpicto($langs->trans('IncludeEmptyDesiredStock'), $langs->trans('IncludeProductWithUndefinedAlerts')) . ' '.$langs->trans('AlertOnly').' 
'.$prod->getNomUrl(1, 'stock').'' . $prod->getNomUrl(1, 'stock') . ''; + print ''; print dol_escape_htmltag($objp->label); - print ''; // TODO Remove this and make a fetch to get description when creating order instead of a GETPOST + print ''; // TODO Remove this and make a fetch to get description when creating order instead of a GETPOST print ''.$duration.'' . $duration . ''.((getDolGlobalString('STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE') && $fk_entrepot > 0) > 0 ? $alertstockwarehouse : $alertstock).''.$warning.$stock; - print ''; + print '' . $warning . $stock; + print ''; print ''.$ordered.' '.$picto.'' . $ordered . ' ' . $picto . ''; - print $form->select_product_fourn_price($prod->id, 'fourn'.$i, $fk_supplier); + print $form->select_product_fourn_price($prod->id, 'fourn' . $i, $fk_supplier); print '
'; + print '
'; print ''; print $langs->trans("None"); print ''; @@ -998,7 +1011,7 @@ print dol_get_fiche_end(); $value = $langs->trans("CreateOrders"); -print '
'; +print '
'; print ''; diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index d9c192d8891..e70265e1dbd 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -1579,7 +1579,7 @@ if (empty($_SESSION["basiclayout"]) || $_SESSION["basiclayout"] != 1) { // In phone version only show when it is invoice page if (empty($mobilepage) || $mobilepage == "invoice") { print '' . price($invoice->total_ht, 1, '', 1, -1, -1, $conf->currency) . ''; - if (isModEnabled('multicurrency') && $_SESSION["takeposcustomercurrency"] != "" && $conf->currency != $_SESSION["takeposcustomercurrency"]) { + if (isModEnabled('multicurrency') && !empty($_SESSION["takeposcustomercurrency"]) && $conf->currency != $_SESSION["takeposcustomercurrency"]) { //Only show customer currency if multicurrency module is enabled, if currency selected and if this currency selected is not the same as main currency include_once DOL_DOCUMENT_ROOT . '/multicurrency/class/multicurrency.class.php'; $multicurrency = new MultiCurrency($db); diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 0ba4e3a2789..75806dc63bf 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -5237,6 +5237,7 @@ div#card-errors { border-radius: 6px; } + /* ============================================================================== */ /* For content of image preview */ /* ============================================================================== */ diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 2863f54963e..6a9de020112 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -551,7 +551,7 @@ if (empty($reshook)) { $error++; if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') { $langs->load("errors"); - setEventMessages($langs->trans("ErrorLoginAlreadyExists", $object->login), null, 'errors'); + setEventMessages($langs->trans("ErrorUpdateCanceledDueToDuplicatedUniqueValue", $object->login), null, 'errors'); } else { setEventMessages($object->error, $object->errors, 'errors'); $action = 'edit';