From e88aff2dda6953d7c6597147a1964c6897e2d51f Mon Sep 17 00:00:00 2001 From: phasefx Date: Mon, 18 Jul 2005 14:56:33 +0000 Subject: [PATCH] get patron bills for real git-svn-id: svn://svn.open-ils.org/ILS/trunk@1256 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../content/evergreen/patron/patron_utils.js | 29 +++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/Evergreen/staff_client/chrome/content/evergreen/patron/patron_utils.js b/Evergreen/staff_client/chrome/content/evergreen/patron/patron_utils.js index ed0e2f87fc..57b48c7434 100755 --- a/Evergreen/staff_client/chrome/content/evergreen/patron/patron_utils.js +++ b/Evergreen/staff_client/chrome/content/evergreen/patron/patron_utils.js @@ -36,9 +36,36 @@ function patron_get_barcode( au ) { return '???'; } +function patron_get_bills( au ) { + sdump('D_PATRON_UTILS',arg_dump(arguments)); + try { + au.bills = ( user_request( // FIXME: make bills a virtual field of au + 'open-ils.actor', + 'open-ils.actor.user.fines.summary', + [ mw.G.auth_ses[0], au.id() ] + )[0] ); + sdump('D_PATRON_UTILS','bills = ' + js2JSON(au.bills) + '\n'); + return au.bills + } catch(E) { + sdump('D_ERROR',js2JSON(E) + '\n'); + return null; + } + +} + function patron_get_bills_total( au ) { sdump('D_PATRON_UTILS',arg_dump(arguments)); - return '$0.00'; + if (! au.bills ) patron_get_bills( au ); + if (au.bills == null) + return '???'; + else { + var total = 0; + for (var i = 0; i < au.bills.length; i++) { + total += parseFloat( au.bills[i].balance(owed) ); + } + return '$' + total; + } + } function patron_get_credit_total( au ) { -- 2.11.0