diff --git a/html/ajax_misc.php b/html/ajax_misc.php index 13852e9a6..2bac2bfd1 100644 --- a/html/ajax_misc.php +++ b/html/ajax_misc.php @@ -104,6 +104,9 @@ switch ($op) case 'card' : require NOALYSS_INCLUDE.'/ajax/ajax_card.php'; return; + case 'ledger' : + require NOALYSS_INCLUDE.'/ajax/ajax_ledger.php'; + return; case "todo_list": require NOALYSS_INCLUDE.'/ajax/ajax_todo_list.php'; return; diff --git a/html/js/acc_ledger.js b/html/js/acc_ledger.js index e9e2eb62c..523dd3996 100644 --- a/html/js/acc_ledger.js +++ b/html/js/acc_ledger.js @@ -795,9 +795,13 @@ function update_history_card(obj) function removeOperation(p_jr_id, dossier, div) { waiting_box(); - var qs = "gDossier=" + dossier + "&act=rmop&div=" + div + "&jr_id=" + p_jr_id; - var action = new Ajax.Request( - "ajax_ledger.php", + var qs = { "gDossier" : dossier , + "op":"ledger", + "act":"rmop", + "div" : div , + "jr_id" : p_jr_id}; + new Ajax.Request( + "ajax_misc.php", { method: 'get', parameters: qs, @@ -815,11 +819,12 @@ function removeOperation(p_jr_id, dossier, div) function reverseOperation(obj) { var qs = $(obj).serialize(); + qs["op"]="ledger"; g('ext' + obj.divname).style.display = 'none'; g('bext' + obj.divname).style.display = 'none'; waiting_box(); - var action = new Ajax.Request( - "ajax_ledger.php", + new Ajax.Request( + "ajax_misc.php", { method: 'get', parameters: qs, @@ -839,18 +844,21 @@ function reverseOperation(obj) function modifyOperation(p_value, dossier) { layer++; - var id = 'det' + layer; + var id_div = 'det' + layer; waiting_box(); - var querystring = 'gDossier=' + dossier + '&act=de&jr_id=' + p_value + '&div=' + id; - + var querystring = { "gDossier" : dossier , + "op":"ledger", + "act":"de", + "div" : id_div , + "jr_id" : p_jr_id}; var action = new Ajax.Request( - "ajax_ledger.php", + "ajax_misc.php", { method: 'get', parameters: querystring, onFailure: error_box, onSuccess: function (xml, txt) { - var popup = {'id': id, 'cssclass': 'inner_box' + var popup = {'id': id_div, 'cssclass': 'inner_box' , 'html': "", 'drag': true}; remove_waiting_box(); add_div(popup); @@ -872,12 +880,13 @@ function viewOperation(p_value, p_dossier) } function dropLink(p_dossier, p_div, p_jr_id, p_jr_id2) { - var querystring = 'gDossier=' + p_dossier; - querystring += '&div=' + p_div; - querystring += '&jr_id=' + p_jr_id; - querystring += '&act=rmr'; - querystring += '&jr_id2=' + p_jr_id2; - var action = new Ajax.Request('ajax_ledger.php', + var querystring = { "gDossier" : p_dossier , + "op":"ledger", + "act":"rmr", + "div" : p_div , + "jr_id" : p_jr_id, + "jr_id2" : p_jr_id2}; + var action = new Ajax.Request('ajax_misc.php', { method: 'get', parameters: querystring, @@ -1035,13 +1044,15 @@ function op_save(obj) queryString += '&div=' + obj.whatdiv.value; var divid=obj.whatdiv.value; queryString += '&act=save'; + queryString += '&op=ledger'; + waiting_box(); /* * Operation detail is in a new window */ if (g('inpopup')) { - var action = new Ajax.Request('ajax_ledger.php', + var action = new Ajax.Request('ajax_misc.php', { method: 'post', parameters: queryString, @@ -1056,15 +1067,16 @@ function op_save(obj) /* *Operation is in a modal box */ - var action = new Ajax.Request('ajax_ledger.php', + var action = new Ajax.Request('ajax_misc.php', { method: 'post', parameters: queryString, onFailure: null, onSuccess: function(req,json) { - new Ajax.Request('ajax_ledger.php', { + new Ajax.Request('ajax_misc.php', { parameters:{'gDossier':obj.gDossier.value, 'act':'de', + 'op':'ledger', 'jr_id' : jr_id, 'div' : divid}, onSuccess:function(xml) { @@ -1181,9 +1193,9 @@ function document_remove(p_dossier,p_div,p_jrid) smoke.confirm('Effacer ?', function (e) { if (e) { - new Ajax.Request('ajax_ledger.php', + new Ajax.Request('ajax_misc.php', { - parameters:{"p_dossier":p_dossier,"div":p_div,"p_jrid":p_jrid,'act':'rmf'}, + parameters:{"op":"ledger","gDossier":p_dossier,"div":p_div,"p_jrid":p_jrid,'act':'rmf'}, onSuccess : function(x) { $('receipt'+p_div).innerHTML=x.responseText; } diff --git a/html/ajax_ledger.php b/include/ajax/ajax_ledger.php similarity index 93% rename from html/ajax_ledger.php rename to include/ajax/ajax_ledger.php index 6ab53d4f7..0184ad6c7 100644 --- a/html/ajax_ledger.php +++ b/include/ajax/ajax_ledger.php @@ -28,9 +28,8 @@ - for reconcialiation - update of analytic content */ -if ( ! defined('ALLOWED')) define ('ALLOWED',1); +if ( ! defined('ALLOWED')) die(_('Non authorisé')); -require_once '../include/constant.php'; require_once NOALYSS_INCLUDE.'/lib/class_database.php'; require_once NOALYSS_INCLUDE.'/class/class_user.php'; require_once NOALYSS_INCLUDE.'/class/class_acc_operation.php'; @@ -60,32 +59,10 @@ $gDossier=dossier::id(); /** *if $_SESSION['g_user'] is not set : echo a warning */ -ajax_disconnected($div); $cn=Dossier::connect(); $g_parameter=new Own($cn); -if ( LOGINPUT) - { - $file_loginput=fopen($_ENV['TMP'].'/scenario-'.$_SERVER['REQUEST_TIME'].'.php','a+'); - fwrite ($file_loginput,"check(); if ( $g_user->check_dossier(dossier::id(),true)=='X' ) { @@ -297,7 +274,7 @@ case 'file': { // Not possible to remove the file thanks a modal dialog box, // because of the frameset - $x=sprintf(''.SMALLX.'', + $x=sprintf(''.SMALLX.'', $gDossier,$div,$jr_id); } @@ -342,7 +319,7 @@ case 'loadfile': if ($g_user->check_action (RMRECEIPT) == 1) { // Not possible to remove the file thanks a modal dialog box, // because of the frameset - $x=sprintf(''.SMALLX.'', + $x=sprintf(''.SMALLX.'', $gDossier,$div,$jr_id); echo $x; } diff --git a/include/template/ledger_detail_file.php b/include/template/ledger_detail_file.php index bbc64f1c6..f42ddb68c 100644 --- a/include/template/ledger_detail_file.php +++ b/include/template/ledger_detail_file.php @@ -7,10 +7,10 @@ * - a input type to save a file * - a file name (which can be opened or removed */ -$str='?'.dossier::get()."&div=$div&act=file&jr_id=$jr_id"; +$str='?'.dossier::get()."&op=ledger&div=$div&act=file&jr_id=$jr_id"; if ( isset ($_REQUEST['ajax'])) $str.="&ajax=1"; ?>
- +
\ No newline at end of file