Commit 127ca022 authored by Romain Therville's avatar Romain Therville 🐭

The resend_purge_demand_mail() function has been reworked to display the

analyzes and runs's names, and links to ng6.
Issue#31
parent 8e79ebf0
......@@ -200,17 +200,36 @@ class tx_nG6_pi6 extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin {
return "Mail sent";
}
static function resend_purge_demand_mail ($demands_id) {
static function resend_purge_demand_mail ($demands_id) {
$res_demands = tx_nG6_db::get_purge_demand_from_id($demands_id);
foreach($res_demands as $res_demand){
$res_project = tx_nG6_db::select_project($res_demand["project_id"]);
$total_project_size = tx_nG6_db::get_project_size($res_demand["project_id"], true) ;
$run_info=Array();
$analyses_info=Array();
$search=array("###TYPE_OBJECT###","###RUN_ID###","###PROJECT_ID###");
$project_id = $res_demand["project_id"];
$all_purgeable_runs = explode(',',$res_demand["run_ids"]);
$all_purgeable_analysis = explode(',',$res_demand["analyze_ids"]);
foreach($all_purgeable_runs as $run_id ){
$run = tx_nG6_db::select_run($run_id);
$run_name = $run["name"];
$replace=array("run_id",$run_id,$project_id);
$run_info[] = '<a href="'.str_replace($search, $replace, $GLOBALS['TSFE']->tmpl->setup["plugin."]["tx_nG6_pi6."]["run_link_url"]).'">'.$run["name"].' ('.$run_id.')</a>';
}
foreach($all_purgeable_analysis as $analysis_id ){
$analysis = tx_nG6_db::select_analyse($analysis_id);
$analysis_name = $analysis["name"];
$replace=array("analyze_id",$analysis_id,$project_id);
$analyses_info[] = '<a href="'.str_replace($search, $replace, $GLOBALS['TSFE']->tmpl->setup["plugin."]["tx_nG6_pi6."]["run_link_url"]).'">'.$analysis_name.' ('.$analysis_id.')</a>';
}
$mail = tx_nG6_utils::get_purge_mail($res_project["name"],$res_demand["project_id"],
count(explode(",", $res_demand["run_ids"])), count(explode(",", $res_demand["analyze_ids"])), $res_demand["demand_id"],
tx_nG6_utils::get_octet_string_representation($res_demand["purge_size"]), tx_nG6_utils::get_octet_string_representation($total_project_size),
$GLOBALS['TSFE']->tmpl->setup["plugin."]["tx_nG6_pi6."]["delay_purge"],
$GLOBALS['TSFE']->tmpl->setup["plugin."]["tx_nG6_pi6."]["extension_url_price"], $GLOBALS['TSFE']->tmpl->setup["plugin."]["tx_nG6_pi6."]["min_extension_duration"],
$GLOBALS['TSFE']->tmpl->setup["plugin."]["tx_nG6_pi6."]["min_extension_size"], "This email was send to ". join(', ',$res_demand["emails"]).". ", $res_demand["run_ids"], $res_demand["analyze_ids"]);
$GLOBALS['TSFE']->tmpl->setup["plugin."]["tx_nG6_pi6."]["min_extension_size"], "This email was send to ". join(', ',$res_demand["emails"]).". ", join(', ', $run_info), join(', ', $analyses_info));
$subject = '[nG6 purge / reminder] No '.$res_demand["demand_id"].' - Project '.$res_project["name"];
$headers[] = 'From: '.$GLOBALS['TSFE']->tmpl->setup["plugin."]["tx_nG6_pi6."]["email_from"];
......
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