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';
67$langs->loadLangs(array(
"webhook@webhook",
"other",
"admin"));
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'));
78$backtopage =
GETPOST(
'backtopage',
'alpha');
79$backtopageforcancel =
GETPOST(
'backtopageforcancel',
'alpha');
80$optioncss =
GETPOST(
'optioncss',
'aZ');
81$dol_openinpopup =
GETPOST(
'dol_openinpopup',
'aZ09');
86$diroutputmassaction = $conf->webhook->dir_output.
'/temp/massgeneration/'.$user->id;
87$hookmanager->initHooks(array(
$object->element.
'card',
'globalcard'));
91$extrafields->fetch_name_optionals_label(
$object->table_element);
94$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
97$search_all = trim(
GETPOST(
"search_all",
'alpha'));
99foreach (
$object->fields as $key => $val) {
100 if (
GETPOST(
'search_'.$key,
'alpha')) {
101 $search[$key] =
GETPOST(
'search_'.$key,
'alpha');
105if (empty($action) && empty($id) && empty($ref)) {
110include DOL_DOCUMENT_ROOT.
'/core/actions_fetchobject.inc.php';
114$permissiontoread = $permissiontoadd = $permissiontodelete = $permissionnote = $permissiondellink = (!empty($user->admin) ? 1 : 0);
116$upload_dir = $conf->webhook->multidir_output[!empty(
$object->entity) ?
$object->entity : 1].
'/triggerhistory';
126if (!$permissiontoread) {
137$parameters = array();
138$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
143if (empty($reshook)) {
144 $backurlforlist =
dol_buildpath(
'/webhook/history_list.php', 1);
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;
151 $backtopage =
dol_buildpath(
'/webhook/history_card.php', 1).
'?id='.((!empty($id) &&
$id > 0) ? $id :
'__ID__');
156 $triggermodname =
'WEBHOOK_MYOBJECT_MODIFY';
159 include DOL_DOCUMENT_ROOT.
'/core/actions_addupdatedelete.inc.php';
162 include DOL_DOCUMENT_ROOT.
'/core/actions_dellink.inc.php';
165 include DOL_DOCUMENT_ROOT.
'/core/actions_printing.inc.php';
171 include DOL_DOCUMENT_ROOT.
'/core/actions_builddoc.inc.php';
173 if ($action ==
'set_thirdparty' && $permissiontoadd) {
174 $object->setValueFrom(
'fk_soc',
GETPOSTINT(
'fk_soc'),
'',
null,
'date',
'', $user, $triggermodname);
176 if ($action ==
'classin' && $permissiontoadd) {
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';
194$form =
new Form($db);
198$title = $langs->trans(
"TriggerHistory").
" - ".$langs->trans(
'Card');
200if ($action ==
'create') {
201 $title = $langs->trans(
"NewObject", $langs->transnoentitiesnoconv(
"TriggerHistory"));
205llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-webhook page-card');
224if ($action ==
'create') {
225 if (empty($permissiontoadd)) {
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">';
235 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
237 if ($backtopageforcancel) {
238 print
'<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.
'">';
240 if ($dol_openinpopup) {
241 print
'<input type="hidden" name="dol_openinpopup" value="'.$dol_openinpopup.
'">';
247 print
'<table class="border centpercent tableforfieldcreate">'.
"\n";
250 include DOL_DOCUMENT_ROOT.
'/core/tpl/commonfields_add.tpl.php';
253 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_add.tpl.php';
255 print
'</table>'.
"\n";
259 print $form->buttonsSaveCancel(
"Create");
267if (($id || $ref) && $action ==
'edit') {
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.
'">';
275 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
277 if ($backtopageforcancel) {
278 print
'<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.
'">';
283 print
'<table class="border centpercent tableforfieldedit">'.
"\n";
286 include DOL_DOCUMENT_ROOT.
'/core/tpl/commonfields_edit.tpl.php';
289 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_edit.tpl.php';
295 print $form->buttonsSaveCancel();
301if (
$object->id > 0 && (empty($action) || ($action !=
'edit' && $action !=
'create'))) {
304 print
dol_get_fiche_head($head,
'card', $langs->trans(
""), -1,
$object->picto, 0,
'',
'', 0,
'', 1);
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');
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);
318 if ($action ==
'clone') {
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);
348 $parameters = array(
'formConfirm' => $formconfirm,
'lineid' => $lineid);
349 $reshook = $hookmanager->executeHooks(
'formConfirm', $parameters, $object, $action);
350 if (empty($reshook)) {
351 $formconfirm .= $hookmanager->resPrint;
352 } elseif ($reshook > 0) {
353 $formconfirm = $hookmanager->resPrint;
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>';
364 $morehtmlref =
'<div class="refidno">';
396 $morehtmlref .=
'</div>';
399 dol_banner_tab($object,
'id', $linkback, 1,
'rowid',
'', $morehtmlref);
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";
411 include DOL_DOCUMENT_ROOT.
'/core/tpl/commonfields_view.tpl.php';
414 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
420 print
'<div class="clearboth"></div>';
429 if (!empty(
$object->table_element_line)) {
431 $result =
$object->getLinesArray();
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.
'">
441 if (!empty($conf->use_javascript_ajax) &&
$object->status == 0) {
442 include DOL_DOCUMENT_ROOT.
'/core/tpl/ajaxrow.tpl.php';
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%">';
455 if (
$object->status == 0 && $permissiontoadd && $action !=
'selectlines') {
456 if ($action !=
'editline') {
459 $parameters = array();
460 $reshook = $hookmanager->executeHooks(
'formAddObjectLine', $parameters, $object, $action);
464 if (empty($reshook)) {
470 if (!empty(
$object->lines) || (
$object->status == $object::STATUS_ERROR && $permissiontoadd && $action !=
'selectlines' && $action !=
'editline')) {
481 if ($action !=
'presend' && $action !=
'editline') {
482 print
'<div class="tabsAction">'.
"\n";
483 $parameters = array();
484 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters, $object, $action);
489 if (empty($reshook)) {
501 print
dolGetButtonAction(
'', $langs->trans(
'Modify'),
'default', $_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=edit&token='.
newToken(),
'', $permissiontoadd);
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)) {
540 $buttonId =
'action-delete';
543 print
dolGetButtonAction(
'', $langs->trans(
"Delete"),
'delete', $deleteUrl, $buttonId, $permissiontodelete, $params);
550 if (
GETPOST(
'modelselected')) {
554 if ($action !=
'presend') {
555 print
'<div class="fichecenter"><div class="fichehalfleft">';
556 print
'<a name="builddoc"></a>';
558 $includedocgeneration = 0;
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);
569 $somethingshown = $form->showLinkedObjectBlock($object, $tmparray);
572 print
'</div><div class="fichehalfright">';
578 print
'</div></div>';
582 $modelmail =
'triggerhistory';
583 $defaulttopic =
'InformationMessage';
584 $diroutput = $conf->webhook->dir_output;
585 $trackid =
'triggerhistory'.$object->id;
587 include DOL_DOCUMENT_ROOT.
'/core/tpl/card_presend.tpl.php';
$id
Support class for third parties, contacts, members, users or resources.
if(! $sortfield) if(! $sortorder) $object
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
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.
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.