Merge branch '11.0' of git@github.com:Dolibarr/dolibarr.git into 12.0
This commit is contained in:
commit
6b12dd4143
@ -48,7 +48,7 @@ $hookmanager->initHooks(array('stockreplenishlist'));
|
|||||||
|
|
||||||
//checks if a product has been ordered
|
//checks if a product has been ordered
|
||||||
|
|
||||||
$action = GETPOST('action', 'alpha');
|
$action = GETPOST('action', 'aZ09');
|
||||||
$sref = GETPOST('sref', 'alpha');
|
$sref = GETPOST('sref', 'alpha');
|
||||||
$snom = GETPOST('snom', 'alpha');
|
$snom = GETPOST('snom', 'alpha');
|
||||||
$sall = trim((GETPOST('search_all', 'alphanohtml') != '') ?GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml'));
|
$sall = trim((GETPOST('search_all', 'alphanohtml') != '') ?GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml'));
|
||||||
@ -309,7 +309,7 @@ if (!empty($conf->global->STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE) && $fk_entre
|
|||||||
}
|
}
|
||||||
|
|
||||||
$sql = 'SELECT p.rowid, p.ref, p.label, p.description, p.price,';
|
$sql = 'SELECT p.rowid, p.ref, p.label, p.description, p.price,';
|
||||||
$sql .= ' p.price_ttc, p.price_base_type,p.fk_product_type,';
|
$sql .= ' p.price_ttc, p.price_base_type, p.fk_product_type,';
|
||||||
$sql .= ' p.tms as datem, p.duration, p.tobuy,';
|
$sql .= ' p.tms as datem, p.duration, p.tobuy,';
|
||||||
$sql .= ' p.desiredstock, p.seuil_stock_alerte,';
|
$sql .= ' p.desiredstock, p.seuil_stock_alerte,';
|
||||||
if (!empty($conf->global->STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE) && $fk_entrepot > 0) {
|
if (!empty($conf->global->STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE) && $fk_entrepot > 0) {
|
||||||
@ -327,11 +327,8 @@ $sql .= $hookmanager->resPrint;
|
|||||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'product as p';
|
$sql .= ' FROM '.MAIN_DB_PREFIX.'product as p';
|
||||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_stock as s ON p.rowid = s.fk_product';
|
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_stock as s ON p.rowid = s.fk_product';
|
||||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'entrepot AS ent ON s.fk_entrepot = ent.rowid AND ent.entity IN('.getEntity('stock').')';
|
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'entrepot AS ent ON s.fk_entrepot = ent.rowid AND ent.entity IN('.getEntity('stock').')';
|
||||||
if ($fk_supplier > 0) {
|
|
||||||
$sql .= ' INNER JOIN '.MAIN_DB_PREFIX.'product_fournisseur_price pfp ON (pfp.fk_product = p.rowid AND pfp.fk_soc = '.$fk_supplier.')';
|
|
||||||
}
|
|
||||||
if (!empty($conf->global->STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE) && $fk_entrepot > 0) {
|
if (!empty($conf->global->STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE) && $fk_entrepot > 0) {
|
||||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_warehouse_properties AS pse ON (p.rowid = pse.fk_product AND pse.fk_entrepot = '.$fk_entrepot.')';
|
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_warehouse_properties AS pse ON (p.rowid = pse.fk_product AND pse.fk_entrepot = '.((int) $fk_entrepot).')';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add fields from hooks
|
// Add fields from hooks
|
||||||
@ -353,6 +350,9 @@ if ($sref) $sql .= natural_search('p.ref', $sref);
|
|||||||
if ($snom) $sql .= natural_search('p.label', $snom);
|
if ($snom) $sql .= natural_search('p.label', $snom);
|
||||||
$sql .= ' AND p.tobuy = 1';
|
$sql .= ' AND p.tobuy = 1';
|
||||||
if (!empty($canvas)) $sql .= ' AND p.canvas = "'.$db->escape($canvas).'"';
|
if (!empty($canvas)) $sql .= ' AND p.canvas = "'.$db->escape($canvas).'"';
|
||||||
|
if ($fk_supplier > 0) {
|
||||||
|
$sql .= ' AND EXISTS (SELECT pfp.rowid FROM '.MAIN_DB_PREFIX.'product_fournisseur_price as pfp WHERE pfp.fk_product = p.rowid AND pfp.fk_soc = '.((int) $fk_supplier).' AND pfp.entity IN ('.getEntity('product_fournisseur_price').'))';
|
||||||
|
}
|
||||||
$sql .= ' GROUP BY p.rowid, p.ref, p.label, p.description, p.price';
|
$sql .= ' GROUP BY p.rowid, p.ref, p.label, p.description, p.price';
|
||||||
$sql .= ', p.price_ttc, p.price_base_type,p.fk_product_type, p.tms';
|
$sql .= ', p.price_ttc, p.price_base_type,p.fk_product_type, p.tms';
|
||||||
$sql .= ', p.duration, p.tobuy';
|
$sql .= ', p.duration, p.tobuy';
|
||||||
@ -766,7 +766,9 @@ while ($i < ($limit ? min($num, $limit) : $num))
|
|||||||
print '<td class="right">'.$alertstock.'</td>';
|
print '<td class="right">'.$alertstock.'</td>';
|
||||||
|
|
||||||
// Current stock (all warehouses)
|
// Current stock (all warehouses)
|
||||||
print '<td class="right">'.$warning.$stock.'</td>';
|
print '<td class="right">'.$warning.$stock;
|
||||||
|
print '<!-- stock returned by main sql is '.$objp->stock_physique.' -->';
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
// Already ordered
|
// Already ordered
|
||||||
print '<td class="right"><a href="replenishorders.php?search_product='.$prod->id.'">'.$ordered.'</a> '.$picto.'</td>';
|
print '<td class="right"><a href="replenishorders.php?search_product='.$prod->id.'">'.$ordered.'</a> '.$picto.'</td>';
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user