Commit 6e730837 authored by Celine Noirot's avatar Celine Noirot

#22 do not change date if retention date is upper than extention date, disable...

#22 do not change date if retention date is upper than extention date, disable button disabing as when using datatable filtering is do not work
parent b099c687
......@@ -170,22 +170,30 @@ class tx_nG6_db {
################################
//Get list of obsolete run/analyses per project
function filter_list_retention_data_info($filter_size, $max_retention_date, $create_user_id, $without_user_group_id,$with_user_group_id) {
$where = ' DATEDIFF( FROM_UNIXTIME( retention_date ) , now( ) ) <0';
if ($max_retention_date != "") {
$where = ' DATEDIFF( FROM_UNIXTIME( retention_date ) , STR_TO_DATE( "'.$max_retention_date.'", "%d/%m/%Y" ) ) <0';
}
$where .= ' AND purge_demand_id IS NULL ';
$where .= ' AND state IN ( \'stored\', \'extended\') ';
if ($filter_size != "") {
$where .=" AND storage_size > $filter_size";
$conditions=Array();
//filter by date
if ( $max_retention_date != "" ) {
//from user filter value
$conditions[] = ' DATEDIFF( FROM_UNIXTIME( retention_date ) , STR_TO_DATE( "'.$max_retention_date.'", "%d/%m/%Y" ) ) <0';
} else {
//from now
$conditions[] = ' DATEDIFF( FROM_UNIXTIME( retention_date ) , now( ) ) <0';
}
$conditions[] = 'purge_demand_id IS NULL';
$conditions[] = 'state IN ( \'stored\', \'extended\')';
if ($filter_size != "") {
$conditions[] = "storage_size > $filter_size";
}
$project_list_ids = "";
if ($create_user_id != "" or $without_user_group_id != "" or $with_user_group_id != "") {
#retrieve list of project id created by a user and with or without a list of group_id
$project_list_ids = tx_nG6_db::get_project_list_by_group_filter($create_user_id,$without_user_group_id, $with_user_group_id);
$where .=" AND project_id in (" . $project_list_ids.")" ;
$conditions[] = "project_id in (" . $project_list_ids.")" ;
}
$where = join(' AND ', $conditions);
return (tx_nG6_db::select_list_retention_data_info($where));
}
......
......@@ -42,9 +42,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<li class="active"><a href="#statistics" data-toggle="tab">Statistics</a></li>
<li><a href="#admin_management" data-toggle="tab">Admin management</a></li>
<li><a href="#wf_monitoring" data-toggle="tab">Workflows monitoring</a></li>
<li><a href="#project_data_management" data-toggle="tab">Projets data management</a></li>
<li><a href="#purge_demand_management" data-toggle="tab">Purge demand management</a></li>
<li><a href="#project_data_management" data-toggle="tab">Mail obsolete project</a></li>
<li><a href="#purge_demand_management" data-toggle="tab">Process mail demands</a></li>
<li><a href="#list_all_project" data-toggle="tab">Extend project</a></li>
</ul>
<div id="myTabContent" class="tab-content">
......@@ -57,17 +57,15 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
following table and use the button to generate the chart.
</p>
</div>
<div class="col-sm-6">
<fieldset class="col-sm-12">
<h4>1. Which users should be considered ?</h4>
<div class="radio">
<label class="radio">
<input type="radio" name="users_to_consider" id="select_cruser" value="create_user" checked>
users who have added data
</label>
</div>
<h4>1. Which users should be considered ?</h4>
<div class="radio">
<label class="radio">
<input type="radio" name="users_to_consider" id="select_cruser" value="create_user" checked>
users who have added data
</label>
</div>
<div class="radio">
<label class="radio">
<input type="radio" name="users_to_consider" id="select_owner" value="manager">
......@@ -280,51 +278,51 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
</div>
<div class="col-sm-6">
<fieldset class="col-sm-12">
<fieldset class="col-sm-12">
<h4>1. Filter on size greater than</h4>
<div class="text">
<label class="text">
<input type="text" name="size" id="filter_size" > bytes
</label>
</div>
</fieldset>
</fieldset>
</div>
<div class="col-sm-6">
<fieldset class="col-sm-12">
<fieldset class="col-sm-12">
<h4>2. Retention date lower than : </h4>
<div class="text">
<label class="text">
<input id="max_retention_date" class="form-control" type="text" value="" data-date-format="dd/mm/yyyy" data-provide="datepicker" name="max_retention_date"/>
</label>
</div>
</fieldset>
</fieldset>
</div>
<div class="col-sm-6">
<fieldset class="col-sm-12">
<h4>3. Which create user ?</h4>
<div id="wrapper_datatable_create">
<table class="table table-striped table-bordered dataTable" id="data_table_users">
<thead>
<th></th>
<th>Create user</th>
</thead>
<tbody>
{foreach $ng6_admin_users key=user_key item=user_values}
<tr>
<td><center><input type="checkbox" class="chk_create_user" value="{$user_values.id}"></center></td>
<td>{$user_values.username}</td>
</tr>
{/foreach}
</tbody>
</table>
<fieldset class="col-sm-12">
<h4>3. Which create user ?</h4>
<div id="wrapper_datatable_create">
<table class="table table-striped table-bordered dataTable" id="data_table_users">
<thead>
<th></th>
<th>Create user</th>
</thead>
<tbody>
{foreach $ng6_admin_users key=user_key item=user_values}
<tr>
<td><center><input type="checkbox" class="chk_create_user" value="{$user_values.id}"></center></td>
<td>{$user_values.username}</td>
</tr>
{/foreach}
</tbody>
</table>
</fieldset>
</div>
<div class="col-sm-6">
<div class="col-sm-6">
<fieldset class="col-sm-12">
<h4>4. Laboratories implie: </h4>
<h4>4. Laboratories implie: </h4>
<div id="wrapper_datatable_laboratories">
<table class="table table-striped table-bordered dataTable" id="data_table_select_lab">
<thead>
......@@ -342,15 +340,18 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
{/foreach}
</tbody>
</table>
</fieldset>
</div>
<div class="row">
<div class="col-sm-offset-10 col-sm-2">
<button type="button" id="refresh_obsolete_list_btn" class="multiple-selection-btn btn btn-primary"> <i class="glyphicon glyphicon-refresh"></i> Refresh list</button>
</div>
</div>
</div>
</fieldset>
</div>
<div class="row">
<div class="col-sm-offset-10 col-sm-2">
<button type="button" id="refresh_obsolete_list_btn" class="multiple-selection-btn btn btn-primary"> <i class="glyphicon glyphicon-refresh"></i> Refresh list</button>
</div>
</div>
</div>
<br />
......
......@@ -211,28 +211,32 @@ Files impacted of:
$all_demands=tx_nG6_db::get_purge_demand_from_id( join(', ', $demand_ids));
$all_runs=array();
$all_analyses=array();
foreach($all_demands as $res){
if ($res["state"] != "deleted")
{
if ($type_extend == 'extend_all_project') {
//extend all project
$curr_project_id=$res["project_id"];
// get all info of a project even non obsolete run analyse (by TRUE parameter)
$curr_project=tx_nG6_db::select_a_project_retention_data_info($curr_project_id, TRUE);
$states = array('extended','stored') ;
foreach ($states as $state){
//list all analyse (run/project)
$all_analyses=array_merge($all_analyses,$curr_project[$curr_project_id]["state"][$state]['analysis_ids']);
//list all run
$all_runs=array_merge($all_runs,$curr_project[$curr_project_id]["state"][$state]['run_ids']);
}
}
else {
$all_analyses=array_merge($all_analyses,explode(',',$res["analyze_ids"]));
$all_runs=array_merge($all_runs,explode(',',$res["run_ids"]));
}
if ($type_extend == 'extend_all_project') {
//extend all project
$curr_project_id=$res["project_id"];
$all_project_filter = " project_id =".$curr_project_id. " AND DATEDIFF( FROM_UNIXTIME( retention_date ), FROM_UNIXTIME(" .$date. ") ) <0
AND state in ('extended','stored') ";
// get all info of a project even non obsolete run analyse (by TRUE parameter)
$res_project_analyze = tx_nG6_db::select_all_in_view("tx_nG6_view_project_analyze", $all_project_filter);
$res_project_run = tx_nG6_db::select_all_in_view("tx_nG6_view_project_run", $all_project_filter);
$res_project_run_analyze = tx_nG6_db::select_all_in_view("tx_nG6_view_project_run_analyze", $all_project_filter);
while($res_row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res_project_analyze)) {
$all_analyses[] = $res_row["analyze_id"];
}
while($res_row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res_project_run_analyze)) {
$all_analyses[] = $res_row["analyze_id"];
}
while($res_row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res_project_run)) {
$all_runs[] = $res_row["run_id"];
}
} else {
$all_analyses=array_merge($all_analyses,explode(',',$res["analyze_ids"]));
$all_runs=array_merge($all_runs,explode(',',$res["run_ids"]));
}
}
}
......
......@@ -351,13 +351,14 @@ $(function () {
},
"order": [[ 1, "asc" ]],
"columns": [
{ "orderable": false },
{ "orderable": false , className: 'select-checkbox' },
null,null,null,null,null,null]
});
//Load data
refresh_project_obsolete(purge_table["obsolete"]);
refresh_purge_demand(purge_table["demand"]);
//filtre table obsolete
$("#refresh_obsolete_list_btn").click(function(){
refresh_project_obsolete(purge_table["obsolete"]);
......@@ -369,17 +370,12 @@ $(function () {
$('#data_table_obsolete_wait').show();
$('#obsolete_list').hide();
var all_runs="",
all_analyses="",
all_project="";
var all_project=Array();
$("#ng6modal").modal('hide');
$(':checked[id^=chk_obsolete').each(function(){
project_id=$(this).val();
all_project+=project_id+"," ;
});
all_project=all_project.slice(0,-1);
all_project = getPurgeDatatableCheckedValue(purge_table["obsolete"], "obsolete")
$.ajax({
url: "index.php?eID=tx_nG6&type=purge_managment_mail&project="+all_project+"&user_id="+$('input[id=user_id]').val(),
url: "index.php?eID=tx_nG6&type=purge_managment_mail&project="+all_project.join(',')+"&user_id="+$('input[id=user_id]').val(),
dataType: 'json',
success: function(val, status, xhr) {
refresh_project_obsolete(purge_table["obsolete"]);
......@@ -467,13 +463,9 @@ $(function () {
// Extend retention after selecting list of ids demand
$("#btn_demand_retention").click(function(){
demands="";
$(':checked[id^=chk_demand').each(function(){
demand_id=$(this).val();
demands+=demand_id+"," ;
});
demands=demands.slice(0,-1);
extend_date(demands,purge_table["demand"],purge_table["obsolete"]);
var demands=Array();
demands = getPurgeDatatableCheckedValue(purge_table["demand"],"demand");
extend_date(demands.join(','),purge_table["demand"],purge_table["obsolete"]);
});
/***** DataTable Obsolete & Demand chek all ****/
......@@ -481,7 +473,7 @@ $(function () {
var type = $(this).attr("id").split("_")[2];
var chk_status = $(this)[0].checked ;
$('input[id^=chk_'+type+']').prop('checked', chk_status);
updateDatatableButton(purge_table[type],type);
//updateDatatableButton(purge_table[type],type);
});
});
......@@ -528,6 +520,7 @@ function extend_date(list_ids, purge_demand_datatable, obsolete_project_datatabl
refresh_project_obsolete(obsolete_project_datatable);
},
error: function(val) {
//TO PRINT ERROR
$("#ng6modal").modal('hide');
refresh_purge_demand(purge_demand_datatable);
refresh_project_obsolete(obsolete_project_datatable);
......@@ -568,16 +561,19 @@ function extend_date(list_ids, purge_demand_datatable, obsolete_project_datatabl
} else {
row.push("no");
}
oTable.row.add(row );
oTable.row.add(row);
});
oTable.draw();
$('#purge_demand_list').show();
$('#data_table_purge_demand_wait').hide();
/*
updateDatatableButton(purge_demand_datatable, "demand");
//BUG doesn't work after datatable filtering
$("input[type=checkbox][class=chk_demand]").change(function(){
updateDatatableButton(purge_demand_datatable, "demand");
});
* */
}
});
......@@ -592,14 +588,13 @@ function refresh_project_obsolete(obsolete_project_datatable){
without_lab=[],
with_lab=[],
create_users=[];
$(':checked[class^=chk_create_user').each(function(){
$(':checked[class^=chk_create_user]').each(function(){
create_users.push($(this).val());
});
$(':checked[class^=chk_without_lab_').each(function(){
$(':checked[class^=chk_without_lab_]').each(function(){
without_lab.push($(this).val());
});
$(':checked[class^=chk_with_lab_').each(function(){
$(':checked[class^=chk_with_lab_]').each(function(){
with_lab.push($(this).val());
});
without_laboratories = without_lab.join(',');
......@@ -668,12 +663,16 @@ function refresh_project_obsolete(obsolete_project_datatable){
oTable.draw();
$('#nb_purgeable_project').text(nb_purgeable_project);
$('#global_purgeable_size').text(get_octet_string_representation(global_purgeable_size,2));
$('#obsolete_list').show();
$('#data_table_obsolete_wait').hide();
/*
updateDatatableButton(obsolete_project_datatable, "obsolete");
//BUG doesn't work after datatable filtering
$("input[type=checkbox][class=chk_obsolete]").change(function(){
updateDatatableButton(obsolete_project_datatable, "obsolete");
});
* */
}
});
......@@ -683,15 +682,15 @@ function refresh_project_obsolete(obsolete_project_datatable){
*/
function getPurgeDatatableCheckedValue(oTable, type){
var values = new Array();
$.each(oTable.rows().nodes(), function(idx, node){
$.each(oTable.rows({search: 'applied'}).nodes(), function(idx, node){
$(node)
.find('input[type=checkbox][class=chk_'+type+']:checked')
.each(function(idx,element){
values.push($(this).val());
});
});
console.log(values);
return values
}
......
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