NEW add hook printFieldWhere in load_state_board function

This commit is contained in:
Regis Houssin 2022-03-22 15:51:30 +01:00
parent 2e27c40de4
commit 4ca3d45eca
4 changed files with 22 additions and 4 deletions

View File

@ -376,7 +376,7 @@ class Contact extends CommonObject
public function load_state_board()
{
// phpcs:enable
global $user;
global $user, $hookmanager;
$this->nb = array();
$clause = "WHERE";
@ -394,6 +394,12 @@ class Contact extends CommonObject
if ($user->socid > 0) {
$sql .= " AND sp.fk_soc = ".((int) $user->socid);
}
// Add where from hooks
if (is_object($hookmanager)) {
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $this); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager->resPrint;
}
$resql = $this->db->query($sql);
if ($resql) {

View File

@ -106,7 +106,7 @@ class Fournisseur extends Societe
public function load_state_board()
{
// phpcs:enable
global $conf, $user;
global $conf, $user, $hookmanager;
$this->nb = array();
$clause = "WHERE";
@ -120,6 +120,12 @@ class Fournisseur extends Societe
}
$sql .= " ".$clause." s.fournisseur = 1";
$sql .= " AND s.entity IN (".getEntity('societe').")";
// Add where from hooks
if (is_object($hookmanager)) {
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $this); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager->resPrint;
}
$resql = $this->db->query($sql);
if ($resql) {

View File

@ -5692,7 +5692,7 @@ class Product extends CommonObject
// Add where from hooks
if (is_object($hookmanager)) {
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook
$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $this); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager->resPrint;
}
$sql .= ' GROUP BY fk_product_type';

View File

@ -57,7 +57,7 @@ class Client extends Societe
public function load_state_board()
{
// phpcs:enable
global $user;
global $user, $hookmanager;
$this->nb = array("prospects" => 0, "customers" => 0);
$clause = "WHERE";
@ -71,6 +71,12 @@ class Client extends Societe
}
$sql .= " ".$clause." s.client IN (1,2,3)";
$sql .= ' AND s.entity IN ('.getEntity($this->element).')';
// Add where from hooks
if (is_object($hookmanager)) {
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $this); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager->resPrint;
}
$sql .= " GROUP BY s.client";
$resql = $this->db->query($sql);