FIX Selection of addmaindocfile is lost on error
This commit is contained in:
parent
dbb2168b83
commit
770f8c3f3b
@ -881,8 +881,12 @@ class FormMail extends Form
|
|||||||
|
|
||||||
$out.= '<td>';
|
$out.= '<td>';
|
||||||
|
|
||||||
|
if (GETPOSTISSET('sendmail'))
|
||||||
|
{
|
||||||
|
$this->withmaindocfile = (GETPOST('addmaindocfile', 'alpha') ? -1 : 1);
|
||||||
|
}
|
||||||
// If a template was selected, we use setup of template to define if join file checkbox is selected or not.
|
// If a template was selected, we use setup of template to define if join file checkbox is selected or not.
|
||||||
if (is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0)
|
elseif (is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0)
|
||||||
{
|
{
|
||||||
$this->withmaindocfile = ($arraydefaultmessage->joinfiles ? -1 : 1);
|
$this->withmaindocfile = ($arraydefaultmessage->joinfiles ? -1 : 1);
|
||||||
}
|
}
|
||||||
@ -895,7 +899,7 @@ class FormMail extends Form
|
|||||||
}
|
}
|
||||||
if ($this->withmaindocfile == -1)
|
if ($this->withmaindocfile == -1)
|
||||||
{
|
{
|
||||||
$out.='<input type="checkbox" name="addmaindocfile" checked="checked" />';
|
$out.='<input type="checkbox" name="addmaindocfile" value="1" checked="checked" />';
|
||||||
}
|
}
|
||||||
$out.=' '.$langs->trans("JoinMainDoc").'.<br>';
|
$out.=' '.$langs->trans("JoinMainDoc").'.<br>';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -41,11 +41,12 @@ if ($massaction == 'presend')
|
|||||||
{
|
{
|
||||||
$langs->load("mails");
|
$langs->load("mails");
|
||||||
|
|
||||||
|
$listofselectedid = array();
|
||||||
|
$listofselectedthirdparties = array();
|
||||||
|
$listofselectedref = array();
|
||||||
|
|
||||||
if (! GETPOST('cancel', 'alpha'))
|
if (! GETPOST('cancel', 'alpha'))
|
||||||
{
|
{
|
||||||
$listofselectedid = array();
|
|
||||||
$listofselectedthirdparties = array();
|
|
||||||
$listofselectedref = array();
|
|
||||||
foreach ($arrayofselected as $toselectid)
|
foreach ($arrayofselected as $toselectid)
|
||||||
{
|
{
|
||||||
$result = $objecttmp->fetch($toselectid);
|
$result = $objecttmp->fetch($toselectid);
|
||||||
@ -110,8 +111,8 @@ if ($massaction == 'presend')
|
|||||||
} else {
|
} else {
|
||||||
$formmail->withtoreadonly = 1;
|
$formmail->withtoreadonly = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
$formmail->withoptiononeemailperrecipient = empty($liste)?0:((GETPOST('oneemailperrecipient')=='on')?1:-1);
|
$formmail->withoptiononeemailperrecipient = (count($listofselectedref) == 1 || empty($liste))? 0 : ((GETPOST('oneemailperrecipient')=='on')?1:-1);
|
||||||
$formmail->withto = empty($liste)?(GETPOST('sendto','alpha')?GETPOST('sendto','alpha'):array()):$liste;
|
$formmail->withto = empty($liste)?(GETPOST('sendto','alpha')?GETPOST('sendto','alpha'):array()):$liste;
|
||||||
$formmail->withtofree = empty($liste)?1:0;
|
$formmail->withtofree = empty($liste)?1:0;
|
||||||
$formmail->withtocc = 1;
|
$formmail->withtocc = 1;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user