Merge pull request #2937 from atm-ph/fix_target_list_emailing
FIX : when mailing is deleted, the targets list was kept in database
This commit is contained in:
commit
cc7f2518b6
@ -421,7 +421,7 @@ class Mailing extends CommonObject
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
return 1;
|
||||
return $this->delete_targets();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -429,6 +429,29 @@ class Mailing extends CommonObject
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete targets emailing
|
||||
*
|
||||
* @return int 1 if OK, 0 if error
|
||||
*/
|
||||
function delete_targets()
|
||||
{
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."mailing_cibles";
|
||||
$sql.= " WHERE fk_mailing = ".$this->id;
|
||||
|
||||
dol_syslog("Mailing::delete_targets", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
||||
Loading…
Reference in New Issue
Block a user