NEW: Adding a recipient on emails sent, change status to sent partialy.

This commit is contained in:
Laurent Destailleur 2024-02-07 11:55:02 +01:00
parent f2774906ba
commit d4e8c6bf9a
2 changed files with 15 additions and 3 deletions

View file

@ -129,6 +129,11 @@ if ($action == 'add' && $user->hasRight('mailing', 'creer')) { // Add recipient
}
}
if ($result > 0) {
// If status of emailing is sent completely, change to to send partially
if ($object->status == $object::STATUS_SENTCOMPLETELY) {
$object->setStatut($object::STATUS_SENTPARTIALY);
}
setEventMessages($langs->trans("XTargetsAdded", $result), null, 'mesgs');
$action = '';
}
@ -400,7 +405,14 @@ if ($object->fetch($id) >= 0) {
print '<br>';
$newcardbutton = '';
$allowaddtarget = ($object->status == $object::STATUS_DRAFT);
if (GETPOST('allowaddtarget')) {
$allowaddtarget = 1;
}
if (!$allowaddtarget) {
$newcardbutton .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', $_SERVER["PHP_SELF"].'?id='.$object->id.'&allowaddtarget=1', '', $user->hasRight('mailing', 'creer'));
}
// Show email selectors
if ($allowaddtarget && $user->hasRight('mailing', 'creer')) {
@ -658,14 +670,14 @@ if ($object->fetch($id) >= 0) {
print '<input type="hidden" name="page_y" value="">';
$morehtmlcenter = '';
if ($allowaddtarget) {
if ($object->status == $object::STATUS_DRAFT) {
$morehtmlcenter = '<span class="opacitymedium hideonsmartphone">'.$langs->trans("ToClearAllRecipientsClickHere").'</span> <a href="'.$_SERVER["PHP_SELF"].'?clearlist=1&id='.$object->id.'" class="button reposition smallpaddingimp">'.$langs->trans("TargetsReset").'</a>';
}
$morehtmlcenter .= ' &nbsp; <a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=exportcsv&token='.newToken().'&exportcsv=1&id='.$object->id.'">'.img_picto('', 'download', 'class="pictofixedwidth"').$langs->trans("Download").'</a>';
$massactionbutton = '';
print_barre_liste($langs->trans("MailSelectedRecipients"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $morehtmlcenter, $num, $nbtotalofrecords, 'generic', 0, '', '', $limit, 0, 0, 1);
print_barre_liste($langs->trans("MailSelectedRecipients"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $morehtmlcenter, $num, $nbtotalofrecords, 'generic', 0, $newcardbutton, '', $limit, 0, 0, 1);
print '</form>';

View file

@ -4519,7 +4519,7 @@ abstract class CommonObject
*/
public function setStatut($status, $elementId = null, $elementType = '', $trigkey = '', $fieldstatus = 'fk_statut')
{
global $user, $langs, $conf;
global $user;
$savElementId = $elementId; // To be used later to know if we were using the method using the id of this or not.