Bugzilla – Attachment 11425 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]
Fix Validation of total higher as budget in neworderempty
SIGNED-OFF-Validation-of-total-budget-in-neworderempty.patch (text/plain), 3.57 KB, created by
Marc Véron
on 2012-08-07 16:32:41 UTC
(
hide
)
Description:
Fix Validation of total higher as budget in neworderempty
Filename:
MIME Type:
Creator:
Marc Véron
Created:
2012-08-07 16:32:41 UTC
Size:
3.57 KB
patch
obsolete
>From d1d227ba58c31140da5e180ef31b74b8b7a41ea2 Mon Sep 17 00:00:00 2001 >From: Maxime Pelletier <maxime.pelletier@libeo.com> >Date: Tue, 3 Jul 2012 17:21:48 -0400 >Subject: [PATCH] Validation of total budget in neworderempty >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >http://bugs.koha-community.org/show_bug.cgi?id=6832 >Signed-off-by: Marc Veron <veron@veron.ch> > >Tested on master. >Create a new order in a basket and changed existing order as well with total higher than the total of the selected budget. >Patch behaves as expected. >--- > koha-tmpl/intranet-tmpl/prog/en/js/acq.js | 38 +++++++------------ > .../prog/en/modules/acqui/neworderempty.tt | 14 ++++--- > 2 files changed, 22 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 2efeba0..2262430 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/js/acq.js >+++ b/koha-tmpl/intranet-tmpl/prog/en/js/acq.js >@@ -776,30 +776,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: "../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 566318f..beb4986 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt >@@ -56,12 +56,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 empty_item_mandatory = 0; > for (i = 0; i < ff.field_value.length; i++) { >@@ -87,6 +81,14 @@ function Check(ff) { > [% END %] > 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?"); >+ return confirm(stringWarning); >+ } >+ } > > [% IF (AcqCreateItemOrdering) %] > if(check_additem('[% UniqueItemFields %]') == false) { >-- >1.7.2.5
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