Fix edition of operation into email collector
This commit is contained in:
parent
ef2bd563e2
commit
6fad9c2d3b
@ -153,13 +153,21 @@ if (GETPOST('addoperation', 'alpha'))
|
||||
$emailcollectoroperation->status = 1;
|
||||
$emailcollectoroperation->position = 50;
|
||||
|
||||
$result = $emailcollectoroperation->create($user);
|
||||
if (in_array($emailcollectoroperation->type, array('loadthirdparty', 'loadandcreatethirdparty'))
|
||||
&& empty($emailcollectoroperation->actionparam)) {
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorAParameterIsRequiredForThisOperation"), null, 'errors');
|
||||
}
|
||||
|
||||
if ($result > 0)
|
||||
{
|
||||
$object->fetchActions();
|
||||
} else {
|
||||
setEventMessages($emailcollectoroperation->errors, $emailcollectoroperation->error, 'errors');
|
||||
if (!$error) {
|
||||
$result = $emailcollectoroperation->create($user);
|
||||
|
||||
if ($result > 0) {
|
||||
$object->fetchActions();
|
||||
} else {
|
||||
$error++;
|
||||
setEventMessages($emailcollectoroperation->errors, $emailcollectoroperation->error, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -170,13 +178,22 @@ if ($action == 'updateoperation')
|
||||
|
||||
$emailcollectoroperation->actionparam = GETPOST('operationparam2', 'restricthtml');
|
||||
|
||||
$result = $emailcollectoroperation->update($user);
|
||||
if (in_array($emailcollectoroperation->type, array('loadthirdparty', 'loadandcreatethirdparty'))
|
||||
&& empty($emailcollectoroperation->actionparam)) {
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorAParameterIsRequiredForThisOperation"), null, 'errors');
|
||||
}
|
||||
|
||||
if ($result > 0)
|
||||
{
|
||||
$object->fetchActions();
|
||||
} else {
|
||||
setEventMessages($emailcollectoroperation->errors, $emailcollectoroperation->error, 'errors');
|
||||
if (!$error) {
|
||||
$result = $emailcollectoroperation->update($user);
|
||||
|
||||
if ($result > 0)
|
||||
{
|
||||
$object->fetchActions();
|
||||
} else {
|
||||
$error++;
|
||||
setEventMessages($emailcollectoroperation->errors, $emailcollectoroperation->error, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($action == 'deleteoperation')
|
||||
@ -458,7 +475,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="border centpercent tableforfield">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Filters").'</td><td></td><td></td>';
|
||||
print '<td>'.$form->textwithpicto($langs->trans("Filters"), $langs->trans("EmailCollectorFilterDesc")).'</td><td></td><td></td>';
|
||||
print '</tr>';
|
||||
// Add filter
|
||||
print '<tr class="oddeven">';
|
||||
@ -491,7 +508,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
'isnotanswer'=>array('label'=>'IsNotAnAnswer', 'data-noparam'=>1),
|
||||
'isanswer'=>array('label'=>'IsAnAnswer', 'data-noparam'=>1)
|
||||
);
|
||||
print $form->selectarray('filtertype', $arrayoftypes, '', 1, 0, 0, '', 1, 0, 0, '', 'maxwidth500', 0, '', 2);
|
||||
print $form->selectarray('filtertype', $arrayoftypes, '', 1, 0, 0, '', 1, 0, 0, '', 'maxwidth500', 1, '', 2);
|
||||
|
||||
print "\n";
|
||||
print '<script>';
|
||||
@ -544,7 +561,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table id="tablelines" class="noborder noshadow tableforfield">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("EmailcollectorOperations").'</td><td></td><td></td><td></td>';
|
||||
print '<td>'.$form->textwithpicto($langs->trans("EmailcollectorOperations"), $langs->trans("EmailcollectorOperationsDesc")).'</td><td></td><td></td><td></td>';
|
||||
print '</tr>';
|
||||
// Add operation
|
||||
print '<tr class="oddeven">';
|
||||
@ -561,13 +578,15 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
$parameters = array('arrayoftypes' => $arrayoftypes);
|
||||
$res = $hookmanager->executeHooks('addMoreActionsEmailCollector', $parameters, $object, $action);
|
||||
|
||||
if ($res)
|
||||
if ($res) {
|
||||
$arrayoftypes = $hookmanager->resArray;
|
||||
else foreach ($hookmanager->resArray as $k=>$desc)
|
||||
} else {
|
||||
foreach ($hookmanager->resArray as $k=>$desc) {
|
||||
$arrayoftypes[$k] = $desc;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
print $form->selectarray('operationtype', $arrayoftypes, '', 1, 0, 0, '', 1, 0, 0, '', 'maxwidth300');
|
||||
print $form->selectarray('operationtype', $arrayoftypes, '', 1, 0, 0, '', 1, 0, 0, '', 'maxwidth300', 1);
|
||||
print '</td><td>';
|
||||
print '<input type="text" name="operationparam">';
|
||||
print '</td>';
|
||||
|
||||
@ -1555,10 +1555,9 @@ class EmailCollector extends CommonObject
|
||||
// Search and create thirdparty
|
||||
if ($operation['type'] == 'loadthirdparty' || $operation['type'] == 'loadandcreatethirdparty')
|
||||
{
|
||||
if (empty($operation['actionparam']))
|
||||
{
|
||||
if (empty($operation['actionparam'])) {
|
||||
$errorforactions++;
|
||||
$this->error = "Action loadthirdparty or loadandcreatethirdparty has empty parameter. Must be 'SET:xxx' or 'EXTRACT:(body|subject):regex' to define how to extract data";
|
||||
$this->error = "Action loadthirdparty or loadandcreatethirdparty has empty parameter. Must be a rule like 'SET:xxx' or 'EXTRACT:(body|subject):regex' to define how to set or extract data";
|
||||
$this->errors[] = $this->error;
|
||||
} else {
|
||||
$actionparam = $operation['actionparam'];
|
||||
|
||||
@ -1985,6 +1985,7 @@ EMailHost=Host of email IMAP server
|
||||
MailboxSourceDirectory=Mailbox source directory
|
||||
MailboxTargetDirectory=Mailbox target directory
|
||||
EmailcollectorOperations=Operations to do by collector
|
||||
EmailcollectorOperationsDesc=Operations are executed from top to bottom order
|
||||
MaxEmailCollectPerCollect=Max number of emails collected per collect
|
||||
CollectNow=Collect now
|
||||
ConfirmCloneEmailCollector=Are you sure you want to clone the Email collector %s ?
|
||||
@ -2007,7 +2008,7 @@ WithDolTrackingID=Message from a conversation initiated by a first email sent fr
|
||||
WithoutDolTrackingID=Message from a conversation initiated by a first email NOT sent from Dolibarr
|
||||
WithDolTrackingIDInMsgId=Message sent from Dolibarr
|
||||
WithoutDolTrackingIDInMsgId=Message NOT sent from Dolibarr
|
||||
CreateCandidature=Create candidature
|
||||
CreateCandidature=Create job application
|
||||
FormatZip=Zip
|
||||
MainMenuCode=Menu entry code (mainmenu)
|
||||
ECMAutoTree=Show automatic ECM tree
|
||||
|
||||
@ -254,6 +254,7 @@ ErrorNotAvailableWithThisDistribution=Not available with this distribution
|
||||
ErrorPublicInterfaceNotEnabled=Public interface was not enabled
|
||||
ErrorLanguageRequiredIfPageIsTranslationOfAnother=The language of new page must be defined if it is set as a translation of another page
|
||||
ErrorLanguageMustNotBeSourceLanguageIfPageIsTranslationOfAnother=The language of new page must not be the source language if it is set as a translation of another page
|
||||
ErrorAParameterIsRequiredForThisOperation=A parameter is mandatory for this operation
|
||||
|
||||
# Warnings
|
||||
WarningParamUploadMaxFileSizeHigherThanPostMaxSize=Your PHP parameter upload_max_filesize (%s) is higher than PHP parameter post_max_size (%s). This is not a consistent setup.
|
||||
|
||||
@ -92,6 +92,7 @@ MailingModuleDescEmailsFromUser=Emails input by user
|
||||
MailingModuleDescDolibarrUsers=Users with Emails
|
||||
MailingModuleDescThirdPartiesByCategories=Third parties (by categories)
|
||||
SendingFromWebInterfaceIsNotAllowed=Sending from web interface is not allowed.
|
||||
EmailCollectorFilterDesc=All filters must match to have an email being collected
|
||||
|
||||
# Libelle des modules de liste de destinataires mailing
|
||||
LineInFile=Line %s in file
|
||||
|
||||
@ -437,6 +437,7 @@ RemainToPay=Remain to pay
|
||||
Module=Module/Application
|
||||
Modules=Modules/Applications
|
||||
Option=Option
|
||||
Filters=Filters
|
||||
List=List
|
||||
FullList=Full list
|
||||
FullConversation=Full conversation
|
||||
|
||||
Loading…
Reference in New Issue
Block a user