diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index 02ce94ed681..61263fb380f 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -1763,9 +1763,11 @@ if ($_GET['propalid'] > 0) $liste[$key]=$value; } - // Cr�� l'objet formulaire mail + // Create form object include_once('../html.formmail.class.php'); $formmail = new FormMail($db); + $formmail->fromtype = 'user'; + $formmail->fromid = $user->id; $formmail->fromname = $user->fullname; $formmail->frommail = $user->email; $formmail->withfrom=1; diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index fc8adf8e96e..37505c18b39 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -1930,6 +1930,8 @@ else // Cr�� l'objet formulaire mail include_once('../html.formmail.class.php'); $formmail = new FormMail($db); + $formmail->fromtype = 'user'; + $formmail->fromid = $user->id; $formmail->fromname = $user->fullname; $formmail->frommail = $user->email; $formmail->withfrom=1; diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index c1b62b30f54..e742616764c 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -1,7 +1,7 @@ * Copyright (C) 2004 Eric Seigne - * Copyright (C) 2004-2007 Laurent Destailleur + * Copyright (C) 2004-2008 Laurent Destailleur * Copyright (C) 2005 Marc Barilley / Ocebo * Copyright (C) 2005-2007 Regis Houssin * Copyright (C) 2006 Andre Cianfarani @@ -2996,8 +2996,8 @@ else /* - * Affiche formulaire mail - */ + * Affiche formulaire mail + */ if ($_GET['action'] == 'presend') { $facref = sanitize_string($fac->ref); @@ -3031,6 +3031,8 @@ else // Créé l'objet formulaire mail include_once(DOL_DOCUMENT_ROOT.'/html.formmail.class.php'); $formmail = new FormMail($db); + $formmail->fromtype = 'user'; + $formmail->fromid = $user->id; $formmail->fromname = $user->fullname; $formmail->frommail = $user->email; $formmail->withfrom=1; diff --git a/htdocs/html.formmail.class.php b/htdocs/html.formmail.class.php index 116c2fa7df1..7c2877e87d5 100644 --- a/htdocs/html.formmail.class.php +++ b/htdocs/html.formmail.class.php @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * $Id$ - * $Source$ */ /** @@ -138,7 +137,32 @@ class FormMail { print ''; print ''; - print "".$langs->trans("MailFrom")."".$this->fromname.($this->frommail?(" <".$this->frommail.">"):"")."\n"; + print "".$langs->trans("MailFrom").""; + if ($this->fromtype == 'user') + { + $langs->load("users"); + $fuser=new User($this->db); + $fuser->id=$this->fromid; + $fuser->fetch(); + print $fuser->getNomUrl(1); + } + else + { + print $this->fromname; + } + if ($this->frommail) + { + print " <".$this->frommail.">"; + } + else + { + if ($this->fromtype) + { + $langs->load("errors"); + print ' <'.$langs->trans("ErrorNoMailDefinedForThisUser").'> '; + } + } + print "\n"; print "\n"; } } diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index b69ffc1a225..366573a461c 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -16,4 +16,4 @@ ErrorBadParameters=Bad parameters UserCannotBeDelete=User can not be deleted. May be it is associated on Dolibarr entities. ErrorFieldsRequired=Some required fields were not filled. ErrorFailedToCreateDir=Failed to create a directory. Check that Web server user has permissions to write into Dolibarr documents directory. If parameter safe_mode is enabled on this PHP, check that Dolibarr php files owns to web server user (or group). - +ErrorNoMailDefinedForThisUser=No mail defined for this user diff --git a/htdocs/langs/fr_FR/errors.lang b/htdocs/langs/fr_FR/errors.lang index b67a0004778..20264046c94 100644 --- a/htdocs/langs/fr_FR/errors.lang +++ b/htdocs/langs/fr_FR/errors.lang @@ -16,3 +16,4 @@ ErrorBadParameters=Parametres incorrects UserCannotBeDelete=L'utilisateur ne peut pas etre supprimée. Peut-être est-il associé à des éléments de Dolibarr. ErrorFieldsRequired=Des champs obligatoires n'ont pas été renseignés ErrorFailedToCreateDir=Echec a la creation d'un repertoire. Verifiez que le user du serveur Web a bien les droits d'ecriture dans les repertoires documents de Dolibarr. Si le parametre safe_mode a été activé sur ce PHP, vérifier que les fichiers php dolibarr appartiennent à l'utilisateur du serveur Web. +ErrorNoMailDefinedForThisUser=EMail non defini pour cet utilisateur \ No newline at end of file