Fix: A lot of fix in stock value calculation.
This commit is contained in:
parent
f55d82dee5
commit
9dfb79ebc8
@ -38,7 +38,7 @@ if ( $_GET['filtre'] ) {
|
||||
$sql.= " AND p.fk_product_type = 0";
|
||||
$sql.= " AND (p.ref LIKE '%".$_GET['filtre']."%' OR p.label LIKE '%".$_GET['filtre']."%')";
|
||||
$sql.= " ORDER BY label";
|
||||
|
||||
|
||||
dol_syslog("facturation.php sql=".$sql);
|
||||
$resql=$db->query ($sql);
|
||||
if ($resql)
|
||||
@ -62,15 +62,15 @@ if ( $_GET['filtre'] ) {
|
||||
// Sans filtre
|
||||
$ret=array();
|
||||
$i=0;
|
||||
|
||||
|
||||
$sql = "SELECT p.rowid, ref, label, tva_tx";
|
||||
if ($conf->stock->enabled && !empty($conf_fkentrepot)) $sql.= ", ps.reel";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."product as p";
|
||||
if ($conf->stock->enabled && !empty($conf_fkentrepot)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as ps ON p.rowid = ps.fk_product AND ps.fk_entrepot = ".$conf_fkentrepot;
|
||||
if ($conf->stock->enabled && !empty($conf_fkentrepot)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as ps ON p.rowid = ps.fk_product AND ps.fk_entrepot = '".$conf_fkentrepot."'";
|
||||
$sql.= " WHERE p.envente = 1";
|
||||
$sql.= " AND p.fk_product_type = 0";
|
||||
$sql.= " ORDER BY p.label";
|
||||
|
||||
|
||||
dol_syslog($sql);
|
||||
$resql=$db->query ($sql);
|
||||
if ($resql)
|
||||
|
||||
@ -408,7 +408,7 @@ class Expedition extends CommonObject
|
||||
$i=0;
|
||||
while($i < $num)
|
||||
{
|
||||
dol_syslog("Expedition::valid movment index ".$i);
|
||||
dol_syslog("Expedition::valid movement index ".$i);
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
if ($this->lignes[$i]->fk_product > 0 && $this->lignes[$i]->product_type == 0)
|
||||
|
||||
@ -547,7 +547,7 @@ if ($_GET["action"] == 'create')
|
||||
if ($_REQUEST["entrepot_id"])
|
||||
{
|
||||
//var_dump($product);
|
||||
$stock = $product->stock_entrepot[$_REQUEST["entrepot_id"]];
|
||||
$stock = $product->stock_warehouse[$_REQUEST["entrepot_id"]]->real;
|
||||
$stock+=0; // Convertit en numerique
|
||||
$defaultqty=min($quantityToBeDelivered, $stock);
|
||||
if (($line->product_type == 1 && empty($conf->global->STOCK_SUPPORTS_SERVICES)) || $defaultqty < 0) $defaultqty=0;
|
||||
|
||||
@ -9,6 +9,7 @@
|
||||
-- Add unique key
|
||||
ALTER TABLE llx_product_stock ADD UNIQUE INDEX uk_product_stock (fk_product,fk_entrepot);
|
||||
|
||||
ALTER TABLE llx_product_stock drop column location;
|
||||
|
||||
-- Add missing table llx_product_association
|
||||
create table llx_product_association
|
||||
|
||||
Loading…
Reference in New Issue
Block a user