Commit 4075314c authored by Romain Therville's avatar Romain Therville 🐭
Browse files

The algorithm has been reworked once more, to correct a bug I introduced

during the last commit, and to make it simpler.
parent eba2cc76
...@@ -119,30 +119,42 @@ class tx_nG6_pi6 extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin { ...@@ -119,30 +119,42 @@ class tx_nG6_pi6 extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin {
} }
$users_id[$u["right_level_label"]][] = $u["user_id"]; $users_id[$u["right_level_label"]][] = $u["user_id"];
$users_emails[$u["right_level_label"]][] = $u["email"]; $users_emails[$u["right_level_label"]][] = $u["email"];
} }
#Warn if mail is sent to several manager #Warn if mail is sent to several manager
$email_warn="" ; $email_warn="" ;
$purge_email_to=""; $purge_email_to="";
$purge_user_id_to=Array();
if ( count( $users_emails['manager']) > 1 ) { if ( count( $users_emails['manager']) > 1 ) {
$email_warn.="Be aware that every user associated with this project received this email, please send only one answer per purge alert number.\n"; $email_warn.="Be aware that every user associated with this project received this email, please send only one answer per purge alert number.\n";
} }
$users_emails_to = array_merge($users_emails['administrator'],$users_emails['manager'],$users_emails['member']); $purge_user_id_to = array();
$purge_user_id_to = array_merge($users_id['administrator'],$users_id['manager'],$users_id['member']); $users_emails_to = array();
if(isset($users_emails['administrator'])){
$users_emails_to = array_merge($users_emails_to, $users_emails['administrator']);
$purge_user_id_to = array_merge($purge_user_id_to, $users_id['administrator']);
}
if(isset($users_emails['manager'])){
$users_emails_to = array_merge($users_emails_to,$users_emails['manager']);
$purge_user_id_to = array_merge($purge_user_id_to, $users_id['manager']);
}
if(isset($users_emails['member'])){
$users_emails_to = array_merge($users_emails_to, $users_emails['member']);
$purge_user_id_to = array_merge($purge_user_id_to, $users_id['member']);
}
$purge_email_to = join(', ',$users_emails_to ); $purge_email_to = join(', ',$users_emails_to );
$email_warn.= "Every user associated with this project received this alert.\n"; $email_warn.= "Every user associated with this project received this alert.\n";
if( count($users_emails['administrator']) > 0 ){ if( isset($users_emails['administrator']) && count($users_emails['administrator']) > 0 ){
$email_warn.= " - Administrator(s): ".join(', ',$users_emails['administrator']). "\n"; $email_warn.= " - Administrator(s): ".join(', ',$users_emails['administrator']). "\n";
} }
if( count($users_emails['manager']) > 0 ){ if( isset($users_emails['manager']) && count($users_emails['manager']) > 0 ){
$email_warn.= " - Manager(s): ".join(', ',$users_emails['manager']). "\n"; $email_warn.= " - Manager(s): ".join(', ',$users_emails['manager']). "\n";
} }
if( count($users_emails['member']) > 0 ){ if( isset($users_emails['member']) && count($users_emails['member']) > 0 ){
$email_warn.= " - Members(s): ".join(', ',$users_emails['member']). "\n"; $email_warn.= " - Member(s): ".join(', ',$users_emails['member']). "\n";
} }
//Retrieve purgeable information for email //Retrieve purgeable information for email
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment