Commit f5f7143f authored by Celine Noirot's avatar Celine Noirot

Merge branch 'issue#161' into 'dev'

Merge branch Issue#161with dev

See merge request !95
parents d332661f b54944a3
......@@ -920,7 +920,9 @@ class tx_nG6_eid {
print json_encode(tx_nG6_pi6::resend_purge_demand_mail($purge_ids));
} elseif ($type == 'refresh_purge_demand') {
$purge_delay = trim(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('purge_delay'));
print json_encode(tx_nG6_db::get_purge_demand_list($purge_delay));
$purge_demand_filter_space = trim(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('purge_demand_filter_space'));
$purge_demand_filter_delay_exceeded = trim(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('purge_demand_filter_delay_exceeded'));
print json_encode(tx_nG6_db::get_purge_demand_list($purge_delay,$purge_demand_filter_space,$purge_demand_filter_delay_exceeded));
} elseif ($type == 'refresh_purge_list') {
$max_retention_date = trim(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('max_retention_date'));
$filter_space = trim(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('filter_space'));
......
......@@ -419,23 +419,40 @@ class tx_nG6_db {
}
static function get_purge_demand_list($delay_in_days){
static function get_purge_demand_list($delay_in_days,$space_filter,$delay_exceeded_filter){
#We first build the WHERE conditions from the given parameters
if ($space_filter != "") {
$conditions[] = "space_id = '$space_filter'";
}
//For an unknown reason, we can't use the alias 'delay_excedeed' in the WHERE clause...
if ($delay_exceeded_filter == 'yes') {
$conditions[] = "DATEDIFF( now( ), FROM_UNIXTIME( tx_nG6_purge_demand.mail_sent_date ) ) >".$delay_in_days;
}elseif($delay_exceeded_filter == 'no'){
$conditions[] = "DATEDIFF( now( ), FROM_UNIXTIME( tx_nG6_purge_demand.mail_sent_date ) ) <".$delay_in_days;
}
$conditions[] = '`tx_nG6_purge_demand`.processed_date IS NULL';
$where = join(' AND ', $conditions);
#select all demand id not processed
$queryParts=array(
'SELECT' => 'tx_nG6_purge_demand.uid AS demand_id, `tx_nG6_purge_demand`.project_id AS project_id, tx_nG6_project.name as project_name,
`tx_nG6_purge_demand`.purge_size AS purge_size, `tx_nG6_purge_demand`.mail_sent_date, `tx_nG6_purge_demand`.demand_state,
`fe_users`.username, `fe_groups`.title AS user_group_title,
`fe_users`.username, `fe_groups`.title AS user_group_title, `tx_nG6_project`.space_id AS space_id,
DATEDIFF( now( ), FROM_UNIXTIME( `tx_nG6_purge_demand`.mail_sent_date ) ) >'.$delay_in_days.' AS delay_excedeed',
'FROM' => '`tx_nG6_purge_demand`
INNER JOIN tx_nG6_project ON tx_nG6_project.uid = tx_nG6_purge_demand.project_id
INNER JOIN `tx_nG6_purge_demand_fe_users` ON `tx_nG6_purge_demand_fe_users`.`purge_demand_id` = tx_nG6_purge_demand.uid
INNER JOIN fe_users ON fe_users.uid = `tx_nG6_purge_demand_fe_users`.`fe_users_id`
INNER JOIN fe_groups ON fe_groups.uid = fe_users.usergroup',
'WHERE' => '`tx_nG6_purge_demand`.processed_date IS NULL',
'WHERE' => $where,
'GROUPBY' => '',
'ORDERBY' => '',
'LIMIT' => ''
);
file_put_contents ('/work/ng6-test/jflow_rtherville/ng6_php.log',"IN tx_nG6_db.php, get_purge_demand_list. queryParts=".print_r($queryParts,TRUE));
$results=array();
$res = $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($queryParts);
while($res_row= $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
......@@ -449,6 +466,7 @@ INNER JOIN fe_groups ON fe_groups.uid = fe_users.usergroup',
"project_name"=>$res_row["project_name"],
"demand_state"=>$res_row["demand_state"],
"delay_excedeed"=>$res_row["delay_excedeed"],
"space_id"=>$res_row["space_id"],
"users"=>array(array("username"=>$res_row["username"], "user_group_title"=>$res_row["user_group_title"]))
);
}
......
......@@ -467,6 +467,41 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
</p>
</div>
<div class="col-sm-6">
<fieldset class="col-sm-12">
<h4>1. Filter on space</h4>
<div class="text">
<select name="space_select_options" id="purge_demand_filter_space" >
<option value="">No filter</option>
{foreach $available_space_ids key=space_id item=space_name}
<option value="{$space_name}">{$space_name}</option>
{/foreach}
</select>
</div>
</fieldset>
</div>
<div class="col-sm-6">
<fieldset class="col-sm-12">
<h4>2. Delay exceeded : </h4>
<div class="text">
<select name="delay_exceeded_options" id="purge_demand_filter_delay_exceeded" >
<option value="">No filter</option>
<option value="yes">Yes</option>
<option value="no">No</option>
</select>
</div>
</fieldset>
</div>
<div class="row">
<div class="col-sm-offset-10 col-sm-2">
<button type="button" id="refresh_purge_demands_list_btn" class="multiple-selection-btn btn btn-primary"> <i class="glyphicon glyphicon-refresh"></i> Refresh list</button>
</div>
</div>
</br>
<div class="tx-nG6-wait" id="data_table_purge_demand_wait">Please wait while processing ...</div>
<div class="alert alert-danger" id="purge_demand_error"></div>
<div id="purge_demand_list">
......@@ -476,6 +511,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<th><center><input type="checkbox" id="all_chk_demand"></center></th>
<th>Demand number</th>
<th>Project name</th>
<th>Project space</th>
<th>Purgeable size</th>
<th>Demand date</th>
<th>Users</th>
......@@ -488,7 +524,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
</tbody>
<tfoot>
<tr>
<th align="left" colspan="7">
<th align="left" colspan="8">
With selection :
<div class="btn-group">
<button id="btn_demand_resend_mail" type="button" class="btn btn-sm btn-default" ><i class="glyphicon glyphicon-remove"></i> Resend mail</button>
......
......@@ -516,7 +516,7 @@ $(function () {
"order": [[ 1, "asc" ]],
"columns": [
{ "orderable": false },
null,null,null,null,null,null]});
null,null,null,null,null,null,null]});
purge_table["allproject"] = $("#data_table_allproject").DataTable({});
......@@ -571,6 +571,12 @@ $(function () {
/****************************************
* tab process mail demand
***************************************/
//refresh purge demands list button
$("#refresh_purge_demands_list_btn").click(function(){
refresh_purge_demand(purge_table["demand"]);
});
//resend email
$("#btn_demand_resend_mail").click(function(){
var demands = getPurgeDatatableCheckedValue(purge_table["demand"],"demand");
......@@ -814,12 +820,15 @@ $(function () {
}
function refresh_purge_demand(purge_demand_datatable){
var purge_delay=$("#purge_delay").val();
var purge_demand_filter_delay_exceeded = $("#purge_demand_filter_delay_exceeded").val();
var purge_demand_filter_space = $("#purge_demand_filter_space").val();
$("#purge_demand_error").hide();
$('#data_table_purge_demand_wait').show();
$('#purge_demand_list').hide();
$.ajax({
url: "index.php?eID=tx_nG6&type=refresh_purge_demand&purge_delay="+purge_delay,
url: "index.php?eID=tx_nG6&type=refresh_purge_demand&purge_delay="+purge_delay+"&purge_demand_filter_space="+purge_demand_filter_space+"&purge_demand_filter_delay_exceeded="+purge_demand_filter_delay_exceeded,
dataType: 'json',
success: function(val, status, xhr) {
oTable = purge_demand_datatable;
......@@ -829,6 +838,7 @@ $(function () {
var checkbox = '<center><input id="chk_demand_"'+key+'" type="checkbox" value="' + key + '" class="chk_demand"></center>' ;
tx_nG6_pi6_redirection_page = $("#tx_nG6_pi6_redirection_page").val();
var row=[checkbox, key, "<a href='index.php?id="+tx_nG6_pi6_redirection_page+"&tx_nG6_pi1[project_id]="+values["project_id"]+"'>"+values["project_name"]+"</a>",
values["space_id"],
get_octet_string_representation(values["purge_size"],2),
values["mail_sent_date"]];
......
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