Merge pull request #17893 from atm-john/develop_fix_missing_hooks_for_stock_mvm

New :  Missing hook for stock movements list
This commit is contained in:
Laurent Destailleur 2021-06-11 19:58:21 +02:00 committed by GitHub
commit 1933072712
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 2 deletions

View File

@ -11,7 +11,7 @@ if (empty($extrafieldsobjectkey) && is_object($object)) {
}
// Loop to show all columns of extrafields from $obj, $extrafields and $db
if (!empty($extrafieldsobjectkey)) { // $extrafieldsobject is the $object->table_element like 'societe', 'socpeople', ...
if (!empty($extrafieldsobjectkey) && !empty($extrafields->attributes[$extrafieldsobjectkey])) { // $extrafieldsobject is the $object->table_element like 'societe', 'socpeople', ...
if (key_exists('label', $extrafields->attributes[$extrafieldsobjectkey]) && is_array($extrafields->attributes[$extrafieldsobjectkey]['label']) && count($extrafields->attributes[$extrafieldsobjectkey]['label'])) {
if (empty($extrafieldsobjectprefix)) {
$extrafieldsobjectprefix = 'ef.';

View File

@ -86,6 +86,7 @@ $search_user = trim(GETPOST("search_user"));
$search_batch = trim(GETPOST("search_batch"));
$search_qty = trim(GETPOST("search_qty"));
$search_type_mouvement = GETPOST('search_type_mouvement', 'int');
$search_fk_projet=GETPOST("search_fk_projet", 'int');
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
@ -198,6 +199,7 @@ if (empty($reshook)) {
$search_user = "";
$search_batch = "";
$search_qty = '';
$search_fk_projet=0;
$sall = "";
$toselect = '';
$search_array_options = array();
@ -549,6 +551,9 @@ if (!empty($search_batch)) {
if (!empty($product_id)) {
$sql .= natural_search('p.rowid', $product_id);
}
if (!empty($search_fk_projet) && $search_fk_projet != '-1') {
$sql .= natural_search('m.fk_projet', $search_fk_projet);
}
if ($search_qty != '') {
$sql .= natural_search('m.value', $search_qty, 1);
}
@ -889,7 +894,7 @@ if ($resql) {
$moreforfilter = '';
$parameters = array();
$parameters = array('arrayfields'=>&$arrayfields);
$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook
if (empty($reshook)) {
$moreforfilter .= $hookmanager->resPrint;
@ -1255,6 +1260,14 @@ if ($resql) {
}
print '</td>';
}
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
// Fields from hook
$parameters = array('arrayfields'=>$arrayfields, 'objp'=>$objp, 'i'=>$i, 'totalarray'=>&$totalarray);
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Action column
print '<td class="nowrap center">';
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined