diff --git a/htdocs/cashdesk/admin/cashdesk.php b/htdocs/cashdesk/admin/cashdesk.php index c879523ec27..5b2d565378b 100644 --- a/htdocs/cashdesk/admin/cashdesk.php +++ b/htdocs/cashdesk/admin/cashdesk.php @@ -131,7 +131,7 @@ if ($conf->stock->enabled) $var=!$var; print ''.$langs->trans("CashDeskIdWareHouse").''; print ''; - $formproduct->selectWarehouses($conf->global->CASHDESK_ID_WAREHOUSE,'CASHDESK_ID_WAREHOUSE','',1); + print $formproduct->selectWarehouses($conf->global->CASHDESK_ID_WAREHOUSE,'CASHDESK_ID_WAREHOUSE','',1); print ''; } diff --git a/htdocs/cashdesk/index.php b/htdocs/cashdesk/index.php index 46a8dcd1bea..4d1dd01ac90 100644 --- a/htdocs/cashdesk/index.php +++ b/htdocs/cashdesk/index.php @@ -99,7 +99,7 @@ if ($conf->stock->enabled) print ''; $disabled=0; if (! empty($conf->global->CASHDESK_ID_WAREHOUSE)) $disabled=1; // If a particular stock is defined, we disable choice - $formproduct->selectWarehouses(GETPOST('warehouseid')?GETPOST('warehouseid'):$conf->global->CASHDESK_ID_WAREHOUSE,'warehouseid','',!$disabled,$disabled); + print $formproduct->selectWarehouses(GETPOST('warehouseid')?GETPOST('warehouseid'):$conf->global->CASHDESK_ID_WAREHOUSE,'warehouseid','',!$disabled,$disabled); //print ''; print ''; print "\n"; diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index 3b94af45958..146a44ac991 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -1462,7 +1462,18 @@ else $text.='
'; $text.=$notify->confirmMessage('NOTIFY_VAL_ORDER',$object->socid); } - $formconfirm=$html->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ValidateOrder'), $text, 'confirm_validate', '', 0, 1); + if (! empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER) && '1' == 'TODO') + { + require_once(DOL_DOCUMENT_ROOT."/product/class/html.formproduct.class.php"); + $formproduct=new FormProduct($db); + $formquestion=array( + //'text' => $langs->trans("ConfirmClone"), + //array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1), + //array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1), + array('type' => 'other', 'name' => 'idwarehouse', 'label' => $langs->trans("SelectWarehouseForStockDecrease"), 'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse'),'idwarehouse','',1))); + } + + $formconfirm=$html->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ValidateOrder'), $text, 'confirm_validate', $formquestion, 0, 1); } /* diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 26ea9fda78d..1227d22be4d 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -2168,15 +2168,15 @@ class Form /** * Show a confirmation HTML form or AJAX popup * - * @param page Url of page to call if confirmation is OK - * @param title title - * @param question question - * @param action action - * @param formquestion an array with complementary inputs to add into forms: array(array('label'=> ,'type'=> , )) - * @param selectedchoice "" or "no" or "yes" - * @param useajax 0=No, 1=Yes, 2=Yes but submit page with &confirm=no if choice is No - * @param height Force height of box - * @return string 'ajax' if a confirm ajax popup is shown, 'html' if it's an html form + * @param string $page Url of page to call if confirmation is OK + * @param string $title Title + * @param string $question Question + * @param string $action Action + * @param array $formquestion An array with complementary inputs to add into forms: array(array('label'=> ,'type'=> , )) + * @param string $selectedchoice "" or "no" or "yes" + * @param int $useajax 0=No, 1=Yes, 2=Yes but submit page with &confirm=no if choice is No + * @param int $height Force height of box + * @return string 'ajax' if a confirm ajax popup is shown, 'html' if it's an html form */ function formconfirm($page, $title, $question, $action, $formquestion='', $selectedchoice="", $useajax=0, $height=170, $width=500) { diff --git a/htdocs/expedition/fiche.php b/htdocs/expedition/fiche.php index 003616595d5..5bd07808112 100644 --- a/htdocs/expedition/fiche.php +++ b/htdocs/expedition/fiche.php @@ -749,7 +749,7 @@ if ($action == 'create') // Show warehous if ($_REQUEST["entrepot_id"]) { - $formproduct->selectWarehouses($_REQUEST["entrepot_id"],'entl'.$indiceAsked,'',1,0,$line->fk_product); + print $formproduct->selectWarehouses($_REQUEST["entrepot_id"],'entl'.$indiceAsked,'',1,0,$line->fk_product); //print $stock.' '.$quantityToBeDelivered; //if ($stock >= 0 && $stock < $quantityToBeDelivered) if ($stock < $quantityToBeDelivered) @@ -759,7 +759,7 @@ if ($action == 'create') } else { - $formproduct->selectWarehouses('','entl'.$indiceAsked,'',1,0,$line->fk_product); + print $formproduct->selectWarehouses('','entl'.$indiceAsked,'',1,0,$line->fk_product); } } else diff --git a/htdocs/expedition/shipment.php b/htdocs/expedition/shipment.php index 9b37eb076b4..da3148bc41c 100644 --- a/htdocs/expedition/shipment.php +++ b/htdocs/expedition/shipment.php @@ -624,8 +624,8 @@ if ($id > 0 || ! empty($ref)) { print ''.$langs->trans("WarehouseSource").''; print ''; - $result=$formproduct->selectWarehouses(-1,'entrepot_id','',1); - if ($result <= 0) + print $formproduct->selectWarehouses(-1,'entrepot_id','',1); + if (count($formproduct->cache_warehouses) <= 0) { print '   No warehouse defined, add one'; } @@ -653,7 +653,7 @@ if ($id > 0 || ! empty($ref)) print ''; } } - + show_list_sending_receive('commande',$commande->id); } else diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 64643feb193..923884898a0 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -82,7 +82,7 @@ DetailMenuIdParent=ID of parent menu (0 for a top menu) DetailPosition=Sort number to define menu position PersonalizedMenusNotSupported=Personalized menus not supported AllMenus=All -NotConfigured=Numbering module not configured +NotConfigured=Module not configured Setup=Setup Activation=Activation Active=Active diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index 67d6b046e95..a37c2a8d7df 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -83,7 +83,7 @@ DetailMenuIdParent= Id du menu parent (0 pour un menu du haut) DetailPosition= Numéro d'ordre déterminant la position du menu PersonalizedMenusNotSupported= Menus personnalisés non gérés AllMenus= Tous -NotConfigured=Module numérotation non configuré +NotConfigured=Module non configuré Setup= Configuration Activation= Activation Active= Actif diff --git a/htdocs/product/class/html.formproduct.class.php b/htdocs/product/class/html.formproduct.class.php index b0506a20252..9ed66ba880a 100644 --- a/htdocs/product/class/html.formproduct.class.php +++ b/htdocs/product/class/html.formproduct.class.php @@ -39,22 +39,24 @@ class FormProduct /** - * \brief Constructeur - * \param DB Database handler + * Constructor + * + * @param DoliDB $db Database handler */ - function FormProduct($DB) + function FormProduct($db) { - $this->db = $DB; + $this->db = $db; return 1; } /** - * \brief Load in cache array list of warehouses - * \param fk_product Add quantity of stock in label for product with id fk_product. Nothing if 0. - * \return int Nb of loaded lines, 0 if already loaded, <0 if KO - * \remarks If fk_product is not 0, we do not use cache + * Load in cache array list of warehouses + * If fk_product is not 0, we do not use cache + * + * @param int $fk_product Add quantity of stock in label for product with id fk_product. Nothing if 0. + * @return int Nb of loaded lines, 0 if already loaded, <0 if KO */ function loadWarehouses($fk_product=0) { @@ -73,7 +75,7 @@ class FormProduct $sql.= " WHERE statut = 1"; $sql.= " ORDER BY e.label"; - dol_syslog('FormProduct::loadWarehouses sql='.$sql,LOG_DEBUG); + dol_syslog(get_class($this).'::loadWarehouses sql='.$sql,LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -98,39 +100,41 @@ class FormProduct } /** - * \brief Return list of possible payments modes - * \param selected Id du mode de paiement pre-selectionne - * \param htmlname Name of html select html - * \param filtertype For filtre - * \param empty 1=Can be empty, 0 if not - * \param disabled 1=Select is disabled - * \param fk_product Add quantity of stock in label for product with id fk_product. Nothing if 0. - * \return int <0 if KO, Nb of product in list if OK + * Return list of possible payments modes + * + * @param int $selected Id du mode de paiement pre-selectionne + * @param string $htmlname Name of html select html + * @param string $filtertype For filter + * @param int $empty 1=Can be empty, 0 if not + * @param int $disabled 1=Select is disabled + * @param int $fk_product Add quantity of stock in label for product with id fk_product. Nothing if 0. + * @return string HTML select */ function selectWarehouses($selected='',$htmlname='idwarehouse',$filtertype='',$empty=0,$disabled=0,$fk_product=0) { global $langs,$user; - dol_syslog("Form::selectWarehouses $selected, $htmlname, $filtertype, $empty, $disabled, $fk_product",LOG_DEBUG); + dol_syslog(get_class($this)."::selectWarehouses $selected, $htmlname, $filtertype, $empty, $disabled, $fk_product",LOG_DEBUG); $this->loadWarehouses($fk_product); - print ''; + if ($empty) $out.=''; foreach($this->cache_warehouses as $id => $arraytypes) { - print ''; + if ($selected == $id) $out.=' selected="selected"'; + $out.='>'; + $out.=$arraytypes['label']; + if ($fk_product) $out.=' ('.$langs->trans("Stock").': '.($arraytypes['stock']>0?$arraytypes['stock']:'?').')'; + $out.=''; } - print ''; - if ($disabled) print ''; + $out.=''; + if ($disabled) $out.=''; - return count($this->cache_warehouses); + //count($this->cache_warehouses); + return $out; } /** diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index 4944be1bde2..4edb1411eb1 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -327,7 +327,7 @@ if ($_GET["id"] || $_GET["ref"]) print ''; print ''.$langs->trans("Warehouse").''; print ''; - $formproduct->selectWarehouses($_GET["dwid"],'id_entrepot','',1); + print $formproduct->selectWarehouses($_GET["dwid"],'id_entrepot','',1); print ''; print ''; print ''; print ''; @@ -403,7 +403,7 @@ if ($_GET["id"] || $_GET["ref"]) print ''; print ''; print ''; print '';
'.$langs->trans("Warehouse").''; - $formproduct->selectWarehouses('','id_entrepot','',1); + print $formproduct->selectWarehouses('','id_entrepot','',1); print ''.$langs->trans("NumberOfUnit").'
 '; print '