forked from Wavyzz/dolibarr
Removed deprecated code
This commit is contained in:
@@ -33,7 +33,7 @@ switch ( $_GET['action'] ) {
|
|||||||
// Recuperation des donnees en fonction de la source (liste d<>roulante ou champ texte) ...
|
// Recuperation des donnees en fonction de la source (liste d<>roulante ou champ texte) ...
|
||||||
if ( $_POST['hdnSource'] == 'LISTE' ) {
|
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
|
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
|
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'].'
|
WHERE fk_product = '.$_POST['selProduit'].'
|
||||||
@@ -41,7 +41,7 @@ switch ( $_GET['action'] ) {
|
|||||||
|
|
||||||
} else if ( $_POST['hdnSource'] == 'REF' ) {
|
} 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
|
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
|
LEFT JOIN '.MAIN_DB_PREFIX.'product_stock ON '.MAIN_DB_PREFIX.'product.rowid = '.MAIN_DB_PREFIX.'product_stock.fk_product
|
||||||
WHERE ref = \''.$_POST['txtRef'].'\'
|
WHERE ref = \''.$_POST['txtRef'].'\'
|
||||||
@@ -64,11 +64,11 @@ switch ( $_GET['action'] ) {
|
|||||||
|
|
||||||
$obj_facturation->id( $tab['fk_product'] );
|
$obj_facturation->id( $tab['fk_product'] );
|
||||||
$obj_facturation->ref( $tab['ref'] );
|
$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->prix( $tab['price'] );
|
||||||
$obj_facturation->tva( $tab['tva_tx'] );
|
$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' ) {
|
if ( $_POST['hdnSource'] == 'LISTE' ) {
|
||||||
|
|
||||||
$filtre = $tab['ref'];
|
$filtre = $tab['ref'];
|
||||||
|
|||||||
@@ -252,7 +252,7 @@ class Commande extends CommonObject
|
|||||||
if (eregi('^\(PROV', $this->ref))
|
if (eregi('^\(PROV', $this->ref))
|
||||||
{
|
{
|
||||||
// On renomme repertoire facture ($this->ref = ancienne ref, $numfa = nouvelle 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);
|
$comref = sanitizeFileName($this->ref);
|
||||||
$snum = sanitizeFileName($num);
|
$snum = sanitizeFileName($num);
|
||||||
$dirsource = $conf->commande->dir_output.'/'.$comref;
|
$dirsource = $conf->commande->dir_output.'/'.$comref;
|
||||||
@@ -1241,8 +1241,6 @@ class Commande extends CommonObject
|
|||||||
$product = new Product($this->db);
|
$product = new Product($this->db);
|
||||||
$product->id = $obj->fk_product;
|
$product->id = $obj->fk_product;
|
||||||
|
|
||||||
$result=$product->ajust_stock_commande($obj->qty, 1);
|
|
||||||
|
|
||||||
// Supprime ligne
|
// Supprime ligne
|
||||||
$ligne = new CommandeLigne($this->db);
|
$ligne = new CommandeLigne($this->db);
|
||||||
$ligne->id = $idligne;
|
$ligne->id = $idligne;
|
||||||
@@ -1645,69 +1643,59 @@ class Commande extends CommonObject
|
|||||||
$subprice = $pu;
|
$subprice = $pu;
|
||||||
$remise = 0;
|
$remise = 0;
|
||||||
if ($remise_percent > 0)
|
if ($remise_percent > 0)
|
||||||
{
|
{
|
||||||
$remise = round(($pu * $remise_percent / 100),2);
|
$remise = round(($pu * $remise_percent / 100),2);
|
||||||
$price = ($pu - $remise);
|
$price = ($pu - $remise);
|
||||||
}
|
}
|
||||||
$price = price2num($price);
|
$price = price2num($price);
|
||||||
$subprice = price2num($subprice);
|
$subprice = price2num($subprice);
|
||||||
|
|
||||||
|
|
||||||
$LigneOld = new CommandeLigne($this->db);
|
$LigneOld = new CommandeLigne($this->db);
|
||||||
$LigneOld->fetch($rowid);
|
$LigneOld->fetch($rowid);
|
||||||
|
|
||||||
// Mise a jour ligne en base
|
// Mise a jour ligne en base
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."commandedet SET";
|
$sql = "UPDATE ".MAIN_DB_PREFIX."commandedet SET";
|
||||||
$sql.= " description='".addslashes($desc)."'";
|
$sql.= " description='".addslashes($desc)."'";
|
||||||
$sql.= ",price='".price2num($price)."'";
|
$sql.= ",price='".price2num($price)."'";
|
||||||
$sql.= ",subprice='".price2num($subprice)."'";
|
$sql.= ",subprice='".price2num($subprice)."'";
|
||||||
$sql.= ",remise='".price2num($remise)."'";
|
$sql.= ",remise='".price2num($remise)."'";
|
||||||
$sql.= ",remise_percent='".price2num($remise_percent)."'";
|
$sql.= ",remise_percent='".price2num($remise_percent)."'";
|
||||||
$sql.= ",tva_tx='".price2num($txtva)."'";
|
$sql.= ",tva_tx='".price2num($txtva)."'";
|
||||||
$sql.= ",qty='".price2num($qty)."'";
|
$sql.= ",qty='".price2num($qty)."'";
|
||||||
//if ($date_end) { $sql.= ",date_start='$date_end'"; }
|
//if ($date_end) { $sql.= ",date_start='$date_end'"; }
|
||||||
//else { $sql.=',date_start=null'; }
|
//else { $sql.=',date_start=null'; }
|
||||||
//if ($date_end) { $sql.= ",date_end='$date_end'"; }
|
//if ($date_end) { $sql.= ",date_end='$date_end'"; }
|
||||||
//else { $sql.=',date_end=null'; }
|
//else { $sql.=',date_end=null'; }
|
||||||
$sql.= ",info_bits='".$info_bits."'";
|
$sql.= ",info_bits='".$info_bits."'";
|
||||||
$sql.= ",total_ht='".price2num($total_ht)."'";
|
$sql.= ",total_ht='".price2num($total_ht)."'";
|
||||||
$sql.= ",total_tva='".price2num($total_tva)."'";
|
$sql.= ",total_tva='".price2num($total_tva)."'";
|
||||||
$sql.= ",total_ttc='".price2num($total_ttc)."'";
|
$sql.= ",total_ttc='".price2num($total_ttc)."'";
|
||||||
|
|
||||||
// Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html)
|
// Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html)
|
||||||
// Save the start and end date in the database
|
// Save the start and end date in the database
|
||||||
if ($date_start) { $sql.= ",date_start='".$date_start."'"; }
|
if ($date_start) { $sql.= ",date_start='".$date_start."'"; }
|
||||||
else { $sql.=',date_start=null'; }
|
else { $sql.=',date_start=null'; }
|
||||||
if ($date_end) { $sql.= ",date_end='".$date_end."'"; }
|
if ($date_end) { $sql.= ",date_end='".$date_end."'"; }
|
||||||
else { $sql.=',date_end=null'; }
|
else { $sql.=',date_end=null'; }
|
||||||
|
|
||||||
$sql.= " WHERE rowid = ".$rowid;
|
$sql.= " WHERE rowid = ".$rowid;
|
||||||
|
|
||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
// Mise a jour info denormalisees au niveau facture
|
// Mise a jour info denormalisees
|
||||||
$this->update_price();
|
$this->update_price();
|
||||||
|
|
||||||
if ($LigneOld->qty <> $qty && $LigneOld->produit_id)
|
$this->db->commit();
|
||||||
{
|
return $result;
|
||||||
$delta = $qty - $LigneOld->qty;
|
}
|
||||||
$op = ($delta > 0) ? 0 : 1;
|
else
|
||||||
|
{
|
||||||
$product = new Product($this->db);
|
$this->error=$this->db->error();
|
||||||
$product->id = $LigneOld->produit_id;
|
$this->db->rollback();
|
||||||
$product->ajust_stock_commande(abs($delta), $op);
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->db->commit();
|
|
||||||
return $result;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$this->error=$this->db->error();
|
|
||||||
$this->db->rollback();
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -2274,9 +2262,9 @@ class CommandeLigne
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Insere l'objet ligne de commande en base
|
* \brief Insere l'objet ligne de commande en base
|
||||||
* \param notrigger 1 ne declenche pas les triggers, 0 sinon
|
* \param notrigger 1 ne declenche pas les triggers, 0 sinon
|
||||||
* \return int <0 si ko, >0 si ok
|
* \return int <0 si ko, >0 si ok
|
||||||
*/
|
*/
|
||||||
function insert($notrigger=0)
|
function insert($notrigger=0)
|
||||||
{
|
{
|
||||||
@@ -2342,13 +2330,6 @@ class CommandeLigne
|
|||||||
else { $sql.='null'; }
|
else { $sql.='null'; }
|
||||||
$sql.= ')';
|
$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");
|
dolibarr_syslog("CommandeLigne::insert sql=$sql");
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
|
|||||||
@@ -1337,6 +1337,7 @@ class Facture extends CommonObject
|
|||||||
{
|
{
|
||||||
require_once(DOL_DOCUMENT_ROOT."/product/stock/mouvementstock.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/product/stock/mouvementstock.class.php");
|
||||||
|
|
||||||
|
// Loop on each line
|
||||||
for ($i = 0 ; $i < sizeof($this->lignes) ; $i++)
|
for ($i = 0 ; $i < sizeof($this->lignes) ; $i++)
|
||||||
{
|
{
|
||||||
if ($this->lignes[$i]->fk_product && $this->lignes[$i]->product_type == 0)
|
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);
|
$mouvP = new MouvementStock($this->db);
|
||||||
// We decrease stock for product
|
// We decrease stock for product
|
||||||
$entrepot_id = "1"; // TODO ajouter possibilit<69> de choisir l'entrepot
|
$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);
|
$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);
|
$mouvP = new MouvementStock($this->db);
|
||||||
// We decrease stock for product
|
// We decrease stock for product
|
||||||
$entrepot_id = "1"; // TODO ajouter possibilit<69> de choisir l'entrepot
|
$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);
|
$result=$mouvP->reception($user, $this->lignes[$i]->fk_product, $entrepot_id, $this->lignes[$i]->qty);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -527,6 +527,7 @@ class CommandeFournisseur extends Commande
|
|||||||
$mouvP = new MouvementStock($this->db);
|
$mouvP = new MouvementStock($this->db);
|
||||||
// We decrement stock of product (and sub-products)
|
// We decrement stock of product (and sub-products)
|
||||||
$entrepot_id = "1"; //Todo: ajouter possibilite de choisir l'entrepot
|
$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);
|
$result=$mouvP->reception($user, $this->lignes[$i]->fk_product, $entrepot_id, $this->lignes[$i]->qty);
|
||||||
if ($result < 0) { $error++; }
|
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
|
// Si module stock g<>r<EFBFBD> et que expedition faite depuis un entrepot
|
||||||
if (!$error && $conf->stock->enabled && $entrepot)
|
if (!$error && $conf->stock->enabled && $entrepot)
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
* Enregistrement d'un mouvement de stock pour chaque produit de l'expedition
|
|
||||||
*/
|
|
||||||
$mouv = new MouvementStock($this->db);
|
$mouv = new MouvementStock($this->db);
|
||||||
|
// TODO Add price of product in method or '' to update PMP
|
||||||
$result=$mouv->reception($user, $product, $entrepot, $qty, $price);
|
$result=$mouv->reception($user, $product, $entrepot, $qty, $price);
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -423,6 +423,7 @@ class FactureFournisseur extends Facture
|
|||||||
$mouvP = new MouvementStock($this->db);
|
$mouvP = new MouvementStock($this->db);
|
||||||
// We increase stock for product
|
// We increase stock for product
|
||||||
$entrepot_id = "1"; // TODO ajouter possibilité de choisir l'entrepot
|
$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);
|
$result=$mouvP->reception($user, $this->lignes[$i]->fk_product, $entrepot_id, $this->lignes[$i]->qty);
|
||||||
if ($result < 0) { $error++; }
|
if ($result < 0) { $error++; }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,14 +18,14 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
\file htdocs/html.formactions.class.php
|
\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$
|
\version $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\class FormActions
|
\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
|
class FormActions
|
||||||
{
|
{
|
||||||
@@ -35,7 +35,7 @@ class FormActions
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Constructeur
|
* \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)
|
function FormActions($DB)
|
||||||
{
|
{
|
||||||
@@ -131,7 +131,7 @@ class FormActions
|
|||||||
print '<tr '.$bc[$var].'>';
|
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><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_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 '<td>'.$objp->login.'</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
$i++;
|
$i++;
|
||||||
@@ -151,7 +151,7 @@ class FormActions
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Retourne la liste des types de comptes financiers
|
* \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
|
* \param htmlname Nom champ formulaire
|
||||||
*/
|
*/
|
||||||
function select_type_actions($selected='',$htmlname='actioncode')
|
function select_type_actions($selected='',$htmlname='actioncode')
|
||||||
|
|||||||
@@ -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)
|
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>.
|
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
|
DolibarrDemo=Dolibarr ERP/CRM demo
|
||||||
StatsByNumberOfUnits=Statistics in number of units
|
StatsByNumberOfUnits=Statistics in number of products/services units
|
||||||
StatsByNumberOfEntities=Statistics in number of entities
|
StatsByNumberOfEntities=Statistics in number of referring entities
|
||||||
NumberOfProposals=Number of proposals on last 12 month
|
NumberOfProposals=Number of proposals on last 12 month
|
||||||
NumberOfCustomerOrders=Number of customer orders on last 12 month
|
NumberOfCustomerOrders=Number of customer orders on last 12 month
|
||||||
NumberOfCustomerInvoices=Number of customer invoices on last 12 month
|
NumberOfCustomerInvoices=Number of customer invoices on last 12 month
|
||||||
|
|||||||
@@ -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)
|
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>.
|
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
|
DolibarrDemo=Démo de Dolibarr ERP/CRM
|
||||||
StatsByNumberOfUnits=Statistiques en nombre d'unités
|
StatsByNumberOfUnits=Statistiques en nombre d'unités du produit/service
|
||||||
StatsByNumberOfEntities=Statistiques en nombre d'entités
|
StatsByNumberOfEntities=Statistiques en nombre d'entités référentes
|
||||||
NumberOfProposals=Nombre de propal sur les 12 derniers mois
|
NumberOfProposals=Nombre de propal sur les 12 derniers mois
|
||||||
NumberOfCustomerOrders=Nombre de commande clients 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
|
NumberOfCustomerInvoices=Nombre de facture clients sur les 12 derniers mois
|
||||||
|
|||||||
@@ -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 */
|
/* For backward compatiblity */
|
||||||
function dolibarr_syslog($message, $level=LOG_INFO)
|
function dolibarr_syslog($message, $level=LOG_INFO)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -399,6 +399,7 @@ class Livraison extends CommonObject
|
|||||||
$obj = $this->db->fetch_object($resql);
|
$obj = $this->db->fetch_object($resql);
|
||||||
|
|
||||||
$mouvS = new MouvementStock($this->db);
|
$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);
|
$result=$mouvS->livraison($user, $obj->fk_product, $this->entrepot_id, $obj->qty);
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -901,7 +901,7 @@ class Product extends CommonObject
|
|||||||
$sql = "SELECT rowid, ref, label, description, note, price, price_ttc,";
|
$sql = "SELECT rowid, ref, label, description, note, price, price_ttc,";
|
||||||
$sql.= " price_min, price_min_ttc, price_base_type, tva_tx, envente,";
|
$sql.= " price_min, price_min_ttc, price_base_type, tva_tx, envente,";
|
||||||
$sql.= " fk_product_type, duration, seuil_stock_alerte,canvas,";
|
$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";
|
$sql.= " FROM ".MAIN_DB_PREFIX."product";
|
||||||
if ($id) $sql.= " WHERE rowid = '".$id."'";
|
if ($id) $sql.= " WHERE rowid = '".$id."'";
|
||||||
if ($ref) $sql.= " WHERE ref = '".addslashes($ref)."'";
|
if ($ref) $sql.= " WHERE ref = '".addslashes($ref)."'";
|
||||||
@@ -939,7 +939,7 @@ class Product extends CommonObject
|
|||||||
$this->barcode = $result["barcode"];
|
$this->barcode = $result["barcode"];
|
||||||
$this->barcode_type = $result["fk_barcode_type"];
|
$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>';
|
$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 user utilisateur qui demande l'ajustement
|
||||||
* \param id_entrepot id de l'entrepot
|
* \param id_entrepot id de l'entrepot
|
||||||
* \param nbpiece nombre de pieces
|
* \param nbpiece nombre de pieces
|
||||||
* \param mouvement 0 = ajout, 1 = suppression
|
* \param mouvement 0 = ajout, 1 = suppression
|
||||||
|
* \remarks Called by correct_stock
|
||||||
*/
|
*/
|
||||||
function ajust_stock($user, $id_entrepot, $nbpiece, $mouvement)
|
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
|
* \brief Charge les informations en stock du produit
|
||||||
* \return int < 0 si erreur, > 0 si ok
|
* \return int < 0 si erreur, > 0 si ok
|
||||||
|
|||||||
@@ -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 = '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.duration, p.envente as statut, p.seuil_stock_alerte,';
|
||||||
$sql.= ' p.stock_commande,';
|
$sql.= ' SUM(s.reel) as stock_physique';
|
||||||
$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.= ' FROM '.MAIN_DB_PREFIX.'product_stock as s,';
|
$sql.= ' FROM '.MAIN_DB_PREFIX.'product_stock as s,';
|
||||||
$sql.= ' '.MAIN_DB_PREFIX.'product as p';
|
$sql.= ' '.MAIN_DB_PREFIX.'product as p';
|
||||||
if ($catid || ($conf->categorie->enabled && ! $user->rights->categorie->voir))
|
if ($catid || ($conf->categorie->enabled && ! $user->rights->categorie->voir))
|
||||||
|
|||||||
@@ -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_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;
|
||||||
|
|
||||||
|
|||||||
@@ -38,8 +38,6 @@ create table llx_product
|
|||||||
envente tinyint DEFAULT 1,
|
envente tinyint DEFAULT 1,
|
||||||
fk_product_type integer DEFAULT 0,
|
fk_product_type integer DEFAULT 0,
|
||||||
duration varchar(6),
|
duration varchar(6),
|
||||||
stock_propale integer DEFAULT 0,
|
|
||||||
stock_commande integer DEFAULT 0,
|
|
||||||
seuil_stock_alerte integer DEFAULT 0,
|
seuil_stock_alerte integer DEFAULT 0,
|
||||||
stock_loc varchar(10), -- emplacement dans le stock
|
stock_loc varchar(10), -- emplacement dans le stock
|
||||||
barcode varchar(255) DEFAULT NULL,
|
barcode varchar(255) DEFAULT NULL,
|
||||||
|
|||||||
Reference in New Issue
Block a user