diff --git a/ChangeLog.md b/ChangeLog.md index b1acc23..0c23364 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -1,4 +1,8 @@ -# CHANGELOG SENDFACRECMAIL FOR DOLIBARR ERP CRM +# CHANGELOG SENDRECURRINGINVOICEBYMAIL FOR DOLIBARR ERP CRM + +## 0.2.3 +Renaming from 'sendfacrecmail' to 'sendrecurringinvoicebymail'. + ## 0.1.2 -Première version fonctionnelle. +First working version. diff --git a/README.md b/README.md index 99c8b97..278f705 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@ -# SendFacRecMail for DOLIBARR ERP CRM +# SendRecurringInvoiceByMail for DOLIBARR ERP CRM ## Features This module send the PDF generated with recurring invoices by email to the client. -This is currently a demo for Dolibarr 9.0.0-beta. +It requires Dolibarr version 10.0 at least (first version with the 'cron/afterCreationOfRecurringInvoice()' hook). Other modules are available on Dolistore.com. @@ -64,11 +64,11 @@ Note: If this screen tell you there is no custom directory, check your setup is ### From a GIT repository -- Clone the repository in ```$dolibarr_main_document_root_alt/sendfacrecmail``` +- Clone the repository in ```$dolibarr_main_document_root_alt/sendrecurringinvoicebymail``` ```sh cd ....../custom -git clone git@github.com:bugness-chl/sendfacrecmail.git sendfacrecmail +git clone git@github.com:bugness-chl/sendrecurringinvoicebymail.git sendrecurringinvoicebymail ``` ### Final steps diff --git a/class/actions_sendfacrecmail.class.php b/class/actions_sendrecurringinvoicebymail.class.php similarity index 93% rename from class/actions_sendfacrecmail.class.php rename to class/actions_sendrecurringinvoicebymail.class.php index b457f4c..dfc4a9d 100644 --- a/class/actions_sendfacrecmail.class.php +++ b/class/actions_sendrecurringinvoicebymail.class.php @@ -16,17 +16,17 @@ */ /** - * \file sendfacrecmail/class/actions_sendfacrecmail.class.php - * \ingroup sendfacrecmail - * \brief Hook overload for SendFacRecEmail + * \file sendrecurringinvoicebymail/class/actions_sendrecurringinvoicebymail.class.php + * \ingroup sendrecurringinvoicebymail + * \brief Hook overload for cron / afterCreationOfRecurringInvoice() * * Put detailed description here. */ /** - * Class Actionssendfacrecmail + * Class Actionssendrecurringinvoicebymail */ -class Actionssendfacrecmail +class Actionssendrecurringinvoicebymail { /** * @var DoliDB Database handler. @@ -94,9 +94,9 @@ class Actionssendfacrecmail // 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...) - $result = $this->db->query("SELECT * FROM " . MAIN_DB_PREFIX . "c_email_templates WHERE module = 'sendfacrecmail' AND active = 1 AND enabled = '1' ORDER BY tms DESC LIMIT 1"); + $result = $this->db->query("SELECT * FROM " . MAIN_DB_PREFIX . "c_email_templates WHERE module = 'sendrecurringinvoicebymail' AND active = 1 AND enabled = '1' ORDER BY tms DESC LIMIT 1"); if ( ! $result or ! ($template = $this->db->fetch_object($result))) { - $this->error = "Can't find mail template for sendfacrecmail"; + $this->error = "Can't find mail template for sendrecurringinvoicebymail"; $this->errors[] = $this->error; $error++; return -1; diff --git a/core/modules/modsendfacrecmail.class.php b/core/modules/modsendrecurringinvoicebymail.class.php similarity index 63% rename from core/modules/modsendfacrecmail.class.php rename to core/modules/modsendrecurringinvoicebymail.class.php index 33c67e5..3fb4a5b 100644 --- a/core/modules/modsendfacrecmail.class.php +++ b/core/modules/modsendrecurringinvoicebymail.class.php @@ -18,20 +18,20 @@ */ /** - * \defgroup sendfacrecmail Module sendfacrecmail - * \brief sendfacrecmail module descriptor. + * \defgroup sendrecurringinvoicebymail Module sendrecurringinvoicebymail + * \brief sendrecurringinvoicebymail module descriptor. * - * \file htdocs/sendfacrecmail/core/modules/modsendfacrecmail.class.php - * \ingroup sendfacrecmail - * \brief Description and activation file for module sendfacrecmail + * \file htdocs/sendrecurringinvoicebymail/core/modules/modsendrecurringinvoicebymail.class.php + * \ingroup sendrecurringinvoicebymail + * \brief Description and activation file for module sendrecurringinvoicebymail */ include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php'; /** - * Description and activation class for module sendfacrecmail + * Description and activation class for module sendrecurringinvoicebymail */ -class modsendfacrecmail extends DolibarrModules +class modsendrecurringinvoicebymail extends DolibarrModules { /** * Constructor. Define names, constants, directories, boxes, permissions @@ -48,7 +48,7 @@ class modsendfacrecmail extends DolibarrModules // Use here a free id (See in Home -> System information -> Dolibarr for list of used modules id). $this->numero = 500331; // TODO Go on page https://wiki.dolibarr.org/index.php/List_of_modules_id to reserve id number for your module // Key text used to identify module (for permissions, menus, etc...) - $this->rights_class = 'sendfacrecmail'; + $this->rights_class = 'sendrecurringinvoicebymail'; // 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 @@ -58,22 +58,22 @@ class modsendfacrecmail extends DolibarrModules // 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) //$this->familyinfo = array('myownfamily' => array('position' => '01', 'label' => $langs->trans("MyOwnFamily"))); - // Module label (no space allowed), used if translation string 'ModulesendfacrecmailName' not found (sendfacrecmail is name of module). + // Module label (no space allowed), used if translation string 'ModulesendrecurringinvoicebymailName' not found (sendrecurringinvoicebymail is name of module). $this->name = preg_replace('/^mod/i','',get_class($this)); - // Module description, used if translation string 'ModulesendfacrecmailDesc' not found (sendfacrecmail is name of module). + // Module description, used if translation string 'ModulesendrecurringinvoicebymailDesc' not found (sendrecurringinvoicebymail is name of module). $this->description = "Send generated invoice by email"; // Used only if file README.md and README-LL.md not found. $this->descriptionlong = "This module hooks onto the recurring invoice generation to automatically send the generated PDF."; $this->editor_name = 'Bugness'; - $this->editor_url = 'https://www.bugness.org'; + $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.2.2'; + $this->version = '0.2.3'; //Url to the file with your last numberversion of this module //$this->url_last_version = 'http://www.example.com/versionmodule.txt'; - // Key used in llx_const table to save module status enabled/disabled (where SENDFACRECMAIL is value of property name of module in uppercase) + // Key used in llx_const table to save module status enabled/disabled (where SENDRECURRINGINVOICEBYMAIL is value of property name of module in uppercase) $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); // Name of image file used for this module. // If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue' @@ -90,39 +90,39 @@ class modsendfacrecmail extends DolibarrModules 'tpl' => 0, // Set this to 1 if module overwrite template dir (core/tpl) 'barcode' => 0, // Set this to 1 if module has its own barcode directory (core/modules/barcode) '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 + //'css' => array('/sendrecurringinvoicebymail/css/sendrecurringinvoicebymail.css.php'), // Set this to relative path of css file if module has its own css file + //'js' => array('/sendrecurringinvoicebymail/js/sendrecurringinvoicebymail.js.php'), // Set this to relative path of js file if module must load a js on all pages 'hooks' => array('cron'), // 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 ); // Data directories to create when module is enabled. - // Example: this->dirs = array("/sendfacrecmail/temp","/sendfacrecmail/subdir"); - $this->dirs = array("/sendfacrecmail/temp"); + // Example: this->dirs = array("/sendrecurringinvoicebymail/temp","/sendrecurringinvoicebymail/subdir"); + $this->dirs = array("/sendrecurringinvoicebymail/temp"); - // Config pages. Put here list of php page, stored into sendfacrecmail/admin directory, to use to setup module. - $this->config_page_url = array("setup.php@sendfacrecmail"); + // Config pages. Put here list of php page, stored into sendrecurringinvoicebymail/admin directory, to use to setup module. + $this->config_page_url = array("setup.php@sendrecurringinvoicebymail"); // Dependencies $this->hidden = false; // A condition to hide module $this->depends = array('modFacture'); // List of module class names as string that must be enabled if this module is enabled. Example: array('always1'=>'modModuleToEnable1','always2'=>'modModuleToEnable2', 'FR1'=>'modModuleToEnableFR'...) $this->requiredby = array(); // List of module class names as string to disable if this one is disabled. Example: array('modModuleToDisable1', ...) $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->langfiles = array("sendrecurringinvoicebymail@sendrecurringinvoicebymail"); //$this->phpmin = array(5,4); // Minimum version of PHP required by module - $this->need_dolibarr_version = array(9,9); // Minimum version of Dolibarr required by module + $this->need_dolibarr_version = array(10,0); // 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'); + //$this->automatic_activation = array('FR'=>'sendrecurringinvoicebymailWasAutomaticallyActivatedBecauseOfYourCountryChoice'); //$this->always_enabled = true; // If true, can't be disabled // Constants // List of particular constants to add when module is enabled (key, 'chaine', value, desc, visible, 'current' or 'allentities', deleteonunactive) - // Example: $this->const=array(0=>array('SENDFACRECMAIL_MYNEWCONST1','chaine','myvalue','This is a constant to add',1), - // 1=>array('SENDFACRECMAIL_MYNEWCONST2','chaine','myvalue','This is another constant to add',0, 'current', 1) + // Example: $this->const=array(0=>array('SENDRECURRINGINVOICEBYMAIL_MYNEWCONST1','chaine','myvalue','This is a constant to add',1), + // 1=>array('SENDRECURRINGINVOICEBYMAIL_MYNEWCONST2','chaine','myvalue','This is another constant to add',0, 'current', 1) // ); $this->const = array( - //1=>array('SENDFACRECMAIL_MYCONSTANT', 'chaine', 'avalue', 'This is a constant to add', 1, 'allentities', 1) + //1=>array('SENDRECURRINGINVOICEBYMAIL_MYCONSTANT', 'chaine', 'avalue', 'This is a constant to add', 1, 'allentities', 1) ); // Some keys to add into the overwriting translation tables @@ -131,18 +131,18 @@ class modsendfacrecmail extends DolibarrModules 'fr_FR:ParentCompany'=>'Maison mère ou revendeur' )*/ - if (! isset($conf->sendfacrecmail) || ! isset($conf->sendfacrecmail->enabled)) + if (! isset($conf->sendrecurringinvoicebymail) || ! isset($conf->sendrecurringinvoicebymail->enabled)) { - $conf->sendfacrecmail=new stdClass(); - $conf->sendfacrecmail->enabled=0; + $conf->sendrecurringinvoicebymail=new stdClass(); + $conf->sendrecurringinvoicebymail->enabled=0; } // Array to add new pages in new tabs $this->tabs = array(); // Example: - // $this->tabs[] = array('data'=>'objecttype:+tabname1:Title1:mylangfile@sendfacrecmail:$user->rights->sendfacrecmail->read:/sendfacrecmail/mynewtab1.php?id=__ID__'); // To add a new tab identified by code tabname1 - // $this->tabs[] = array('data'=>'objecttype:+tabname2:SUBSTITUTION_Title2:mylangfile@sendfacrecmail:$user->rights->othermodule->read:/sendfacrecmail/mynewtab2.php?id=__ID__', // To add another new tab identified by code tabname2. Label will be result of calling all substitution functions on 'Title2' key. + // $this->tabs[] = array('data'=>'objecttype:+tabname1:Title1:mylangfile@sendrecurringinvoicebymail:$user->rights->sendrecurringinvoicebymail->read:/sendrecurringinvoicebymail/mynewtab1.php?id=__ID__'); // To add a new tab identified by code tabname1 + // $this->tabs[] = array('data'=>'objecttype:+tabname2:SUBSTITUTION_Title2:mylangfile@sendrecurringinvoicebymail:$user->rights->othermodule->read:/sendrecurringinvoicebymail/mynewtab2.php?id=__ID__', // To add another new tab identified by code tabname2. Label will be result of calling all substitution functions on 'Title2' key. // $this->tabs[] = array('data'=>'objecttype:-tabname:NU:conditiontoremove'); // To remove an existing tab identified by code tabname // // Where objecttype can be @@ -171,7 +171,7 @@ class modsendfacrecmail extends DolibarrModules $this->dictionaries=array(); /* Example: $this->dictionaries=array( - 'langs'=>'mylangfile@sendfacrecmail', + 'langs'=>'mylangfile@sendrecurringinvoicebymail', 'tabname'=>array(MAIN_DB_PREFIX."table1",MAIN_DB_PREFIX."table2",MAIN_DB_PREFIX."table3"), // List of tables we want to see into dictonnary editor 'tablib'=>array("Table1","Table2","Table3"), // Label of tables 'tabsql'=>array('SELECT f.rowid as rowid, f.code, f.label, f.active FROM '.MAIN_DB_PREFIX.'table1 as f','SELECT f.rowid as rowid, f.code, f.label, f.active FROM '.MAIN_DB_PREFIX.'table2 as f','SELECT f.rowid as rowid, f.code, f.label, f.active FROM '.MAIN_DB_PREFIX.'table3 as f'), // Request to select fields @@ -180,27 +180,27 @@ class modsendfacrecmail extends DolibarrModules 'tabfieldvalue'=>array("code,label","code,label","code,label"), // List of fields (list of fields to edit a record) 'tabfieldinsert'=>array("code,label","code,label","code,label"), // List of fields (list of fields for insert) 'tabrowid'=>array("rowid","rowid","rowid"), // Name of columns with primary key (try to always name it 'rowid') - 'tabcond'=>array($conf->sendfacrecmail->enabled,$conf->sendfacrecmail->enabled,$conf->sendfacrecmail->enabled) // Condition to show each dictionary + 'tabcond'=>array($conf->sendrecurringinvoicebymail->enabled,$conf->sendrecurringinvoicebymail->enabled,$conf->sendrecurringinvoicebymail->enabled) // Condition to show each dictionary ); */ // Boxes/Widgets - // Add here list of php file(s) stored in sendfacrecmail/core/boxes that contains class to show a widget. + // Add here list of php file(s) stored in sendrecurringinvoicebymail/core/boxes that contains class to show a widget. $this->boxes = array( - //0=>array('file'=>'sendfacrecmailwidget1.php@sendfacrecmail','note'=>'Widget provided by sendfacrecmail','enabledbydefaulton'=>'Home'), - //1=>array('file'=>'sendfacrecmailwidget2.php@sendfacrecmail','note'=>'Widget provided by sendfacrecmail'), - //2=>array('file'=>'sendfacrecmailwidget3.php@sendfacrecmail','note'=>'Widget provided by sendfacrecmail') + //0=>array('file'=>'sendrecurringinvoicebymailwidget1.php@sendrecurringinvoicebymail','note'=>'Widget provided by sendrecurringinvoicebymail','enabledbydefaulton'=>'Home'), + //1=>array('file'=>'sendrecurringinvoicebymailwidget2.php@sendrecurringinvoicebymail','note'=>'Widget provided by sendrecurringinvoicebymail'), + //2=>array('file'=>'sendrecurringinvoicebymailwidget3.php@sendrecurringinvoicebymail','note'=>'Widget provided by sendrecurringinvoicebymail') ); // Cronjobs (List of cron jobs entries to add when module is enabled) // unit_frequency must be 60 for minute, 3600 for hour, 86400 for day, 604800 for week $this->cronjobs = array( - //0=>array('label'=>'MyJob label', 'jobtype'=>'method', 'class'=>'/sendfacrecmail/class/myobject.class.php', 'objectname'=>'MyObject', 'method'=>'doScheduledJob', 'parameters'=>'', 'comment'=>'Comment', 'frequency'=>2, 'unitfrequency'=>3600, 'status'=>0, 'test'=>'$conf->sendfacrecmail->enabled', 'priority'=>50) + //0=>array('label'=>'MyJob label', 'jobtype'=>'method', 'class'=>'/sendrecurringinvoicebymail/class/myobject.class.php', 'objectname'=>'MyObject', 'method'=>'doScheduledJob', 'parameters'=>'', 'comment'=>'Comment', 'frequency'=>2, 'unitfrequency'=>3600, 'status'=>0, 'test'=>'$conf->sendrecurringinvoicebymail->enabled', 'priority'=>50) ); - // Example: $this->cronjobs=array(0=>array('label'=>'My label', 'jobtype'=>'method', 'class'=>'/dir/class/file.class.php', 'objectname'=>'MyClass', 'method'=>'myMethod', 'parameters'=>'param1, param2', 'comment'=>'Comment', 'frequency'=>2, 'unitfrequency'=>3600, 'status'=>0, 'test'=>'$conf->sendfacrecmail->enabled', 'priority'=>50), - // 1=>array('label'=>'My label', 'jobtype'=>'command', 'command'=>'', 'parameters'=>'param1, param2', 'comment'=>'Comment', 'frequency'=>1, 'unitfrequency'=>3600*24, 'status'=>0, 'test'=>'$conf->sendfacrecmail->enabled', 'priority'=>50) + // Example: $this->cronjobs=array(0=>array('label'=>'My label', 'jobtype'=>'method', 'class'=>'/dir/class/file.class.php', 'objectname'=>'MyClass', 'method'=>'myMethod', 'parameters'=>'param1, param2', 'comment'=>'Comment', 'frequency'=>2, 'unitfrequency'=>3600, 'status'=>0, 'test'=>'$conf->sendrecurringinvoicebymail->enabled', 'priority'=>50), + // 1=>array('label'=>'My label', 'jobtype'=>'command', 'command'=>'', 'parameters'=>'param1, param2', 'comment'=>'Comment', 'frequency'=>1, 'unitfrequency'=>3600*24, 'status'=>0, 'test'=>'$conf->sendrecurringinvoicebymail->enabled', 'priority'=>50) // ); @@ -209,24 +209,24 @@ class modsendfacrecmail extends DolibarrModules /* $r=0; $this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used) - $this->rights[$r][1] = 'Read myobject of sendfacrecmail'; // Permission label + $this->rights[$r][1] = 'Read myobject of sendrecurringinvoicebymail'; // Permission label $this->rights[$r][3] = 1; // Permission by default for new user (0/1) - $this->rights[$r][4] = 'read'; // In php code, permission will be checked by test if ($user->rights->sendfacrecmail->level1->level2) - $this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->sendfacrecmail->level1->level2) + $this->rights[$r][4] = 'read'; // In php code, permission will be checked by test if ($user->rights->sendrecurringinvoicebymail->level1->level2) + $this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->sendrecurringinvoicebymail->level1->level2) $r++; $this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used) - $this->rights[$r][1] = 'Create/Update myobject of sendfacrecmail'; // Permission label + $this->rights[$r][1] = 'Create/Update myobject of sendrecurringinvoicebymail'; // Permission label $this->rights[$r][3] = 1; // Permission by default for new user (0/1) - $this->rights[$r][4] = 'write'; // In php code, permission will be checked by test if ($user->rights->sendfacrecmail->level1->level2) - $this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->sendfacrecmail->level1->level2) + $this->rights[$r][4] = 'write'; // In php code, permission will be checked by test if ($user->rights->sendrecurringinvoicebymail->level1->level2) + $this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->sendrecurringinvoicebymail->level1->level2) $r++; $this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used) - $this->rights[$r][1] = 'Delete myobject of sendfacrecmail'; // Permission label + $this->rights[$r][1] = 'Delete myobject of sendrecurringinvoicebymail'; // Permission label $this->rights[$r][3] = 1; // Permission by default for new user (0/1) - $this->rights[$r][4] = 'delete'; // In php code, permission will be checked by test if ($user->rights->sendfacrecmail->level1->level2) - $this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->sendfacrecmail->level1->level2) + $this->rights[$r][4] = 'delete'; // In php code, permission will be checked by test if ($user->rights->sendrecurringinvoicebymail->level1->level2) + $this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->sendrecurringinvoicebymail->level1->level2) */ @@ -240,14 +240,14 @@ class modsendfacrecmail extends DolibarrModules /* $this->menu[$r++]=array('fk_menu'=>'', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode 'type'=>'top', // This is a Top menu entry - 'titre'=>'sendfacrecmail', - 'mainmenu'=>'sendfacrecmail', + 'titre'=>'sendrecurringinvoicebymail', + 'mainmenu'=>'sendrecurringinvoicebymail', 'leftmenu'=>'', - 'url'=>'/sendfacrecmail/sendfacrecmailindex.php', - 'langs'=>'sendfacrecmail@sendfacrecmail', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. + 'url'=>'/sendrecurringinvoicebymail/sendrecurringinvoicebymailindex.php', + 'langs'=>'sendrecurringinvoicebymail@sendrecurringinvoicebymail', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. 'position'=>1000+$r, - 'enabled'=>'$conf->sendfacrecmail->enabled', // Define condition to show or hide menu entry. Use '$conf->sendfacrecmail->enabled' if entry must be visible if module is enabled. - 'perms'=>'1', // Use 'perms'=>'$user->rights->sendfacrecmail->level1->level2' if you want your menu with a permission rules + 'enabled'=>'$conf->sendrecurringinvoicebymail->enabled', // Define condition to show or hide menu entry. Use '$conf->sendrecurringinvoicebymail->enabled' if entry must be visible if module is enabled. + 'perms'=>'1', // Use 'perms'=>'$user->rights->sendrecurringinvoicebymail->level1->level2' if you want your menu with a permission rules 'target'=>'', 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both */ @@ -255,28 +255,28 @@ class modsendfacrecmail extends DolibarrModules /* END MODULEBUILDER TOPMENU */ /* BEGIN MODULEBUILDER LEFTMENU MYOBJECT - $this->menu[$r++]=array( 'fk_menu'=>'fk_mainmenu=sendfacrecmail', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode + $this->menu[$r++]=array( 'fk_menu'=>'fk_mainmenu=sendrecurringinvoicebymail', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode 'type'=>'left', // This is a Left menu entry 'titre'=>'List MyObject', - 'mainmenu'=>'sendfacrecmail', - 'leftmenu'=>'sendfacrecmail_myobject_list', - 'url'=>'/sendfacrecmail/myobject_list.php', - 'langs'=>'sendfacrecmail@sendfacrecmail', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. + 'mainmenu'=>'sendrecurringinvoicebymail', + 'leftmenu'=>'sendrecurringinvoicebymail_myobject_list', + 'url'=>'/sendrecurringinvoicebymail/myobject_list.php', + 'langs'=>'sendrecurringinvoicebymail@sendrecurringinvoicebymail', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. 'position'=>1000+$r, - 'enabled'=>'$conf->sendfacrecmail->enabled', // Define condition to show or hide menu entry. Use '$conf->sendfacrecmail->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. - 'perms'=>'1', // Use 'perms'=>'$user->rights->sendfacrecmail->level1->level2' if you want your menu with a permission rules + 'enabled'=>'$conf->sendrecurringinvoicebymail->enabled', // Define condition to show or hide menu entry. Use '$conf->sendrecurringinvoicebymail->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. + 'perms'=>'1', // Use 'perms'=>'$user->rights->sendrecurringinvoicebymail->level1->level2' if you want your menu with a permission rules 'target'=>'', 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both - $this->menu[$r++]=array( 'fk_menu'=>'fk_mainmenu=sendfacrecmail,fk_leftmenu=sendfacrecmail', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode + $this->menu[$r++]=array( 'fk_menu'=>'fk_mainmenu=sendrecurringinvoicebymail,fk_leftmenu=sendrecurringinvoicebymail', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode 'type'=>'left', // This is a Left menu entry 'titre'=>'New MyObject', - 'mainmenu'=>'sendfacrecmail', - 'leftmenu'=>'sendfacrecmail_myobject_new', - 'url'=>'/sendfacrecmail/myobject_page.php?action=create', - 'langs'=>'sendfacrecmail@sendfacrecmail', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. + 'mainmenu'=>'sendrecurringinvoicebymail', + 'leftmenu'=>'sendrecurringinvoicebymail_myobject_new', + 'url'=>'/sendrecurringinvoicebymail/myobject_page.php?action=create', + 'langs'=>'sendrecurringinvoicebymail@sendrecurringinvoicebymail', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. 'position'=>1000+$r, - 'enabled'=>'$conf->sendfacrecmail->enabled', // Define condition to show or hide menu entry. Use '$conf->sendfacrecmail->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. - 'perms'=>'1', // Use 'perms'=>'$user->rights->sendfacrecmail->level1->level2' if you want your menu with a permission rules + 'enabled'=>'$conf->sendrecurringinvoicebymail->enabled', // Define condition to show or hide menu entry. Use '$conf->sendrecurringinvoicebymail->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. + 'perms'=>'1', // Use 'perms'=>'$user->rights->sendrecurringinvoicebymail->level1->level2' if you want your menu with a permission rules 'target'=>'', 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both END MODULEBUILDER LEFTMENU MYOBJECT */ @@ -287,10 +287,10 @@ class modsendfacrecmail extends DolibarrModules /* BEGIN MODULEBUILDER EXPORT MYOBJECT */ /* - $langs->load("sendfacrecmail@sendfacrecmail"); + $langs->load("sendrecurringinvoicebymail@sendrecurringinvoicebymail"); $this->export_code[$r]=$this->rights_class.'_'.$r; $this->export_label[$r]='MyObjectLines'; // Translation key (used only if key ExportDataset_xxx_z not found) - $this->export_icon[$r]='myobject@sendfacrecmail'; + $this->export_icon[$r]='myobject@sendrecurringinvoicebymail'; $keyforclass = 'MyObject'; $keyforclassfile='/mymobule/class/myobject.class.php'; $keyforelement='myobject'; include DOL_DOCUMENT_ROOT.'/core/commonfieldsinexport.inc.php'; $keyforselect='myobject'; $keyforaliasextra='extra'; $keyforelement='myobject'; @@ -317,11 +317,11 @@ class modsendfacrecmail extends DolibarrModules $sql = array(); // we check if our model already exists - $result = $this->db->query("SELECT COUNT(*) AS cpt FROM " . MAIN_DB_PREFIX."c_email_templates WHERE module = 'sendfacrecmail'"); + $result = $this->db->query("SELECT COUNT(*) AS cpt FROM " . MAIN_DB_PREFIX."c_email_templates WHERE module = 'sendrecurringinvoicebymail'"); if ($result) { $row = $this->db->fetch_object($result); if ($row->cpt == 0) { - $sql[] = "INSERT INTO " . MAIN_DB_PREFIX."c_email_templates (module, type_template, lang, label, joinfiles, topic, content) VALUES ('sendfacrecmail', 'thirdparty', 'fr_FR', 'Envoi automatique de facture via sendfacrecmail', '1', '[__MYCOMPANY_NAME__] Nouvelle facture __REF__', 'Bonjour,\n\nNouvelle facture ci-jointe.\n\nEn cas de règlement par virement, merci d''indiquer dans le libellé la référence du contrat : __CONTRACT_REF__ .\n\nCordialement,\nle nouveau robot de l''équipe tréso.')"; + $sql[] = "INSERT INTO " . MAIN_DB_PREFIX."c_email_templates (module, type_template, lang, label, joinfiles, topic, content) VALUES ('sendrecurringinvoicebymail', 'thirdparty', 'fr_FR', 'Envoi automatique de facture via sendrecurringinvoicebymail', '1', '[__MYCOMPANY_NAME__] Nouvelle facture __REF__', 'Bonjour,\n\nNouvelle facture ci-jointe.\n\nEn cas de règlement par virement, merci d''indiquer dans le libellé la référence du contrat : __CONTRACT_REF__ .\n\nCordialement,\nle nouveau robot de l''équipe tréso.')"; } } @@ -340,7 +340,7 @@ class modsendfacrecmail extends DolibarrModules { $sql = array(); - $sql[] = "DELETE FROM " . MAIN_DB_PREFIX."c_email_templates WHERE module = 'sendfacrecmail'"; + $sql[] = "DELETE FROM " . MAIN_DB_PREFIX."c_email_templates WHERE module = 'sendrecurringinvoicebymail'"; return $this->_remove($sql, $options); } diff --git a/img/object_sendfacrecmail.png b/img/object_sendrecurringinvoicebymail.png similarity index 100% rename from img/object_sendfacrecmail.png rename to img/object_sendrecurringinvoicebymail.png diff --git a/img/sendfacrecmail.png b/img/sendrecurringinvoicebymail.png similarity index 100% rename from img/sendfacrecmail.png rename to img/sendrecurringinvoicebymail.png diff --git a/langs/en_US/sendfacrecmail.lang b/langs/en_US/sendrecurringinvoicebymail.lang similarity index 53% rename from langs/en_US/sendfacrecmail.lang rename to langs/en_US/sendrecurringinvoicebymail.lang index b54f8e0..38b8b89 100644 --- a/langs/en_US/sendfacrecmail.lang +++ b/langs/en_US/sendrecurringinvoicebymail.lang @@ -17,29 +17,29 @@ # Generic # -# Module label 'ModulesendfacrecmailName' -ModulesendfacrecmailName = SendFacRecMail -# Module description 'ModulesendfacrecmailDesc' -ModulesendfacrecmailDesc = Send FactureRec generated invoices by mail to customers +# Module label 'ModulesendrecurringinvoicebymailName' +ModulesendrecurringinvoicebymailName = SendRecurringInvoiceByMail +# Module description 'ModulesendrecurringinvoicebymailDesc' +ModulesendrecurringinvoicebymailDesc = Send FactureRec generated invoices by mail to customers # # Admin page # -sendfacrecmailSetup = sendfacrecmail setup +sendrecurringinvoicebymailSetup = sendrecurringinvoicebymail setup Settings = Settings -sendfacrecmailSetupPage = sendfacrecmail setup page -SENDFACRECMAIL_MYPARAM1 = My param 1 -SENDFACRECMAIL_MYPARAM1Tooltip = My param 1 tooltip -SENDFACRECMAIL_MYPARAM2=My param 2 -SENDFACRECMAIL_MYPARAM2Tooltip=My param 2 tooltip +sendrecurringinvoicebymailSetupPage = sendrecurringinvoicebymail setup page +SENDRECURRINGINVOICEBYMAIL_MYPARAM1 = My param 1 +SENDRECURRINGINVOICEBYMAIL_MYPARAM1Tooltip = My param 1 tooltip +SENDRECURRINGINVOICEBYMAIL_MYPARAM2=My param 2 +SENDRECURRINGINVOICEBYMAIL_MYPARAM2Tooltip=My param 2 tooltip # # About page # About = About -sendfacrecmailAbout = About sendfacrecmail -sendfacrecmailAboutPage = sendfacrecmail about page +sendrecurringinvoicebymailAbout = About sendrecurringinvoicebymail +sendrecurringinvoicebymailAboutPage = sendrecurringinvoicebymail about page # # Sample page diff --git a/langs/fr_FR/sendfacrecmail.lang b/langs/fr_FR/sendrecurringinvoicebymail.lang similarity index 59% rename from langs/fr_FR/sendfacrecmail.lang rename to langs/fr_FR/sendrecurringinvoicebymail.lang index 605d381..a43e076 100644 --- a/langs/fr_FR/sendfacrecmail.lang +++ b/langs/fr_FR/sendrecurringinvoicebymail.lang @@ -17,24 +17,24 @@ # Générique # -# Module label 'ModulesendfacrecmailName' -ModulesendfacrecmailName = SendFacRecMail -# Module description 'ModulesendfacrecmailDesc' -ModulesendfacrecmailDesc = Envoi par mail des factures générées par les modèles +# Module label 'ModulesendrecurringinvoicebymailName' +ModulesendrecurringinvoicebymailName = SendRecurringInvoiceByMail +# Module description 'ModulesendrecurringinvoicebymailDesc' +ModulesendrecurringinvoicebymailDesc = Envoi par mail des factures générées par les modèles # # Page d'administration # -sendfacrecmailSetup = Configuration du module sendfacrecmail +sendrecurringinvoicebymailSetup = Configuration du module sendrecurringinvoicebymail Settings = Réglages -sendfacrecmailSetupPage = Page de configuration du module sendfacrecmail +sendrecurringinvoicebymailSetupPage = Page de configuration du module sendrecurringinvoicebymail # # Page À propos # About = À propos -sendfacrecmailAbout = À propos de sendfacrecmail -sendfacrecmailAboutPage = Page à propos de sendfacrecmail +sendrecurringinvoicebymailAbout = À propos de sendrecurringinvoicebymail +sendrecurringinvoicebymailAboutPage = Page à propos de sendrecurringinvoicebymail # # Page d'exemple diff --git a/phpdoc.dist.xml b/phpdoc.dist.xml index 4ce280d..df4906b 100644 --- a/phpdoc.dist.xml +++ b/phpdoc.dist.xml @@ -1,6 +1,6 @@ - sendfacrecmail + sendrecurringinvoicebymail build/phpdoc utf8 @@ -27,4 +27,4 @@ doc/* vendor/* - \ No newline at end of file + diff --git a/test/phpunit/sendfacrecmailFunctionalTest.php b/test/phpunit/sendrecurringinvoicebymailFunctionalTest.php similarity index 84% rename from test/phpunit/sendfacrecmailFunctionalTest.php rename to test/phpunit/sendrecurringinvoicebymailFunctionalTest.php index 82d17d5..d1b2e09 100644 --- a/test/phpunit/sendfacrecmailFunctionalTest.php +++ b/test/phpunit/sendrecurringinvoicebymailFunctionalTest.php @@ -17,8 +17,8 @@ */ /** - * \file test/functional/sendfacrecmailFunctionalTest.php - * \ingroup sendfacrecmail + * \file test/functional/sendrecurringinvoicebymailFunctionalTest.php + * \ingroup sendrecurringinvoicebymail * \brief Example Selenium test. * * Put detailed description here. @@ -29,7 +29,7 @@ namespace test\functional; use PHPUnit_Extensions_Selenium2TestCase_WebDriverException; /** - * Class sendfacrecmailFunctionalTest + * Class sendrecurringinvoicebymailFunctionalTest * * Requires chromedriver for Google Chrome * Requires geckodriver for Mozilla Firefox @@ -39,9 +39,9 @@ use PHPUnit_Extensions_Selenium2TestCase_WebDriverException; * @todo Windows support (IE, Google Chrome, Mozilla Firefox, Safari) * @todo OSX support (Safari, Google Chrome, Mozilla Firefox) * - * @package Testsendfacrecmail + * @package Testsendrecurringinvoicebymail */ -class sendfacrecmailFunctionalTest extends \PHPUnit_Extensions_Selenium2TestCase +class sendrecurringinvoicebymailFunctionalTest extends \PHPUnit_Extensions_Selenium2TestCase { // TODO: move to a global configuration file? /** @var string Base URL of the webserver under test */ @@ -176,12 +176,12 @@ class sendfacrecmailFunctionalTest extends \PHPUnit_Extensions_Selenium2TestCase $module_status_image = $this->byXPath($module_status_image_path); if (strstr($module_status_image->attribute('src'), 'switch_off.png')) { // Enable the module - $this->byHref('modsendfacrecmail')->click(); + $this->byHref('modsendrecurringinvoicebymail')->click(); } else { // Disable the module - $this->byHref('modsendfacrecmail')->click(); + $this->byHref('modsendrecurringinvoicebymail')->click(); // Reenable the module - $this->byHref('modsendfacrecmail')->click(); + $this->byHref('modsendrecurringinvoicebymail')->click(); } // Page reloaded, we need a new Xpath $module_status_image = $this->byXPath($module_status_image_path); @@ -196,9 +196,9 @@ class sendfacrecmailFunctionalTest extends \PHPUnit_Extensions_Selenium2TestCase */ public function testConfigurationPage() { - $this->url('/custom/sendfacrecmail/admin/setup.php'); + $this->url('/custom/sendrecurringinvoicebymail/admin/setup.php'); $this->authenticate(); - return $this->assertContains('sendfacrecmail/admin/setup.php', $this->url(), 'Configuration page'); + return $this->assertContains('sendrecurringinvoicebymail/admin/setup.php', $this->url(), 'Configuration page'); } /** @@ -209,9 +209,9 @@ class sendfacrecmailFunctionalTest extends \PHPUnit_Extensions_Selenium2TestCase */ public function testAboutPage() { - $this->url('/custom/sendfacrecmail/admin/about.php'); + $this->url('/custom/sendrecurringinvoicebymail/admin/about.php'); $this->authenticate(); - return $this->assertContains('sendfacrecmail/admin/about.php', $this->url(), 'About page'); + return $this->assertContains('sendrecurringinvoicebymail/admin/about.php', $this->url(), 'About page'); } /** @@ -222,7 +222,7 @@ class sendfacrecmailFunctionalTest extends \PHPUnit_Extensions_Selenium2TestCase */ public function testAboutPageRendersMarkdownReadme() { - $this->url('/custom/sendfacrecmail/admin/about.php'); + $this->url('/custom/sendrecurringinvoicebymail/admin/about.php'); $this->authenticate(); return $this->assertEquals( 'Dolibarr Module Template (aka My Module)', @@ -241,7 +241,7 @@ class sendfacrecmailFunctionalTest extends \PHPUnit_Extensions_Selenium2TestCase { $this->url('/admin/boxes.php'); $this->authenticate(); - return $this->assertContains('sendfacrecmailwidget1', $this->source(), "Box enabled"); + return $this->assertContains('sendrecurringinvoicebymailwidget1', $this->source(), "Box enabled"); } /** @@ -255,7 +255,7 @@ class sendfacrecmailFunctionalTest extends \PHPUnit_Extensions_Selenium2TestCase $this->url('/admin/triggers.php'); $this->authenticate(); return $this->assertContains( - 'interface_99_modsendfacrecmail_sendfacrecmailTriggers.class.php', + 'interface_99_modsendrecurringinvoicebymail_sendrecurringinvoicebymailTriggers.class.php', $this->byTag('body')->text(), "Trigger declared" ); @@ -273,7 +273,7 @@ class sendfacrecmailFunctionalTest extends \PHPUnit_Extensions_Selenium2TestCase $this->authenticate(); return $this->assertContains( 'tick.png', - $this->byXPath('//td[text()="interface_99_modsendfacrecmail_MyTrigger.class.php"]/following::img')->attribute('src'), + $this->byXPath('//td[text()="interface_99_modsendrecurringinvoicebymail_MyTrigger.class.php"]/following::img')->attribute('src'), "Trigger enabled" ); }