Commit caa936b2 authored by Gerald Salin's avatar Gerald Salin

correction array_merge "bug" if no manager are linked to the project

parent cc260712
......@@ -88,11 +88,11 @@ class tx_nG6_pi6 extends tslib_pibase {
$group_list = tx_nG6_db::get_group_list();
$smarty->assign('login_user', $GLOBALS['TSFE']->loginUser);
$smarty->assign('user_id', $GLOBALS['TSFE']->fe_user->user['uid']);
$smarty->assign('user_name', $GLOBALS['TSFE']->fe_user->user['username']);
$smarty->assign('user_name', $GLOBALS['TSFE']->fe_user->user['username']);
$smarty->assign('group_list', $group_list);
$smarty->assign('data_folder', $this->conf["data"]);
$smarty->assign('server_url', $this->conf['server_url']);
$smarty->assign('server_name', $this->conf["server_name"]);
$smarty->assign('server_name', $this->conf["server_name"]);
$distribution = tx_nG6_db::select_projects_repartition('create_user', 'title');
$smarty->assign('distribution', $distribution);
......@@ -112,7 +112,7 @@ class tx_nG6_pi6 extends tslib_pibase {
#build email list of managers
$users_id=array();
$users_emails = array();
$users_emails = array();
foreach ( $p[$project_id]["users"] as $u ){
if (!isset ($users_id[$u["right_level_label"]]) ){
$users_id[$u["right_level_label"]]=Array();
......@@ -133,8 +133,15 @@ class tx_nG6_pi6 extends tslib_pibase {
$purge_email_to=join(',', $users_emails['manager']);
$purge_user_id_to=$users_id['manager'];
} elseif ( count($users_emails['manager']) == 0) {
$purge_email_to=join(', ', array_merge($users_emails['administrator'],$users_emails['member']));
$purge_user_id_to=array_merge($users_id['administrator'],$users_id['member']);
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']);
}else{
$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";
......@@ -142,7 +149,7 @@ class tx_nG6_pi6 extends tslib_pibase {
}
//Retrieve purgeable information for email
$run_info=Array();
//ici bug car on prend l'ensemble des runs/analyses du projets
$all_purgeable_runs=array_merge($p[$project_id]["state"]["stored"]["run_ids"],$p[$project_id]["state"]["extended"]["run_ids"]);
$all_purgeable_analysis=array_merge($p[$project_id]["state"]["stored"]["analysis_ids"],$p[$project_id]["state"]["extended"]["analysis_ids"]);
......@@ -172,7 +179,7 @@ class tx_nG6_pi6 extends tslib_pibase {
$headers[] = 'From: '.$GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['ng6']['email_from'];
$headers[] = 'X-Mailer: PHP/' . phpversion();
#TODO Uncomment
$to = "celine.noirot@inra.fr";
#$to = "celine.noirot@inra.fr";
mail($to, $subject, $mail, implode("\r\n", $headers));
//TODO check return function mail ok
}
......@@ -197,7 +204,7 @@ class tx_nG6_pi6 extends tslib_pibase {
$to= join(",",$res_demand["emails"]);
#TODO Uncomment
$to = "celine.noirot@inra.fr";
#$to = "celine.noirot@inra.fr";
mail($to, $subject, $mail, implode("\r\n", $headers));
}
......
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