Qual: Remove deprecated code

This commit is contained in:
Laurent Destailleur 2010-06-17 16:53:26 +00:00
parent 3edc470f73
commit c0521a20a9
10 changed files with 48 additions and 83 deletions

View File

@ -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);

View File

@ -109,7 +109,7 @@ if ($conf->stock->enabled)
print '<td>';
$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 '<input name="warehouse_id" class="texte_login" type="warehouse_id" value="" />';
print '</td>';
print "</tr>";

View File

@ -1057,7 +1057,7 @@ if ($_GET['action'] == 'create' && $user->rights->commande->creer)
// Date
print '<tr><td class="fieldrequired">'.$langs->trans('Date').'</td><td>';
$html->select_date('','re','','','',"crea_commande");
$html->select_date('','re','','','',"crea_commande",1,1);
print '</td></tr>';
// 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 "</td></tr>";
// 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 '<a class="butAction" href="'.DOL_URL_ROOT.'/expedition/fiche.php?id='.$_GET['id'].'&amp;action=create&amp;commande_id='.$_GET["id"].'&entrepot_id='.$user->entrepots[0]['id'].'">';
@ -2122,9 +2122,9 @@ else
}
else
{
{*/
print '<a class="butAction" href="'.DOL_URL_ROOT.'/expedition/shipment.php?id='.$_GET['id'].'">'.$langs->trans('ShipProduct').'</a>';
}
//}
}
else
{
@ -2162,7 +2162,7 @@ else
if ($user->rights->commande->annuler && $nb_expedition == 0)
{
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$commande->id.'&amp;action=cancel"';
print '>'.$langs->trans('CancelOrder').'</a>';
print '>'.$langs->trans('Cancel').'</a>';
}
}

View File

@ -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 "</td>\n";
}
// Qty ordered
print '<td align="center">'.$objp->qty.'</td>';
// Qty already shipped
$qtyProdCom=$objp->qty;
print '<td align="center">';
// Nb of sending products for this line of order
@ -485,10 +487,18 @@ if ($id > 0 || ! empty($ref))
print $quantite_livree;
print '</td>';
$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 '<td align="center">';
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 '</td>';
if ($objp->fk_product > 0)
@ -610,21 +620,10 @@ if ($id > 0 || ! empty($ref))
$langs->load("stocks");
print '<tr>';
print '<td>'.$langs->trans("Warehouse").'</td>';
print '<td>'.$langs->trans("WarehouseSource").'</td>';
print '<td>';
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 ' &nbsp; No warehouse defined, <a href="'.DOL_URL_ROOT.'/product/stock/fiche.php?action=create">add one</a>';
}

View File

@ -267,16 +267,16 @@ if ($id > 0 || ! empty($ref))
// Warehouse
print '<td align="right">';
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 "</td>\n";
print "</tr>\n";
}

View File

@ -1,28 +0,0 @@
-- ============================================================================
-- Copyright (C) 2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
--
-- 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;

View File

@ -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");

View File

@ -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 '</select>';
if ($disabled) print '<input type="hidden" name="'.$htmlname.'" value="'.$selected.'">';
return sizeof($this->cache_warehouses);
}
/**

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2003-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005 Simon Tosser <simon@kornog-computing.com>
* Copyright (C) 2005-2006 Regis Houssin <regis@dolibarr.fr>
*
@ -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");

View File

@ -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)
{