diff --git a/class/actions_sendfacrecmail.class.php b/class/actions_sendfacrecmail.class.php index 4b12866..b457f4c 100644 --- a/class/actions_sendfacrecmail.class.php +++ b/class/actions_sendfacrecmail.class.php @@ -73,7 +73,7 @@ class Actionssendfacrecmail * @param HookManager $hookmanager Hook manager propagated to allow calling another hook * @return int < 0 on error, 0 on success, 1 to replace standard code */ - public function generatedInvoice($parameters, &$object, &$action, $hookmanager) + public function afterCreationOfRecurringInvoice($parameters, &$object, &$action, $hookmanager) { global $conf, $user, $langs; $langs->load('mails'); @@ -86,6 +86,11 @@ class Actionssendfacrecmail if ($object->brouillon) { return 0; } + // On n'envoie évidemment pas s'il n'y a pas d'adresse email renseignée + if (empty($object->thirdparty->email)) { + dol_syslog("Empty email for thirdparty " . $object->thirdparty->id . ". Not sending facturerec " . $facturerec->ref . " (id:" . $facturerec->id . ")."); + return 0; + } // récupération du template du mail // (pas très précise mais je commence à en avoir marre de creuser tout dolibarr pour trouver les bonnes fonctions...) diff --git a/core/modules/modsendfacrecmail.class.php b/core/modules/modsendfacrecmail.class.php index 26d4300..a328a60 100644 --- a/core/modules/modsendfacrecmail.class.php +++ b/core/modules/modsendfacrecmail.class.php @@ -69,7 +69,7 @@ class modsendfacrecmail extends DolibarrModules $this->editor_url = 'https://www.bugness.org'; // Possible values for version are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z' - $this->version = '0.2.0'; + $this->version = '0.2.1'; //Url to the file with your last numberversion of this module //$this->url_last_version = 'http://www.example.com/versionmodule.txt'; @@ -92,7 +92,7 @@ class modsendfacrecmail extends DolibarrModules 'models' => 0, // Set this to 1 if module has its own models directory (core/modules/xxx) //'css' => array('/sendfacrecmail/css/sendfacrecmail.css.php'), // Set this to relative path of css file if module has its own css file //'js' => array('/sendfacrecmail/js/sendfacrecmail.js.php'), // Set this to relative path of js file if module must load a js on all pages - 'hooks' => array('data'=>array('createrecurringinvoices'), 'entity'=>'0'), // Set here all hooks context managed by module. To find available hook context, make a "grep -r '>initHooks(' *" on source code. You can also set hook context 'all' + 'hooks' => array('creationOfRecurringInvoices'), // Set here all hooks context managed by module. To find available hook context, make a "grep -r '>initHooks(' *" on source code. You can also set hook context 'all' 'moduleforexternal' => 0 // Set this to 1 if feature of module are opened to external users ); @@ -110,7 +110,7 @@ class modsendfacrecmail extends DolibarrModules $this->conflictwith = array(); // List of module class names as string this module is in conflict with. Example: array('modModuleToDisable1', ...) $this->langfiles = array("sendfacrecmail@sendfacrecmail"); //$this->phpmin = array(5,4); // Minimum version of PHP required by module - $this->need_dolibarr_version = array(8,9); // Minimum version of Dolibarr required by module + $this->need_dolibarr_version = array(9,9); // Minimum version of Dolibarr required by module $this->warnings_activation = array(); // Warning to show when we activate module. array('always'='text') or array('FR'='textfr','ES'='textes'...) $this->warnings_activation_ext = array(); // Warning to show when we activate an external module. array('always'='text') or array('FR'='textfr','ES'='textes'...) //$this->automatic_activation = array('FR'=>'sendfacrecmailWasAutomaticallyActivatedBecauseOfYourCountryChoice');