dolibarr 23.0.3
triggerhistory_card.php
1<?php
2/* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
3 * Copyright (C) 2024-2025 Frédéric France <frederic.france@free.fr>
4 * Copyright (C) 2025 Alice Adminson <myemail@mycompany.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 */
19
27// General defined Options
28//if (! defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN', '1'); // Force use of CSRF protection with tokens even for GET
29//if (! defined('MAIN_AUTHENTICATION_MODE')) define('MAIN_AUTHENTICATION_MODE', 'aloginmodule'); // Force authentication handler
30//if (! defined('MAIN_LANG_DEFAULT')) define('MAIN_LANG_DEFAULT', 'auto'); // Force LANG (language) to a particular value
31//if (! defined('MAIN_SECURITY_FORCECSP')) define('MAIN_SECURITY_FORCECSP', 'none'); // Disable all Content Security Policies
32//if (! defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1'); // Disable browser notification
33//if (! defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
34//if (! defined('NOLOGIN')) define('NOLOGIN', '1'); // Do not use login - if this page is public (can be called outside logged session). This includes the NOIPCHECK too.
35//if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); // Do not load ajax.lib.php library
36//if (! defined('NOREQUIREDB')) define('NOREQUIREDB', '1'); // Do not create database handler $db
37//if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); // Do not load html.form.class.php
38//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); // Do not load and show top and left menu
39//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1'); // Do not load object $mysoc
40//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN', '1'); // Do not load object $langs
41//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER', '1'); // Do not load object $user
42//if (! defined('NOSCANGETFORINJECTION')) define('NOSCANGETFORINJECTION', '1'); // Do not check injection attack on GET parameters
43//if (! defined('NOSCANPOSTFORINJECTION')) define('NOSCANPOSTFORINJECTION', '1'); // Do not check injection attack on POST parameters
44//if (! defined('NOSESSION')) define('NOSESSION', '1'); // On CLI mode, no need to use web sessions
45//if (! defined('NOSTYLECHECK')) define('NOSTYLECHECK', '1'); // Do not check style html tag into posted data
46//if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Do not roll the Anti CSRF token (used if MAIN_SECURITY_CSRF_WITH_TOKEN is on)
47
48
49// Load Dolibarr environment
50require '../main.inc.php';
51require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
52require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
53require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
54dol_include_once('/webhook/class/triggerhistory.class.php');
55dol_include_once('/webhook/lib/webhook_triggerhistory.lib.php');
56
66// Load translation files required by the page
67$langs->loadLangs(array("webhook@webhook", "other", "admin"));
68
69// Get parameters
70$id = GETPOSTINT('id');
71$ref = GETPOST('ref', 'alpha');
72$lineid = GETPOSTINT('lineid');
73
74$action = GETPOST('action', 'aZ09');
75$confirm = GETPOST('confirm', 'alpha');
76$cancel = GETPOST('cancel', 'alpha');
77$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : str_replace('_', '', basename(dirname(__FILE__)).basename(__FILE__, '.php')); // To manage different context of search
78$backtopage = GETPOST('backtopage', 'alpha'); // if not set, a default page will be used
79$backtopageforcancel = GETPOST('backtopageforcancel', 'alpha'); // if not set, $backtopage will be used
80$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
81$dol_openinpopup = GETPOST('dol_openinpopup', 'aZ09');
82
83// Initialize a technical objects
84$object = new TriggerHistory($db);
85$extrafields = new ExtraFields($db);
86$diroutputmassaction = $conf->webhook->dir_output.'/temp/massgeneration/'.$user->id;
87$hookmanager->initHooks(array($object->element.'card', 'globalcard')); // Note that conf->hooks_modules contains array
88$soc = null;
89
90// Fetch optionals attributes and labels
91$extrafields->fetch_name_optionals_label($object->table_element);
92
93
94$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
95
96// Initialize array of search criteria
97$search_all = trim(GETPOST("search_all", 'alpha'));
98$search = array();
99foreach ($object->fields as $key => $val) {
100 if (GETPOST('search_'.$key, 'alpha')) {
101 $search[$key] = GETPOST('search_'.$key, 'alpha');
102 }
103}
104
105if (empty($action) && empty($id) && empty($ref)) {
106 $action = 'view';
107}
108
109// Load object
110include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be 'include', not 'include_once'.
111
112// There is several ways to check permission.
113// Set $enablepermissioncheck to 1 to enable a minimum low level of checks
114$permissiontoread = $permissiontoadd = $permissiontodelete = $permissionnote = $permissiondellink = (!empty($user->admin) ? 1 : 0);
115
116$upload_dir = $conf->webhook->multidir_output[!empty($object->entity) ? $object->entity : 1].'/triggerhistory';
117
118// Security check (enable the most restrictive one)
119//if ($user->socid > 0) accessforbidden();
120//if ($user->socid > 0) $socid = $user->socid;
121//$isdraft = (isset($object->status) && ($object->status == $object::STATUS_DRAFT) ? 1 : 0);
122//restrictedArea($user, $object->module, $object, $object->table_element, $object->element, 'fk_soc', 'rowid', $isdraft);
123if (!isModEnabled($object->module)) {
124 accessforbidden("Module ".$object->module." not enabled");
125}
126if (!$permissiontoread) {
128}
129
130$error = 0;
131
132
133/*
134 * Actions
135 */
136
137$parameters = array();
138$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
139if ($reshook < 0) {
140 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
141}
142
143if (empty($reshook)) {
144 $backurlforlist = dol_buildpath('/webhook/history_list.php', 1);
145
146 if (empty($backtopage) || ($cancel && empty($id))) {
147 if (empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) {
148 if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) {
149 $backtopage = $backurlforlist;
150 } else {
151 $backtopage = dol_buildpath('/webhook/history_card.php', 1).'?id='.((!empty($id) && $id > 0) ? $id : '__ID__');
152 }
153 }
154 }
155
156 $triggermodname = 'WEBHOOK_MYOBJECT_MODIFY'; // Name of trigger action code to execute when we modify record
157
158 // Actions cancel, add, update, update_extras, confirm_validate, confirm_delete, confirm_deleteline, confirm_clone, confirm_close, confirm_setdraft, confirm_reopen
159 include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php';
160
161 // Actions when linking object each other
162 include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php';
163
164 // Actions when printing a doc from card
165 include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
166
167 // Action to move up and down lines of object
168 //include DOL_DOCUMENT_ROOT.'/core/actions_lineupdown.inc.php';
169
170 // Action to build doc
171 include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
172
173 if ($action == 'set_thirdparty' && $permissiontoadd) {
174 $object->setValueFrom('fk_soc', GETPOSTINT('fk_soc'), '', null, 'date', '', $user, $triggermodname);
175 }
176 if ($action == 'classin' && $permissiontoadd) {
177 $object->setProject(GETPOSTINT('projectid'));
178 }
179
180 // Actions to send emails
181 $triggersendname = 'WEBHOOK_MYOBJECT_SENTBYMAIL';
182 $autocopy = 'MAIN_MAIL_AUTOCOPY_MYOBJECT_TO';
183 $trackid = 'triggerhistory'.$object->id;
184 include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
185}
186
187
188
189
190/*
191 * View
192 */
193
194$form = new Form($db);
195$formfile = new FormFile($db);
196$formproject = new FormProjets($db);
197
198$title = $langs->trans("TriggerHistory")." - ".$langs->trans('Card');
199//$title = $object->ref." - ".$langs->trans('Card');
200if ($action == 'create') {
201 $title = $langs->trans("NewObject", $langs->transnoentitiesnoconv("TriggerHistory"));
202}
203$help_url = '';
204
205llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-webhook page-card');
206
207// Example : Adding jquery code
208// print '<script type="text/javascript">
209// jQuery(document).ready(function() {
210// function init_myfunc()
211// {
212// jQuery("#myid").removeAttr(\'disabled\');
213// jQuery("#myid").attr(\'disabled\',\'disabled\');
214// }
215// init_myfunc();
216// jQuery("#mybutton").click(function() {
217// init_myfunc();
218// });
219// });
220// </script>';
221
222
223// Part to create
224if ($action == 'create') {
225 if (empty($permissiontoadd)) {
226 accessforbidden('NotEnoughPermissions', 0, 1);
227 }
228
229 print load_fiche_titre($title, '', $object->picto);
230
231 print '<form method="POST" action="'.dolBuildUrl($_SERVER["PHP_SELF"]).'">';
232 print '<input type="hidden" name="token" value="'.newToken().'">';
233 print '<input type="hidden" name="action" value="add">';
234 if ($backtopage) {
235 print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
236 }
237 if ($backtopageforcancel) {
238 print '<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.'">';
239 }
240 if ($dol_openinpopup) {
241 print '<input type="hidden" name="dol_openinpopup" value="'.$dol_openinpopup.'">';
242 }
243
244 print dol_get_fiche_head(array(), '');
245
246
247 print '<table class="border centpercent tableforfieldcreate">'."\n";
248
249 // Common attributes
250 include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_add.tpl.php';
251
252 // Other attributes
253 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php';
254
255 print '</table>'."\n";
256
257 print dol_get_fiche_end();
258
259 print $form->buttonsSaveCancel("Create");
260
261 print '</form>';
262
263 //dol_set_focus('input[name="ref"]');
264}
265
266// Part to edit record
267if (($id || $ref) && $action == 'edit') {
268 print load_fiche_titre($langs->trans(""), '', $object->picto);
269
270 print '<form method="POST" action="'.dolBuildUrl($_SERVER["PHP_SELF"]).'">';
271 print '<input type="hidden" name="token" value="'.newToken().'">';
272 print '<input type="hidden" name="action" value="update">';
273 print '<input type="hidden" name="id" value="'.$object->id.'">';
274 if ($backtopage) {
275 print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
276 }
277 if ($backtopageforcancel) {
278 print '<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.'">';
279 }
280
281 print dol_get_fiche_head();
282
283 print '<table class="border centpercent tableforfieldedit">'."\n";
284
285 // Common attributes
286 include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_edit.tpl.php';
287
288 // Other attributes
289 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_edit.tpl.php';
290
291 print '</table>';
292
293 print dol_get_fiche_end();
294
295 print $form->buttonsSaveCancel();
296
297 print '</form>';
298}
299
300// Part to show record
301if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'create'))) {
302 $head = triggerhistoryPrepareHead($object);
303
304 print dol_get_fiche_head($head, 'card', $langs->trans(""), -1, $object->picto, 0, '', '', 0, '', 1);
305
306 $formconfirm = '';
307
308 // Confirmation to delete (using preloaded confirm popup)
309 if ($action == 'delete' || ($conf->use_javascript_ajax && empty($conf->dol_use_jmobile))) {
310 $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteTriggereHistoryRecord'), $langs->trans('ConfirmDeleteObject'), 'confirm_delete', '', 0, 'action-delete');
311 }
312 // Confirmation to delete line
313 if ($action == 'deleteline') {
314 $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_deleteline', '', 0, 1);
315 }
316
317 // Clone confirmation
318 if ($action == 'clone') {
319 // Create an array for form
320 $formquestion = array();
321 $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneAsk', $object->ref), 'confirm_clone', $formquestion, 'yes', 1);
322 }
323
324 // Confirmation of action xxxx (You can use it for xxx = 'close', xxx = 'reopen', ...)
325 // if ($action == 'xxx') {
326 // $text = $langs->trans('ConfirmActionXxx', $object->ref);
327 // if (isModEnabled('notification')) {
328 // require_once DOL_DOCUMENT_ROOT . '/core/class/notify.class.php';
329 // $notify = new Notify($db);
330 // $text .= '<br>';
331 // $text .= $notify->confirmMessage('MYOBJECT_CLOSE', $object->socid, $object);
332 // }
333
334 // $formquestion = array();
335
336 // $forcecombo=0;
337 // if ($conf->browser->name == 'ie') $forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy
338 // $formquestion = array(
339 // // 'text' => $langs->trans("ConfirmClone"),
340 // // array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1),
341 // // array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1),
342 // // array('type' => 'other', 'name' => 'idwarehouse', 'label' => $langs->trans("SelectWarehouseForStockDecrease"), 'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse')?GETPOST('idwarehouse'):'ifone', 'idwarehouse', '', 1, 0, 0, '', 0, $forcecombo))
343 // );
344 // $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('XXX'), $text, 'confirm_xxx', $formquestion, 0, 1, 220);
345 // }
346
347 // Call Hook formConfirm
348 $parameters = array('formConfirm' => $formconfirm, 'lineid' => $lineid);
349 $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
350 if (empty($reshook)) {
351 $formconfirm .= $hookmanager->resPrint;
352 } elseif ($reshook > 0) {
353 $formconfirm = $hookmanager->resPrint;
354 }
355
356 // Print form confirm
357 print $formconfirm;
358
359
360 // Object card
361 // ------------------------------------------------------------
362 $linkback = '<a href="'.dol_buildpath('/webhook/triggerhistory_list.php', 1).'?restore_lastsearch_values=1&mode=modulesetup'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
363
364 $morehtmlref = '<div class="refidno">';
365 /*
366 // Ref customer
367 $morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, $usercancreate, 'string', '', 0, 1);
368 $morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $usercancreate, 'string'.(getDolGlobalInt('THIRDPARTY_REF_INPUT_SIZE') ? ':'.getDolGlobalInt('THIRDPARTY_REF_INPUT_SIZE') : ''), '', null, null, '', 1);
369 // Thirdparty
370 $morehtmlref .= '<br>'.$object->thirdparty->getNomUrl(1, 'customer');
371 if (!getDolGlobalInt('MAIN_DISABLE_OTHER_LINK') && $object->thirdparty->id > 0) {
372 $morehtmlref .= ' (<a href="'.DOL_URL_ROOT.'/commande/list.php?socid='.$object->thirdparty->id.'&search_societe='.urlencode($object->thirdparty->name).'">'.$langs->trans("OtherOrders").'</a>)';
373 }
374 // Project
375 if (isModEnabled('project')) {
376 $langs->load("projects");
377 $morehtmlref .= '<br>';
378 if ($permissiontoadd) {
379 $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"');
380 if ($action != 'classify') {
381 $morehtmlref .= '<a class="editfielda" href="'.dolBuildUrl($_SERVER['PHP_SELF'], ['action' => 'classify', 'id' => $object->id], true).'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> ';
382 }
383 $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300');
384 } else {
385 if (!empty($object->fk_project)) {
386 $proj = new Project($db);
387 $proj->fetch($object->fk_project);
388 $morehtmlref .= $proj->getNomUrl(1);
389 if ($proj->title) {
390 $morehtmlref .= '<span class="opacitymedium"> - '.dol_escape_htmltag($proj->title).'</span>';
391 }
392 }
393 }
394 }
395 */
396 $morehtmlref .= '</div>';
397
398
399 dol_banner_tab($object, 'id', $linkback, 1, 'rowid', '', $morehtmlref);
400
401
402 print '<div class="fichecenter">';
403 print '<div class="fichehalfleft">';
404 print '<div class="underbanner clearboth"></div>';
405 print '<table class="border centpercent tableforfield">'."\n";
406
407 // Common attributes
408 //$keyforbreak='fieldkeytoswitchonsecondcolumn'; // We change column just before this field
409 //unset($object->fields['fk_project']); // Hide field already shown in banner
410 //unset($object->fields['fk_soc']); // Hide field already shown in banner
411 include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php';
412
413 // Other attributes. Fields from hook formObjectOptions and Extrafields.
414 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
415
416 print '</table>';
417 print '</div>';
418 print '</div>';
419
420 print '<div class="clearboth"></div>';
421
422 print dol_get_fiche_end();
423
424
425 /*
426 * Lines
427 */
428
429 if (!empty($object->table_element_line)) {
430 // Show object lines
431 $result = $object->getLinesArray();
432
433 print ' <form name="addproduct" id="addproduct" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.(($action != 'editline') ? '' : '#line_'.GETPOSTINT('lineid')).'" method="POST">
434 <input type="hidden" name="token" value="' . newToken().'">
435 <input type="hidden" name="action" value="' . (($action != 'editline') ? 'addline' : 'updateline').'">
436 <input type="hidden" name="mode" value="">
437 <input type="hidden" name="page_y" value="">
438 <input type="hidden" name="id" value="' . $object->id.'">
439 ';
440
441 if (!empty($conf->use_javascript_ajax) && $object->status == 0) {
442 include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php';
443 }
444
445 print '<div class="div-table-responsive-no-min">';
446 if (!empty($object->lines) || ($object->status == $object::STATUS_ERROR && $permissiontoadd && $action != 'selectlines' && $action != 'editline')) {
447 print '<table id="tablelines" class="noborder noshadow" width="100%">';
448 }
449
450 if (!empty($object->lines)) {
451 $object->printObjectLines($action, $mysoc, null, GETPOSTINT('lineid'), 1);
452 }
453
454 // Form to add new line
455 if ($object->status == 0 && $permissiontoadd && $action != 'selectlines') {
456 if ($action != 'editline') {
457 // Add products/services form
458
459 $parameters = array();
460 $reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
461 if ($reshook < 0) {
462 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
463 }
464 if (empty($reshook)) {
465 $object->formAddObjectLine(1, $mysoc, $soc);
466 }
467 }
468 }
469
470 if (!empty($object->lines) || ($object->status == $object::STATUS_ERROR && $permissiontoadd && $action != 'selectlines' && $action != 'editline')) {
471 print '</table>';
472 }
473 print '</div>';
474
475 print "</form>\n";
476 }
477
478
479 // Buttons for actions
480
481 if ($action != 'presend' && $action != 'editline') {
482 print '<div class="tabsAction">'."\n";
483 $parameters = array();
484 $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
485 if ($reshook < 0) {
486 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
487 }
488
489 if (empty($reshook)) {
490 /*// Send
491 if (empty($user->socid)) {
492 print dolGetButtonAction('', $langs->trans('SendMail'), 'email', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&token='.newToken().'&mode=init#formmailbeforetitle');
493 }
494
495 // Back to draft
496 if ($object->status == $object::STATUS_SUCCESS) {
497 print dolGetButtonAction('', $langs->trans('SetToDraft'), 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=confirm_setdraft&confirm=yes&token='.newToken(), '', $permissiontoadd);
498 }*/
499
500 // Modify
501 print dolGetButtonAction('', $langs->trans('Modify'), 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit&token='.newToken(), '', $permissiontoadd);
502
503 /*// Validate
504 if ($object->status == $object::STATUS_ERROR) {
505 if (empty($object->table_element_line) || (is_array($object->lines) && count($object->lines) > 0)) {
506 print dolGetButtonAction('', $langs->trans('Validate'), 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=confirm_validate&confirm=yes&token='.newToken(), '', $permissiontoadd);
507 } else {
508 $langs->load("errors");
509 print dolGetButtonAction($langs->trans("ErrorAddAtLeastOneLineFirst"), $langs->trans("Validate"), 'default', '#', '', 0);
510 }
511 }
512
513 // Clone
514 if ($permissiontoadd) {
515 print dolGetButtonAction('', $langs->trans('ToClone'), 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.(!empty($object->socid) ? '&socid='.$object->socid : '').'&action=clone&token='.newToken(), '', $permissiontoadd);
516 }
517
518 // Disable / Enable
519 if ($permissiontoadd) {
520 if ($object->status == $object::STATUS_ENABLED) {
521 print dolGetButtonAction('', $langs->trans('Disable'), 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=disable&token='.newToken(), '', $permissiontoadd);
522 } else {
523 print dolGetButtonAction('', $langs->trans('Enable'), 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=enable&token='.newToken(), '', $permissiontoadd);
524 }
525 }
526 if ($permissiontoadd) {
527 if ($object->status == $object::STATUS_VALIDATED) {
528 print dolGetButtonAction('', $langs->trans('Cancel'), 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=close&token='.newToken(), '', $permissiontoadd);
529 } else {
530 print dolGetButtonAction('', $langs->trans('Re-Open'), 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=reopen&token='.newToken(), '', $permissiontoadd);
531 }
532 }
533 */
534
535 // Delete (with preloaded confirm popup)
536 $deleteUrl = $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken();
537 $buttonId = 'action-delete-no-ajax';
538 if ($conf->use_javascript_ajax && empty($conf->dol_use_jmobile)) { // We can use preloaded confirm if not jmobile
539 $deleteUrl = '';
540 $buttonId = 'action-delete';
541 }
542 $params = array();
543 print dolGetButtonAction('', $langs->trans("Delete"), 'delete', $deleteUrl, $buttonId, $permissiontodelete, $params);
544 }
545 print '</div>'."\n";
546 }
547
548
549 // Select mail models is same action as presend
550 if (GETPOST('modelselected')) {
551 $action = 'presend';
552 }
553
554 if ($action != 'presend') {
555 print '<div class="fichecenter"><div class="fichehalfleft">';
556 print '<a name="builddoc"></a>'; // ancre
557
558 $includedocgeneration = 0;
559
560 // Show links to link elements
561 $tmparray = $form->showLinkToObjectBlock($object, array(), array('triggerhistory'), 1);
562 if (is_array($tmparray)) {
563 $linktoelem = $tmparray['linktoelem'];
564 $htmltoenteralink = $tmparray['htmltoenteralink'];
565 print $htmltoenteralink;
566 $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
567 } else {
568 // backward compatibility
569 $somethingshown = $form->showLinkedObjectBlock($object, $tmparray);
570 }
571
572 print '</div><div class="fichehalfright">';
573
574 $MAXEVENT = 10;
575
576 $morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-bars imgforviewmode', dol_buildpath('/webhook/history_agenda.php', 1).'?id='.$object->id);
577
578 print '</div></div>';
579 }
580
581 // Presend form
582 $modelmail = 'triggerhistory';
583 $defaulttopic = 'InformationMessage';
584 $diroutput = $conf->webhook->dir_output;
585 $trackid = 'triggerhistory'.$object->id;
586
587 include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php';
588}
589
590// End of page
591llxFooter();
592$db->close();
$id
Support class for third parties, contacts, members, users or resources.
Definition account.php:47
if(! $sortfield) if(! $sortorder) $object
Definition account.php:100
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
Definition wrapper.php:91
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Definition wrapper.php:73
Class to manage standard extra fields.
Class to offer components to list and upload files.
Class to manage generation of HTML components Only common components must be here.
Class to manage building of HTML components.
global $mysoc
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
Show tabs of a record.
dolGetButtonTitle($label, $helpText='', $iconClass='fa fa-file', $url='', $id='', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
if(!function_exists( 'dol_getprefix')) dol_include_once($relpath, $classname='')
Make an include_once using default root and alternate root if it fails.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
dolGetButtonAction($label, $text='', $actionType='default', $url='', $id='', $userRight=1, $params=array())
Function dolGetButtonAction.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
isModEnabled($module)
Is Dolibarr module enabled.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.
triggerhistoryPrepareHead($object)
Prepare array of tabs for.