[form 1.6] envoi de groupe ok

This commit is contained in:
fredtempez 2019-03-10 20:56:36 +01:00
parent 3efa972d71
commit 7bde4a55af
1 changed files with 8 additions and 7 deletions

View File

@ -32,7 +32,7 @@ class form extends common {
public static $pagination; public static $pagination;
const FORM_VERSION = '1.5'; const FORM_VERSION = '1.6';
const TYPE_MAIL = 'mail'; const TYPE_MAIL = 'mail';
const TYPE_SELECT = 'select'; const TYPE_SELECT = 'select';
@ -314,25 +314,26 @@ class form extends common {
// Rechercher l'adresse en fonction du mail // Rechercher l'adresse en fonction du mail
$sent = true; $sent = true;
$singleuser = $this->getData(['user', $singleuser = $this->getData(['user',
$this->getData(['module', $this->getUrl(0), 'config', 'user']), $this->getData(['module', $this->getUrl(0), 'config', 'user']),
'mail']); 'mail']);
$singlemail = $this->getData(['module', $this->getUrl(0), 'config', 'mail']); $singlemail = $this->getData(['module', $this->getUrl(0), 'config', 'mail']);
$group = $this->getData(['module', $this->getUrl(0), 'config', 'group']);
// Verification si le mail peut être envoyé // Verification si le mail peut être envoyé
if( if(
self::$inputNotices === [] && ( self::$inputNotices === [] && (
$group = $this->getData(['module', $this->getUrl(0), 'config', 'group']) || $group > 0 ||
$singleuser !== '' || $singleuser !== '' ||
$singlemail !== '' ) $singlemail !== '' )
) { ) {
// Utilisateurs dans le groupe // Utilisateurs dans le groupe
if (!empty($user)){ $to = [];
$to = []; if ($group > 0){
foreach($this->getData(['user']) as $userId => $user) { foreach($this->getData(['user']) as $userId => $user) {
if($user['group'] === $group) { if($user['group'] === $group) {
$to[] = $user['mail']; $to[] = $user['mail'];
} }
} }
} }
// Utilisateur désigné // Utilisateur désigné
if (!empty($singleuser)) { if (!empty($singleuser)) {
$to[] = $singleuser; $to[] = $singleuser;