FIX cloning of emailing when no content selected

This commit is contained in:
Laurent Destailleur 2020-04-03 02:29:10 +02:00
parent 4c8a04cf38
commit 193a10bc39
2 changed files with 6 additions and 6 deletions

View File

@ -90,13 +90,13 @@ if (empty($reshook))
// Action clone object
if ($action == 'confirm_clone' && $confirm == 'yes')
{
if (empty($_REQUEST["clone_content"]) && empty($_REQUEST["clone_receivers"]))
if (! GETPOST("clone_content", 'alpha') && ! GETPOST("clone_receivers", 'alpha'))
{
setEventMessages($langs->trans("NoCloneOptionsSpecified"), null, 'errors');
}
else
{
$result = $object->createFromClone($user, $object->id, $_REQUEST["clone_content"], $_REQUEST["clone_receivers"]);
$result = $object->createFromClone($user, $object->id, GETPOST("clone_content", 'alpha'), GETPOST("clone_receivers", 'alpha'));
if ($result > 0)
{
header("Location: ".$_SERVER['PHP_SELF'].'?id='.$result);

View File

@ -273,8 +273,8 @@ class Mailing extends CommonObject
*
* @param User $user User making the clone
* @param int $fromid Id of object to clone
* @param int $option1 1=Copy content, 0=Forget content
* @param int $option2 Not used
* @param int $option1 1=Clone content, 0=Forget content
* @param int $option2 1=Clone recipients
* @return int New id of clone
*/
public function createFromClone(User $user, $fromid, $option1, $option2)
@ -305,7 +305,7 @@ class Mailing extends CommonObject
$object->bgcolor = '';
$object->bgimage = '';
$object->email_from = '';
//$object->email_from = ''; // We do not reset from email because it is a mandatory value
$object->email_replyto = '';
$object->email_errorsto = '';
@ -331,7 +331,7 @@ class Mailing extends CommonObject
if (! $error)
{
//Clone target
// Clone recipient targets
if (!empty($option2)) {
require_once DOL_DOCUMENT_ROOT .'/core/modules/mailings/modules_mailings.php';