diff --git a/htdocs/comm/mailing/class/mailing.class.php b/htdocs/comm/mailing/class/mailing.class.php index ef83c5d1470..e5cda94aa9f 100644 --- a/htdocs/comm/mailing/class/mailing.class.php +++ b/htdocs/comm/mailing/class/mailing.class.php @@ -61,6 +61,11 @@ class Mailing extends CommonObject */ public $body; + /** + * @var int 1=Email will be sent even to email that has opt-out + */ + public $evenunsubscribe; + /** * @var int number of email */ @@ -317,6 +322,7 @@ class Mailing extends CommonObject $sql .= ", email_errorsto = '".$this->db->escape($this->email_errorsto)."'"; $sql .= ", bgcolor = '".($this->bgcolor ? $this->db->escape($this->bgcolor) : null)."'"; $sql .= ", bgimage = '".($this->bgimage ? $this->db->escape($this->bgimage) : null)."'"; + $sql .= ", evenunsubscribe = ".((int) $this->evenunsubscribe); $sql .= " WHERE rowid = ".(int) $this->id; dol_syslog(__METHOD__, LOG_DEBUG); @@ -357,7 +363,7 @@ class Mailing extends CommonObject { global $conf; - $sql = "SELECT m.rowid, m.titre as title, m.sujet, m.body, m.bgcolor, m.bgimage"; + $sql = "SELECT m.rowid, m.titre as title, m.sujet, m.body, m.bgcolor, m.bgimage, m.evenunsubscribe"; $sql .= ", m.email_from, m.email_replyto, m.email_errorsto"; $sql .= ", m.statut, m.nbemail"; $sql .= ", m.fk_user_creat, m.fk_user_valid"; @@ -389,6 +395,7 @@ class Mailing extends CommonObject $this->bgcolor = $obj->bgcolor; $this->bgimage = $obj->bgimage; + $this->evenunsubscribe = $obj->evenunsubscribe; $this->email_from = $obj->email_from; $this->email_replyto = $obj->email_replyto; @@ -454,6 +461,7 @@ class Mailing extends CommonObject $object->body = ''; $object->bgcolor = ''; $object->bgimage = ''; + $object->evenunsubscribe = 0; //$object->email_from = ''; // We do not reset from email because it is a mandatory value $object->email_replyto = ''; diff --git a/htdocs/install/mysql/migration/17.0.0-18.0.0.sql b/htdocs/install/mysql/migration/17.0.0-18.0.0.sql index 02b3eedd57a..a5b1406cfdb 100644 --- a/htdocs/install/mysql/migration/17.0.0-18.0.0.sql +++ b/htdocs/install/mysql/migration/17.0.0-18.0.0.sql @@ -388,5 +388,5 @@ ALTER TABLE llx_bordereau_cheque ADD COLUMN label varchar(255) AFTER ref; ALTER TABLE llx_c_email_templates add COLUMN defaultfortype smallint DEFAULT 0; -ALTER TALBE llx_mailing ADD COLUMN evenunsubscribe smallint DEFAULT 0; +ALTER TABLE llx_mailing ADD COLUMN evenunsubscribe smallint DEFAULT 0;