25 require
'../main.inc.php';
26 require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
27 require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
28 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
29 require_once DOL_DOCUMENT_ROOT.
'/webhook/class/target.class.php';
30 require_once DOL_DOCUMENT_ROOT.
'/webhook/lib/webhook_target.lib.php';
34 $langs->loadLangs(array(
'other'));
39 $action =
GETPOST(
'action',
'aZ09');
40 $cancel =
GETPOST(
'cancel',
'aZ09');
41 $backtopage =
GETPOST(
'backtopage',
'alpha');
43 if (
GETPOST(
'actioncode',
'array')) {
44 $actioncode =
GETPOST(
'actioncode',
'array', 3);
45 if (!count($actioncode)) {
49 $actioncode =
GETPOST(
"actioncode",
"alpha", 3) ?
GETPOST(
"actioncode",
"alpha", 3) : (
GETPOST(
"actioncode") ==
'0' ?
'0' : (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT) ?
'' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT));
52 $search_agenda_label =
GETPOST(
'search_agenda_label');
54 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
55 $sortfield =
GETPOST(
'sortfield',
'aZ09comma');
56 $sortorder =
GETPOST(
'sortorder',
'aZ09comma');
58 if (empty($page) || $page == -1) {
62 $offset = $limit * $page;
63 $pageprev = $page - 1;
64 $pagenext = $page + 1;
66 $sortfield =
'a.datep,a.id';
69 $sortorder =
'DESC,DESC';
75 $diroutputmassaction = $conf->webhook->dir_output.
'/temp/massgeneration/'.$user->id;
76 $hookmanager->initHooks(array(
'targetagenda',
'globalcard'));
79 $extrafields->fetch_name_optionals_label($object->table_element);
82 include DOL_DOCUMENT_ROOT.
'/core/actions_fetchobject.inc.php';
83 if ($id > 0 || !empty($ref)) {
84 $upload_dir = $conf->webhook->multidir_output[!empty($object->entity) ? $object->entity : $conf->entity].
"/".$object->id;
89 $enablepermissioncheck = 0;
90 if ($enablepermissioncheck) {
91 $permissiontoread = $user->rights->webhook->target->read;
92 $permissiontoadd = $user->rights->webhook->target->write;
94 $permissiontoread = 1;
112 $parameters = array(
'id'=>$id);
113 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
118 if (empty($reshook)) {
120 if (
GETPOST(
'cancel',
'alpha') && !empty($backtopage)) {
121 header(
"Location: ".$backtopage);
126 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
128 $search_agenda_label =
'';
140 if ($object->id > 0) {
141 $title = $langs->trans(
"Agenda");
147 $langs->load(
"mails");
152 print
dol_get_fiche_head($head,
'agenda', $langs->trans(
"Target"), -1, $object->picto);
156 $linkback =
'<a href="'.dol_buildpath(
'/webhook/target_list.php', 1).
'?restore_lastsearch_values=1'.(!empty($socid) ?
'&socid='.$socid :
'').
'">'.$langs->trans(
"BackToList").
'</a>';
158 $morehtmlref =
'<div class="refidno">';
195 $morehtmlref .=
'</div>';
198 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
200 print
'<div class="fichecenter">';
201 print
'<div class="underbanner clearboth"></div>';
203 $object->info($object->id);
214 $objthirdparty = $object;
215 $objcon =
new stdClass();
217 $out =
'&origin='.urlencode($object->element.
'@'.$object->module).
'&originid='.urlencode($object->id);
218 $urlbacktopage = $_SERVER[
'PHP_SELF'].
'?id='.$object->id;
219 $out .=
'&backtopage='.urlencode($urlbacktopage);
220 $permok = $user->rights->agenda->myactions->create;
221 if ((!empty($objthirdparty->id) || !empty($objcon->id)) && $permok) {
223 if (get_class($objthirdparty) ==
'Societe') {
224 $out .=
'&socid='.urlencode($objthirdparty->id);
226 $out .= (!empty($objcon->id) ?
'&contactid='.urlencode($objcon->id) :
'').
'&percentage=-1';
233 print
'<div class="tabsAction">';
236 if (!empty($user->rights->agenda->myactions->create) || !empty($user->rights->agenda->allactions->create)) {
237 print
'<a class="butAction" href="'.DOL_URL_ROOT.
'/comm/action/card.php?action=create'.$out.
'">'.$langs->trans(
"AddAction").
'</a>';
239 print
'<a class="butActionRefused classfortooltip" href="#">'.$langs->trans(
"AddAction").
'</a>';
245 if (
isModEnabled(
'agenda') && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) {
246 $param =
'&id='.$object->id.
'&socid='.$socid;
247 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
248 $param .=
'&contextpage='.urlencode($contextpage);
250 if ($limit > 0 && $limit != $conf->liste_limit) {
251 $param .=
'&limit='.urlencode($limit);
259 $filters[
'search_agenda_label'] = $search_agenda_label;
262 show_actions_done($conf, $langs, $db, $object,
null, 0, $actioncode,
'', $filters, $sortfield, $sortorder, $object->module);