|
@@ -427,8 +427,12 @@ class Mailing extends CommonObject
|
|
* @param int $rowid id du mailing a supprimer
|
|
* @param int $rowid id du mailing a supprimer
|
|
* @return int 1 en cas de succes
|
|
* @return int 1 en cas de succes
|
|
*/
|
|
*/
|
|
- public function delete($rowid)
|
|
|
|
|
|
+ public function delete($rowid, $notrigger = 0)
|
|
{
|
|
{
|
|
|
|
+ global $user;
|
|
|
|
+
|
|
|
|
+ $this->db->begin();
|
|
|
|
+
|
|
$sql = "DELETE FROM ".MAIN_DB_PREFIX."mailing";
|
|
$sql = "DELETE FROM ".MAIN_DB_PREFIX."mailing";
|
|
$sql .= " WHERE rowid = ".$rowid;
|
|
$sql .= " WHERE rowid = ".$rowid;
|
|
|
|
|
|
@@ -436,13 +440,31 @@ class Mailing extends CommonObject
|
|
$resql = $this->db->query($sql);
|
|
$resql = $this->db->query($sql);
|
|
if ($resql)
|
|
if ($resql)
|
|
{
|
|
{
|
|
- return $this->delete_targets();
|
|
|
|
|
|
+ $res = $this->delete_targets();
|
|
|
|
+ if(empty($res)){
|
|
|
|
+ $this->db->rollback();
|
|
|
|
+ $this->error = $this->db->lasterror();
|
|
|
|
+ return -1;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
|
|
+ $this->db->rollback();
|
|
$this->error = $this->db->lasterror();
|
|
$this->error = $this->db->lasterror();
|
|
return -1;
|
|
return -1;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ if(!$notrigger){
|
|
|
|
+ $result = $this->call_trigger('MAILING_DELETE', $user);
|
|
|
|
+ if ($result < 0)
|
|
|
|
+ {
|
|
|
|
+ $this->db->rollback();
|
|
|
|
+ return -1;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ $this->db->commit();
|
|
|
|
+ return 1;
|
|
}
|
|
}
|
|
|
|
|
|
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
|
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|