FIX: product stock/reassort list: add hooks
This commit is contained in:
parent
071b909d38
commit
a4427bd2d2
@ -83,6 +83,9 @@ if (! empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT) || ! empty($conf->global
|
||||
$virtualdiffersfromphysical=1; // According to increase/decrease stock options, virtual and physical stock may differs.
|
||||
}
|
||||
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
$hookmanager->initHooks(array('productreassortlist'));
|
||||
|
||||
|
||||
|
||||
/*
|
||||
@ -121,6 +124,10 @@ $sql.= ' p.fk_product_type, p.tms as datem,';
|
||||
$sql.= ' p.duration, p.tosell as statut, p.tobuy, p.seuil_stock_alerte, p.desiredstock,';
|
||||
$sql.= ' SUM(s.reel) as stock_physique';
|
||||
if (! empty($conf->global->PRODUCT_USE_UNITS)) $sql.= ', u.short_label as unit_short';
|
||||
// Add fields from hooks
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
|
||||
$sql.=$hookmanager->resPrint;
|
||||
$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.'entrepot as e on s.fk_entrepot = e.rowid AND e.entity IN ('.getEntity('entrepot').')';
|
||||
@ -152,8 +159,16 @@ if($catid) $sql.= " AND cp.fk_categorie = ".$catid;
|
||||
if ($fourn_id > 0) $sql.= " AND p.rowid = pf.fk_product AND pf.fk_soc = ".$fourn_id;
|
||||
// Insert categ filter
|
||||
if ($search_categ) $sql .= " AND cp.fk_categorie = ".$db->escape($search_categ);
|
||||
// Add where from hooks
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook
|
||||
$sql.=$hookmanager->resPrint;
|
||||
$sql.= " GROUP BY p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price_base_type, p.entity,";
|
||||
$sql.= " p.fk_product_type, p.tms, p.duration, p.tosell, p.tobuy, p.seuil_stock_alerte, p.desiredstock";
|
||||
// Add fields from hooks
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldSelect', $parameters); // Note that $action and $object may have been modified by hook
|
||||
$sql.=$hookmanager->resPrint;
|
||||
if ($toolowstock) $sql.= " HAVING SUM(".$db->ifsql('s.reel IS NULL', '0', 's.reel').") < p.seuil_stock_alerte";
|
||||
$sql.= $db->order($sortfield, $sortorder);
|
||||
|
||||
@ -298,6 +313,9 @@ if ($resql)
|
||||
print '<td class="liste_titre"> </td>';
|
||||
print '<td class="liste_titre" colspan="'.$colspan_warehouse.'"> </td>';
|
||||
print '<td class="liste_titre"></td>';
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
print '<td class="liste_titre maxwidthsearch">';
|
||||
$searchpicto=$form->showFilterAndCheckAddButtons(0);
|
||||
print $searchpicto;
|
||||
@ -329,6 +347,10 @@ if ($resql)
|
||||
print_liste_field_titre('');
|
||||
print_liste_field_titre("ProductStatusOnSell", $_SERVER["PHP_SELF"], "p.tosell", $param, "", '', $sortfield, $sortorder, 'right ');
|
||||
print_liste_field_titre("ProductStatusOnBuy", $_SERVER["PHP_SELF"], "p.tobuy", $param, "", '', $sortfield, $sortorder, 'right ');
|
||||
// Hook fields
|
||||
$parameters=array('param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder);
|
||||
$reshook=$hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
print_liste_field_titre('');
|
||||
print "</tr>\n";
|
||||
|
||||
@ -393,6 +415,10 @@ if ($resql)
|
||||
print '<td class="right"><a href="'.DOL_URL_ROOT.'/product/stock/movement_list.php?idproduct='.$product->id.'">'.$langs->trans("Movements").'</a></td>';
|
||||
print '<td class="right nowrap">'.$product->LibStatut($objp->statut, 5, 0).'</td>';
|
||||
print '<td class="right nowrap">'.$product->LibStatut($objp->tobuy, 5, 1).'</td>';
|
||||
// Fields from hook
|
||||
$parameters=array('obj'=>$objp);
|
||||
$reshook=$hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
print '<td></td>';
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user