From 68ec172798cf1032cd051f57c7ea6fbceecb297d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 3 Nov 2018 12:37:52 +0100 Subject: [PATCH] Fix setup to enable reminder b email --- htdocs/adherents/admin/adherent_emails.php | 3 ++- htdocs/adherents/class/adherent.class.php | 12 +++++++--- htdocs/comm/action/class/actioncomm.class.php | 10 +++++++-- htdocs/core/lib/admin.lib.php | 22 ++++++++++++++----- htdocs/langs/en_US/admin.lang | 1 + 5 files changed, 37 insertions(+), 11 deletions(-) diff --git a/htdocs/adherents/admin/adherent_emails.php b/htdocs/adherents/admin/adherent_emails.php index 60e0b2c3b48..36c7091a47b 100644 --- a/htdocs/adherents/admin/adherent_emails.php +++ b/htdocs/adherents/admin/adherent_emails.php @@ -147,8 +147,9 @@ $constantes=array( 'ADHERENT_EMAIL_TEMPLATE_AUTOREGISTER' =>'emailtemplate:member', /* old was ADHERENT_AUTOREGISTER_MAIL */ 'ADHERENT_EMAIL_TEMPLATE_MEMBER_VALIDATION' =>'emailtemplate:member', /* old was ADHERENT_MAIL_VALID */ 'ADHERENT_EMAIL_TEMPLATE_SUBSCRIPTION' =>'emailtemplate:member', /* old was ADHERENT_MAIL_COTIS */ - 'ADHERENT_EMAIL_TEMPLATE_REMIND_EXPIRATION' =>'emailtemplate:member', 'ADHERENT_EMAIL_TEMPLATE_CANCELATION' =>'emailtemplate:member', /* old was ADHERENT_MAIL_RESIL */ + 'MEMBER_REMINDER_EMAIL'=>array('type'=>'yesno', 'label'=>$langs->trans('MEMBER_REMINDER_EMAIL', $langs->transnoentities("Module2300Name"))), + 'ADHERENT_EMAIL_TEMPLATE_REMIND_EXPIRATION' =>'emailtemplate:member', ); $helptext='*'.$langs->trans("FollowingConstantsWillBeSubstituted").'
'; diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 3df36ef3eda..4277b274a1d 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -2644,13 +2644,19 @@ class Adherent extends CommonObject $blockingerrormsg = ''; - /*if (empty($conf->global->MEMBER_REMINDER_EMAIL)) + if (empty($conf->adherent->enabled)) // Should not happen. If module disabled, cron job should not be visible. + { + $langs->load("agenda"); + $this->output = $langs->trans('ModuleNotEnabled', $langs->transnoentitiesnoconv("Adherent")); + return 0; + } + if (empty($conf->global->MEMBER_REMINDER_EMAIL)) { $langs->load("agenda"); $this->output = $langs->trans('EventRemindersByEmailNotEnabled', $langs->transnoentitiesnoconv("Adherent")); return 0; - }*/ - + } + $now = dol_now(); $nbok = 0; $nbko = 0; diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 92af9fef6da..e84ef93da2d 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -1679,13 +1679,19 @@ class ActionComm extends CommonObject $this->output = ''; $this->error=''; - if (empty($conf->global->AGENDA_REMINDER_EMAIL)) + if (empty($conf->agenda->enabled)) // Should not happen. If module disabled, cron job should not be visible. + { + $langs->load("agenda"); + $this->output = $langs->trans('ModuleNotEnabled', $langs->transnoentitiesnoconv("Agenda")); + return 0; + } + if (empty($conf->global->AGENDA_REMINDER_EMAIL)) { $langs->load("agenda"); $this->output = $langs->trans('EventRemindersByEmailNotEnabled', $langs->transnoentitiesnoconv("Agenda")); return 0; } - + $now = dol_now(); dol_syslog(__METHOD__, LOG_DEBUG); diff --git a/htdocs/core/lib/admin.lib.php b/htdocs/core/lib/admin.lib.php index f5efa5c5b7e..89f511c18c2 100644 --- a/htdocs/core/lib/admin.lib.php +++ b/htdocs/core/lib/admin.lib.php @@ -1353,7 +1353,8 @@ function complete_elementList_with_modules(&$elementList) /** * Show array with constants to edit * - * @param array $tableau Array of constants array('key'=>type, ) where type can be 'string', 'text', 'textarea', 'html', 'yesno', 'emailtemplate:xxx', ... + * @param array $tableau Array of constants array('key'=>array('type'=>type, 'label'=>label) + * where type can be 'string', 'text', 'textarea', 'html', 'yesno', 'emailtemplate:xxx', ... * @param int $strictw3c 0=Include form into table (deprecated), 1=Form is outside table to respect W3C (no form into table), 2=No form nor button at all * @param string $helptext Help * @return void @@ -1377,17 +1378,28 @@ function form_constantes($tableau, $strictw3c=0, $helptext='') if (empty($strictw3c)) print ''.$langs->trans("Action").''; print "\n"; + $label=''; $listofparam=array(); foreach($tableau as $key => $const) // Loop on each param { + $label=''; // $const is a const key like 'MYMODULE_ABC' - if (is_numeric($key)) { + if (is_numeric($key)) { // Very old behaviour $type = 'string'; } else { - $type = $const; - $const = $key; + if (is_array($const)) + { + $type = $const['type']; + $label = $const['label']; + $const = $key; + } + else + { + $type = $const; + $const = $key; + } } $sql = "SELECT "; @@ -1428,7 +1440,7 @@ function form_constantes($tableau, $strictw3c=0, $helptext='') print ''; print ''; - print $langs->trans('Desc'.$const); + print ($label ? $label : $langs->trans('Desc'.$const)); if ($const == 'ADHERENT_MAILMAN_URL') { diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 190b7cded97..a59cc0eee2e 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1282,6 +1282,7 @@ AdherentLoginRequired= Manage a Login for each member AdherentMailRequired=EMail required to create a new member MemberSendInformationByMailByDefault=Checkbox to send mail confirmation to members (validation or new subscription) is on by default VisitorCanChooseItsPaymentMode=Visitor can choose among available payment modes +MEMBER_REMINDER_EMAIL=Enable automatic reminder by emails of expired subscriptions. Note: Module %s must be enabled and correctly setup to have reminder sent. ##### LDAP setup ##### LDAPSetup=LDAP Setup LDAPGlobalParameters=Global parameters