diff --git a/htdocs/admin/mails.php b/htdocs/admin/mails.php
index 778d0eda82d..9af4c15e0a6 100644
--- a/htdocs/admin/mails.php
+++ b/htdocs/admin/mails.php
@@ -587,9 +587,13 @@ else
}
else dol_print_error($db);
- print '
| '.$langs->trans('MAIN_MAIL_DEFAULT_FROMTYPE').' | ';
+ print '
| '.$langs->trans('MAIN_MAIL_DEFAULT_FROMTYPE').' | ';
print '';
- if ($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE === 'user')
+ if ($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE === 'robot')
+ {
+ print $langs->trans('RobotEmail');
+ }
+ else if ($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE === 'user')
{
print $langs->trans('UserEmail');
}
@@ -726,9 +730,10 @@ else
$formmail = new FormMail($db);
$formmail->fromname = (isset($_POST['fromname'])?$_POST['fromname']:$conf->global->MAIN_MAIL_EMAIL_FROM);
$formmail->frommail = (isset($_POST['frommail'])?$_POST['frommail']:$conf->global->MAIN_MAIL_EMAIL_FROM);
+ $formmail->fromid=$user->id;
$formmail->trackid=(($action == 'testhtml')?"testhtml":"test");
$formmail->withfromreadonly=1;
- $formmail->fromtype='all';
+ $formmail->fromtype=(GETPOST('fromtype')?GETPOST('fromtype'):(!empty($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE)?$conf->global->MAIN_MAIL_DEFAULT_FROMTYPE:'user'));
$formmail->withsubstit=0;
$formmail->withfrom=1;
$formmail->witherrorsto=1;
diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php
index e4eb5016d7d..05529b3fe5f 100644
--- a/htdocs/core/class/html.formmail.class.php
+++ b/htdocs/core/class/html.formmail.class.php
@@ -429,12 +429,14 @@ class FormMail extends Form
{
$out.= ' |
| '.$langs->trans("MailFrom").' | ';
+ // $this->fromtype is the default value to use to select sender
if (! ($this->fromtype === 'user' && $this->fromid > 0)
&& ! ($this->fromtype === 'company')
+ && ! ($this->fromtype === 'robot')
&& ! preg_match('/user_aliases/', $this->fromtype)
&& ! preg_match('/global_aliases/', $this->fromtype)
&& ! preg_match('/senderprofile/', $this->fromtype)
- && ! ($this->fromtype === 'all'))
+ )
{
// Use this->fromname and this->frommail or error if not defined
$out.= $this->fromname;
@@ -453,15 +455,6 @@ class FormMail extends Form
} else {
$liste = array();
- if ($this->fromtype === 'all')
- {
- $liste['robot'] = $this->fromname;
- if ($this->frommail)
- {
- $liste['robot'] .= ' <'.$this->frommail.'>';
- }
- }
-
// Add user email
if (empty($user->email))
{
@@ -498,6 +491,16 @@ class FormMail extends Form
}
else dol_print_error($this->db);
+ // Also add robot email
+ if (! empty($conf->global->MAIN_MAIL_EMAIL_FROM) && $conf->global->MAIN_MAIL_EMAIL_FROM != $conf->global->MAIN_INFO_SOCIETE_MAIL)
+ {
+ $liste['robot'] = $conf->global->MAIN_MAIL_EMAIL_FROM;
+ if ($this->frommail)
+ {
+ $liste['robot'] .= ' <'.$conf->global->MAIN_MAIL_EMAIL_FROM.'>';
+ }
+ }
+
foreach($listaliases as $typealias => $listalias)
{
$posalias=0;
diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang
index 294de90d900..fa138c15dea 100644
--- a/htdocs/langs/en_US/admin.lang
+++ b/htdocs/langs/en_US/admin.lang
@@ -1557,7 +1557,7 @@ AGENDA_USE_EVENT_TYPE_DEFAULT=Set automatically this default value for type of e
AGENDA_DEFAULT_FILTER_TYPE=Set automatically this type of event into search filter of agenda view
AGENDA_DEFAULT_FILTER_STATUS=Set automatically this status for events into search filter of agenda view
AGENDA_DEFAULT_VIEW=Which tab do you want to open by default when selecting menu Agenda
-AGENDA_REMINDER_EMAIL=Enable event reminder by emails (defined on each event). Note: Module %s must be enabled and correctly setup to have reminder sent at the correct frequency.
+AGENDA_REMINDER_EMAIL=Enable event reminder by emails (remind option/delay can be defined on each event). Note: Module %s must be enabled and correctly setup to have reminder sent at the correct frequency.
AGENDA_REMINDER_BROWSER=Enable event reminder on users browser (when event date is reached, each user is able to refuse this from the browser confirmation question)
AGENDA_REMINDER_BROWSER_SOUND=Enable sound notification
AGENDA_SHOW_LINKED_OBJECT=Show linked object into agenda view
diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php
index 02ec2a7da0b..de7ad0ddc58 100644
--- a/htdocs/societe/card.php
+++ b/htdocs/societe/card.php
@@ -2440,82 +2440,6 @@ else
if (GETPOST('modelselected')) {
$action = 'presend';
}
- /*if ($action == 'presend')
- {
- // By default if $action=='presend'
- $titreform='SendMail';
- $topicmail='';
- $action='send';
- $modelmail='thirdparty';
-
- print '';
- print '';
- print ' ';
- print load_fiche_titre($langs->trans($titreform));
-
- dol_fiche_head();
-
- // Define output language
- $outputlangs = $langs;
- $newlang = '';
- if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id']))
- $newlang = $_REQUEST['lang_id'];
- if ($conf->global->MAIN_MULTILANGS && empty($newlang))
- $newlang = $object->default_lang;
-
- // Cree l'objet formulaire mail
- include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
- $formmail = new FormMail($db);
- $formmail->param['langsmodels']=(empty($newlang)?$langs->defaultlang:$newlang);
- $formmail->fromtype = (GETPOST('fromtype')?GETPOST('fromtype'):(!empty($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE)?$conf->global->MAIN_MAIL_DEFAULT_FROMTYPE:'user'));
-
- if($formmail->fromtype === 'user'){
- $formmail->fromid = $user->id;
-
- }
- $formmail->trackid='thi'.$object->id;
- if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 2)) // If bit 2 is set
- {
- include DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
- $formmail->frommail=dolAddEmailTrackId($formmail->frommail, 'thi'.$object->id);
- }
- $formmail->withfrom=1;
- $formmail->withtopic=1;
- $liste=array();
- foreach ($object->thirdparty_and_contact_email_array(1) as $key=>$value) $liste[$key]=$value;
- $formmail->withto=GETPOST('sendto')?GETPOST('sendto'):$liste;
- $formmail->withtofree=1;
- $formmail->withtocc=$liste;
- $formmail->withtoccc=$conf->global->MAIN_EMAIL_USECCC;
- $formmail->withfile=2;
- $formmail->withbody=1;
- $formmail->withdeliveryreceipt=1;
- $formmail->withcancel=1;
- // Array of substitutions
- $formmail->setSubstitFromObject($object, $outputlangs);
- $formmail->substit['__THIRDPARTY_ID__']=$object->id; // substit in setSubstitFromObject was wrong for this one
- $formmail->substit['__THIRDPARTY_NAME__']=$object->name; // substit in setSubstitFromObject was wrong for this one
- $formmail->substit['__PERSONALIZED__']=''; // deprecated
- $formmail->substit['__CONTACTCIVNAME__']='';
-
-
- // Tableau des parametres complementaires du post
- $formmail->param['action']=$action;
- $formmail->param['models']=$modelmail;
- $formmail->param['models_id']=GETPOST('modelmailselected','int');
- $formmail->param['socid']=$object->id;
- $formmail->param['returnurl']=$_SERVER["PHP_SELF"].'?socid='.$object->id;
-
- // Init list of files
- if (GETPOST("mode")=='init')
- {
- $formmail->clear_attached_files();
- $formmail->add_attached_files($file,basename($file),dol_mimetype($file));
- }
- print $formmail->get_form();
-
- dol_fiche_end();
- }*/
if ($action != 'presend')
{
|