Commit 110f4ecb authored by Romain Therville's avatar Romain Therville 🐭
Browse files

Function send_purge_demand_mail() reworked.

The hidden runs and analyzes do not appear in the mail or volume count
anymore.
Next : the resend function.

Issues #178, #193
parent c8ba73b6
...@@ -194,9 +194,37 @@ class tx_nG6_pi6 extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin { ...@@ -194,9 +194,37 @@ class tx_nG6_pi6 extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin {
} }
#Add purge demand to get id #Add purge demand to get id
$purge_demand_id = tx_nG6_db::add_purge_demand($GLOBALS['TSFE']->fe_user->user['uid'],$project_id,$p[$project_id]["total_purgeable_size"],$all_purgeable_runs,$all_purgeable_analysis,$purge_user_id_to); $purge_demand_id = tx_nG6_db::add_purge_demand($GLOBALS['TSFE']->fe_user->user['uid'],$project_id,$p[$project_id]["total_purgeable_size"],$all_purgeable_runs,$all_purgeable_analysis,$purge_user_id_to);
// We remove the hidden runs and analyzes from $p so they will not appear in the purge alert mail
$p=tx_nG6_db::select_a_project_retention_data_info($project_id, FALSE, FALSE);
//We then need to compute the displayed values once more, to make the hidden elements part of the purge without displaying them in the mail
$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"]);
$nb_run_purgeable = $p[$project_id]["state"]["stored"]["nb_run"]+ $p[$project_id]["state"]["extended"]["nb_run"];
$nb_analyse_purgeable = $p[$project_id]["state"]["stored"]["nb_analyze"]+ $p[$project_id]["state"]["extended"]["nb_analyze"];
//We need to reset those values to only display unhidden elements
$run_info=Array();
$analyses_info=Array();
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>';
}
#Build corresponding string array #Build corresponding string array
//TODO RETURN TOTAL SIZE tx_nG6_utils::get_octet_string_representation($p[$project_id]["total_size"] //We get the project size without any hidden run or analyze
$total_project_size = tx_nG6_db::get_project_size($project_id, true); $total_project_size = tx_nG6_db::get_project_size($project_id, true, false);
$mail = tx_nG6_utils::get_purge_mail($p[$project_id]["project_name"],$project_id, $nb_run_purgeable,$nb_analyse_purgeable, $purge_demand_id, $mail = tx_nG6_utils::get_purge_mail($p[$project_id]["project_name"],$project_id, $nb_run_purgeable,$nb_analyse_purgeable, $purge_demand_id,
tx_nG6_utils::get_octet_string_representation($p[$project_id]["total_purgeable_size"]), tx_nG6_utils::get_octet_string_representation($total_project_size), tx_nG6_utils::get_octet_string_representation($p[$project_id]["total_purgeable_size"]), tx_nG6_utils::get_octet_string_representation($total_project_size),
......
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