fix for the 0.2.7 "hacky way" :)

This commit is contained in:
Chl 2021-07-17 19:26:55 +02:00
parent 55ae226239
commit 6cfa45fb1b
2 changed files with 4 additions and 2 deletions

View file

@ -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.

View file

@ -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);
}
}
}