diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php
index 41a49bd386d..2e1526c89cb 100644
--- a/htdocs/adherents/card.php
+++ b/htdocs/adherents/card.php
@@ -238,21 +238,6 @@ if (empty($reshook))
}
}
- /*
- if ($action == 'confirm_sendinfo' && $confirm == 'yes')
- {
- if ($object->email)
- {
- $from=$conf->email_from;
- if (! empty($conf->global->ADHERENT_MAIL_FROM)) $from=$conf->global->ADHERENT_MAIL_FROM;
-
- $result=$object->send_an_email($langs->transnoentitiesnoconv("ThisIsContentOfYourCard")."\n\n%INFOS%\n\n",$langs->transnoentitiesnoconv("CardContent"));
-
- $langs->load("mails");
- setEventMessages($langs->trans("MailSuccessfulySent", $from, $object->email), null, 'mesgs');
- }
- }*/
-
if ($action == 'update' && ! $cancel && $user->rights->adherent->creer)
{
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
@@ -630,7 +615,34 @@ if (empty($reshook))
// Send confirmation email (according to parameters of member type. Otherwise generic)
if ($object->email && GETPOST("send_mail"))
{
- $result=$object->send_an_email($adht->getMailOnValid(),$conf->global->ADHERENT_MAIL_VALID_SUBJECT,array(),array(),array(),"","",0,2);
+ $subject = '';
+ $msg= '';
+
+ // Send subscription email
+ include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
+ $formmail=new FormMail($db);
+ // Set output language
+ $outputlangs = new Translate('', $conf);
+ $outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? $mysoc->default_lang : $object->thirdparty->default_lang);
+ $outputlangs->loadLangs(array("main", "members"));
+ // Get email content fro mtemplae
+ $arraydefaultmessage=null;
+ $labeltouse = $conf->global->ADHERENT_EMAIL_TEMPLATE_MEMBER_VALIDATION;
+
+ if (! empty($labeltouse)) $arraydefaultmessage=$formmail->getEMailTemplate($db, 'member', $user, $outputlangs, 0, 1, $labeltouse);
+
+ if (! empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0)
+ {
+ $subject = $arraydefaultmessage->topic;
+ $msg = $arraydefaultmessage->content;
+ }
+
+ $substitutionarray=getCommonSubstitutionArray($outputlangs, 0, null, $object);
+ complete_substitutions_array($substitutionarray, $outputlangs, $object);
+ $subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs);
+ $texttosend = make_substitutions(dol_concatdesc($msg, $adht->getMailOnValid()), $substitutionarray, $outputlangs);
+
+ $result=$object->send_an_email($texttosend, $subjecttosend, array(), array(), array(), "", "", 0, 2);
if ($result < 0)
{
$error++;
@@ -674,7 +686,34 @@ if (empty($reshook))
{
if ($object->email && GETPOST("send_mail"))
{
- $result=$object->send_an_email($adht->getMailOnResiliate(),$conf->global->ADHERENT_MAIL_RESIL_SUBJECT,array(),array(),array(),"","",0,-1);
+ $subject = '';
+ $msg= '';
+
+ // Send subscription email
+ include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
+ $formmail=new FormMail($db);
+ // Set output language
+ $outputlangs = new Translate('', $conf);
+ $outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? $mysoc->default_lang : $object->thirdparty->default_lang);
+ $outputlangs->loadLangs(array("main", "members"));
+ // Get email content fro mtemplae
+ $arraydefaultmessage=null;
+ $labeltouse = $conf->global->ADHERENT_EMAIL_TEMPLATE_CANCELATION;
+
+ if (! empty($labeltouse)) $arraydefaultmessage=$formmail->getEMailTemplate($db, 'member', $user, $outputlangs, 0, 1, $labeltouse);
+
+ if (! empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0)
+ {
+ $subject = $arraydefaultmessage->topic;
+ $msg = $arraydefaultmessage->content;
+ }
+
+ $substitutionarray=getCommonSubstitutionArray($outputlangs, 0, null, $object);
+ complete_substitutions_array($substitutionarray, $outputlangs, $object);
+ $subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs);
+ $texttosend = make_substitutions(dol_concatdesc($msg, $adht->getMailOnResiliate()), $substitutionarray, $outputlangs);
+
+ $result=$object->send_an_email($texttosend, $subjecttosend, array(), array(), array(), "", "", 0, -1);
}
if ($result < 0)
{
@@ -1350,8 +1389,32 @@ else
$adht = new AdherentType($db);
$adht->fetch($object->typeid);
- $subjecttosend=$object->makeSubstitution($conf->global->ADHERENT_MAIL_VALID_SUBJECT);
- $texttosend=$object->makeSubstitution($adht->getMailOnValid());
+ $subject = '';
+ $msg= '';
+
+ // Send subscription email
+ include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
+ $formmail=new FormMail($db);
+ // Set output language
+ $outputlangs = new Translate('', $conf);
+ $outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? $mysoc->default_lang : $object->thirdparty->default_lang);
+ $outputlangs->loadLangs(array("main", "members"));
+ // Get email content fro mtemplae
+ $arraydefaultmessage=null;
+ $labeltouse = $conf->global->ADHERENT_EMAIL_TEMPLATE_MEMBER_VALIDATION;
+
+ if (! empty($labeltouse)) $arraydefaultmessage=$formmail->getEMailTemplate($db, 'member', $user, $outputlangs, 0, 1, $labeltouse);
+
+ if (! empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0)
+ {
+ $subject = $arraydefaultmessage->topic;
+ $msg = $arraydefaultmessage->content;
+ }
+
+ $substitutionarray=getCommonSubstitutionArray($outputlangs, 0, null, $object);
+ complete_substitutions_array($substitutionarray, $outputlangs, $object);
+ $subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs);
+ $texttosend = make_substitutions(dol_concatdesc($msg, $adht->getMailOnValid()), $substitutionarray, $outputlangs);
$tmp=$langs->trans("SendingAnEMailToMember");
$tmp.='
'.$langs->trans("MailFrom").': '.$conf->global->ADHERENT_MAIL_FROM.', ';
@@ -1375,7 +1438,7 @@ else
if (! empty($conf->mailman->enabled) && ! empty($conf->global->ADHERENT_USE_SPIP)) {
$formquestion[]=array('type'=>'other','label'=>$langs->transnoentitiesnoconv("SynchroSpipEnabled"),'value'=>'');
}
- print $form->formconfirm("card.php?rowid=".$id,$langs->trans("ValidateMember"),$langs->trans("ConfirmValidateMember"),"confirm_valid",$formquestion,1,1);
+ print $form->formconfirm("card.php?rowid=".$id, $langs->trans("ValidateMember"), $langs->trans("ConfirmValidateMember"), "confirm_valid", $formquestion, '1', 1, 220);
}
// Confirm send card by mail
@@ -1392,8 +1455,32 @@ else
$adht = new AdherentType($db);
$adht->fetch($object->typeid);
- $subjecttosend=$object->makeSubstitution($conf->global->ADHERENT_MAIL_RESIL_SUBJECT);
- $texttosend=$object->makeSubstitution($adht->getMailOnResiliate());
+ $subject = '';
+ $msg= '';
+
+ // Send subscription email
+ include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
+ $formmail=new FormMail($db);
+ // Set output language
+ $outputlangs = new Translate('', $conf);
+ $outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? $mysoc->default_lang : $object->thirdparty->default_lang);
+ $outputlangs->loadLangs(array("main", "members"));
+ // Get email content fro mtemplae
+ $arraydefaultmessage=null;
+ $labeltouse = $conf->global->ADHERENT_EMAIL_TEMPLATE_CANCELATION;
+
+ if (! empty($labeltouse)) $arraydefaultmessage=$formmail->getEMailTemplate($db, 'member', $user, $outputlangs, 0, 1, $labeltouse);
+
+ if (! empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0)
+ {
+ $subject = $arraydefaultmessage->topic;
+ $msg = $arraydefaultmessage->content;
+ }
+
+ $substitutionarray=getCommonSubstitutionArray($outputlangs, 0, null, $object);
+ complete_substitutions_array($substitutionarray, $outputlangs, $object);
+ $subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs);
+ $texttosend = make_substitutions(dol_concatdesc($msg, $adht->getMailOnResiliate()), $substitutionarray, $outputlangs);
$tmp=$langs->trans("SendingAnEMailToMember");
$tmp.='
('.$langs->trans("MailFrom").': '.$conf->global->ADHERENT_MAIL_FROM.', ';
@@ -1623,7 +1710,7 @@ else
$parameters = array();
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been
if (empty($reshook)) {
- if ($action != 'valid' && $action != 'editlogin' && $action != 'editthirdparty')
+ if ($action != 'editlogin' && $action != 'editthirdparty')
{
// Send
if ($object->statut == 1) {
diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php
index 3ef7af75ceb..5323355eb11 100644
--- a/htdocs/adherents/class/adherent.class.php
+++ b/htdocs/adherents/class/adherent.class.php
@@ -2556,7 +2556,7 @@ class Adherent extends CommonObject
// Send reminder email
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
- include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
+ $formmail=new FormMail($db);
$outputlangs = new Translate('', $conf);
$outputlangs->setDefaultLang(empty($adherent->thirdparty->default_lang) ? $mysoc->default_lang : $adherent->thirdparty->default_lang);
@@ -2578,6 +2578,7 @@ class Adherent extends CommonObject
$from = $conf->global->ADHERENT_MAIL_FROM;
$to = $adherent->email;
+ include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
$cmail = new CMailFile($subject, $to, $from, $msg, array(), array(), array(), '', '', 0, 1);
$result = $cmail->sendfile();
if (! $result)
diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php
index 71f18f01e4a..2393d5dad3b 100644
--- a/htdocs/adherents/class/adherent_type.class.php
+++ b/htdocs/adherents/class/adherent_type.class.php
@@ -499,7 +499,7 @@ class AdherentType extends CommonObject
/**
* getMailOnValid
*
- * @return string Return mail model
+ * @return string Return mail content of type or empty
*/
function getMailOnValid()
{
@@ -509,16 +509,14 @@ class AdherentType extends CommonObject
{
return $this->mail_valid;
}
- else
- {
- return $conf->global->ADHERENT_MAIL_VALID;
- }
+
+ return '';
}
/**
* getMailOnSubscription
*
- * @return string Return mail model
+ * @return string Return mail content of type or empty
*/
function getMailOnSubscription()
{
@@ -529,16 +527,14 @@ class AdherentType extends CommonObject
{
return $this->mail_subscription;
}
- else
- {
- return $conf->global->ADHERENT_MAIL_COTIS;
- }
+
+ return '';
}
/**
* getMailOnResiliate
*
- * @return string Return mail model
+ * @return string Return mail model content of type or empty
*/
function getMailOnResiliate()
{
@@ -549,10 +545,8 @@ class AdherentType extends CommonObject
{
return $this->mail_resiliate;
}
- else
- {
- return $conf->global->ADHERENT_MAIL_RESIL;
- }
+
+ return '';
}
}
diff --git a/htdocs/adherents/subscription.php b/htdocs/adherents/subscription.php
index 9d164307e91..3e4af5438c6 100644
--- a/htdocs/adherents/subscription.php
+++ b/htdocs/adherents/subscription.php
@@ -349,8 +349,32 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
// Send confirmation Email
if ($object->email && $sendalsoemail)
{
- $subjecttosend=$object->makeSubstitution($conf->global->ADHERENT_MAIL_COTIS_SUBJECT);
- $texttosend=$object->makeSubstitution($adht->getMailOnSubscription());
+ $subject = '';
+ $msg= '';
+
+ // Send subscription email
+ include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
+ $formmail=new FormMail($db);
+ // Set output language
+ $outputlangs = new Translate('', $conf);
+ $outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? $mysoc->default_lang : $object->thirdparty->default_lang);
+ $outputlangs->loadLangs(array("main", "members"));
+ // Get email content fro mtemplae
+ $arraydefaultmessage=null;
+ $labeltouse = $conf->global->ADHERENT_EMAIL_TEMPLATE_SUBSCRIPTION;
+
+ if (! empty($labeltouse)) $arraydefaultmessage=$formmail->getEMailTemplate($db, 'member', $user, $outputlangs, 0, 1, $labeltouse);
+
+ if (! empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0)
+ {
+ $subject = $arraydefaultmessage->topic;
+ $msg = $arraydefaultmessage->content;
+ }
+
+ $substitutionarray=getCommonSubstitutionArray($outputlangs, 0, null, $object);
+ complete_substitutions_array($substitutionarray, $outputlangs, $object);
+ $subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs);
+ $texttosend = make_substitutions(dol_concatdesc($msg, $adht->getMailOnSubscription()), $substitutionarray, $outputlangs);
// Attach a file ?
$file='';
@@ -1018,8 +1042,33 @@ if ($rowid > 0)
$adht = new AdherentType($db);
$adht->fetch($object->typeid);
- $subjecttosend=$object->makeSubstitution($conf->global->ADHERENT_MAIL_COTIS_SUBJECT);
- $texttosend=$object->makeSubstitution($adht->getMailOnSubscription());
+ // Send subscription email
+ $subject = '';
+ $msg= '';
+
+ // Send subscription email
+ include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
+ $formmail=new FormMail($db);
+ // Set output language
+ $outputlangs = new Translate('', $conf);
+ $outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? $mysoc->default_lang : $object->thirdparty->default_lang);
+ $outputlangs->loadLangs(array("main", "members"));
+ // Get email content fro mtemplae
+ $arraydefaultmessage=null;
+ $labeltouse = $conf->global->ADHERENT_EMAIL_TEMPLATE_SUBSCRIPTION;
+
+ if (! empty($labeltouse)) $arraydefaultmessage=$formmail->getEMailTemplate($db, 'member', $user, $outputlangs, 0, 1, $labeltouse);
+
+ if (! empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0)
+ {
+ $subject = $arraydefaultmessage->topic;
+ $msg = $arraydefaultmessage->content;
+ }
+
+ $substitutionarray=getCommonSubstitutionArray($outputlangs, 0, null, $object);
+ complete_substitutions_array($substitutionarray, $outputlangs, $object);
+ $subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs);
+ $texttosend = make_substitutions(dol_concatdesc($msg, $adht->getMailOnSubscription()), $substitutionarray, $outputlangs);
$tmp='global->ADHERENT_DEFAULT_SENDINFOBYMAIL)?' checked':'')).'>';
$helpcontent='';
diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index 8c575b6478e..8e9fa3bec4e 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -3597,7 +3597,7 @@ class Form
* @param string $action Action
* @param array $formquestion An array with complementary inputs to add into forms: array(array('label'=> ,'type'=> , ))
* type can be 'hidden', 'text', 'password', 'checkbox', 'radio', 'date', ...
- * @param string $selectedchoice "" or "no" or "yes"
+ * @param string $selectedchoice '' or 'no' or 'yes' or '1' or '0'
* @param int $useajax 0=No, 1=Yes, 2=Yes but submit page with &confirm=no if choice is No, 'xxx'=Yes and preoutput confirm box with div id=dialog-confirm-xxx
* @param int $height Force height of box
* @param int $width Force width of box ('999' or '90%'). Ignored and forced to 90% on smartphones.
diff --git a/htdocs/core/class/html.formticketsup.class.php b/htdocs/core/class/html.formticketsup.class.php
index 3310b83eb09..b86ebc95442 100644
--- a/htdocs/core/class/html.formticketsup.class.php
+++ b/htdocs/core/class/html.formticketsup.class.php
@@ -808,7 +808,7 @@ class FormTicketsup
// External users can't send message email
- if ($user->rights->ticketsup->write && !$user->societe_id) {
+ if ($user->rights->ticketsup->write && !$user->socid) {
print '