Plugins  LAST
 All Data Structures Files Functions Variables Pages
bank_js.js
Go to the documentation of this file.
1 /* This file is part of NOALYSS and is under GPL see licence.txt */
2 function reconcilie(target,dossier_id,p_id,plugin_code,tiers)
3 {
4  var qs="gDossier="+dossier_id+'&plugin_code='+plugin_code+'&act=show&id='+p_id+'&ctl='+target+"&target="+tiers;
5 
6  var action=new Ajax.Request ( 'ajax.php',
7  {
8  method:'get',
9  parameters:qs,
10  onFailure:error_box,
11  onSuccess:success_box
12  }
13  );
14  if ( $(target))
15  {
16  removeDiv(target);
17  }
18  var sx=calcy(120);
19 
20  var str_style="top:"+sx+"px;";
21 
22  var div={id:target, cssclass:'inner_box',style:str_style,html:loading(),drag:1};
23 
24  add_div(div);
25 }
26 /**
27  * When we save a reconcile dialog box with info
28  * @param {type} obj
29  * @returns {Boolean}
30  */
31 function save_bank_info(obj)
32 {
33  var query_string=obj.serialize();
34  var action=new Ajax.Request ( 'ajax.php',
35  {
36  method:'get',
37  parameters:query_string,
38  onFailure:error_box,
39  onSuccess:success_bank_info
40  });
41 
42  return false;
43 }
44 /**
45  * Handle the ajax from save_bank_info
46  * @param {type} req
47  * @param {type} json
48  * @returns {undefined}
49  */
50 function success_bank_info(req,json)
51 {
52  try {
53  var answer=req.responseXML;
54  var a=answer.getElementsByTagName('extra');
55  var name_ctl=a[0].firstChild.nodeValue;
56  var ob=name_ctl.evalJSON(true);
57  $('st'+ob.id).innerHTML=unescape_xml(ob.msg);
58  if (ob.tiers) { $('tiers'+ob.id).innerHTML=unescape_xml(ob.tiers);}
59  if (ob.concop){$('concop'+ob.id).innerHTML=unescape_xml(ob.concop);}
60  var div=answer.getElementsByTagName('ctl');
61  var div_ctl=div[0].firstChild.nodeValue;
62  removeDiv(div_ctl);
63  }
64  catch(e) {
65  alert_box('Erreur success_bank_info '+e.message);
66  }
67 }
68 /**
69  * @brief if a row is checked or unchecked, save it into the table temp_bank.is_checked
70  * @param p_dossier
71  * @param p_plugin_code
72  * @param p_row_id temp_bank.id
73  */
74 function impb_check_item(p_dossier,p_plugin_code,p_row_id)
75 {
76  var name_checkbox='temp_bank';
77  var status=($(name_checkbox+p_row_id).checked)?1:0;
78  waiting_box();
79  new Ajax.Request('ajax.php', {
80  method:'get',
81  parameters : {'gDossier':p_dossier,
82  'plugin_code':p_plugin_code,
83  'act' : 'save_check',
84  'row_id':p_row_id,
85  'state':status
86 
87  },
88  onSuccess:function(req) {
89  remove_waiting_box();
90  }
91 
92  });
93 }
94 /**
95  * Select the same tiers for several rows. The information
96  * import_id .. are in the form
97  * @param {type} p_form_id string id of the form
98  * @returns {undefined}
99  */
100 function selected_set_tiers(p_form_id) {
101 try {
102  smoke.confirm('Confirmez',
103  function(e) {
104  if (e) {
105  $(p_form_id).submit();
106  new Ajax.Request('ajax.php',
107  {
108  method:'get',
109  parameters: {
110  'gDossier':$(p_form_id)['gDossier'].value,
111  'act':'set_tiers',
112  'import_id':$(p_form_id)['import_id'].value,
113  'plugin_code':$(p_form_id)['plugin_code'].value,
114  'ac':$(p_form_id)['ac'].value,
115  'fiche':$(p_form_id)['fiche1000'].value
116  }
117  });
118  }
119 
120  });
121 } catch (e) {
122 alert(e.message);
123 }
124 return false;
125  }
126 /**
127  * Display the suggest when several are found
128  * @param {type} p_dossier
129  * @param {type} p_plugin_code
130  * @param {type} p_id
131  * @returns {undefined}
132  */
133 function display_suggest(p_dossier,p_plugin_code,p_id) {
134  waiting_box();
135  new Ajax.Request(
136  'ajax.php',
137  {
138  method:'get',
139  parameters:{
140  "plugin_code":p_plugin_code,
141  "gDossier":p_dossier,
142  "id":p_id,
143  "act":"display_suggest"
144 
145  },
146  onSuccess:function(p_xml,p_json) {
147  removeDiv('display_suggest_box');
148  var style=fixed_position(150,200)+";width:50%";
149  add_div({"id":"display_suggest_box","cssclass":"inner_box","style":style,"html":p_xml.responseText});
150  remove_waiting_box();
151  }
152 
153  })
154 
155 }
156 function select_suggest(p_dossier,p_plugin_code,temp_bank_id,suggest_bank_id)
157 {
158  waiting_box();
159  try {
160  new Ajax.Request(
161  'ajax.php',
162  {
163  method:'get',
164  parameters:{'act':'set_suggest','id':temp_bank_id, 'suggest_id':suggest_bank_id,'gDossier':p_dossier,'plugin_code':p_plugin_code},
165  onSuccess:function(req,json) {
166  try {
167  remove_waiting_box();
168  removeDiv('display_suggest_box');
169  var json=req.responseText.evalJSON();
170  $('tiers'+temp_bank_id).innerHTML=json.tiers;
171  $('concop'+temp_bank_id).innerHTML=json.concop;
172  $('st'+temp_bank_id).innerHTML=json.status;
173  }catch (x) {
174  alert_box("select_suggest.function_ajax"+e.message);
175  }
176  }
177  });
178  }catch (e) {
179  alert_box("select_suggest"+e.message);
180  }
181 }
$note style
function reconcilie(target, dossier_id, p_id, plugin_code, tiers)
Definition: bank_js.js:2
$p_year value
function select_suggest(p_dossier, p_plugin_code, temp_bank_id, suggest_bank_id)
Definition: bank_js.js:156
function display_suggest(p_dossier, p_plugin_code, p_id)
Display the suggest when several are found.
Definition: bank_js.js:133
function success_bank_info(req, json)
Handle the ajax from save_bank_info.
Definition: bank_js.js:50
function selected_set_tiers(p_form_id)
Select the same tiers for several rows.
Definition: bank_js.js:100
function impb_check_item(p_dossier, p_plugin_code, p_row_id)
if a row is checked or unchecked, save it into the table temp_bank.is_checked
Definition: bank_js.js:74
$oPeriode p_id
function save_bank_info(obj)
When we save a reconcile dialog box with info.
Definition: bank_js.js:31