Lines 242-270
function getAuthValueDropbox( name, cat, destination, selected ) {
Link Here
|
242 |
//USED BY NEWORDEREMPTY.PL |
242 |
//USED BY NEWORDEREMPTY.PL |
243 |
function totalExceedsBudget(budgetId, total) { |
243 |
function totalExceedsBudget(budgetId, total) { |
244 |
|
244 |
|
245 |
var xmlhttp = null; |
|
|
246 |
xmlhttp = new XMLHttpRequest(); |
247 |
if ( typeof xmlhttp.overrideMimeType != 'undefined') { |
248 |
xmlhttp.overrideMimeType('text/xml'); |
249 |
} |
250 |
|
251 |
var url = '../acqui/check_budget_total.pl?budget_id=' + budgetId + "&total=" + total; |
245 |
var url = '../acqui/check_budget_total.pl?budget_id=' + budgetId + "&total=" + total; |
252 |
xmlhttp.open('GET', url, false); |
246 |
var ret = undefined; |
253 |
xmlhttp.send(null); |
247 |
jQuery.ajax({ |
254 |
|
248 |
url: url, |
255 |
xmlhttp.onreadystatechange = function() { |
249 |
mimeType: 'text/xml', |
256 |
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) { |
250 |
async: false, // non-async because we need to return a value based on the result |
257 |
|
251 |
success: function(data, textStatus, xmlhttp) { |
258 |
actTotal = eval ( xmlhttp.responseText ); |
252 |
actTotal = eval ( xmlhttp.responseText ); |
259 |
|
253 |
|
260 |
if ( Math.abs(actTotal) < Math.abs(total) ) { |
254 |
if ( Math.abs(actTotal) < Math.abs(total) ) { |
261 |
// if budget is to low :( |
255 |
// if budget is to low :( |
262 |
return true ; |
256 |
ret = true ; |
263 |
} else { |
257 |
} else { |
264 |
return false; |
258 |
ret = false; |
265 |
} |
259 |
} |
266 |
} |
260 |
} |
267 |
} |
261 |
}); |
|
|
262 |
return ret; |
268 |
} |
263 |
} |
269 |
|
264 |
|
270 |
|
265 |
|
Lines 272-313
function totalExceedsBudget(budgetId, total) {
Link Here
|
272 |
function budgetExceedsParent(budgetTotal, budgetId, newBudgetParent, periodID) { |
267 |
function budgetExceedsParent(budgetTotal, budgetId, newBudgetParent, periodID) { |
273 |
|
268 |
|
274 |
|
269 |
|
275 |
var xmlhttp = null; |
|
|
276 |
xmlhttp = new XMLHttpRequest(); |
277 |
if ( typeof xmlhttp.overrideMimeType != 'undefined') { |
278 |
xmlhttp.overrideMimeType('text/xml'); |
279 |
} |
280 |
|
281 |
// make the call... yawn |
270 |
// make the call... yawn |
282 |
// var url = '../admin/check_parent_total.pl?budget_id=' + budgetId + '&parent_id=' + newBudgetParent + "&total=" + budgetTotal + "&period_id="+ periodID ; |
271 |
// var url = '../admin/check_parent_total.pl?budget_id=' + budgetId + '&parent_id=' + newBudgetParent + "&total=" + budgetTotal + "&period_id="+ periodID ; |
283 |
|
272 |
|
284 |
|
273 |
|
285 |
var url = '../admin/check_parent_total.pl?total=' + budgetTotal + "&period_id="+ periodID ; |
274 |
var url = '../admin/check_parent_total.pl?total=' + budgetTotal + "&period_id="+ periodID ; |
286 |
|
|
|
287 |
if (budgetId ) { url += '&budget_id=' + budgetId }; |
275 |
if (budgetId ) { url += '&budget_id=' + budgetId }; |
288 |
if ( newBudgetParent ) { url += '&parent_id=' + newBudgetParent}; |
276 |
if ( newBudgetParent ) { url += '&parent_id=' + newBudgetParent}; |
289 |
|
277 |
var ret = undefined; |
290 |
|
278 |
jQuery.ajax({ |
291 |
xmlhttp.open('GET', url, false); |
279 |
url: url, |
292 |
xmlhttp.send(null); |
280 |
mimeType: 'text/xml', |
293 |
|
281 |
async: false, // non-async because we need to return a value based on the result |
294 |
xmlhttp.onreadystatechange = function() { |
282 |
success: function(data, textStatus, xmlhttp) { |
295 |
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) { |
283 |
var result = eval ( xmlhttp.responseText ); |
296 |
// stupid JS... |
284 |
|
297 |
} else { |
285 |
if (result == '1') { |
298 |
// wait for the call to complete |
286 |
ret = MSG_BUDGET_PARENT_ALLOCATIONl; |
|
|
287 |
} else if (result == '2') { |
288 |
ret = MSG_BUDGET_PERIOD_ALLOCATION; |
289 |
} else { |
290 |
ret = false; |
291 |
} |
299 |
} |
292 |
} |
300 |
}; |
293 |
}); |
301 |
|
294 |
return ret; |
302 |
var result = eval ( xmlhttp.responseText ); |
|
|
303 |
|
304 |
if (result == '1') { |
305 |
return MSG_BUDGET_PARENT_ALLOCATION; |
306 |
} else if (result == '2') { |
307 |
return MSG_BUDGET_PERIOD_ALLOCATION; |
308 |
} else { |
309 |
return false; |
310 |
} |
311 |
} |
295 |
} |
312 |
|
296 |
|
313 |
|
297 |
|
Lines 315-347
if ( newBudgetParent ) { url += '&parent_id=' + newBudgetParent};
Link Here
|
315 |
|
299 |
|
316 |
//USED BY AQBUDGETS.TMPL |
300 |
//USED BY AQBUDGETS.TMPL |
317 |
function checkBudgetParent(budgetId, newBudgetParent) { |
301 |
function checkBudgetParent(budgetId, newBudgetParent) { |
318 |
var xmlhttp = null; |
|
|
319 |
xmlhttp = new XMLHttpRequest(); |
320 |
if ( typeof xmlhttp.overrideMimeType != 'undefined') { |
321 |
xmlhttp.overrideMimeType('text/xml'); |
322 |
} |
323 |
|
324 |
var url = '../admin/check_budget_parent.pl?budget_id=' + budgetId + '&new_parent=' + newBudgetParent; |
302 |
var url = '../admin/check_budget_parent.pl?budget_id=' + budgetId + '&new_parent=' + newBudgetParent; |
325 |
xmlhttp.open('GET', url, false); |
303 |
var ret = undefined; |
326 |
xmlhttp.send(null); |
304 |
jQuery.ajax({ |
327 |
|
305 |
url: url, |
328 |
xmlhttp.onreadystatechange = function() { |
306 |
mimeType: 'text/xml', |
329 |
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) { |
307 |
async: false, // non-async because we need to return a value based on the result |
330 |
// do something with the results |
308 |
success: function(data, textStatus, xmlhttp) { |
331 |
} else { |
309 |
var result = eval ( xmlhttp.responseText ); |
332 |
// wait for the call to complete |
310 |
|
|
|
311 |
if (result == '1') { |
312 |
ret = MSG_PARENT_BENEATH_BUDGET; |
313 |
// } else if (result == '2') { |
314 |
// ret = "- New budget-parent has insufficent funds\n"; |
315 |
// } else { |
316 |
// ret = false; |
317 |
} |
333 |
} |
318 |
} |
334 |
}; |
319 |
}); |
335 |
|
320 |
return ret; |
336 |
var result = eval ( xmlhttp.responseText ); |
|
|
337 |
|
338 |
if (result == '1') { |
339 |
return MSG_PARENT_BENEATH_BUDGET; |
340 |
// } else if (result == '2') { |
341 |
// return "- New budget-parent has insufficent funds\n"; |
342 |
// } else { |
343 |
// return false; |
344 |
} |
345 |
} |
321 |
} |
346 |
|
322 |
|
347 |
function hideColumn(num) { |
323 |
function hideColumn(num) { |
348 |
- |
|
|