diff --git a/ChangeLog.md b/ChangeLog.md index 906f983..8f8ce21 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -3,6 +3,8 @@ ## 0.3.0 Dedicated tab on the template invoice's page, to be able to customize more cleanly the recipients, and the email content. +The hacky way of 0.2.7 is converted at installation (reinstallation for upgrade) but is not used after that and the support will be dropped in a future release. + ## 0.2.7 Add the possibility to overwrite some email fields (recipients, subject, body) for each template. diff --git a/core/modules/modsendrecurringinvoicebymail.class.php b/core/modules/modsendrecurringinvoicebymail.class.php index 9d816d3..14b9d38 100644 --- a/core/modules/modsendrecurringinvoicebymail.class.php +++ b/core/modules/modsendrecurringinvoicebymail.class.php @@ -354,7 +354,7 @@ class modsendrecurringinvoicebymail extends DolibarrModules $mail_data = $this->parseCustomFieldsMail($row->note_private); $sid = $row->sid; if (! $sid) { - $this->db->query("INSERT INTO " . MAIN_DB_PREFIX . "sribm_custom_mail_info (fk_facture_rec) VALUES (" . (int)$row->rid . ")"); + $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) { @@ -365,7 +365,7 @@ class modsendrecurringinvoicebymail extends DolibarrModules if ($key == 'sendto') { // If the note_private specified a recipient, we disable sending to the // main societe's mail. - $this->db->query("UPDATE " . MAIN_DB_PREFIX . "sribm_custom_mail_info SET sendto_thirdparty = 0 WHERE rowid = " . (int)$row->rid); + $this->db->query("UPDATE " . MAIN_DB_PREFIX . "sribm_custom_mail_info SET sendto_thirdparty = 0 WHERE rowid = " . (int)$sid); } } }