Ver Fonte

Fix option MAIN_MAIL_ENABLED_USER_DEST_SELECT

Laurent Destailleur há 7 anos atrás
pai
commit
f074daae48

+ 12 - 11
htdocs/core/actions_sendmails.inc.php

@@ -146,9 +146,8 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
 		$sendtocc='';
 		$sendtobcc='';
 		$sendtoid = array();
-		if (!empty($conf->global->MAIN_MAIL_ENABLED_USER_DEST_SELECT)) {
-			$sendtouserid=array();
-		}
+		$sendtouserid=array();
+		$sendtoccuserid=array();
 
 		// Define $sendto
 		$receiver=$_POST['receiver'];
@@ -179,18 +178,20 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
 				}
 			}
 		}
-		if (!empty($conf->global->MAIN_MAIL_ENABLED_USER_DEST_SELECT)) {
+		if (!empty($conf->global->MAIN_MAIL_ENABLED_USER_DEST_SELECT))
+		{
 			$receiveruser=$_POST['receiveruser'];
 			if (is_array($receiveruser) && count($receiveruser)>0)
 			{
 				$fuserdest = new User($db);
 				foreach($receiveruser as $key=>$val)
 				{
-					$tmparray[] = $fuserdest->user_get_property($key,'email');
-					$sendtouserid[] = $key;
+					$tmparray[] = $fuserdest->user_get_property($val,'email');
+					$sendtouserid[] = $val;
 				}
 			}
 		}
+
 		$sendto=implode(',',$tmparray);
 
 		// Define $sendtocc
@@ -222,15 +223,15 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
 			}
 		}
 		if (!empty($conf->global->MAIN_MAIL_ENABLED_USER_DEST_SELECT)) {
-			$receiveruser=$_POST['receiveccruser'];
+			$receiverccuser=$_POST['receiverccuser'];
 
-			if (is_array($receiveruser) && count($receiveruser)>0)
+			if (is_array($receiverccuser) && count($receiverccuser)>0)
 			{
 				$fuserdest = new User($db);
-				foreach($receiveruser as $key=>$val)
+				foreach($receiverccuser as $key=>$val)
 				{
-					$tmparray[] = $fuserdest->user_get_property($key,'email');
-					$sendtouserid[] = $key;
+					$tmparray[] = $fuserdest->user_get_property($val,'email');
+					$sendtoccuserid[] = $val;
 				}
 			}
 		}

+ 3 - 3
htdocs/core/class/html.formmail.class.php

@@ -632,7 +632,7 @@ class FormMail extends Form
 			if (! empty($this->withtouser) && is_array($this->withtouser) && !empty($conf->global->MAIN_MAIL_ENABLED_USER_DEST_SELECT))
 			{
 				$out.= '<tr><td>';
-				$out.= $langs->trans("MailToSalaries");
+				$out.= $langs->trans("MailToUsers");
 				$out.= '</td><td>';
 
 				// multiselect array convert html entities into options tags, even if we dont want this, so we encode them a second time
@@ -698,7 +698,7 @@ class FormMail extends Form
 			if (! empty($this->withtoccuser) && is_array($this->withtoccuser) && !empty($conf->global->MAIN_MAIL_ENABLED_USER_DEST_SELECT))
 			{
 				$out.= '<tr><td>';
-				$out.= $langs->trans("MailToCCSalaries");
+				$out.= $langs->trans("MailToCCUsers");
 				$out.= '</td><td>';
 
 				// multiselect array convert html entities into options tags, even if we dont want this, so we encode them a second time
@@ -1112,7 +1112,7 @@ class FormMail extends Form
 				elseif ($type_template=='thirdparty')				{ $defaultmessage=$outputlangs->transnoentities("PredefinedMailContentThirdparty"); }
 				elseif ($type_template=='user')				        { $defaultmessage=$outputlangs->transnoentities("PredefinedMailContentUser"); }
 				elseif (!empty($type_template))				        { $defaultmessage=$outputlangs->transnoentities("PredefinedMailContent".ucfirst($type_template)); }
-				
+
 				$ret->label = 'default';
 				$ret->lang = $outputlangs->defaultlang;
 				$ret->topic = '';

+ 2 - 2
htdocs/langs/en_US/mails.lang

@@ -11,9 +11,9 @@ MailFrom=Sender
 MailErrorsTo=Errors to
 MailReply=Reply to
 MailTo=Receiver(s)
-MailToSalaries=To salarie(s)
+MailToUsers=To user(s)
 MailCC=Copy to
-MailToCCSalaries=Copy to salarie(s)
+MailToCCUsers=Copy to users(s)
 MailCCC=Cached copy to
 MailTopic=EMail topic
 MailText=Message