Bonjour à tous,

Vous trouverez ci-joint un patch qui ajoute un champ signature pour les 
utilisateurs de Dolibarr. Si le champ est rempli, lors de l'envoi par mail 
d'une proposition commerciale, facture etc. , elle s'ajoute automatiquement de 
la zone de saisi du message.

Il faut ajouter la configuration suivantes ( dans Divers ) : MAIL_USE_SIGN avec 
1 pour activé, 0 pour déactivé.

De plus il faut modifier la table user pour ajouter le champ signature :
ALTER TABLE `llx_user` ADD `signature` VARCHAR( 255 ) NULL DEFAULT NULL AFTER 
`email`

Cordialement,
Mouillard Dimitri

--------------------------------------------
Dimitri Mouilllard
Développeur
Teclib' -  5, rue Jean Perrin, 28600 Luisant
Mail : [email protected]
diff -BNaur --exclude=CVS --exclude='*.patch' --exclude='.#*' --exclude='*~' --exclude='*.rej' --exclude='*.orig' --exclude='*.bak' --exclude=conf.php --exclude=documents core/class/html.formmail.class.php core/class/html.formmail.class.php
--- core/class/html.formmail.class.php	2011-01-17 02:42:24.000000000 +0100
+++ core/class/html.formmail.class.php	2011-05-09 15:43:33.000000000 +0200
@@ -486,6 +486,20 @@
 			}
 			else
 			{
+			   if($conf->global->MAIL_USE_SIGN) {
+			   $fuser=new User($this->db);
+				$fuser->fetch($this->fromid);
+				
+				   if(!empty($fuser->signature)) {
+			      $defaultmessage.=dol_htmlentitiesbr_decode($fuser->signature);
+		         }
+		         else {
+		         $defaultmessage.=$langs->trans("Cordialement");
+		         }
+		      }
+		      else {
+		      $defaultmessage.=$langs->trans("Cordialement");  
+		      }
 				// Editeur wysiwyg
 				require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php");
 				$doleditor=new DolEditor('message',$defaultmessage,280,'dolibarr_notes','In',true,false,$this->withfckeditor,8,72);
diff -BNaur --exclude=CVS --exclude='*.patch' --exclude='.#*' --exclude='*~' --exclude='*.rej' --exclude='*.orig' --exclude='*.bak' --exclude=conf.php --exclude=documents langs/fr_FR/main.lang langs/fr_FR/main.lang
--- langs/fr_FR/main.lang	2011-01-17 02:46:06.000000000 +0100
+++ langs/fr_FR/main.lang	2011-05-09 15:44:29.000000000 +0200
@@ -535,6 +535,7 @@
 For=Pour
 ForCustomer=Pour le client
 Signature=Signature
+Cordialement=Cordialement
 HidePassword=Afficher commande avec mot de passe masqué
 UnHidePassword=Afficher commande réelle avec mot de passe en clair
 Root=Racine
diff -BNaur --exclude=CVS --exclude='*.patch' --exclude='.#*' --exclude='*~' --exclude='*.rej' --exclude='*.orig' --exclude='*.bak' --exclude=conf.php --exclude=documents langs/fr_FR/other.lang langs/fr_FR/other.lang
--- langs/fr_FR/other.lang	2011-01-17 02:46:06.000000000 +0100
+++ langs/fr_FR/other.lang	2011-05-09 15:44:57.000000000 +0200
@@ -45,12 +45,12 @@
 WarningUntilDirRemoved=Les alertes de sécurité sont visibles par les administrateurs uniquement et resteront actives tant que la vulnérabilité sera avérée (ou que la constante MAIN_REMOVE_INSTALL_WARNING aura été définie dans Configuration->Divers) 
 PredefinedMailTest=Ceci est un mail de test.\nLes 2 lignes sont séparées par un retour à la ligne.
 PredefinedMailTestHtml=Ceci est un mail de <b>test</b> (le mot test doit être en gras).<br>Les 2 lignes sont séparées par un retour à la ligne.
-PredefinedMailContentSendInvoice=Veuillez trouver ci-joint la facture __FACREF__\n\nCordialement\n\n
-PredefinedMailContentSendInvoiceReminder=Nous apportons à votre connaissance que la facture  __FACREF__ ne semble pas avoir été réglée. La voici donc, pour rappel, en pièce jointe.\n\nCordialement\n\n
-PredefinedMailContentSendProposal=Veuillez trouver ci-joint la proposition commerciale __PROPREF__\n\nCordialement\n\n
-PredefinedMailContentSendOrder=Veuillez trouver ci-joint la commande __ORDERREF__\n\nCordialement\n\n
-PredefinedMailContentSendSupplierOrder=Veuillez trouver ci-joint notre commande __ORDERREF__\n\nCordialement\n\n
-PredefinedMailContentSendSupplierInvoice=Veuillez trouver ci-joint la facture __FACREF__\n\nCordialement\n\n
+PredefinedMailContentSendInvoice=Veuillez trouver ci-joint la facture __FACREF__\n\n
+PredefinedMailContentSendInvoiceReminder=Nous apportons à votre connaissance que la facture  __FACREF__ ne semble pas avoir été réglée. La voici donc, pour rappel, en pièce jointe.\n\n
+PredefinedMailContentSendProposal=Veuillez trouver ci-joint la proposition commerciale __PROPREF__\n\n
+PredefinedMailContentSendOrder=Veuillez trouver ci-joint la commande __ORDERREF__\n\n
+PredefinedMailContentSendSupplierOrder=Veuillez trouver ci-joint notre commande __ORDERREF__\n\n
+PredefinedMailContentSendSupplierInvoice=Veuillez trouver ci-joint la facture __FACREF__\n\n
 DemoDesc=Dolibarr est un logiciel de gestion d'activité (professionnelle ou associative) composé de modules fonctionnels indépendants et optionnels. Une démonstration qui inclut tous ces modules n'a pas de sens car les modules ne sont jamais tous utilisés en même temps. Aussi, plusieurs profils type de démo sont disponibles.
 ChooseYourDemoProfil=Veuillez choisir le profil de démo qui correspond le mieux à votre activité...
 DemoFundation=Gestion des adhérents d'une association
diff -BNaur --exclude=CVS --exclude='*.patch' --exclude='.#*' --exclude='*~' --exclude='*.rej' --exclude='*.orig' --exclude='*.bak' --exclude=conf.php --exclude=documents user/class/user.class.php user/class/user.class.php
--- user/class/user.class.php	2011-02-13 12:27:36.000000000 +0100
+++ user/class/user.class.php	2011-05-09 15:17:51.000000000 +0200
@@ -53,6 +53,7 @@
     var $firstname;
 	var $note;
 	var $email;
+	var $signature;
 	var $office_phone;
 	var $office_fax;
 	var $user_mobile;
@@ -130,7 +131,7 @@
 		$login=trim($login);
 
 		// Recupere utilisateur
-		$sql = "SELECT u.rowid, u.name, u.firstname, u.email, u.office_phone, u.office_fax, u.user_mobile,";
+		$sql = "SELECT u.rowid, u.name, u.firstname, u.email, u.signature, u.office_phone, u.office_fax, u.user_mobile,";
 		$sql.= " u.admin, u.login, u.webcal_login, u.phenix_login, u.phenix_pass, u.note,";
 		$sql.= " u.pass, u.pass_crypted, u.pass_temp,";
 		$sql.= " u.fk_societe, u.fk_socpeople, u.fk_member, u.ldap_sid,";
@@ -183,6 +184,7 @@
 				$this->office_fax   = $obj->office_fax;
 				$this->user_mobile  = $obj->user_mobile;
 				$this->email = $obj->email;
+				$this->signature = $obj->signature;
 				$this->admin = $obj->admin;
 				$this->note = $obj->note;
 				$this->statut = $obj->statut;
@@ -1000,6 +1002,7 @@
 		$this->office_fax   = trim($this->office_fax);
 		$this->user_mobile  = trim($this->user_mobile);
 		$this->email        = trim($this->email);
+		$this->signature    = trim($this->signature);
 		$this->note         = trim($this->note);
 		$this->openid       = trim(empty($this->openid)?'':$this->openid);    // Avoid warning
 		$this->webcal_login = trim($this->webcal_login);
@@ -1030,6 +1033,7 @@
 		$sql.= ", office_fax = '".$this->db->escape($this->office_fax)."'";
 		$sql.= ", user_mobile = '".$this->db->escape($this->user_mobile)."'";
 		$sql.= ", email = '".$this->db->escape($this->email)."'";
+		$sql.= ", signature = '".nl2br(addslashes($this->signature))."'";
 		$sql.= ", webcal_login = '".$this->db->escape($this->webcal_login)."'";
 		$sql.= ", phenix_login = '".$this->db->escape($this->phenix_login)."'";
 		$sql.= ", phenix_pass = '".$this->db->escape($this->phenix_pass)."'";
@@ -1038,7 +1042,7 @@
 		$sql.= ", openid = ".($this->openid?"'".$this->db->escape($this->openid)."'":"null");
 		//$sql.= ", entity = '".$this->entity."'";
 		$sql.= " WHERE rowid = ".$this->id;
-
+      
 		dol_syslog("User::update sql=".$sql, LOG_DEBUG);
 		$resql = $this->db->query($sql);
 		if ($resql)
diff -BNaur --exclude=CVS --exclude='*.patch' --exclude='.#*' --exclude='*~' --exclude='*.rej' --exclude='*.orig' --exclude='*.bak' --exclude=conf.php --exclude=documents user/fiche.php user/fiche.php
--- user/fiche.php	2011-03-16 13:07:55.000000000 +0100
+++ user/fiche.php	2011-05-09 14:56:03.000000000 +0200
@@ -192,6 +192,7 @@
 		$edituser->office_fax    = $_POST["office_fax"];
 		$edituser->user_mobile   = $_POST["user_mobile"];
 		$edituser->email         = $_POST["email"];
+		$edituser->signature     = $_POST["signature"];
 		$edituser->webcal_login  = $_POST["webcal_login"];
 		$edituser->phenix_login  = $_POST["phenix_login"];
 		$edituser->phenix_pass   = $_POST["phenix_pass"];
@@ -289,6 +290,7 @@
 			$edituser->office_fax    = $_POST["office_fax"];
 			$edituser->user_mobile   = $_POST["user_mobile"];
 			$edituser->email         = $_POST["email"];
+			$edituser->signature     = $_POST["signature"];
 			$edituser->openid         = $_POST["openid"];
 			$edituser->webcal_login  = $_POST["webcal_login"];
 			$edituser->phenix_login  = $_POST["phenix_login"];
@@ -730,7 +732,15 @@
 		print '<input size="40" type="text" name="email" value="'.$_POST["email"].'">';
 	}
 	print '</td></tr>';
-
+   
+   // Signature
+   if($conf->global->MAIL_USE_SIGN) {
+	print '<tr><td valign="top">'.$langs->trans("Signature").'</td>';
+	print '<td>';
+		print '<textarea rows="5" cols="90" name="signature">'.$_POST["signature"].'</textarea>';
+	print '</td></tr>';   
+   }
+   
 	// Note
 	print '<tr><td valign="top">';
 	print $langs->trans("Note");
@@ -1017,7 +1027,14 @@
 			print '<tr><td valign="top">'.$langs->trans("EMail").'</td>';
 			print '<td>'.dol_print_email($fuser->email,0,0,1).'</td>';
 			print "</tr>\n";
-
+         
+         // Signature
+         if($conf->global->MAIL_USE_SIGN) {
+         print '<tr><td valign="top">'.$langs->trans('Signature').'</td>';
+         print '<td>'.$fuser->signature.'</td>';
+         print "</tr>\n";
+         }
+         
 			// Statut
 			print '<tr><td valign="top">'.$langs->trans("Status").'</td>';
 			print '<td>';
@@ -1504,6 +1521,14 @@
 				print $fuser->email;
 			}
 			print '</td></tr>';
+			
+			// Signature
+			if($conf->global->MAIL_USE_SIGN) {
+   			print "<tr>".'<td valign="top">'.$langs->trans("Signature").'</td>';
+   			print '<td>';		
+   			print '<textarea name="signature" rows="5" cols="90">'.dol_htmlentitiesbr_decode($fuser->signature).'</textarea>';
+   			print '</td></tr>';	   
+			}
 
 			// openid
 			if (preg_match('/myopenid/',$conf->authmode))
_______________________________________________
Dolibarr-dev mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/dolibarr-dev

Répondre à