From 9dfb79ebc863f00e8e8119475817c220e9247d2d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 14 Jul 2010 15:41:41 +0000 Subject: [PATCH] Fix: A lot of fix in stock value calculation. --- htdocs/cashdesk/facturation.php | 8 ++++---- htdocs/expedition/class/expedition.class.php | 2 +- htdocs/expedition/fiche.php | 2 +- htdocs/install/mysql/migration/2.8.0-2.9.0.sql | 1 + 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/htdocs/cashdesk/facturation.php b/htdocs/cashdesk/facturation.php index f705c7b71db..1d20e4462d1 100644 --- a/htdocs/cashdesk/facturation.php +++ b/htdocs/cashdesk/facturation.php @@ -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) diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 9914814829d..3166e004e11 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -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) diff --git a/htdocs/expedition/fiche.php b/htdocs/expedition/fiche.php index abc9de6ac53..5e22e9db444 100644 --- a/htdocs/expedition/fiche.php +++ b/htdocs/expedition/fiche.php @@ -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; diff --git a/htdocs/install/mysql/migration/2.8.0-2.9.0.sql b/htdocs/install/mysql/migration/2.8.0-2.9.0.sql index 0c4403c3486..c67caba575e 100755 --- a/htdocs/install/mysql/migration/2.8.0-2.9.0.sql +++ b/htdocs/install/mysql/migration/2.8.0-2.9.0.sql @@ -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