From: Janusz Dobrowolski Date: Wed, 12 May 2010 19:19:11 +0000 (+0000) Subject: [0000229] Payment overallocation is now forbidden. X-Git-Tag: 2.3-final~904 X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=commitdiff_plain;ds=sidebyside;h=c83c49b9224f6454f4dc00496bd574a1036cd0ea;p=fa-stable.git [0000229] Payment overallocation is now forbidden. --- diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 72923fef..901f47fe 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -24,6 +24,9 @@ $ -> Affected files $ /admin/system_diagnostics.php # [0000227] Fixed cookie name to enable multiply FA instances on the same server. $ /includes/session.inc +# [0000229] Payment overallocation is now forbidden +$ /includes/ui/allocation_cart.inc + /js/allocate.js # Fixed email links to use ajax $ /purchasing/po_entry_items.php /sales/credit_note_entry.php diff --git a/includes/ui/allocation_cart.inc b/includes/ui/allocation_cart.inc index bd84f5cc..058e0b91 100644 --- a/includes/ui/allocation_cart.inc +++ b/includes/ui/allocation_cart.inc @@ -274,7 +274,7 @@ function show_allocatable($show_totals) { amount_cells(null, "amount" . $counter, price_format('amount' . $counter)); $un_allocated = round($alloc_item->amount - $alloc_item->amount_allocated, 6); - amount_cell($un_allocated); + amount_cell($un_allocated, false,'', 'maxval'.$counter); label_cell("" . _("All") . ""); label_cell("" diff --git a/js/allocate.js b/js/allocate.js index 0294137a..707bdf8e 100644 --- a/js/allocate.js +++ b/js/allocate.js @@ -14,12 +14,16 @@ function focus_alloc(i) { } function blur_alloc(i) { - var change = get_amount(i.name); - price_format(i.name, change, user.pdec); - if(change<0) change = 0; - change = change-i.getAttribute('_last'); + + var last = +i.getAttribute('_last') + var left = get_amount('left_to_allocate', 1); + var cur = Math.min(get_amount(i.name), get_amount('maxval'+i.name.substr(6), 1), last+left) + + price_format(i.name, cur, user.pdec); + change = cur-last; + var total = get_amount('total_allocated', 1)+change; - var left = get_amount('left_to_allocate', 1)-change; + left -= change; price_format('left_to_allocate', left, user.pdec, 1, 1); price_format('total_allocated', total, user.pdec, 1, 1);