NEW: Add new hooks for actioncomm
This commit is contained in:
parent
d0a824c5e9
commit
a355f4fc8b
@ -1306,8 +1306,17 @@ class ActionComm extends CommonObject
|
||||
|
||||
dol_syslog(get_class()."::getActions", LOG_DEBUG);
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php';
|
||||
$hookmanager = new HookManager($db);
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
$hookmanager->initHooks(array('agendadao'));
|
||||
|
||||
$sql = "SELECT a.id";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."actioncomm as a";
|
||||
// Fields from hook
|
||||
$parameters = array('sql' => &$sql, 'socid' => $socid, 'fk_element' => $fk_element, 'elementtype' => $elementtype);
|
||||
$reshook = $hookmanager->executeHooks('getActionsListFrom', $parameters); // Note that $action and $object may have been modified by hook
|
||||
if (!empty($hookmanager->resPrint)) $sql.= $hookmanager->resPrint;
|
||||
$sql .= " WHERE a.entity IN (".getEntity('agenda').")";
|
||||
if (!empty($socid)) {
|
||||
$sql .= " AND a.fk_soc = ".((int) $socid);
|
||||
@ -1326,6 +1335,10 @@ class ActionComm extends CommonObject
|
||||
if (!empty($filter)) {
|
||||
$sql .= $filter;
|
||||
}
|
||||
// Fields where hook
|
||||
$parameters = array('sql' => &$sql, 'socid' => $socid, 'fk_element' => $fk_element, 'elementtype' => $elementtype);
|
||||
$reshook = $hookmanager->executeHooks('getActionsListWhere', $parameters); // Note that $action and $object may have been modified by hook
|
||||
if (!empty($hookmanager->resPrint)) $sql.= $hookmanager->resPrint;
|
||||
if ($sortorder && $sortfield) {
|
||||
$sql .= $this->db->order($sortfield, $sortorder);
|
||||
}
|
||||
|
||||
@ -1489,6 +1489,11 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin
|
||||
$sql = '';
|
||||
|
||||
if (isModEnabled('agenda')) {
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php';
|
||||
$hookmanager = new HookManager($db);
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
$hookmanager->initHooks(array('agendadao'));
|
||||
|
||||
// Recherche histo sur actioncomm
|
||||
if (is_object($objcon) && $objcon->id > 0) {
|
||||
$sql = "SELECT DISTINCT a.id, a.label as label,";
|
||||
@ -1528,6 +1533,11 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin
|
||||
}
|
||||
}
|
||||
|
||||
// Fields from hook
|
||||
$parameters = array('sql' => &$sql, 'filterobj' => $filterobj, 'objcon' => $objcon);
|
||||
$reshook = $hookmanager->executeHooks('showActionsDoneListSelect', $parameters); // Note that $action and $object may have been modified by hook
|
||||
if (!empty($hookmanager->resPrint)) $sql.= $hookmanager->resPrint;
|
||||
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."actioncomm as a";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on u.rowid = a.fk_user_action";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_actioncomm as c ON a.fk_action = c.id";
|
||||
@ -1539,6 +1549,11 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin
|
||||
$sql .= " AND r.element_type = '".$db->escape($objcon->table_element)."' AND r.fk_element = ".((int) $objcon->id);
|
||||
}
|
||||
|
||||
// Fields from hook
|
||||
$parameters = array('sql' => &$sql, 'filterobj' => $filterobj, 'objcon' => $objcon);
|
||||
$reshook = $hookmanager->executeHooks('showActionsDoneListFrom', $parameters); // Note that $action and $object may have been modified by hook
|
||||
if (!empty($hookmanager->resPrint)) $sql.= $hookmanager->resPrint;
|
||||
|
||||
if (is_object($filterobj) && in_array(get_class($filterobj), array('Societe', 'Client', 'Fournisseur'))) {
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sp ON a.fk_contact = sp.rowid";
|
||||
} elseif (is_object($filterobj) && get_class($filterobj) == 'Dolresource') {
|
||||
@ -1639,6 +1654,11 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin
|
||||
|
||||
addOtherFilterSQL($sql, $donetodo, $now, $filters);
|
||||
|
||||
// Fields from hook
|
||||
$parameters = array('sql' => &$sql, 'filterobj' => $filterobj, 'objcon' => $objcon, 'module' => $module);
|
||||
$reshook = $hookmanager->executeHooks('showActionsDoneListWhere', $parameters); // Note that $action and $object may have been modified by hook
|
||||
if (!empty($hookmanager->resPrint)) $sql.= $hookmanager->resPrint;
|
||||
|
||||
if (is_array($actioncode)) {
|
||||
foreach ($actioncode as $code) {
|
||||
$sql2 = addMailingEventTypeSQL($code, $objcon, $filterobj);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user