Bugzilla – Attachment 6895 Details for
Bug 6832
Validation of total > budget in neworderempty
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch for bug 6832 to fix the ajax validation of exceed budget in new orders, reworked for 3.6.
Patch-for-bug-6832-to-fix-the-ajax-validation-of-e.patch (text/plain), 3.28 KB, created by
Chris Cormack
on 2011-12-20 22:09:27 UTC
(
hide
)
Description:
Patch for bug 6832 to fix the ajax validation of exceed budget in new orders, reworked for 3.6.
Filename:
MIME Type:
Creator:
Chris Cormack
Created:
2011-12-20 22:09:27 UTC
Size:
3.28 KB
patch
obsolete
>From 5a60c0d0a7a02143c3499a84085412e6be14f77c Mon Sep 17 00:00:00 2001 >From: Maxime Pelletier <maxime.pelletier@libeo.com> >Date: Tue, 25 Oct 2011 15:23:29 -0400 >Subject: [PATCH] Patch for bug 6832 to fix the ajax validation of exceed > budget in new orders, reworked for 3.6. > >--- > koha-tmpl/intranet-tmpl/prog/en/js/acq.js | 36 +++++++------------ > .../prog/en/modules/acqui/neworderempty.tt | 18 ++++++---- > 2 files changed, 24 insertions(+), 30 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/js/acq.js b/koha-tmpl/intranet-tmpl/prog/en/js/acq.js >index e6d2315..2358532 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/js/acq.js >+++ b/koha-tmpl/intranet-tmpl/prog/en/js/acq.js >@@ -780,30 +780,20 @@ for (i=1;i<=2;i++) { > > //USED BY NEWORDEREMPTY.PL > function totalExceedsBudget(budgetId, total) { >- >- var xmlhttp = null; >- xmlhttp = new XMLHttpRequest(); >- if ( typeof xmlhttp.overrideMimeType != 'undefined') { >- xmlhttp.overrideMimeType('text/xml'); >- } >- >- var url = '../acqui/check_budget_total.pl?budget_id=' + budgetId + "&total=" + total; >- xmlhttp.open('GET', url, false); >- xmlhttp.send(null); >- >- xmlhttp.onreadystatechange = function() { >- if (xmlhttp.readyState == 4 && xmlhttp.status == 200) { >- >- actTotal = eval ( xmlhttp.responseText ); >- >- if ( Math.abs(actTotal) < Math.abs(total) ) { >- // if budget is to low :( >- return true ; >- } else { >- return false; >- } >+ budgetTotal = 0; >+ $.ajax({ >+ url: "/cgi-bin/koha/acqui/check_budget_total.pl", >+ async:false, >+ method: "post", >+ data: {budget_id : budgetId, total : total}, >+ success: function(actTotal) { >+ actTotal = Math.abs(actTotal); >+ exceeds = (actTotal < Math.abs(total)) >+ if (exceeds) >+ budgetTotal = actTotal; > } >- } >+ }); >+ return budgetTotal; > } > > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt >index d58582e..dbb681a 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt >@@ -39,12 +39,6 @@ function Check(ff) { > _alertString += "\n- " + _("Total must be a number"); > } > >- if (totalExceedsBudget(ff.budget_id.value, ff.total.value ) ) { >- ok=1; >- _alertString += "\n- " + _("Order total (") + ff.total.value + >- _(") exceeds budget available (") + actTotal+")"; >- } >- > if ( ff.field_value ) { > var barcodes = []; > var empty_item_mandatory = 0; >@@ -106,9 +100,19 @@ function Check(ff) { > alert(_alertString); > return false; > } >+ else { >+ if (actTotal = totalExceedsBudget(ff.budget_id.value, ff.total.value ) ) { >+ stringWarning = _("Order total (") + ff.total.value + >+ _(") exceeds budget available (") + actTotal+")\n"; >+ stringWarning += _("Are you sure you want do save this order?"); >+ var r=confirm(stringWarning); >+ if (! r){ >+ return false; >+ } >+ } >+ } > > ff.submit(); >- > } > > $(document).ready(function() >-- >1.7.5.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 6832
:
5264
|
6058
|
6895
|
10631
|
11209
|
11425