2
0
forked from Wavyzz/dolibarr

Removed deprecated code

This commit is contained in:
Laurent Destailleur
2009-01-28 09:00:29 +00:00
parent e817b6891b
commit 569316d3bd
14 changed files with 94 additions and 145 deletions

View File

@@ -33,7 +33,7 @@ switch ( $_GET['action'] ) {
// Recuperation des donnees en fonction de la source (liste d<>roulante ou champ texte) ...
if ( $_POST['hdnSource'] == 'LISTE' ) {
$res = $sql->query('SELECT fk_product, ref, stock_propale, stock_commande, price, reel, tva_tx
$res = $sql->query('SELECT fk_product, ref, price, reel, tva_tx
FROM '.MAIN_DB_PREFIX.'product
LEFT JOIN '.MAIN_DB_PREFIX.'product_stock ON '.MAIN_DB_PREFIX.'product.rowid = '.MAIN_DB_PREFIX.'product_stock.fk_product
WHERE fk_product = '.$_POST['selProduit'].'
@@ -41,7 +41,7 @@ switch ( $_GET['action'] ) {
} else if ( $_POST['hdnSource'] == 'REF' ) {
$res = $sql->query('SELECT fk_product, ref, stock_propale, stock_commande, price, reel, tva_tx
$res = $sql->query('SELECT fk_product, ref, price, reel, tva_tx
FROM '.MAIN_DB_PREFIX.'product
LEFT JOIN '.MAIN_DB_PREFIX.'product_stock ON '.MAIN_DB_PREFIX.'product.rowid = '.MAIN_DB_PREFIX.'product_stock.fk_product
WHERE ref = \''.$_POST['txtRef'].'\'
@@ -64,11 +64,11 @@ switch ( $_GET['action'] ) {
$obj_facturation->id( $tab['fk_product'] );
$obj_facturation->ref( $tab['ref'] );
$obj_facturation->stock( $tab['reel'] - $tab['stock_propale'] - $tab['stock_commande'] );
$obj_facturation->stock( $tab['reel']);
$obj_facturation->prix( $tab['price'] );
$obj_facturation->tva( $tab['tva_tx'] );
// Definition du filtre pour n'afficher que le produit concern<EFBFBD>
// Definition du filtre pour n'afficher que le produit concerne
if ( $_POST['hdnSource'] == 'LISTE' ) {
$filtre = $tab['ref'];

View File

@@ -252,7 +252,7 @@ class Commande extends CommonObject
if (eregi('^\(PROV', $this->ref))
{
// On renomme repertoire facture ($this->ref = ancienne ref, $numfa = nouvelle ref)
// afin de ne pas perdre les fichiers attach<63>s
// afin de ne pas perdre les fichiers attach<63>s
$comref = sanitizeFileName($this->ref);
$snum = sanitizeFileName($num);
$dirsource = $conf->commande->dir_output.'/'.$comref;
@@ -1241,8 +1241,6 @@ class Commande extends CommonObject
$product = new Product($this->db);
$product->id = $obj->fk_product;
$result=$product->ajust_stock_commande($obj->qty, 1);
// Supprime ligne
$ligne = new CommandeLigne($this->db);
$ligne->id = $idligne;
@@ -1686,19 +1684,9 @@ class Commande extends CommonObject
$result = $this->db->query($sql);
if ($result > 0)
{
// Mise a jour info denormalisees au niveau facture
// Mise a jour info denormalisees
$this->update_price();
if ($LigneOld->qty <> $qty && $LigneOld->produit_id)
{
$delta = $qty - $LigneOld->qty;
$op = ($delta > 0) ? 0 : 1;
$product = new Product($this->db);
$product->id = $LigneOld->produit_id;
$product->ajust_stock_commande(abs($delta), $op);
}
$this->db->commit();
return $result;
}
@@ -2342,13 +2330,6 @@ class CommandeLigne
else { $sql.='null'; }
$sql.= ')';
if ($this->fk_product)
{
$product = new Product($this->db);
$product->id = $this->fk_product;
$product->ajust_stock_commande($this->qty, 0);
}
dolibarr_syslog("CommandeLigne::insert sql=$sql");
$resql=$this->db->query($sql);
if ($resql)

View File

@@ -1337,6 +1337,7 @@ class Facture extends CommonObject
{
require_once(DOL_DOCUMENT_ROOT."/product/stock/mouvementstock.class.php");
// Loop on each line
for ($i = 0 ; $i < sizeof($this->lignes) ; $i++)
{
if ($this->lignes[$i]->fk_product && $this->lignes[$i]->product_type == 0)
@@ -1344,6 +1345,7 @@ class Facture extends CommonObject
$mouvP = new MouvementStock($this->db);
// We decrease stock for product
$entrepot_id = "1"; // TODO ajouter possibilit<69> de choisir l'entrepot
// TODO Add price of product in method or '' to update PMP
$result=$mouvP->livraison($user, $this->lignes[$i]->fk_product, $entrepot_id, $this->lignes[$i]->qty);
}
}
@@ -1409,6 +1411,7 @@ class Facture extends CommonObject
$mouvP = new MouvementStock($this->db);
// We decrease stock for product
$entrepot_id = "1"; // TODO ajouter possibilit<69> de choisir l'entrepot
// TODO Add price of product in method or '' to update PMP
$result=$mouvP->reception($user, $this->lignes[$i]->fk_product, $entrepot_id, $this->lignes[$i]->qty);
}
}

View File

@@ -527,6 +527,7 @@ class CommandeFournisseur extends Commande
$mouvP = new MouvementStock($this->db);
// We decrement stock of product (and sub-products)
$entrepot_id = "1"; //Todo: ajouter possibilite de choisir l'entrepot
// TODO Add price of product in method or '' to update PMP
$result=$mouvP->reception($user, $this->lignes[$i]->fk_product, $entrepot_id, $this->lignes[$i]->qty);
if ($result < 0) { $error++; }
}
@@ -915,10 +916,8 @@ class CommandeFournisseur extends Commande
// Si module stock g<>r<EFBFBD> et que expedition faite depuis un entrepot
if (!$error && $conf->stock->enabled && $entrepot)
{
/*
* Enregistrement d'un mouvement de stock pour chaque produit de l'expedition
*/
$mouv = new MouvementStock($this->db);
// TODO Add price of product in method or '' to update PMP
$result=$mouv->reception($user, $product, $entrepot, $qty, $price);
if ($result < 0)
{

View File

@@ -423,6 +423,7 @@ class FactureFournisseur extends Facture
$mouvP = new MouvementStock($this->db);
// We increase stock for product
$entrepot_id = "1"; // TODO ajouter possibilité de choisir l'entrepot
// TODO Add price of product in method or '' to update PMP
$result=$mouvP->reception($user, $this->lignes[$i]->fk_product, $entrepot_id, $this->lignes[$i]->qty);
if ($result < 0) { $error++; }
}

View File

@@ -18,14 +18,14 @@
/**
\file htdocs/html.formactions.class.php
\brief Fichier de la classe des fonctions pr<70>d<EFBFBD>finie de composants html actions
\brief Fichier de la classe des fonctions pr<70>d<EFBFBD>finie de composants html actions
\version $Id$
*/
/**
\class FormActions
\brief Classe permettant la g<>n<EFBFBD>ration de composants html actions
\brief Classe permettant la g<>n<EFBFBD>ration de composants html actions
*/
class FormActions
{
@@ -35,7 +35,7 @@ class FormActions
/**
* \brief Constructeur
* \param DB handler d'acc<63>s base de donn<6E>e
* \param DB handler d'acc<63>s base de donn<6E>e
*/
function FormActions($DB)
{
@@ -131,7 +131,7 @@ class FormActions
print '<tr '.$bc[$var].'>';
print '<td><a href="'.DOL_URL_ROOT.'/comm/action/fiche.php?id='.$objp->id.'">'.img_object($langs->trans('ShowTask'),'task').' '.$objp->id.'</a></td>';
print '<td>'.dolibarr_print_date($objp->da,'day').'</td>';
print '<td>'.dolibarr_trunc($objp->label,32).'</td>';
print '<td title="'.dol_escape_htmltag($objp->label).'">'.dolibarr_trunc($objp->label,32).'</td>';
print '<td>'.$objp->login.'</td>';
print '</tr>';
$i++;
@@ -151,7 +151,7 @@ class FormActions
/**
* \brief Retourne la liste des types de comptes financiers
* \param selected Type pr<70>-s<>lectionn<6E>
* \param selected Type pr<70>-s<>lectionn<6E>
* \param htmlname Nom champ formulaire
*/
function select_type_actions($selected='',$htmlname='actioncode')

View File

@@ -88,8 +88,8 @@ EnableGDLibraryDesc=Install or enable GD library with your PHP for use this opti
EnablePhpAVModuleDesc=You need to install a module compatible with your anti-virus. (Clamav : php4-clamavlib ou php5-clamavlib)
ProfIdShortDesc=<b>Prof Id %s</b> is an information depending on third party country.<br>For example, for country <b>%s</b>, it's code <b>%s</b>.
DolibarrDemo=Dolibarr ERP/CRM demo
StatsByNumberOfUnits=Statistics in number of units
StatsByNumberOfEntities=Statistics in number of entities
StatsByNumberOfUnits=Statistics in number of products/services units
StatsByNumberOfEntities=Statistics in number of referring entities
NumberOfProposals=Number of proposals on last 12 month
NumberOfCustomerOrders=Number of customer orders on last 12 month
NumberOfCustomerInvoices=Number of customer invoices on last 12 month

View File

@@ -88,8 +88,8 @@ EnableGDLibraryDesc=Vous devez activer ou installer la librairie GD avec votre P
EnablePhpAVModuleDesc=Vous devez installer un module PHP compatible avec votre anti-virus. (Clamav : php4-clamavlib ou php5-clamavlib)
ProfIdShortDesc=<b>Id prof. %s</b> est une information qui dépend du pays du tiers.<br>Par exemple, pour le pays <b>%s</b>, il s'agit du code <b>%s</b>.
DolibarrDemo=Démo de Dolibarr ERP/CRM
StatsByNumberOfUnits=Statistiques en nombre d'unités
StatsByNumberOfEntities=Statistiques en nombre d'entités
StatsByNumberOfUnits=Statistiques en nombre d'unités du produit/service
StatsByNumberOfEntities=Statistiques en nombre d'entités référentes
NumberOfProposals=Nombre de propal sur les 12 derniers mois
NumberOfCustomerOrders=Nombre de commande clients sur les 12 derniers mois
NumberOfCustomerInvoices=Nombre de facture clients sur les 12 derniers mois

View File

@@ -158,6 +158,18 @@ function dol_escape_js($stringtoescape)
}
/**
* \brief Returns text escaped for inclusion in javascript code
* \param $stringtoescape String to escape
* \return string Escaped string
*/
function dol_escape_htmltag($stringtoescape)
{
// escape quotes and backslashes, newlines, etc.
return strtr($stringtoescape, array('"'=>'',"\r"=>'\\r',"\n"=>'\\n'));
}
/* For backward compatiblity */
function dolibarr_syslog($message, $level=LOG_INFO)
{

View File

@@ -399,6 +399,7 @@ class Livraison extends CommonObject
$obj = $this->db->fetch_object($resql);
$mouvS = new MouvementStock($this->db);
// TODO Add price of product in method or '' to update PMP
$result=$mouvS->livraison($user, $obj->fk_product, $this->entrepot_id, $obj->qty);
if ($result < 0)
{

View File

@@ -901,7 +901,7 @@ class Product extends CommonObject
$sql = "SELECT rowid, ref, label, description, note, price, price_ttc,";
$sql.= " price_min, price_min_ttc, price_base_type, tva_tx, envente,";
$sql.= " fk_product_type, duration, seuil_stock_alerte,canvas,";
$sql.= " stock_commande, stock_loc, weight, weight_units, volume, volume_units, barcode, fk_barcode_type, finished";
$sql.= " stock_loc, weight, weight_units, volume, volume_units, barcode, fk_barcode_type, finished";
$sql.= " FROM ".MAIN_DB_PREFIX."product";
if ($id) $sql.= " WHERE rowid = '".$id."'";
if ($ref) $sql.= " WHERE ref = '".addslashes($ref)."'";
@@ -939,7 +939,7 @@ class Product extends CommonObject
$this->barcode = $result["barcode"];
$this->barcode_type = $result["fk_barcode_type"];
$this->stock_in_command = $result["stock_commande"];
$this->stock_in_command = 0; // TODO
$this->label_url = '<a href="'.DOL_URL_ROOT.'/product/fiche.php?id='.$this->id.'">'.$this->libelle.'</a>';
@@ -2196,11 +2196,12 @@ class Product extends CommonObject
}
/**
* \brief Augmente ou r<EFBFBD>duit la valeur de stock pour le produit
* \brief Augmente ou reduit la valeur de stock pour le produit
* \param user utilisateur qui demande l'ajustement
* \param id_entrepot id de l'entrepot
* \param nbpiece nombre de pieces
* \param mouvement 0 = ajout, 1 = suppression
* \remarks Called by correct_stock
*/
function ajust_stock($user, $id_entrepot, $nbpiece, $mouvement)
{
@@ -2242,54 +2243,6 @@ class Product extends CommonObject
}
}
/**
* \brief Augmente ou r<>duit le nombre de piece en commande a expedier
* \param nbpiece nombre de pieces
* \param mouvement 0 = ajout, 1 = suppression
* \return int < 0 si erreur, > 0 si ok
*/
function ajust_stock_commande($nbpiece, $mouvement)
{
$op[0] = "+" . trim($nbpiece);
$op[1] = "-" . trim($nbpiece);
if ($this->db->begin())
{
$sql = "UPDATE ".MAIN_DB_PREFIX."product ";
$sql .= " SET stock_commande = stock_commande ".$op[$mouvement];
$sql .= " WHERE rowid = '".$this->id ."';";
if ($this->db->query($sql) )
{
$this->load_subproduct();
for ($i = 0 ; $i < sizeof($this->subproducts_id) ; $i++)
{
$product = new Product($this->db);
$product->id = $this->subproducts_id[$i];
$product->ajust_stock_commande($nbpiece, $mouvement);
}
$this->db->commit();
return 1;
}
else
{
dolibarr_print_error($this->db);
$this->db->rollback();
return -2;
}
}
else
{
dolibarr_print_error($this->db);
$this->db->rollback();
return -3;
}
}
/**
* \brief Charge les informations en stock du produit
* \return int < 0 si erreur, > 0 si ok

View File

@@ -74,9 +74,7 @@ $title=$langs->trans("ProductsAndServices");
$sql = 'SELECT p.rowid, p.ref, p.label, p.price, p.fk_product_type, '.$db->pdate('p.tms').' as datem,';
$sql.= ' p.duration, p.envente as statut, p.seuil_stock_alerte,';
$sql.= ' p.stock_commande,';
$sql.= ' SUM(s.reel) as stock_physique,';
$sql.= ' (SUM(s.reel) - p.stock_commande) as stock_theorique'; //Todo: Il faudra additionner les commandes fournisseurs
$sql.= ' SUM(s.reel) as stock_physique';
$sql.= ' FROM '.MAIN_DB_PREFIX.'product_stock as s,';
$sql.= ' '.MAIN_DB_PREFIX.'product as p';
if ($catid || ($conf->categorie->enabled && ! $user->rights->categorie->voir))

View File

@@ -34,3 +34,6 @@ ALTER TABLE llx_mailing_cibles add column other varchar(255) NULL;
ALTER TABLE llx_mailing_cibles ADD INDEX idx_mailing_cibles_email (email);
ALTER TABLE llx_product drop column stock_propale;
ALTER TABLE llx_product drop column stock_commande;

View File

@@ -38,8 +38,6 @@ create table llx_product
envente tinyint DEFAULT 1,
fk_product_type integer DEFAULT 0,
duration varchar(6),
stock_propale integer DEFAULT 0,
stock_commande integer DEFAULT 0,
seuil_stock_alerte integer DEFAULT 0,
stock_loc varchar(10), -- emplacement dans le stock
barcode varchar(255) DEFAULT NULL,