Work on email collector

This commit is contained in:
Laurent Destailleur 2018-11-07 16:33:06 +01:00
parent 46db246273
commit 6ba78b2bb3
12 changed files with 58 additions and 8 deletions

View File

@ -37,7 +37,7 @@ if (!$user->admin)
accessforbidden();
// Load traductions files requiredby by page
$langs->loadLangs(array("admin", "other"));
$langs->loadLangs(array("admin", "mails", "other"));
// Get parameters
$id = GETPOST('id', 'int');
@ -122,6 +122,23 @@ if ($action == 'confirm_collect')
$action = '';
}
if (GETPOST('addfilter','alpha'))
{
$emailcollectorfilter = new EmailCollectorFilter($db);
$emailcollectorfilter->type = GETPOST('filtertype','alpha');
$emailcollectorfilter->rulevalue = GETPOST('rulevalue', 'alpha');
$emailcollectorfilter->fk_emailcollector = $object->id;
$result = $emailcollectorfilter->create($user);
if ($result > 0)
{
$object->fetchFilters();
}
else
{
setEventMessages($emailcollectorfilter->errors, $emailcollectorfilter->error, 'errors');
}
}
@ -322,6 +339,13 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '</table>';
print '<form method="POST" action="' . $_SERVER["PHP_SELF"] . '">';
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
print '<input type="hidden" name="action" value="updatefiltersactions">';
print '<input type="hidden" name="backtopage" value="' . $backtopage . '">';
print '<input type="hidden" name="id" value="' . $object->id . '">';
// Filters
print '<table class="border centpercent">';
print '<tr class="liste_titre">';
@ -330,8 +354,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
// Add filter
print '<tr class="oddeven">';
print '<td>';
$arrayoftypes=array('to'=>'To', 'cc'=>'Cc', 'bcc'=>'Bcc', 'from'=>'From', 'subject'=>'Subject', 'body'=>'Body', 'seen'=>'AlreadyRead', 'unseen'=>'NotRead');
print $form->selectarray('filtertype', $arrayoftypes, '', 1);
$arrayoftypes=array('from'=>'MailFrom', 'to'=>'MailTo', 'cc'=>'Cc', 'bcc'=>'Bcc', 'subject'=>'Subject', 'body'=>'Body', 'seen'=>'AlreadyRead', 'unseen'=>'NotRead');
print $form->selectarray('filtertype', $arrayoftypes, '', 1, 0, 0, '', 1);
print '</td><td>';
print '<input type="text" name="rulevalue">';
print '</td>';
@ -365,7 +389,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '<td>';
$arrayoftypes=array('recordevent'=>'RecordEvent');
if ($conf->projet->enabled) $arrayoftypes['project']='CreateLeadAndThirdParty';
print $form->selectarray('operationtype', $arrayoftypes, '', 1);
print $form->selectarray('operationtype', $arrayoftypes, '', 1, 0, 0, '', 1);
print '</td><td>';
print '<input type="text" name="operationparam">';
print '</td>';
@ -387,6 +411,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '</tr>';
print '</table>';
print '</form>';
print '</div>';
print '</div>';

View File

@ -52,7 +52,7 @@ class modEmailCollector extends DolibarrModules
// It is used to group modules by family in module setup page
$this->family = "interface";
// Module position in the family on 2 digits ('01', '10', '20', ...)
$this->module_position = '75';
$this->module_position = '12';
// Gives the possibility to the module, to provide his own family info and position of this family (Overwrite $this->family and $this->module_position. Avoid this)
//$this->familyinfo = array('myownfamily' => array('position' => '01', 'label' => $langs->trans("MyOwnFamily")));
@ -70,7 +70,7 @@ class modEmailCollector extends DolibarrModules
// Name of image file used for this module.
// If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue'
// If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module'
$this->picto='generic';
$this->picto='email';
// Defined all module parts (triggers, login, substitutions, menus, css, etc...)
// for default path (eg: /dav/core/xxxxx) (0=disable, 1=enable)

View File

@ -49,6 +49,8 @@ class modGravatar extends DolibarrModules
// Family can be 'crm','financial','hr','projects','products','ecm','technic','other'
// It is used to group modules in module setup page
$this->family = "interface";
// Module position in the family on 2 digits ('01', '10', '20', ...)
$this->module_position = '75';
// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
$this->name = preg_replace('/^mod/i', '', get_class($this));
// Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module)

View File

@ -43,6 +43,8 @@ class modLdap extends DolibarrModules
$this->numero = 200;
$this->family = "interface";
// Module position in the family on 2 digits ('01', '10', '20', ...)
$this->module_position = '30';
// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
$this->name = preg_replace('/^mod/i','',get_class($this));
$this->description = "Synchronisation Ldap";

View File

@ -44,7 +44,12 @@ class modMailing extends DolibarrModules
$this->db = $db;
$this->numero = 22;
$this->family = "technic";
// Family can be 'base' (core modules),'crm','financial','hr','projects','products','ecm','technic' (transverse modules),'interface' (link with external tools),'other','...'
// It is used to group modules by family in module setup page
$this->family = "interface";
// Module position in the family on 2 digits ('01', '10', '20', ...)
$this->module_position = '11';
// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
$this->name = preg_replace('/^mod/i','',get_class($this));
$this->description = "Gestion des EMailings";

View File

@ -43,7 +43,11 @@ class modMailmanSpip extends DolibarrModules
$this->db = $db;
$this->numero = 105;
// Family can be 'crm','financial','hr','projects','products','ecm','technic','other'
// It is used to group modules in module setup page
$this->family = "interface";
// Module position in the family on 2 digits ('01', '10', '20', ...)
$this->module_position = '70';
// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
$this->name = preg_replace('/^mod/i','',get_class($this));
$this->description = "Mailman or Spip interface for member module";

View File

@ -41,7 +41,11 @@ class modNotification extends DolibarrModules
$this->db = $db;
$this->numero = 600;
// Family can be 'crm','financial','hr','projects','products','ecm','technic','other'
// It is used to group modules in module setup page
$this->family = "interface";
// Module position in the family on 2 digits ('01', '10', '20', ...)
$this->module_position = '01';
// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
$this->name = preg_replace('/^mod/i','',get_class($this));
$this->description = "EMail notifications (push) on business Dolibarr events";

View File

@ -47,7 +47,7 @@ class modOauth extends DolibarrModules
// Family can be 'crm','financial','hr','projects','products','ecm','technic','other'
// It is used to group modules in module setup page
$this->family = "interface";
$this->module_position = '51';
$this->module_position = '31';
// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
$this->name = preg_replace('/^mod/i','',get_class($this));
// Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module)

View File

@ -46,6 +46,8 @@ class modSocialNetworks extends DolibarrModules
// Family can be 'crm','financial','hr','projects','products','ecm','technic','other'
// It is used to group modules in module setup page
$this->family = "interface";
// Module position in the family on 2 digits ('01', '10', '20', ...)
$this->module_position = '20';
// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
$this->name = preg_replace('/^mod/i','',get_class($this));
$this->description = "Enable Social Networks fields into third parties and addresses (skype, twitter, facebook, ...)";

View File

@ -632,6 +632,7 @@ class EmailCollector extends CommonObject
{
$obj=$this->db->fetch_object($resql);
$this->filters[$obj->rowid]=array('id'=>$obj->rowid, 'type'=>$obj->type, 'rulevalue'=>$obj->rulevalue, 'status'=>$obj->status);
$i++;
}
$this->db->free($resql);
}
@ -659,6 +660,7 @@ class EmailCollector extends CommonObject
{
$obj=$this->db->fetch_object($resql);
$this->rules[$obj->rowid]=array('id'=>$obj->rowid, 'type'=>$obj->type, 'actionparam'=>$obj->actionparam, 'status'=>$obj->status);
$i++;
}
$this->db->free($resql);
}

View File

@ -1815,6 +1815,8 @@ EnableFeatureFor=Enable features for <strong>%s</strong>
VATIsUsedIsOff=Note: The option to use sales Tax or VAT has been set to <strong>Off</strong> in the menu %s - %s, so Sale tax or Vat used will always be 0 for sales.
SwapSenderAndRecipientOnPDF=Swap sender and recipient address on PDF
FeatureSupportedOnTextFieldsOnly=Warning, feature supported on text fields only
EmailCollector=Email collector
EmailCollectorDescription=Add a scheduled job and a setup page to scan regularly email boxes (using IMAP protocol) and record emails received into your application, at the right place and/or create some record automatically (like leads).
NewEmailCollector=New Email Collector
EMailHost=Host of email IMAP server
MailboxSourceDirectory=Mailbox source directory

View File

@ -635,6 +635,8 @@ SendMail=Send email
EMail=E-mail
NoEMail=No email
Email=Email
AlreadyRead=Alreay read
NotRead=Not read
NoMobilePhone=No mobile phone
Owner=Owner
FollowingConstantsWillBeSubstituted=The following constants will be replaced with the corresponding value.