RAPPEL : Opération de maintenance > ForgeMIA indisponible le 20 Janvier entre 7h et 12h

Commit 126a821e authored by Romain Therville's avatar Romain Therville 🐭
Browse files

Merge branch 'issue#128' into 'master'

Merge branch Issue#128 with master

See merge request !46
parents 31cd6c0f 1b8cd109
......@@ -109,6 +109,10 @@ class tx_nG6_pi6 extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin {
#retrieve project data
$p=tx_nG6_db::select_a_project_retention_data_info($project_id, FALSE, TRUE);
#retrieve discarded emails
$string_emails_to_discard = $GLOBALS['TSFE']->tmpl->setup["plugin."]["tx_nG6_pi6."]["email_to_discard"] ;
$array_emails_to_discard = explode(',',$string_emails_to_discard);
#build email list of managers
$users_id=array();
$users_emails = array();
......@@ -117,21 +121,24 @@ class tx_nG6_pi6 extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin {
$users_id[$u["right_level_label"]]=Array();
$users_emails[$u["right_level_label"]]=Array();
}
$users_id[$u["right_level_label"]][] = $u["user_id"];
$users_emails[$u["right_level_label"]][] = $u["email"];
}
$users_id[$u["right_level_label"]][] = $u["user_id"];
$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="" ;
$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 this project is associated to several managers (all received this email), please send only one answer per purge alert number.\n";
}
$purge_email_to=join(',', $users_emails['manager']);
$purge_user_id_to=$users_id['manager'];
if ( count( $users_emails['manager']) > 1 ) {
$email_warn="Be aware that this project is associated to several managers (all 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_merge($users_id['administrator'],$users_id['manager'],$users_id['member']);
} elseif ( count($users_emails['manager']) == 0) {
if( count( $users_emails['member']) >= 1){
$users_emails_to = array_merge($users_emails['administrator'],$users_emails['member']);
$purge_user_id_to=array_merge($users_id['administrator'],$users_id['member']);
......@@ -139,13 +146,28 @@ class tx_nG6_pi6 extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin {
$users_emails_to = $users_emails['administrator'];
$purge_user_id_to=array_merge($users_id['administrator']);
}
$purge_email_to=join(', ',$users_emails_to );
$email_warn="As this project do not have managers, administrators and members recieved this alert.\n";
$email_warn.= " - Administrator(s): ".join(', ',$users_emails['administrator']). "\n";
$email_warn.= " - Members(s): ".join(', ',$users_emails['member']). "\n";
}
//Remove the discarded emails and ids from the lists (emails and ids).
foreach ( $array_emails_to_discard as $key1 => $dis_mail ){
if (($key = array_search($dis_mail, $users_emails_to)) !== false) {
unset($users_emails_to[$key]);
foreach ( $p[$project_id]["users"] as $key2 => $u ){
if($u["email"] == $dis_mail ){
unset($purge_user_id_to[$key2]);
}
}
}
}
$purge_email_to = join(', ',$users_emails_to );
//Retrieve purgeable information for email
$run_info=Array();
$analyses_info=Array();
......
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