diff --git a/htdocs/admin/stock.php b/htdocs/admin/stock.php index 2ad6e3eedb5..30e766eb9d4 100644 --- a/htdocs/admin/stock.php +++ b/htdocs/admin/stock.php @@ -38,19 +38,7 @@ accessforbidden(); /* * Actions */ -/*if ($_POST["action"] == 'STOCK_USERSTOCK') -{ - dolibarr_set_const($db, "STOCK_USERSTOCK", $_POST["STOCK_USERSTOCK"],'chaine',0,'',$conf->entity); - //On desactive l'autocreation si l'option "stock personnel" est desactivee - if ($_POST["STOCK_USERSTOCK"] == 0) - { - dolibarr_set_const($db, "STOCK_USERSTOCK_AUTOCREATE", 0,'chaine',0,'',$conf->entity); - } - Header("Location: stock.php"); - exit; -} -else -*/ + if ($_POST["action"] == 'STOCK_USERSTOCK_AUTOCREATE') { dolibarr_set_const($db, "STOCK_USERSTOCK_AUTOCREATE", $_POST["STOCK_USERSTOCK_AUTOCREATE"],'chaine',0,'',$conf->entity); diff --git a/htdocs/cashdesk/index.php b/htdocs/cashdesk/index.php index 0ad3e748eff..440823566f1 100644 --- a/htdocs/cashdesk/index.php +++ b/htdocs/cashdesk/index.php @@ -109,7 +109,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 - print $formproduct->selectWarehouses($conf->global->CASHDESK_ID_WAREHOUSE,'warehouseid','',!$disabled,$disabled); + $formproduct->selectWarehouses($conf->global->CASHDESK_ID_WAREHOUSE,'warehouseid','',!$disabled,$disabled); //print ''; print ''; print ""; diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index 5a2cbbda924..f435ca75520 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -1057,7 +1057,7 @@ if ($_GET['action'] == 'create' && $user->rights->commande->creer) // Date print ''.$langs->trans('Date').''; - $html->select_date('','re','','','',"crea_commande"); + $html->select_date('','re','','','',"crea_commande",1,1); print ''; // Date de livraison @@ -1070,7 +1070,7 @@ if ($_GET['action'] == 'create' && $user->rights->commande->creer) { $datedelivery=empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0; } - $html->select_date($datedelivery,'liv_','','','',"crea_commande"); + $html->select_date($datedelivery,'liv_','','','',"crea_commande",1,1); print ""; // Delivery address @@ -2114,7 +2114,7 @@ else if ($user->rights->expedition->creer) { // Chargement des permissions - $error = $user->load_entrepots(); + /*$error = $user->load_entrepots(); deprecated if (sizeof($user->entrepots) === 1) { print ''; @@ -2122,9 +2122,9 @@ else } else - { + {*/ print ''.$langs->trans('ShipProduct').''; - } + //} } else { @@ -2162,7 +2162,7 @@ else if ($user->rights->commande->annuler && $nb_expedition == 0) { print ''.$langs->trans('CancelOrder').''; + print '>'.$langs->trans('Cancel').''; } } diff --git a/htdocs/expedition/shipment.php b/htdocs/expedition/shipment.php index f797c0a1825..424cff2e5a9 100644 --- a/htdocs/expedition/shipment.php +++ b/htdocs/expedition/shipment.php @@ -29,6 +29,7 @@ require("../main.inc.php"); require_once(DOL_DOCUMENT_ROOT."/expedition/class/expedition.class.php"); require_once(DOL_DOCUMENT_ROOT."/core/class/html.formfile.class.php"); +require_once(DOL_DOCUMENT_ROOT."/product/class/html.formproduct.class.php"); require_once(DOL_DOCUMENT_ROOT."/lib/order.lib.php"); require_once(DOL_DOCUMENT_ROOT."/lib/sendings.lib.php"); if ($conf->product->enabled || $conf->service->enabled) require_once(DOL_DOCUMENT_ROOT."/product/class/product.class.php"); @@ -52,8 +53,6 @@ $socid=0; if ($user->societe_id) $socid=$user->societe_id; $result=restrictedArea($user,'commande',$id); -// Chargement des permissions -$error = $user->load_entrepots(); /* * Actions @@ -121,6 +120,7 @@ if ($_POST['action'] == 'setconditions' && $user->rights->commande->creer) $html = new Form($db); +$formproduct = new FormProduct($db); $formfile = new FormFile($db); @@ -392,7 +392,7 @@ if ($id > 0 || ! empty($ref)) $sql.= ' cd.date_start,'; $sql.= ' cd.date_end,'; $sql.= ' p.label as product_label, p.ref, p.fk_product_type, p.rowid as prodid,'; - $sql.= ' p.description as product_desc'; + $sql.= ' p.description as product_desc, p.fk_product_type as product_type'; $sql.= " FROM ".MAIN_DB_PREFIX."commandedet as cd"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON cd.fk_product = p.rowid"; $sql.= " WHERE cd.fk_commande = ".$commande->id; @@ -476,8 +476,10 @@ if ($id > 0 || ! empty($ref)) print "\n"; } + // Qty ordered print ''.$objp->qty.''; + // Qty already shipped $qtyProdCom=$objp->qty; print ''; // Nb of sending products for this line of order @@ -485,10 +487,18 @@ if ($id > 0 || ! empty($ref)) print $quantite_livree; print ''; - $reste_a_livrer[$objp->fk_product] = $objp->qty - $quantite_livree; - $reste_a_livrer_total += $reste_a_livrer[$objp->fk_product]; + // Qty remaind to ship print ''; - print $reste_a_livrer[$objp->fk_product]; + if ($objp->product_type == 0) + { + $reste_a_livrer[$objp->fk_product] = $objp->qty - $quantite_livree; + $reste_a_livrer_total += $reste_a_livrer[$objp->fk_product]; + print $reste_a_livrer[$objp->fk_product]; + } + else + { + print '0 ('.$langs->trans("Service").')'; + } print ''; if ($objp->fk_product > 0) @@ -610,21 +620,10 @@ if ($id > 0 || ! empty($ref)) $langs->load("stocks"); print ''; - print ''.$langs->trans("Warehouse").''; + print ''.$langs->trans("WarehouseSource").''; print ''; - - if (sizeof($user->entrepots) === 1) - { - $uentrepot = array(); - $uentrepot[$user->entrepots[0]['id']] = $user->entrepots[0]['label']; - $html->select_array("entrepot_id",$uentrepot); - } - else - { - $html->select_array("entrepot_id",$entrepot->list_array()); - } - - if (sizeof($entrepot->list_array()) <= 0) + $result=$formproduct->selectWarehouses(-1,'entrepot_id','',1); + if ($result <= 0) { print '   No warehouse defined, add one'; } diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index 2c8269d679c..15cee683e3f 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -267,16 +267,16 @@ if ($id > 0 || ! empty($ref)) // Warehouse print ''; - if (sizeof($user->entrepots) === 1) + /*if (sizeof($user->entrepots) === 1) deprecated { $uentrepot = array(); $uentrepot[$user->entrepots[0]['id']] = $user->entrepots[0]['label']; print $html->selectarray("entrepot_".$i, $uentrepot, '', $disabled, 0, 0, 0, '', 0, 0, $disabled); } else - { + {*/ print $html->selectarray("entrepot_".$i, $entrepot->list_array(), '', $disabled, 0, 0, 0, '', 0, 0, $disabled); - } + //} print "\n"; print "\n"; } diff --git a/htdocs/install/mysql/tables/llx_user_entrepot.sql b/htdocs/install/mysql/tables/llx_user_entrepot.sql deleted file mode 100644 index a9eb820102b..00000000000 --- a/htdocs/install/mysql/tables/llx_user_entrepot.sql +++ /dev/null @@ -1,28 +0,0 @@ --- ============================================================================ --- Copyright (C) 2006 Rodolphe Quiedeville --- --- 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 --- the Free Software Foundation; either version 2 of the License, or --- (at your option) any later version. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. --- --- $Id$ --- ============================================================================ - -create table llx_user_entrepot -( - rowid integer AUTO_INCREMENT PRIMARY KEY, - fk_entrepot integer UNSIGNED, -- pointe sur llx_entrepot - fk_user integer UNSIGNED, -- pointe sur llx_user - consult smallint UNSIGNED, - send smallint UNSIGNED -)type=innodb; diff --git a/htdocs/lib/stock.lib.php b/htdocs/lib/stock.lib.php index 2b7c76f37ae..a47fd697434 100644 --- a/htdocs/lib/stock.lib.php +++ b/htdocs/lib/stock.lib.php @@ -53,16 +53,17 @@ function stock_prepare_head($entrepot) $h++; */ + /* Disabled because will never be implemented. Table always empty. if ($conf->global->STOCK_USE_WAREHOUSE_BY_USER) { - // Add the constant STOCK_USE_WAREHOUSE_BY_USER in cont table to use this feature. // Should not be enabled by defaut because does not work yet correctly because - // there is no way to add values in the table llx_user_entrepot + // personnal stocks are not tagged into table llx_entrepot $head[$h][0] = DOL_URL_ROOT.'/product/stock/user.php?id='.$entrepot->id; $head[$h][1] = $langs->trans("Users"); $head[$h][2] = 'user'; $h++; } + */ $head[$h][0] = DOL_URL_ROOT.'/product/stock/info.php?id='.$entrepot->id; $head[$h][1] = $langs->trans("Info"); diff --git a/htdocs/product/class/html.formproduct.class.php b/htdocs/product/class/html.formproduct.class.php index 477c0d3bd39..150515cacc8 100644 --- a/htdocs/product/class/html.formproduct.class.php +++ b/htdocs/product/class/html.formproduct.class.php @@ -96,6 +96,7 @@ class FormProduct * \param filtertype For filtre * \param empty 1=Can be empty, 0 if not * \param disabled 1=Select is disabled + * \return int <0 if KO, Nb of product in list if OK */ function selectWarehouses($selected='',$htmlname='idwarehouse',$filtertype='',$empty=0,$disabled=0) { @@ -118,6 +119,8 @@ class FormProduct } print ''; if ($disabled) print ''; + + return sizeof($this->cache_warehouses); } /** diff --git a/htdocs/product/stock/user.php b/htdocs/product/stock/user.php index c771fe9d476..f9289916b16 100644 --- a/htdocs/product/stock/user.php +++ b/htdocs/product/stock/user.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2008 Laurent Destailleur + * Copyright (C) 2004-2010 Laurent Destailleur * Copyright (C) 2005 Simon Tosser * Copyright (C) 2005-2006 Regis Houssin * @@ -20,10 +20,11 @@ */ /** - * \file htdocs/product/stock/user.php - * \ingroup stock - * \brief Page to link dolibarr users with warehouses - * \version $Id$ + * \file htdocs/product/stock/user.php + * \ingroup stock + * \brief Page to link dolibarr users with warehouses + * \version $Id$ + * \deprecated This page is never called. Feature will never be developped. */ require("../../main.inc.php"); diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 8517c2c0f78..84d5a979302 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -1697,9 +1697,10 @@ class User extends CommonObject } /** - * \brief Charge la liste des entrepots pour l'utilisateur + * \brief Charge la liste ->entrepots[] des entrepots pour l'utilisateur * \return int 0 si ok, <> 0 si erreur */ + /* deprecated function load_entrepots() { $err=0; @@ -1729,7 +1730,7 @@ class User extends CommonObject } return $err; } - +*/ /* * \brief Charge les informations d'ordre info dans l'objet user @@ -1792,7 +1793,7 @@ class User extends CommonObject return -1; } } - + /** * \brief Return number of existing users * \param limitToActive limit to active users @@ -1801,12 +1802,12 @@ class User extends CommonObject function getNbOfUsers($limitToActive=0) { global $conf; - + $sql = "SELECT count(rowid) as nb"; $sql.= " FROM ".MAIN_DB_PREFIX."user"; $sql.= " WHERE entity = ".$conf->entity; if ($limitToActive) $sql.= " AND statut = 1"; - + $resql=$this->db->query($sql); if ($resql) {