Compare commits
3 commits
Author | SHA1 | Date | |
---|---|---|---|
Chl | 38a96d7ac2 | ||
Chl | 60b4a1fd99 | ||
59f543e196 |
10
ChangeLog.md
10
ChangeLog.md
|
@ -1,15 +1,5 @@
|
|||
# CHANGELOG SENDRECURRINGINVOICEBYMAIL FOR [DOLIBARR ERP CRM](https://www.dolibarr.org)
|
||||
|
||||
## 0.3.4
|
||||
|
||||
Fix: the hook was also triggered by supplier invoices.
|
||||
Thanks to jpardenoy for the report and the fix.
|
||||
|
||||
|
||||
## 0.3.3
|
||||
|
||||
Fix: adds CSRF protection.
|
||||
|
||||
|
||||
## 0.3.2
|
||||
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
|
||||
## Features
|
||||
|
||||
(en) This module sends by email the customer invoice generated with a recurring invoice template via scheduled jobs.
|
||||
(en) This module sends by email the invoice generated with recurring invoices via scheduled jobs.
|
||||
|
||||
(fr) Ce module envoie par mail les factures clientes générées automatiquement par les travaux planifiés et les factures modèles.
|
||||
(fr) Ce module envoie par mail les factures générées automatiquement par les travaux planifiés et les factures modèles.
|
||||
|
||||
You can customize the mail globally or by recurring invoice.
|
||||
|
||||
|
@ -14,7 +14,7 @@ To edit the default global mail template, go to Home > Setup > Emails > Email te
|
|||
|
||||
To edit the default sender address, go to Home > Setup > Emails, and edit the `Sender email for automatic emails` field.
|
||||
|
||||
This module hooks himself on the end of the `Recurring invoices` job from the Scheduled jobs (aka. `cron`) module. It will only be triggered via this Scheduled job and will not send mail when manually generating an invoice from a recurring invoice template.
|
||||
This module is triggered by the cron (Scheduled jobs module) and will not send emails when manually generating an invoice.
|
||||
|
||||
|
||||
## Requirements
|
||||
|
|
|
@ -84,14 +84,6 @@ class Actionssendrecurringinvoicebymail
|
|||
$error = 0; // Error counter
|
||||
|
||||
$facturerec = $parameters['facturerec'];
|
||||
// Since Dolibarr 16, this hook is also used for the FactureFournisseurRec class.
|
||||
if (! $facturerec instanceof FactureRec) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Load our own object, linked to this facture
|
||||
// (if it doesn't exist in database, fetch(,,true) will fill the object
|
||||
// from the global mail template)
|
||||
$mailObject = new SRIBMCustomMailInfo($this->db);
|
||||
if ($mailObject->fetch(null, $facturerec->id, true) != 1) {
|
||||
dol_syslog("Error loading SRIBMCustomMailInfo for facture rec " . (isset($facturerec->id) ? $facturerec->id : "(facturerec->id not set ??)"));
|
||||
|
|
|
@ -52,7 +52,7 @@ class modsendrecurringinvoicebymail extends DolibarrModules
|
|||
|
||||
// Family can be 'base' (core modules),'crm','financial','hr','projects','products','ecm','technic' (transverse modules),'interface' (link with external tools),'other','...'
|
||||
// It is used to group modules by family in module setup page
|
||||
$this->family = "financial";
|
||||
$this->family = "crm";
|
||||
// Module position in the family on 2 digits ('01', '10', '20', ...)
|
||||
$this->module_position = '90';
|
||||
// Gives the possibility for the module, to provide his own family info and position of this family (Overwrite $this->family and $this->module_position. Avoid this)
|
||||
|
@ -69,7 +69,7 @@ class modsendrecurringinvoicebymail extends DolibarrModules
|
|||
$this->editor_url = 'https://code.bugness.org/Dolibarr/sendrecurringinvoicebymail';
|
||||
|
||||
// Possible values for version are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'
|
||||
$this->version = '0.3.4';
|
||||
$this->version = '0.3.3';
|
||||
|
||||
//Url to the file with your last numberversion of this module
|
||||
//$this->url_last_version = 'http://www.example.com/versionmodule.txt';
|
||||
|
|
|
@ -147,7 +147,7 @@ do {
|
|||
$mailObject->sendcc_thirdparty = in_array('thirdparty', GETPOST('sendcc_socpeople', 'array'));
|
||||
|
||||
$mailObject->subject = GETPOST('subject', 'alpha');
|
||||
$mailObject->body = GETPOST('body', 'alpha');
|
||||
$mailObject->body = GETPOST('body', 'restricthtml');
|
||||
$mailObject->body_ishtml = (int)GETPOST('body_ishtml', 'int');
|
||||
|
||||
// Save into database
|
||||
|
@ -234,12 +234,6 @@ do {
|
|||
|
||||
$output .= '<div class="titre inline-block">' . $langs->trans("Options") . "</div>\n";
|
||||
$output .= '<form id="sribmform" name="sribmform" method="POST" action="#sribmform">';
|
||||
if (function_exists('newToken')) {
|
||||
$output .= '<input type="hidden" name="token" value="'.newToken().'">'; // CSRF protection
|
||||
} else {
|
||||
// Used before Dolibar 13
|
||||
$output .= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; // CSRF protection
|
||||
}
|
||||
$output .= '<table class="liste" summary="mail options"><tbody>';
|
||||
$output .= '<tr class="oddeven">';
|
||||
$output .= ' <td><label for="active">' . $langs->trans('OptionEnable') . "</label></td>\n";
|
||||
|
@ -306,16 +300,21 @@ do {
|
|||
$output .= '<tr><td class="minwidth200" valign="top">';
|
||||
$output .= $form->textwithpicto($langs->trans("MailText"), $helpforsubstitution, 1, 'help', '', 0, 2, 'substittooltipfrombody');
|
||||
$output .= "</td>\n<td>";
|
||||
/*
|
||||
// doleditor does some weird stuff, adding <br> and newlines, I'll get more into it when I have time.
|
||||
// fallback to simple <textarea> for the time being.
|
||||
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
$doleditor = new DolEditor('body_plaintext', (GETPOST('body_plaintext', 'alpha') ? GETPOST('body_plaintext', 'alpha') : $mailObject->body_plaintext), '', 280);
|
||||
$doleditor = new DolEditor(
|
||||
'body',
|
||||
(GETPOST('body', 'alpha') ? GETPOST('body', 'alpha') : $mailObject->body),
|
||||
'',
|
||||
280,
|
||||
'dolibarr_mailings', // toolbar name
|
||||
'In', // toolbar location
|
||||
false, // toolbar start expanded
|
||||
true, // use local browser
|
||||
!empty($conf->global->FCKEDITOR_ENABLE_MAIL) // follow global conf about using ckeditor for mails.
|
||||
);
|
||||
$output .= $doleditor->Create(1);
|
||||
*/
|
||||
$output .= '<textarea id="body" name="body" rows="14" cols="80" class="flat">';
|
||||
$output .= htmlentities(GETPOST('body', 'alpha') ? GETPOST('body', 'alpha') : $mailObject->body);
|
||||
$output .= "</textarea>\n";
|
||||
$output .= "</td></tr>\n";
|
||||
|
||||
// body_ishtml
|
||||
|
|
Loading…
Reference in a new issue