FIX Do not show check box if not applicable

This commit is contained in:
Laurent Destailleur 2018-10-29 02:27:51 +01:00
parent 553e984465
commit 04f80f0925
2 changed files with 11 additions and 8 deletions

View File

@ -93,7 +93,7 @@ if (! $error && $massaction == 'confirm_presend')
}
// Check mandatory parameters
if (empty($user->email))
if (GETPOST('fromtype','alpha') === 'user' && empty($user->email))
{
$error++;
setEventMessages($langs->trans("NoSenderEmailDefined"), null, 'warnings');

View File

@ -846,14 +846,17 @@ class FormMail extends Form
$out.= '<td>';
if (GETPOSTISSET('sendmail'))
if ($this->withmaindocfile) // withmaindocfile is set to 1 or -1 to show the checkbox (-1 = checked or 1 = not checked)
{
$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.
elseif (is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0)
{
$this->withmaindocfile = ($arraydefaultmessage->joinfiles ? -1 : 1);
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.
elseif (is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0)
{
$this->withmaindocfile = ($arraydefaultmessage->joinfiles ? -1 : 1);
}
}
if (! empty($this->withmaindocfile))