[DB upgrade] Adding a field to select the mail's body format

Technical reminder about the DB upgrade :
There doesn't seem to be an easy and reusable way to give CMail both
parts of an text+html email, so we rework the database schema to have
a simple 'body' field with a 'body_ishtml' switch, following CMail
interface.

Enhancement from issue #1
This commit is contained in:
Chl 2021-11-27 23:47:52 +01:00
parent 0043e39f30
commit 1e694ef51d
7 changed files with 72 additions and 17 deletions

View file

@ -357,7 +357,7 @@ class modsendrecurringinvoicebymail extends DolibarrModules
$this->db->query("INSERT INTO " . MAIN_DB_PREFIX . "sribm_custom_mail_info (fk_facture_rec, fromtype, frommail) VALUES (" . (int)$row->rid . ", 'robot', '" . $this->db->escape($conf->global->MAIN_MAIL_EMAIL_FROM) . "')");
$sid = $this->db->last_insert_id(MAIN_DB_PREFIX . 'sribm_custom_mail_info');
}
foreach (array('subject' => 'subject', 'body' => 'body_plaintext', 'sendto' => 'sendto_free') as $key => $item) {
foreach (array('subject' => 'subject', 'body' => 'body', 'sendto' => 'sendto_free') as $key => $item) {
if (! empty($mail_data[$key])) {
// We loop on each field.
// Not optimized, I know.