diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index 0afb5cdd230..41a769f1c2b 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -1093,18 +1093,18 @@ if ($action == 'create') { } - $htmltext = ''.$langs->trans("FollowingConstantsWillBeSubstituted").':
'; + $htmltext = ''.$langs->trans("FollowingConstantsWillBeSubstituted").':

'; foreach ($object->substitutionarray as $key => $val) { $htmltext .= $key.' = '.$langs->trans($val).'
'; } - $htmltext .= '
'; + $htmltext .= '
'; // Print mail content - print load_fiche_titre($langs->trans("EMail"), $form->textwithpicto(''.$langs->trans("AvailableVariables").'', $htmltext, 1, 'helpclickable', '', 0, 2, 'emailsubstitionhelp'), 'generic'); + print load_fiche_titre($langs->trans("EMail"), $form->textwithpicto(''.$langs->trans("AvailableVariables").'', $htmltext, 1, 'helpclickable', '', 0, 3, 'emailsubstitionhelp'), 'generic'); print dol_get_fiche_head('', '', '', -1); - print ''; + print '
'; // Subject print ''; diff --git a/htdocs/core/modules/mailings/advthirdparties.modules.php b/htdocs/core/modules/mailings/advthirdparties.modules.php index 688db8b8e7f..7649c255d04 100644 --- a/htdocs/core/modules/mailings/advthirdparties.modules.php +++ b/htdocs/core/modules/mailings/advthirdparties.modules.php @@ -42,7 +42,7 @@ class mailing_advthirdparties extends MailingTargets */ public $db; - public $enabled = '$conf->societe->enabled'; + public $enabled = 'isModEnabled("societe")'; /** diff --git a/htdocs/core/modules/mailings/example.modules.php b/htdocs/core/modules/mailings/example.modules.php deleted file mode 100644 index 739ab773196..00000000000 --- a/htdocs/core/modules/mailings/example.modules.php +++ /dev/null @@ -1,154 +0,0 @@ - - * - * This file is an example to follow to add your own email selector inside - * the Dolibarr email tool. - * Follow instructions given in README file to know what to change to build - * your own emailing list selector. - * Code that need to be changed in this file are marked by "CHANGE THIS" tag. - */ - -/** - * \file htdocs/core/modules/mailings/example.modules.php - * \ingroup mailing - * \brief Example file to provide a list of recipients for mailing module - */ - -include_once DOL_DOCUMENT_ROOT.'/core/modules/mailings/modules_mailings.php'; - - -// CHANGE THIS: Class name must be called mailing_xxx with xxx=name of your selector - -/** - \class mailing_example - \brief Class to manage a list of personalised recipients for mailing feature -*/ -class mailing_example extends MailingTargets -{ - // CHANGE THIS: Put here a name not already used - public $name = 'example'; - // CHANGE THIS: Put here a description of your selector module. - // This label is used if no translation is found for key MailingModuleDescXXX where XXX=name is found - public $desc = 'Put here a description'; - // CHANGE THIS: Set to 1 if selector is available for admin users only - public $require_admin = 0; - // CHANGE THIS: Add a tooltip language key to add a tooltip help icon after the email target selector - public $tooltip = 'MyTooltipLangKey'; - - public $require_module = array(); - - /** - * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png - */ - public $picto = ''; - - /** - * @var DoliDB Database handler. - */ - public $db; - - - // CHANGE THIS: Constructor name must be called mailing_xxx with xxx=name of your selector - /** - * Constructor - * - * @param DoliDB $db Database handler - */ - public function __construct($db) - { - $this->db = $db; - } - - - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps - /** - * This is the main function that returns the array of emails - * - * @param int $mailing_id Id of mailing. No need to use it. - * @return int <0 if error, number of emails added if ok - */ - public function add_to_target($mailing_id) - { - // phpcs:enable - $target = array(); - - // CHANGE THIS - // ----- Your code start here ----- - - // You must fill the $target array with record like this - // $target[0]=array('email'=>'email_0','name'=>'name_0','firstname'=>'firstname_0', 'other'=>'other_0'); - // ... - // $target[n]=array('email'=>'email_n','name'=>'name_n','firstname'=>'firstname_n', 'other'=>'other_n'); - - // Example: $target[0]=array('email'=>'myemail@example.com', 'name'=>'Doe', 'firstname'=>'John', 'other'=>'Other information'); - - // ----- Your code end here ----- - - return parent::addTargetsToDatabase($mailing_id, $target); - } - - - /** - * On the main mailing area, there is a box with statistics. - * If you want to add a line in this report you must provide an - * array of SQL request that returns two field: - * One called "label", One called "nb". - * - * @return array Array with SQL requests - */ - public function getSqlArrayForStats() - { - // CHANGE THIS: Optionnal - - //var $statssql=array(); - //$this->statssql[0]="SELECT field1 as label, count(distinct(email)) as nb FROM mytable WHERE email IS NOT NULL"; - return array(); - } - - - /** - * Return here number of distinct emails returned by your selector. - * For example if this selector is used to extract 500 different - * emails from a text file, this function must return 500. - * - * @param string $sql Requete sql de comptage - * @return int|string Nb of recipient, or <0 if error, or '' if NA - */ - public function getNbOfRecipients($sql = '') - { - // CHANGE THIS: Optionnal - - // Example: return parent::getNbOfRecipients("SELECT count(*) as nb from dolibarr_table"); - // Example: return 500; - return '?'; - } - - /** - * This is to add a form filter to provide variant of selector - * If used, the HTML select must be called "filter" - * - * @return string A html select zone - */ - public function formFilter() - { - // CHANGE THIS: Optionnal - - $s = ''; - return $s; - } - - - /** - * Can include an URL link on each record provided by selector - * shown on target page. - * - * @param int $id ID - * @return string Url link - */ - public function url($id) - { - // CHANGE THIS: Optionnal - - return ''; - } -} diff --git a/htdocs/core/modules/mailings/fraise.modules.php b/htdocs/core/modules/mailings/fraise.modules.php index 992539cc303..9fe6a615f5d 100644 --- a/htdocs/core/modules/mailings/fraise.modules.php +++ b/htdocs/core/modules/mailings/fraise.modules.php @@ -41,7 +41,7 @@ class mailing_fraise extends MailingTargets public $require_module = array('adherent'); - public $enabled = '$conf->adherent->enabled'; + public $enabled = 'isModEnabled("adherent")'; /** * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png diff --git a/htdocs/core/modules/mailings/partnership.modules.php b/htdocs/core/modules/mailings/partnership.modules.php index 8a1fe0f2c16..b4a8e9d8fd9 100644 --- a/htdocs/core/modules/mailings/partnership.modules.php +++ b/htdocs/core/modules/mailings/partnership.modules.php @@ -44,7 +44,7 @@ class mailing_partnership extends MailingTargets */ public $db; - public $enabled = '$conf->partnership->enabled'; + public $enabled = 'isModEnabled("partnership")'; /** diff --git a/htdocs/core/modules/mailings/thirdparties.modules.php b/htdocs/core/modules/mailings/thirdparties.modules.php index 71be0733fb2..2f8040d4b75 100644 --- a/htdocs/core/modules/mailings/thirdparties.modules.php +++ b/htdocs/core/modules/mailings/thirdparties.modules.php @@ -31,7 +31,7 @@ class mailing_thirdparties extends MailingTargets public $require_module = array("societe"); // This module allows to select by categories must be also enabled if category module is not activated - public $enabled = '$conf->societe->enabled'; + public $enabled = 'isModEnabled("societe")'; /** * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png diff --git a/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php b/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php index 1f8f3f82f7c..9fc43e37388 100644 --- a/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php +++ b/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php @@ -29,7 +29,7 @@ class mailing_thirdparties_services_expired extends MailingTargets public $require_module = array('contrat'); - public $enabled = '$conf->societe->enabled'; + public $enabled = 'isModEnabled("societe")'; /** * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png diff --git a/htdocs/modulebuilder/template/core/modules/mailings/mailinglist_mymodule_myobject.modules.php b/htdocs/modulebuilder/template/core/modules/mailings/mailinglist_mymodule_myobject.modules.php index 280f62dc2c1..7b2c4e2ab5a 100644 --- a/htdocs/modulebuilder/template/core/modules/mailings/mailinglist_mymodule_myobject.modules.php +++ b/htdocs/modulebuilder/template/core/modules/mailings/mailinglist_mymodule_myobject.modules.php @@ -24,7 +24,7 @@ class mailing_mailinglist_mymodule_myobject extends MailingTargets // CHANGE THIS: Set to 1 if selector is available for admin users only public $require_admin = 0; - public $enabled = '$conf->mymodule->enabled'; + public $enabled = 'isModEnabled("mymodule")'; public $require_module = array();
'.$langs->trans("MailTopic").''.$object->sujet.'