Fix missing printFieldListWhere hook
This commit is contained in:
parent
d326f161ef
commit
d6ba16d357
@ -42,6 +42,9 @@ else $result=restrictedArea($user,'produit|service');
|
|||||||
$langs->load("products");
|
$langs->load("products");
|
||||||
$langs->load("stocks");
|
$langs->load("stocks");
|
||||||
|
|
||||||
|
// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array of hooks
|
||||||
|
$hookmanager->initHooks(array('productindex'));
|
||||||
|
|
||||||
$product_static = new Product($db);
|
$product_static = new Product($db);
|
||||||
|
|
||||||
|
|
||||||
@ -80,7 +83,7 @@ print '<div class="fichecenter"><div class="fichethirdleft">';
|
|||||||
/*
|
/*
|
||||||
* Search Area of product/service
|
* Search Area of product/service
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Search contract
|
// Search contract
|
||||||
if ((! empty($conf->product->enabled) || ! empty($conf->service->enabled)) && ($user->rights->produit->lire || $user->rights->service->lire))
|
if ((! empty($conf->product->enabled) || ! empty($conf->service->enabled)) && ($user->rights->produit->lire || $user->rights->service->lire))
|
||||||
{
|
{
|
||||||
@ -102,7 +105,7 @@ if (count($listofsearchfields))
|
|||||||
print '</tr>';
|
print '</tr>';
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
print '</table>';
|
print '</table>';
|
||||||
print '</form>';
|
print '</form>';
|
||||||
print '<br>';
|
print '<br>';
|
||||||
}
|
}
|
||||||
@ -117,6 +120,10 @@ $sql = "SELECT COUNT(p.rowid) as total, p.fk_product_type, p.tosell, p.tobuy";
|
|||||||
$sql.= " FROM ".MAIN_DB_PREFIX."product as p";
|
$sql.= " FROM ".MAIN_DB_PREFIX."product as p";
|
||||||
$sql.= ' WHERE p.entity IN ('.getEntity($product_static->element, 1).')';
|
$sql.= ' WHERE p.entity IN ('.getEntity($product_static->element, 1).')';
|
||||||
$sql.= " GROUP BY p.fk_product_type, p.tosell, p.tobuy";
|
$sql.= " GROUP BY p.fk_product_type, p.tosell, p.tobuy";
|
||||||
|
// 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;
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
while ($objp = $db->fetch_object($result))
|
while ($objp = $db->fetch_object($result))
|
||||||
{
|
{
|
||||||
@ -246,6 +253,10 @@ $sql.= " p.tms as datem";
|
|||||||
$sql.= " FROM ".MAIN_DB_PREFIX."product as p";
|
$sql.= " FROM ".MAIN_DB_PREFIX."product as p";
|
||||||
$sql.= " WHERE p.entity IN (".getEntity($product_static->element, 1).")";
|
$sql.= " WHERE p.entity IN (".getEntity($product_static->element, 1).")";
|
||||||
if ($type != '') $sql.= " AND p.fk_product_type = ".$type;
|
if ($type != '') $sql.= " AND p.fk_product_type = ".$type;
|
||||||
|
// 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.= $db->order("p.tms","DESC");
|
$sql.= $db->order("p.tms","DESC");
|
||||||
$sql.= $db->plimit($max,0);
|
$sql.= $db->plimit($max,0);
|
||||||
|
|
||||||
@ -419,7 +430,7 @@ function activitytrim($product_type)
|
|||||||
$i = 0;
|
$i = 0;
|
||||||
|
|
||||||
$var=true;
|
$var=true;
|
||||||
|
|
||||||
while ($i < $num)
|
while ($i < $num)
|
||||||
{
|
{
|
||||||
$objp = $db->fetch_object($result);
|
$objp = $db->fetch_object($result);
|
||||||
|
|||||||
@ -78,7 +78,7 @@ $contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'productser
|
|||||||
if ((string) $type == '1') { $contextpage='servicelist'; if ($search_type=='') $search_type='1'; }
|
if ((string) $type == '1') { $contextpage='servicelist'; if ($search_type=='') $search_type='1'; }
|
||||||
if ((string) $type == '0') { $contextpage='productlist'; if ($search_type=='') $search_type='0'; }
|
if ((string) $type == '0') { $contextpage='productlist'; if ($search_type=='') $search_type='0'; }
|
||||||
|
|
||||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array of hooks
|
||||||
$hookmanager->initHooks(array($contextpage));
|
$hookmanager->initHooks(array($contextpage));
|
||||||
$extrafields = new ExtraFields($db);
|
$extrafields = new ExtraFields($db);
|
||||||
$form=new Form($db);
|
$form=new Form($db);
|
||||||
@ -163,7 +163,7 @@ $arrayfields=array(
|
|||||||
// Extra fields
|
// Extra fields
|
||||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
||||||
{
|
{
|
||||||
foreach($extrafields->attribute_label as $key => $val)
|
foreach($extrafields->attribute_label as $key => $val)
|
||||||
{
|
{
|
||||||
$arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>$extrafields->attribute_list[$key], 'position'=>$extrafields->attribute_pos[$key]);
|
$arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>$extrafields->attribute_list[$key], 'position'=>$extrafields->attribute_pos[$key]);
|
||||||
}
|
}
|
||||||
@ -284,7 +284,7 @@ else
|
|||||||
$typ=$extrafields->attribute_type[$tmpkey];
|
$typ=$extrafields->attribute_type[$tmpkey];
|
||||||
$mode=0;
|
$mode=0;
|
||||||
if (in_array($typ, array('int','double'))) $mode=1; // Search on a numeric
|
if (in_array($typ, array('int','double'))) $mode=1; // Search on a numeric
|
||||||
if ($val && ( ($crit != '' && ! in_array($typ, array('select'))) || ! empty($crit)))
|
if ($val && ( ($crit != '' && ! in_array($typ, array('select'))) || ! empty($crit)))
|
||||||
{
|
{
|
||||||
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode);
|
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode);
|
||||||
}
|
}
|
||||||
@ -369,8 +369,8 @@ else
|
|||||||
$crit=$val;
|
$crit=$val;
|
||||||
$tmpkey=preg_replace('/search_options_/','',$key);
|
$tmpkey=preg_replace('/search_options_/','',$key);
|
||||||
if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val);
|
if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val);
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post" name="formulaire">';
|
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post" name="formulaire">';
|
||||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
@ -416,7 +416,7 @@ else
|
|||||||
foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
|
foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
|
||||||
print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall);
|
print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Filter on categories
|
// Filter on categories
|
||||||
$moreforfilter='';
|
$moreforfilter='';
|
||||||
if (! empty($conf->categorie->enabled))
|
if (! empty($conf->categorie->enabled))
|
||||||
@ -458,9 +458,9 @@ else
|
|||||||
if (! empty($arrayfields['p.accountancy_code_buy']['checked'])) print_liste_field_titre($arrayfields['p.accountancy_code_buy']['label'], $_SERVER["PHP_SELF"],"p.accountancy_code_buy","",$param,'',$sortfield,$sortorder);
|
if (! empty($arrayfields['p.accountancy_code_buy']['checked'])) print_liste_field_titre($arrayfields['p.accountancy_code_buy']['label'], $_SERVER["PHP_SELF"],"p.accountancy_code_buy","",$param,'',$sortfield,$sortorder);
|
||||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
||||||
{
|
{
|
||||||
foreach($extrafields->attribute_label as $key => $val)
|
foreach($extrafields->attribute_label as $key => $val)
|
||||||
{
|
{
|
||||||
if (! empty($arrayfields["ef.".$key]['checked']))
|
if (! empty($arrayfields["ef.".$key]['checked']))
|
||||||
{
|
{
|
||||||
$align=$extrafields->getAlignFlag($key);
|
$align=$extrafields->getAlignFlag($key);
|
||||||
print_liste_field_titre($extralabels[$key],$_SERVER["PHP_SELF"],"ef.".$key,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder);
|
print_liste_field_titre($extralabels[$key],$_SERVER["PHP_SELF"],"ef.".$key,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder);
|
||||||
@ -552,7 +552,7 @@ else
|
|||||||
// Extra fields
|
// Extra fields
|
||||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
||||||
{
|
{
|
||||||
foreach($extrafields->attribute_label as $key => $val)
|
foreach($extrafields->attribute_label as $key => $val)
|
||||||
{
|
{
|
||||||
if (! empty($arrayfields["ef.".$key]['checked'])) print '<td class="liste_titre"></td>';
|
if (! empty($arrayfields["ef.".$key]['checked'])) print '<td class="liste_titre"></td>';
|
||||||
}
|
}
|
||||||
@ -627,7 +627,7 @@ else
|
|||||||
$product_static->status_buy = $objp->tobuy;
|
$product_static->status_buy = $objp->tobuy;
|
||||||
$product_static->status = $objp->tosell;
|
$product_static->status = $objp->tosell;
|
||||||
$product_static->entity = $objp->entity;
|
$product_static->entity = $objp->entity;
|
||||||
|
|
||||||
if (! empty($conf->stock->enabled) && $user->rights->stock->lire && $type != 1) // To optimize call of load_stock
|
if (! empty($conf->stock->enabled) && $user->rights->stock->lire && $type != 1) // To optimize call of load_stock
|
||||||
{
|
{
|
||||||
if ($objp->fk_product_type != 1) // Not a service
|
if ($objp->fk_product_type != 1) // Not a service
|
||||||
@ -635,8 +635,8 @@ else
|
|||||||
$product_static->load_stock('nobatch'); // Load stock_reel + stock_warehouse. This also call load_virtual_stock()
|
$product_static->load_stock('nobatch'); // Load stock_reel + stock_warehouse. This also call load_virtual_stock()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
print '<tr '.$bc[$var].'>';
|
print '<tr '.$bc[$var].'>';
|
||||||
|
|
||||||
@ -659,7 +659,7 @@ else
|
|||||||
{
|
{
|
||||||
print '<td>'.dol_trunc($objp->label,40).'</td>';
|
print '<td>'.dol_trunc($objp->label,40).'</td>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Barcode
|
// Barcode
|
||||||
if (! empty($arrayfields['p.barcode']['checked']))
|
if (! empty($arrayfields['p.barcode']['checked']))
|
||||||
{
|
{
|
||||||
@ -765,7 +765,7 @@ else
|
|||||||
print '<td align="center">';
|
print '<td align="center">';
|
||||||
print yn($objp->tobatch);
|
print yn($objp->tobatch);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
// Accountancy code sell
|
// Accountancy code sell
|
||||||
if (! empty($arrayfields['p.accountancy_code_sell']['checked'])) print '<td>'.$objp->accountancy_code_sell.'</td>';
|
if (! empty($arrayfields['p.accountancy_code_sell']['checked'])) print '<td>'.$objp->accountancy_code_sell.'</td>';
|
||||||
// Accountancy code sell
|
// Accountancy code sell
|
||||||
@ -773,9 +773,9 @@ else
|
|||||||
// Extra fields
|
// Extra fields
|
||||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
||||||
{
|
{
|
||||||
foreach($extrafields->attribute_label as $key => $val)
|
foreach($extrafields->attribute_label as $key => $val)
|
||||||
{
|
{
|
||||||
if (! empty($arrayfields["ef.".$key]['checked']))
|
if (! empty($arrayfields["ef.".$key]['checked']))
|
||||||
{
|
{
|
||||||
print '<td';
|
print '<td';
|
||||||
$align=$extrafields->getAlignFlag($key);
|
$align=$extrafields->getAlignFlag($key);
|
||||||
@ -804,8 +804,8 @@ else
|
|||||||
print '<td align="center">';
|
print '<td align="center">';
|
||||||
print dol_print_date($objp->date_update, 'dayhour');
|
print dol_print_date($objp->date_update, 'dayhour');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Status (to sell)
|
// Status (to sell)
|
||||||
if (! empty($arrayfields['p.tosell']['checked']))
|
if (! empty($arrayfields['p.tosell']['checked']))
|
||||||
{
|
{
|
||||||
@ -828,13 +828,13 @@ else
|
|||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
// Action
|
// Action
|
||||||
print '<td> </td>';
|
print '<td> </td>';
|
||||||
|
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
$db->free($resql);
|
$db->free($resql);
|
||||||
|
|
||||||
print "</table>";
|
print "</table>";
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user