26 require
'../main.inc.php';
27 require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
28 require_once DOL_DOCUMENT_ROOT.
'/core/lib/agenda.lib.php';
29 require_once DOL_DOCUMENT_ROOT.
'/core/class/events.class.php';
31 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
32 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
33 include_once DOL_DOCUMENT_ROOT.
'/emailcollector/class/emailcollector.class.php';
34 include_once DOL_DOCUMENT_ROOT.
'/emailcollector/class/emailcollectorfilter.class.php';
35 include_once DOL_DOCUMENT_ROOT.
'/emailcollector/class/emailcollectoraction.class.php';
36 include_once DOL_DOCUMENT_ROOT.
'/emailcollector/lib/emailcollector.lib.php';
39 require DOL_DOCUMENT_ROOT.
'/includes/webklex/php-imap/vendor/autoload.php';
40 use Webklex\PHPIMAP\ClientManager;
41 use Webklex\PHPIMAP\Exceptions\ConnectionFailedException;
42 use Webklex\PHPIMAP\Exceptions\InvalidWhereQueryCriteriaException;
45 use OAuth\Common\Storage\DoliStorage;
46 use OAuth\Common\Consumer\Credentials;
56 $langs->loadLangs(array(
"admin",
"mails",
"other"));
61 $action =
GETPOST(
'action',
'aZ09');
62 $confirm =
GETPOST(
'confirm',
'alpha');
63 $cancel =
GETPOST(
'cancel',
'aZ09');
64 $contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'emailcollectorcard';
65 $backtopage =
GETPOST(
'backtopage',
'alpha');
67 $operationid =
GETPOST(
'operationid',
'int');
72 $diroutputmassaction = $conf->emailcollector->dir_output.
'/temp/massgeneration/'.$user->id;
73 $hookmanager->initHooks(array(
'emailcollectorcard'));
76 $extrafields->fetch_name_optionals_label($object->table_element);
78 $search_array_options = $extrafields->getOptionalsFromPost($object->table_element,
'',
'search_');
81 $search_all =
GETPOST(
"search_all",
'alpha');
83 foreach ($object->fields as $key => $val) {
84 if (
GETPOST(
'search_'.$key,
'alpha')) {
85 $search[$key] =
GETPOST(
'search_'.$key,
'alpha');
89 if (
GETPOST(
'saveoperation2')) {
90 $action =
'updateoperation';
92 if (empty($action) && empty($id) && empty($ref)) {
97 include DOL_DOCUMENT_ROOT.
'/core/actions_fetchobject.inc.php';
105 $permissionnote = $user->admin;
106 $permissiondellink = $user->admin;
107 $permissiontoadd = $user->admin;
116 $parameters = array();
117 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
123 if (empty($reshook)) {
126 $permissiontoadd = 1;
127 $permissiontodelete = 1;
128 if (empty($backtopage)) {
129 $backtopage = DOL_URL_ROOT.
'/admin/emailcollector_card.php?id='.($id > 0 ? $id :
'__ID__');
131 $backurlforlist = DOL_URL_ROOT.
'/admin/emailcollector_list.php';
134 include DOL_DOCUMENT_ROOT.
'/core/actions_addupdatedelete.inc.php';
137 include DOL_DOCUMENT_ROOT.
'/core/actions_dellink.inc.php';
140 include DOL_DOCUMENT_ROOT.
'/core/actions_printing.inc.php';
143 if (
GETPOST(
'addfilter',
'alpha')) {
145 $emailcollectorfilter->type =
GETPOST(
'filtertype',
'aZ09');
146 $emailcollectorfilter->rulevalue =
GETPOST(
'rulevalue',
'alpha');
147 $emailcollectorfilter->fk_emailcollector = $object->id;
148 $emailcollectorfilter->status = 1;
150 $result = $emailcollectorfilter->create($user);
153 $object->fetchFilters();
155 setEventMessages($emailcollectorfilter->errors, $emailcollectorfilter->error,
'errors');
159 if ($action ==
'deletefilter') {
161 $emailcollectorfilter->fetch(
GETPOST(
'filterid',
'int'));
162 if ($emailcollectorfilter->id > 0) {
163 $result = $emailcollectorfilter->delete($user);
165 $object->fetchFilters();
167 setEventMessages($emailcollectorfilter->errors, $emailcollectorfilter->error,
'errors');
172 if (
GETPOST(
'addoperation',
'alpha')) {
174 $emailcollectoroperation->type =
GETPOST(
'operationtype',
'aZ09');
175 $emailcollectoroperation->actionparam =
GETPOST(
'operationparam',
'restricthtml');
176 $emailcollectoroperation->fk_emailcollector = $object->id;
177 $emailcollectoroperation->status = 1;
178 $emailcollectoroperation->position = 50;
180 if ($emailcollectoroperation->type ==
'-1') {
182 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Operation")),
null,
'errors');
185 if (in_array($emailcollectoroperation->type, array(
'loadthirdparty',
'loadandcreatethirdparty'))
186 && empty($emailcollectoroperation->actionparam)) {
188 setEventMessages($langs->trans(
"ErrorAParameterIsRequiredForThisOperation"),
null,
'errors');
192 $result = $emailcollectoroperation->create($user);
195 $object->fetchActions();
198 setEventMessages($emailcollectoroperation->errors, $emailcollectoroperation->error,
'errors');
203 if ($action ==
'updateoperation') {
205 $emailcollectoroperation->fetch(
GETPOST(
'rowidoperation2',
'int'));
207 $emailcollectoroperation->actionparam =
GETPOST(
'operationparam2',
'alphawithlgt');
209 if (in_array($emailcollectoroperation->type, array(
'loadthirdparty',
'loadandcreatethirdparty'))
210 && empty($emailcollectoroperation->actionparam)) {
212 setEventMessages($langs->trans(
"ErrorAParameterIsRequiredForThisOperation"),
null,
'errors');
216 $result = $emailcollectoroperation->update($user);
219 $object->fetchActions();
222 setEventMessages($emailcollectoroperation->errors, $emailcollectoroperation->error,
'errors');
226 if ($action ==
'deleteoperation') {
228 $emailcollectoroperation->fetch(
GETPOST(
'operationid',
'int'));
229 if ($emailcollectoroperation->id > 0) {
230 $result = $emailcollectoroperation->delete($user);
232 $object->fetchActions();
234 setEventMessages($emailcollectoroperation->errors, $emailcollectoroperation->error,
'errors');
239 if ($action ==
'collecttest') {
242 $res = $object->doCollectOneCollector(1);
244 $debuginfo = $object->debuginfo;
247 $debuginfo = $object->debuginfo;
254 if ($action ==
'confirm_collect') {
257 $res = $object->doCollectOneCollector(0);
259 $debuginfo = $object->debuginfo;
262 $debuginfo = $object->debuginfo;
278 $help_url =
"EN:Module_EMail_Collector|FR:Module_Collecteur_de_courrier_électronique|ES:Module_EMail_Collector";
283 if ($action ==
'create') {
284 print
load_fiche_titre($langs->trans(
"NewEmailCollector", $langs->transnoentitiesnoconv(
"EmailCollector")));
286 print
'<form method="POST" action="'.$_SERVER[
"PHP_SELF"].
'">';
287 print
'<input type="hidden" name="token" value="'.newToken().
'">';
288 print
'<input type="hidden" name="action" value="add">';
289 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
293 print
'<table class="border centpercent tableforfield">'.
"\n";
298 include DOL_DOCUMENT_ROOT.
'/core/tpl/commonfields_add.tpl.php';
301 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_add.tpl.php';
303 print
'</table>'.
"\n";
307 print
$form->buttonsSaveCancel(
"Create");
313 if (($id || $ref) && $action ==
'edit') {
316 print
'<form method="POST" action="'.$_SERVER[
"PHP_SELF"].
'">';
317 print
'<input type="hidden" name="token" value="'.newToken().
'">';
318 print
'<input type="hidden" name="action" value="update">';
319 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
320 print
'<input type="hidden" name="id" value="'.$object->id.
'">';
324 print
'<table class="border centpercent tableforfield">'.
"\n";
327 include DOL_DOCUMENT_ROOT.
'/core/tpl/commonfields_edit.tpl.php';
330 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_edit.tpl.php';
336 print
$form->buttonsSaveCancel();
342 if ($object->id > 0 && (empty($action) || ($action !=
'edit' && $action !=
'create'))) {
343 $res = $object->fetch_optionals();
345 $object->fetchFilters();
346 $object->fetchActions();
349 print
dol_get_fiche_head($head,
'card', $langs->trans(
"EmailCollector"), -1,
'email');
354 if ($action ==
'delete') {
355 $formconfirm =
$form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.$object->id, $langs->trans(
'DeleteEmailCollector'), $langs->trans(
'ConfirmDeleteEmailCollector'),
'confirm_delete',
'', 0, 1);
359 if ($action ==
'clone') {
361 $formquestion = array();
362 $formconfirm =
$form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.$object->id, $langs->trans(
'ToClone'), $langs->trans(
'ConfirmCloneEmailCollector', $object->ref),
'confirm_clone', $formquestion,
'yes', 1);
366 if ($action ==
'collect') {
367 $formquestion = array();
368 $formconfirm =
$form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.$object->id, $langs->trans(
'EmailCollectorConfirmCollectTitle'), $langs->trans(
'EmailCollectorConfirmCollect'),
'confirm_collect', $formquestion, 0, 1, 220);
373 $reshook = $hookmanager->executeHooks(
'formConfirm', $parameters, $object, $action);
374 if (empty($reshook)) {
376 } elseif ($reshook > 0) {
385 $linkback =
'<a href="'.DOL_URL_ROOT.
'/admin/emailcollector_list.php?restore_lastsearch_values=1'.(!empty($socid) ?
'&socid='.$socid :
'').
'">'.$langs->trans(
"BackToList").
'</a>';
387 $morehtmlref =
'<div class="refidno">';
388 $morehtmlref .=
'</div>';
390 $morehtml = $langs->trans(
"NbOfEmailsInInbox").
' : ';
392 $sourcedir = $object->source_directory;
393 $targetdir = ($object->target_directory ? $object->target_directory :
'');
396 $connectstringserver =
'';
397 $connectstringsource =
'';
398 $connectstringtarget =
'';
400 if (function_exists(
'imap_open')) {
404 $connectstringserver = $object->getConnectStringIMAP($usessl);
406 if ($action ==
'scan') {
407 if (!empty($conf->global->MAIN_IMAP_USE_PHPIMAP)) {
408 if ($object->acces_type == 1) {
410 require_once DOL_DOCUMENT_ROOT.
'/core/lib/oauth.lib.php';
411 $keyforsupportedoauth2array = $object->oauth_service;
412 if (preg_match(
'/^.*-/', $keyforsupportedoauth2array)) {
413 $keyforprovider = preg_replace(
'/^.*-/',
'', $keyforsupportedoauth2array);
415 $keyforprovider =
'';
417 $keyforsupportedoauth2array = preg_replace(
'/-.*$/',
'', $keyforsupportedoauth2array);
418 $keyforsupportedoauth2array =
'OAUTH_'.$keyforsupportedoauth2array.
'_NAME';
420 $OAUTH_SERVICENAME = (empty($supportedoauth2array[$keyforsupportedoauth2array][
'name']) ?
'Unknown' : $supportedoauth2array[$keyforsupportedoauth2array][
'name'].($keyforprovider ?
'-'.$keyforprovider :
''));
422 require_once DOL_DOCUMENT_ROOT.
'/includes/OAuth/bootstrap.php';
426 $storage =
new DoliStorage($db, $conf);
429 $tokenobj = $storage->retrieveAccessToken($OAUTH_SERVICENAME);
436 if (is_object($tokenobj) && $expire) {
437 $credentials =
new Credentials(
442 $serviceFactory = new \OAuth\ServiceFactory();
443 $oauthname = explode(
'-', $OAUTH_SERVICENAME);
445 $apiService = $serviceFactory->createService($oauthname[0], $credentials, $storage, array());
447 $refreshtoken = $tokenobj->getRefreshToken();
448 $tokenobj = $apiService->refreshAccessToken($tokenobj);
449 $tokenobj->setRefreshToken($refreshtoken);
450 $storage->storeAccessToken($OAUTH_SERVICENAME, $tokenobj);
452 $tokenobj = $storage->retrieveAccessToken($OAUTH_SERVICENAME);
453 if (is_object($tokenobj)) {
454 $token = $tokenobj->getAccessToken();
456 $object->error =
"Token not found";
460 print $e->getMessage();
463 $cm =
new ClientManager();
464 $client = $cm->make([
465 'host' => $object->host,
466 'port' => $object->port,
467 'encryption' =>
'ssl',
468 'validate_cert' =>
true,
469 'protocol' =>
'imap',
470 'username' => $object->login,
471 'password' => $token,
472 'authentication' =>
"oauth",
476 $cm =
new ClientManager();
477 $client = $cm->make([
478 'host' => $object->host,
479 'port' => $object->port,
480 'encryption' =>
'ssl',
481 'validate_cert' =>
true,
482 'protocol' =>
'imap',
483 'username' => $object->login,
484 'password' => $object->password,
485 'authentication' =>
"login",
490 }
catch (ConnectionFailedException $e) {
491 print $e->getMessage();
494 $f = $client->getFolders(
false, $object->source_directory);
495 $nbemail = $f[0]->examine()[
"exists"];
496 $morehtml .= $nbemail;
501 $connectstringsource = $connectstringserver.$object->getEncodedUtf7($sourcedir);
505 $connectstringtarget = $connectstringserver.$object->getEncodedUtf7($targetdir);
508 $timeoutconnect = empty($conf->global->MAIN_USE_CONNECT_TIMEOUT) ? 5 : $conf->global->MAIN_USE_CONNECT_TIMEOUT;
509 $timeoutread = empty($conf->global->MAIN_USE_RESPONSE_TIMEOUT) ? 20 : $conf->global->MAIN_USE_RESPONSE_TIMEOUT;
511 dol_syslog(
"imap_open connectstring=".$connectstringsource.
" login=".$object->login.
" password=".$object->password.
" timeoutconnect=".$timeoutconnect.
" timeoutread=".$timeoutread);
513 $result1 = imap_timeout(IMAP_OPENTIMEOUT, $timeoutconnect);
514 $result2 = imap_timeout(IMAP_READTIMEOUT, $timeoutread);
515 $result3 = imap_timeout(IMAP_WRITETIMEOUT, 5);
516 $result4 = imap_timeout(IMAP_CLOSETIMEOUT, 5);
518 dol_syslog(
"result1=".$result1.
" result2=".$result2.
" result3=".$result3.
" result4=".$result4);
520 $connection = imap_open($connectstringsource, $object->login, $object->password);
524 print $e->getMessage();
528 $morehtml .=
'Failed to open IMAP connection '.$connectstringsource;
529 if (function_exists(
'imap_last_error')) {
530 $morehtml .=
'<br>'.imap_last_error();
535 dol_syslog(
"Imap connected. Now we call imap_num_msg()");
536 $morehtml .= imap_num_msg($connection);
541 imap_close($connection);
545 $morehtml .=
'<a class="flat" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=scan&token='.
newToken().
'">'.
img_picto(
'',
'refresh',
'class="paddingrightonly"').$langs->trans(
"Refresh").
'</a>';
548 $morehtml .=
$form->textwithpicto(
'',
'connect string '.$connectstringserver);
550 $morehtml .=
'IMAP functions not available on your PHP. ';
553 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref.
'<div class="refidno">'.$morehtml.
'</div>',
'', 0,
'',
'', 0,
'');
555 print
'<div class="fichecenter">';
556 print
'<div class="fichehalfleft">';
557 print
'<div class="underbanner clearboth"></div>';
558 print
'<table class="border centpercent tableforfield">'.
"\n";
562 include DOL_DOCUMENT_ROOT.
'/core/tpl/commonfields_view.tpl.php';
565 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
570 print
'<form method="POST" action="'.$_SERVER[
"PHP_SELF"].
'">';
571 print
'<input type="hidden" name="token" value="'.newToken().
'">';
572 print
'<input type="hidden" name="action" value="updatefiltersactions">';
573 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
574 print
'<input type="hidden" name="id" value="'.$object->id.
'">';
577 print
'<div class="div-table-responsive-no-min">';
578 print
'<table id="tablelineoffilters" class="noborder margintable noshadow">';
579 print
'<tr class="liste_titre nodrag nodrop">';
580 print
'<td>'.img_picto(
'',
'filter',
'class="pictofixedwidth opacitymedium"').$form->textwithpicto($langs->trans(
"Filters"), $langs->trans(
"EmailCollectorFilterDesc")).
'</td><td></td><td></td>';
583 print
'<tr class="oddeven nodrag nodrop">';
585 $arrayoftypes = array(
586 'from'=>array(
'label'=>
'MailFrom',
'data-placeholder'=>$langs->trans(
'SearchString')),
587 'to'=>array(
'label'=>
'MailTo',
'data-placeholder'=>$langs->trans(
'SearchString')),
588 'cc'=>array(
'label'=>
'Cc',
'data-placeholder'=>$langs->trans(
'SearchString')),
589 'bcc'=>array(
'label'=>
'Bcc',
'data-placeholder'=>$langs->trans(
'SearchString')),
590 'subject'=>array(
'label'=>
'Subject',
'data-placeholder'=>$langs->trans(
'SearchString')),
591 'body'=>array(
'label'=>
'Body',
'data-placeholder'=>$langs->trans(
'SearchString')),
598 'seen'=>array(
'label'=>
'AlreadyRead',
'data-noparam'=>1),
599 'unseen'=>array(
'label'=>
'NotRead',
'data-noparam'=>1),
600 'unanswered'=>array(
'label'=>
'Unanswered',
'data-noparam'=>1),
601 'answered'=>array(
'label'=>
'Answered',
'data-noparam'=>1),
602 'smaller'=>array(
'label'=>
'SmallerThan',
'data-placeholder'=>$langs->trans(
'NumberOfBytes')),
603 'larger'=>array(
'label'=>
'LargerThan',
'data-placeholder'=>$langs->trans(
'NumberOfBytes')),
605 'withtrackingid'=>array(
'label'=>
'WithDolTrackingID',
'data-noparam'=>1),
606 'withouttrackingid'=>array(
'label'=>
'WithoutDolTrackingID',
'data-noparam'=>1),
607 'withtrackingidinmsgid'=>array(
'label'=>
'WithDolTrackingIDInMsgId',
'data-noparam'=>1),
608 'withouttrackingidinmsgid'=>array(
'label'=>
'WithoutDolTrackingIDInMsgId',
'data-noparam'=>1),
610 'isnotanswer'=>array(
'label'=>
'IsNotAnAnswer',
'data-noparam'=>1),
611 'isanswer'=>array(
'label'=>
'IsAnAnswer',
'data-noparam'=>1)
613 print
$form->selectarray(
'filtertype', $arrayoftypes,
'', 1, 0, 0,
'', 1, 0, 0,
'',
'maxwidth300', 1,
'', 2);
617 print
'jQuery("#filtertype").change(function() {
618 console.log("We change a filter");
619 if (jQuery("#filtertype option:selected").attr("data-noparam")) {
620 jQuery("#rulevalue").attr("placeholder", "");
621 jQuery("#rulevalue").text(""); jQuery("#rulevalue").prop("disabled", true);
623 else { jQuery("#rulevalue").prop("disabled", false); }
624 jQuery("#rulevalue").attr("placeholder", (jQuery("#filtertype option:selected").attr("data-placeholder")));
632 print
'</script>'.
"\n";
635 print
'<input type="text" name="rulevalue" id="rulevalue">';
637 print
'<td class="right"><input type="submit" name="addfilter" id="addfilter" class="flat button small" value="'.$langs->trans(
"Add").
'"></td>';
640 foreach ($object->filters as $rulefilter) {
642 $rulefilterobj->fetch($rulefilter[
'id']);
644 print
'<tr class="oddeven">';
645 print
'<td title="'.dol_escape_htmltag($langs->trans(
"Filter").
': '.$rulefilter[
'type']).
'">';
646 print $langs->trans($arrayoftypes[$rulefilter[
'type']][
'label']);
648 print
'<td>'.$rulefilter[
'rulevalue'].
'</td>';
649 print
'<td class="right">';
650 print
' <a href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=deletefilter&token='.urlencode(
newToken()).
'&filterid='.$rulefilter[
'id'].
'">'.
img_delete().
'</a>';
659 print
'<div class="clearboth"></div><br>';
662 print
'<div class="div-table-responsive">';
663 print
'<table id="tablelines" class="noborder margintable noshadow">';
664 print
'<tr class="liste_titre nodrag nodrop">';
665 print
'<td>'.img_picto(
'',
'technic',
'class="pictofixedwidth"').$form->textwithpicto($langs->trans(
"EmailcollectorOperations"), $langs->trans(
"EmailcollectorOperationsDesc")).
'</td><td></td><td></td><td></td>';
668 $arrayoftypes = array(
669 'loadthirdparty' => $langs->trans(
'LoadThirdPartyFromName', $langs->transnoentities(
"ThirdPartyName")),
670 'loadandcreatethirdparty' => $langs->trans(
'LoadThirdPartyFromNameOrCreate', $langs->transnoentities(
"ThirdPartyName")),
671 'recordjoinpiece' =>
'AttachJoinedDocumentsToObject',
672 'recordevent' =>
'RecordEvent'
674 $arrayoftypesnocondition = $arrayoftypes;
676 $arrayoftypes[
'project'] =
'CreateLeadAndThirdParty';
678 $arrayoftypesnocondition[
'project'] =
'CreateLeadAndThirdParty';
680 $arrayoftypes[
'ticket'] =
'CreateTicketAndThirdParty';
682 $arrayoftypesnocondition[
'ticket'] =
'CreateTicketAndThirdParty';
684 $arrayoftypes[
'candidature'] =
'CreateCandidature';
686 $arrayoftypesnocondition[
'candidature'] =
'CreateCandidature';
689 $parameters = array(
'arrayoftypes' => $arrayoftypes);
690 $res = $hookmanager->executeHooks(
'addMoreActionsEmailCollector', $parameters, $object, $action);
693 $arrayoftypes = $hookmanager->resArray;
695 foreach ($hookmanager->resArray as $k => $desc) {
696 $arrayoftypes[$k] = $desc;
701 print
'<tr class="oddeven nodrag nodrop">';
703 print
$form->selectarray(
'operationtype', $arrayoftypes,
'', 1, 0, 0,
'', 1, 0, 0,
'',
'maxwidth300', 1);
706 $htmltext = $langs->transnoentitiesnoconv(
"OperationParamDesc");
707 print
$form->textwithpicto(
'<input type="text" name="operationparam">', $htmltext, 1,
'help',
'', 0, 2,
'operationparamtt');
711 print
'<td class="right"><input type="submit" name="addoperation" id="addoperation" class="flat button small" value="'.$langs->trans(
"Add").
'"></td>';
714 $nboflines = count($object->actions);
715 $table_element_line =
'emailcollector_emailcollectoraction';
716 $fk_element =
'position';
718 foreach ($object->actions as $ruleaction) {
719 $ruleactionobj =
new EmailcollectorAction($db);
720 $ruleactionobj->fetch($ruleaction[
'id']);
722 print
'<tr class="drag drop oddeven" id="row-'.$ruleaction[
'id'].
'">';
723 print
'<td title="'.dol_escape_htmltag($langs->trans(
"Operation").
': '.$ruleaction[
'type']).
'">';
724 print
'<!-- type of action: '.$ruleaction[
'type'].
' -->';
725 if (array_key_exists($ruleaction[
'type'], $arrayoftypes)) {
726 print $langs->trans($arrayoftypes[$ruleaction[
'type']]);
728 if (array_key_exists($ruleaction[
'type'], $arrayoftypesnocondition)) {
729 print
'<span class="opacitymedium">'.$langs->trans($arrayoftypesnocondition[$ruleaction[
'type']]).
' - '.$langs->trans(
"Disabled").
'</span>';
733 if (in_array($ruleaction[
'type'], array(
'recordevent'))) {
734 print
$form->textwithpicto(
'', $langs->transnoentitiesnoconv(
'IfTrackingIDFoundEventWillBeLinked'));
735 } elseif (in_array($ruleaction[
'type'], array(
'loadthirdparty',
'loadandcreatethirdparty'))) {
736 print
$form->textwithpicto(
'', $langs->transnoentitiesnoconv(
'EmailCollectorLoadThirdPartyHelp'));
739 print
'<td class="wordbreak minwidth300 small">';
740 if ($action ==
'editoperation' && $ruleaction[
'id'] == $operationid) {
741 print
'<input type="text" class="quatrevingtquinzepercent" name="operationparam2" value="'.dol_escape_htmltag($ruleaction[
'actionparam']).
'"><br>';
742 print
'<input type="hidden" name="rowidoperation2" value="'.$ruleaction[
'id'].
'">';
743 print
'<input type="submit" class="button small button-save" name="saveoperation2" value="'.$langs->trans(
"Save").
'">';
744 print
'<input type="submit" class="button small button-cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'">';
750 print
'<td class="center linecolmove tdlineupdown">';
752 print
'<a class="lineupdown" href="'.$_SERVER[
'PHP_SELF'].
'?action=up&rowid='.$ruleaction[
'id'].
'">'.
img_up(
'default', 0,
'imgupforline').
'</a>';
754 if ($i < count($object->actions) - 1) {
755 print
'<a class="lineupdown" href="'.$_SERVER[
'PHP_SELF'].
'?action=down&rowid='.$ruleaction[
'id'].
'">'.
img_down(
'default', 0,
'imgdownforline').
'</a>';
759 print
'<td class="right nowraponall">';
760 print
'<a class="editfielda marginrightonly" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=editoperation&token='.
newToken().
'&operationid='.$ruleaction[
'id'].
'">'.
img_edit().
'</a>';
761 print
' <a href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=deleteoperation&token='.
newToken().
'&operationid='.$ruleaction[
'id'].
'">'.
img_delete().
'</a>';
771 if (!empty($conf->use_javascript_ajax)) {
772 $urltorefreshaftermove = DOL_URL_ROOT.
'/admin/emailcollector_card.php?id='.$id;
773 include DOL_DOCUMENT_ROOT.
'/core/tpl/ajaxrow.tpl.php';
782 print
'<div class="clearboth"></div><br>';
787 if ($action !=
'presend' && $action !=
'editline') {
788 print
'<div class="tabsAction">'.
"\n";
789 $parameters = array();
790 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters, $object, $action);
795 if (empty($reshook)) {
797 print
'<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=edit&token='.
newToken().
'">'.$langs->trans(
"Edit").
'</a></div>';
800 print
'<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER[
'PHP_SELF'].
'?id='.$object->id.
'&action=clone&token='.
newToken().
'&object=order">'.$langs->trans(
"ToClone").
'</a></div>';
803 print
'<div class="inline-block divButAction"><a class="butAction reposition" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=collecttest&token='.
newToken().
'">'.$langs->trans(
"TestCollectNow").
'</a></div>';
805 if (count($object->actions) > 0) {
806 print
'<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=collect&token='.
newToken().
'">'.$langs->trans(
"CollectNow").
'</a></div>';
808 print
'<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans(
"NoOperations")).
'">'.$langs->trans(
"CollectNow").
'</a></div>';
811 print
'<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=delete&token='.urlencode(
newToken()).
'">'.$langs->trans(
'Delete').
'</a></div>';
816 if (!empty($debuginfo)) {
if(GETPOST('button_removefilter_x', 'alpha')||GETPOST('button_removefilter.x', 'alpha')||GETPOST('button_removefilter', 'alpha')) if(GETPOST('button_search_x', 'alpha')||GETPOST('button_search.x', 'alpha')||GETPOST('button_search', 'alpha')) if($action=="save" &&empty($cancel)) $help_url
View.
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
Class for EmailCollectorAction.
Class for EmailCollectorFilter.
Class for EmailCollector.
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
emailcollectorPrepareHead($object)
Prepare array of tabs for EmailCollector.
dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='rowid', $fieldref='ref', $morehtmlref='', $moreparam='', $nodbprefix=0, $morehtmlleft='', $morehtmlstatus='', $onlybanner=0, $morehtmlright='')
Show tab footer of a card.
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='')
Show tabs of a record.
img_delete($titlealt='default', $other='class="pictodelete"', $morecss='')
Show delete logo.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
img_down($titlealt='default', $selected=0, $moreclass='')
Show down arrow logo.
if(!function_exists('dol_getprefix')) dol_include_once($relpath, $classname='')
Make an include_once using default root and alternate root if it fails.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
newToken()
Return the value of token currently saved into session with name 'newtoken'.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='')
Show information for admin users or standard users.
if(!function_exists('utf8_encode')) if(!function_exists('utf8_decode')) getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
img_edit($titlealt='default', $float=0, $other='')
Show logo editer/modifier fiche.
img_up($titlealt='default', $selected=0, $moreclass='')
Show top arrow logo.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
$formconfirm
if ($action == 'delbookkeepingyear') {
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.