NEW Add a button "Test collect" in email collector

This commit is contained in:
Laurent Destailleur 2022-09-16 14:50:25 +02:00
parent a0abad5586
commit 111e5ba3f0
3 changed files with 643 additions and 613 deletions

View File

@ -235,10 +235,25 @@ if ($action == 'deleteoperation') {
}
}
if ($action == 'collecttest') {
dol_include_once('/emailcollector/class/emailcollector.class.php');
$res = $object->doCollectOneCollector(2);
if ($res > 0) {
$debuginfo = $object->debuginfo;
setEventMessages($object->lastresult, null, 'mesgs');
} else {
$debuginfo = $object->debuginfo;
setEventMessages($object->error, null, 'errors');
}
$action = '';
}
if ($action == 'confirm_collect') {
dol_include_once('/emailcollector/class/emailcollector.class.php');
$res = $object->doCollectOneCollector();
$res = $object->doCollectOneCollector(0);
if ($res > 0) {
$debuginfo = $object->debuginfo;
setEventMessages($object->lastresult, null, 'mesgs');
@ -784,6 +799,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
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>';
// Collect now
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=collecttest&token='.newToken().'">'.$langs->trans("TestCollectNow").'</a></div>';
if (count($object->actions) > 0) {
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>';
} else {

File diff suppressed because it is too large Load Diff

View File

@ -2081,6 +2081,7 @@ 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
TestCollectNow=Test collect
CollectNow=Collect now
ConfirmCloneEmailCollector=Are you sure you want to clone the Email collector %s?
DateLastCollectResult=Date of latest collect try