Commit 20387d52 authored by Romain Therville's avatar Romain Therville 🐭
Browse files

Update to the way AJAX responses are evaluated

Every AJAX response is now going to be converted to INT before
evaluation.

issue #170
parent 92921e64
...@@ -948,6 +948,7 @@ class tx_nG6_eid { ...@@ -948,6 +948,7 @@ class tx_nG6_eid {
$user_pwd = trim(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('user_pwd')); $user_pwd = trim(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('user_pwd'));
$res = tx_nG6_db::delete_purge_demand($purge_ids,$user_login, $user_pwd, $data_folder); $res = tx_nG6_db::delete_purge_demand($purge_ids,$user_login, $user_pwd, $data_folder);
//print $res;
print $res; print $res;
} elseif ($type == 'extend_retention_date_from_demand') { } elseif ($type == 'extend_retention_date_from_demand') {
//Extend the retention date for the //Extend the retention date for the
......
...@@ -899,10 +899,11 @@ $(function () { ...@@ -899,10 +899,11 @@ $(function () {
$.ajax({ $.ajax({
url: val_url, url: val_url,
success: function(val, status, xhr) { success: function(val, status, xhr) {
val = parseInt(val);
if (val == 1) { if (val == 1) {
// user has already access to this project // user has already access to this project
$("#error_message").html($("#username_val").val() + ' has already access to this project!').show(); $("#error_message").html($("#username_val").val() + ' has already access to this project!').show();
} else if (val == 4 || val == 3) { } else if (val == 4 || parseInt(val) == 3) {
// username exists in database cannot create // username exists in database cannot create
$("#error_message").html('Cannot create this user account, ' + $("#username_val").val() + ' already exists!').show(); $("#error_message").html('Cannot create this user account, ' + $("#username_val").val() + ' already exists!').show();
} else if (val == 5) { } else if (val == 5) {
...@@ -1591,6 +1592,7 @@ function deletePRAHandler() { ...@@ -1591,6 +1592,7 @@ function deletePRAHandler() {
url: val_url, url: val_url,
success: function(val, status, xhr) { success: function(val, status, xhr) {
// return code : 0 = ok, 1 = right error, 2 = authentication error, 3 = connexion error // return code : 0 = ok, 1 = right error, 2 = authentication error, 3 = connexion error
val = parseInt(val);
if (val == 0) { if (val == 0) {
// Uncheck all checkboxes // Uncheck all checkboxes
$(':checked').each(function(i){ $(':checked').each(function(i){
......
...@@ -663,7 +663,7 @@ $(function () { ...@@ -663,7 +663,7 @@ $(function () {
url: val_url, url: val_url,
success: function(val, status, xhr) { success: function(val, status, xhr) {
// return code : 0 = ok, 1 = right error, 2 = authentication error, 3 = connexion error, 4 = error delete file , 5 error sql update // return code : 0 = ok, 1 = right error, 2 = authentication error, 3 = connexion error, 4 = error delete file , 5 error sql update
val = parseInt(val);
if (val == 0) { if (val == 0) {
// Uncheck all checkboxes // Uncheck all checkboxes
$(".tx-nG6-wait").hide(); $(".tx-nG6-wait").hide();
......
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