Debug emailcollector

This commit is contained in:
Laurent Destailleur 2018-11-05 16:42:29 +01:00
parent 52d4426e87
commit eb9defcf1d
4 changed files with 13 additions and 14 deletions

View File

@ -96,10 +96,10 @@ if (empty($reshook))
// Actions cancel, add, update, delete or clone
include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php';
// Actions when linking object each other
include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be include, not include_once
// Actions when printing a doc from card
include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
}
@ -218,7 +218,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
$formquestion = array();
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('CloneMyObject'), $langs->trans('ConfirmCloneMyObject', $object->ref), 'confirm_clone', $formquestion, 'yes', 1);
}
// Confirmation of action process
if ($action == 'collect') {
$formquestion = array(
@ -232,10 +232,10 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
$reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if (empty($reshook)) $formconfirm.=$hookmanager->resPrint;
elseif ($reshook > 0) $formconfirm=$hookmanager->resPrint;
// Print form confirm
print $formconfirm;
// Object card
// ------------------------------------------------------------
$linkback = '<a href="' . dol_buildpath('/admin/emailcollector_list.php', 1) . '?restore_lastsearch_values=1' . (!empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
@ -308,7 +308,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
dol_include_once('/emailcollector/class/emailcollector.class.php');
$emailcollector = new EmailCollector($object);
$res = $emailcollector->collectEmails();
$res = $emailcollector->doCollect();
if (is_array($res)) {
if (count($res['actions_done']) > 0) {
setEventMessages($langs->trans('XActionsDone', count($res['actions_done'])), null, 'info');
@ -322,8 +322,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
}
print '</div>';
print '</div>';
print '<div class="clearboth"></div><br>';
dol_fiche_end();
@ -334,7 +334,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
$parameters = array();
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
if (empty($reshook))
{
print '<a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&amp;action=collect">' . $langs->trans("CollectNow") . '</a>' . "\n";

View File

@ -85,10 +85,10 @@ class EmailCollector extends CommonObject
'host' => array('type'=>'varchar(255)', 'label'=>'EMailHost', 'visible'=>1, 'enabled'=>1, 'position'=>100, 'notnull'=>1, 'searchall'=>1, 'comment'=>"IMPA server",),
'user' => array('type'=>'varchar(128)', 'label'=>'User', 'visible'=>1, 'enabled'=>1, 'position'=>101, 'notnull'=>1, 'index'=>1, 'comment'=>"IMAP login",),
'password' => array('type'=>'password', 'label'=>'Password', 'visible'=>-1, 'enabled'=>1, 'position'=>102, 'notnull'=>1, 'comment'=>"IMAP password",),
'source_directory' => array('type'=>'varchar(255)', 'label'=>'MailboxSourceDirectory', 'visible'=>-1, 'enabled'=>1, 'position'=>103, 'notnull'=>-1, 'default' => 'Inbox'),
'source_directory' => array('type'=>'varchar(255)', 'label'=>'MailboxSourceDirectory', 'visible'=>-1, 'enabled'=>1, 'position'=>103, 'notnull'=>1, 'default' => 'Inbox'),
//'filter' => array('type'=>'text', 'label'=>'Filter', 'visible'=>1, 'enabled'=>1, 'position'=>105),
//'actiontodo' => array('type'=>'varchar(255)', 'label'=>'ActionToDo', 'visible'=>1, 'enabled'=>1, 'position'=>106),
'target_directory' => array('type'=>'varchar(255)', 'label'=>'MailboxTargetDirectory', 'visible'=>1, 'enabled'=>1, 'position'=>110, 'notnull'=>1, 'comment'=>"Where to store messages once processed"),
'target_directory' => array('type'=>'varchar(255)', 'label'=>'MailboxTargetDirectory', 'visible'=>1, 'enabled'=>1, 'position'=>110, 'notnull'=>0, 'comment'=>"Where to store messages once processed"),
'datelastresult' => array('type'=>'datetime', 'label'=>'DateLastResult', 'visible'=>-2, 'enabled'=>1, 'position'=>121, 'notnull'=>-1,),
'lastresult' => array('type'=>'varchar(255)', 'label'=>'LastResult', 'visible'=>1, 'enabled'=>1, 'position'=>122, 'notnull'=>-1,),
'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'visible'=>0, 'enabled'=>1, 'position'=>61, 'notnull'=>-1,),

View File

@ -150,7 +150,7 @@ CREATE TABLE llx_emailcollector_emailcollector(
host varchar(255),
user varchar(128),
password varchar(128),
source_directory varchar(255),
source_directory varchar(255) NOT NULL,
target_directory varchar(255),
datelastresult datetime,
lastresult varchar(255),
@ -165,7 +165,6 @@ CREATE TABLE llx_emailcollector_emailcollector(
-- END MODULEBUILDER FIELDS
) ENGINE=innodb;
ALTER TABLE llx_emailcollector_emailcollector ADD INDEX idx_emailcollector_rowid (rowid);
ALTER TABLE llx_emailcollector_emailcollector ADD INDEX idx_emailcollector_entity (entity);
ALTER TABLE llx_emailcollector_emailcollector ADD INDEX idx_emailcollector_status (status);

View File

@ -24,7 +24,7 @@ CREATE TABLE llx_emailcollector_emailcollector(
host varchar(255),
user varchar(128),
password varchar(128),
source_directory varchar(255),
source_directory varchar(255) NOT NULL,
target_directory varchar(255),
datelastresult datetime,
lastresult varchar(255),