Merge pull request #22697 from hector-07/develop

NEW: Add agenda hooks
This commit is contained in:
Laurent Destailleur
2022-11-01 23:28:49 +01:00
committed by GitHub
4 changed files with 45 additions and 0 deletions

View File

@@ -2148,6 +2148,15 @@ if ($id > 0) {
$linkback .= '<span class="hideonsmartphone">'.$langs->trans("ViewPerUser").'</span>';
$linkback .= '</a>';
// Add more views from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('addCalendarView', $parameters, $object, $action);
if (empty($reshook)) {
$linkback .= $hookmanager->resPrint;
} elseif ($reshook > 1) {
$linkback = $hookmanager->resPrint;
}
//$linkback.=$out;
$morehtmlref = '<div class="refidno">';

View File

@@ -63,6 +63,9 @@ if ($id > 0) {
$object->fetch_thirdparty();
}
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('actioncard', 'globalcard'));
// Get parameters
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'aZ09comma');
@@ -155,6 +158,15 @@ if ($object->id > 0) {
$out .= '</li><li class="noborder litext">'.img_picto($langs->trans("ViewDay"), 'object_calendarday', 'class="hideonsmartphone pictoactionview"');
$out .= '<a href="'.DOL_URL_ROOT.'/comm/action/index.php?mode=show_day&year='.dol_print_date($object->datep, '%Y').'&month='.dol_print_date($object->datep, '%m').'&day='.dol_print_date($object->datep, '%d').'">'.$langs->trans("ViewDay").'</a>';
// Add more views from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('addCalendarView', $parameters, $object, $action);
if (empty($reshook)) {
$out .= $hookmanager->resPrint;
} elseif ($reshook > 1) {
$out = $hookmanager->resPrint;
}
$linkback .= $out;
$morehtmlref = '<div class="refidno">';

View File

@@ -39,6 +39,9 @@ $langs->load("commercial");
$id = GETPOST('id', 'int');
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('actioncard', 'globalcard'));
// Security check
if ($user->socid > 0) {
$action = '';
@@ -83,6 +86,15 @@ $out .= '<a href="'.DOL_URL_ROOT.'/comm/action/index.php?mode=show_day&year='.do
$out .= '</li><li class="noborder litext">'.img_picto($langs->trans("ViewDay"), 'object_calendarday', 'class="hideonsmartphone pictoactionview"');
$out .= '<a href="'.DOL_URL_ROOT.'/comm/action/index.php?mode=show_day&year='.dol_print_date($object->datep, '%Y').'&month='.dol_print_date($object->datep, '%m').'&day='.dol_print_date($object->datep, '%d').'">'.$langs->trans("ViewDay").'</a>';
// Add more views from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('addCalendarView', $parameters, $object, $action);
if (empty($reshook)) {
$out .= $hookmanager->resPrint;
} elseif ($reshook > 1) {
$out = $hookmanager->resPrint;
}
$linkback .= $out;
$morehtmlref = '<div class="refidno">';

View File

@@ -324,6 +324,9 @@ if (!$ret) {
if (($element_id || $element_ref) && $element == 'action') {
require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php';
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('actioncard', 'globalcard'));
$act = fetchObjectByElement($element_id, $element, $element_ref);
if (is_object($act)) {
$head = actions_prepare_head($act);
@@ -344,6 +347,15 @@ if (!$ret) {
$out .= '</li><li class="noborder litext">'.img_picto($langs->trans("ViewDay"), 'object_calendarday', 'class="hideonsmartphone pictoactionview"');
$out .= '<a href="'.DOL_URL_ROOT.'/comm/action/index.php?mode=show_day&year='.dol_print_date($act->datep, '%Y').'&month='.dol_print_date($act->datep, '%m').'&day='.dol_print_date($act->datep, '%d').'">'.$langs->trans("ViewDay").'</a>';
// Add more views from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('addCalendarView', $parameters, $object, $action);
if (empty($reshook)) {
$out .= $hookmanager->resPrint;
} elseif ($reshook > 1) {
$out = $hookmanager->resPrint;
}
$linkback .= $out;
$morehtmlref = '<div class="refidno">';