Merge remote-tracking branch 'origin/3.7' into 3.8

Conflicts:
	htdocs/fourn/commande/dispatch.php
This commit is contained in:
Laurent Destailleur 2015-09-12 11:50:46 +02:00
commit db1d9d6d8e
4 changed files with 15 additions and 7 deletions

View File

@ -229,7 +229,7 @@ class modFacture extends DolibarrModules
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as c on s.fk_pays = c.rowid,';
$this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'facture as f';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'user as uc ON f.fk_user_author = uc.rowid';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'user as uv ON f.fk_user_valid = uc.rowid';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'user as uv ON f.fk_user_valid = uv.rowid';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'facture_extrafields as extra ON f.rowid = extra.fk_object';
$this->export_sql_end[$r] .=' , '.MAIN_DB_PREFIX.'facturedet as fd';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product as p on (fd.fk_product = p.rowid)';
@ -291,7 +291,7 @@ class modFacture extends DolibarrModules
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as c on s.fk_pays = c.rowid,';
$this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'facture as f';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'user as uc ON f.fk_user_author = uc.rowid';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'user as uv ON f.fk_user_valid = uc.rowid';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'user as uv ON f.fk_user_valid = uv.rowid';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'facture_extrafields as extra ON f.rowid = extra.fk_object';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'paiement_facture as pf ON pf.fk_facture = f.rowid';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'paiement as p ON pf.fk_paiement = p.rowid';

View File

@ -366,9 +366,17 @@ if ($id > 0 || ! empty($ref))
$resql = $db->query($sql);
if ($resql)
{
while ($row = $db->fetch_row($resql))
$num = $db->num_rows($resql);
$i = 0;
if ($num)
{
$products_dispatched[$row[0]] = $row[2];
while ($i < $num)
{
$objd = $db->fetch_object($resql);
$products_dispatched[$objd->rowid] = price2num($objd->qty, 5);
$i++;
}
}
$db->free($resql);
}
@ -429,7 +437,7 @@ if ($id > 0 || ! empty($ref))
}
else
{
$remaintodispatch=($objp->qty - ((int) $products_dispatched[$objp->rowid])); // Calculation of dispatched
$remaintodispatch=price2num($objp->qty - ((float) $products_dispatched[$objp->rowid]), 5); // Calculation of dispatched
if ($remaintodispatch < 0) $remaintodispatch=0;
if ($remaintodispatch || empty($conf->global->SUPPLIER_ORDER_DISABLE_STOCK_DISPATCH_WHEN_TOTAL_REACHED))

View File

@ -3257,7 +3257,7 @@ class Product extends CommonObject
$sql = "SELECT ps.reel, ps.fk_entrepot, ps.pmp, ps.rowid";
$sql.= " FROM ".MAIN_DB_PREFIX."product_stock as ps";
$sql.= ", ".MAIN_DB_PREFIX."entrepot as w";
$sql.= " WHERE w.entity IN (".getEntity('warehouse', 1).")";
$sql.= " WHERE w.entity IN (".getEntity('stock', 1).")";
$sql.= " AND w.rowid = ps.fk_entrepot";
$sql.= " AND ps.fk_product = ".$this->id;

View File

@ -355,7 +355,7 @@ class Entrepot extends CommonObject
$sql = "SELECT rowid, label";
$sql.= " FROM ".MAIN_DB_PREFIX."entrepot";
$sql.= " WHERE entity IN (".getEntity('warehouse', 1).")";
$sql.= " WHERE entity IN (".getEntity('stock', 1).")";
$sql.= " AND statut = ".$status;
$result = $this->db->query($sql);