Commit bb5f3953 authored by Celine Noirot's avatar Celine Noirot

improve delete purge but still bugged

parent c97cfc77
......@@ -225,28 +225,39 @@ Files impacted of:
}
function delete_purge_demand($demand_ids){
$data_folder=$value;
$date= time();
$all_runs_purged=array();
$all_analyses_purged=array();
$all_demands=tx_nG6_db::get_purge_demand_from_id($demand_ids);
$all_runs=array();
$all_analyses=array();
foreach($all_demands as $res){
if ($res["state"] != "deleted")
{
$all_analyses=array_merge($all_analyses,explode(',',$res["analyze_ids"]));
$all_runs=array_merge($all_runs,explode(',',$res["run_ids"]));
}
}
//purged_size = storage_size !!!
tx_nG6_db::update_field('tx_nG6_run', $all_runs_purged, array("purged_size","data_state", "purged_date", "storage_size"),
array("storage_size","purged",$date, 0),
//purge_files
//set purge size BUG
tx_nG6_db::update_field('tx_nG6_run', $all_runs, "purged_size", "`storage_size`");
//set store size
tx_nG6_db::update_field('tx_nG6_run', $all_runs, array("data_state", "purged_date", "storage_size"),
array("purged",$date, 0),
array("purged_size"));
tx_nG6_db::update_field('tx_nG6_analyze',$all_analyses_purged, array("purged_size","data_state", "purged_date", "storage_size"),
tx_nG6_db::update_field('tx_nG6_analyze',$all_analyses, array("purged_size","data_state", "purged_date", "storage_size"),
array("storage_size","purged",$date, 0),
array("purged_size"));
if (count($all_runs_purged)==count($all_runs) and count($all_analyses_purged)==count($all_analyses)){
tx_nG6_db::update_field('tx_nG6_purge_demand',$demand_ids,
array("processed_date","demand_state"),
array($date,"deleted"));
return("Done delete, res : ".$res);
}else{
return("Error: not all runs or analyses were purged , please check unix permission (see apache logs).");
}
tx_nG6_db::update_field('tx_nG6_purge_demand',$demand_ids,
array("processed_date","demand_state"),
array($date,"deleted"));
return("Done delete, res : ".$res);
//todo , est ce necessaire de controler si nb run supprimé == nb run en entrée
}
}
......
......@@ -400,22 +400,23 @@ $(function () {
$("#modal-foot-tmpl").html('<button class="btn btn-default" data-dismiss="modal" aria-hidden="true">No</button>' +
'<button id="modal-btn-yes" class="btn btn-primary">Yes</button>');
$("#ng6modal").modal();
var demands = [];
$("#modal-btn-yes").click( function() {
$(':checked[id^=chk_demand').each(function(){
demand_id=$(this).val();
demands.push(demand_id);
console.log(demands);
console.log("chk : " + demand_id);
});
$.ajax({
url: "index.php?eID=tx_nG6&type=delete_purge_data&purge_demand=" + demands.join(',') + "&user_id="+$('input[id=user_id]').val(),
success: function (data) {
console.log ("DONE");
console.log (data);
}
});
delete_data(demands,purge_table["demand"]);
});
var demands=[];
$(':checked[id^=chk_demand').each(function(){
demand_id=$(this).val();
demands.push(demand_id);
});
delete_data(demands,purge_table["demand"]);
});
// Extend retention after selecting list of ids demand
......@@ -437,15 +438,6 @@ $(function () {
});
});
function delete_data(list_ids,purge_demand_datatable){
$.ajax({
url: "index.php?eID=tx_nG6&type=delete_purge_data&purge_demand=" + list_ids.join(',') + "&user_id="+$('input[id=user_id]').val(),
success: function (data) {
console.log ("DONE");
}
});
}
function extend_date(list_ids, purge_demand_datatable, obsolete_project_datatable){
if(list_ids == ""){
......
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