From ba65ff0951365841b1a5b863d673c4644d5fd2b6 Mon Sep 17 00:00:00 2001 From: phasefx Date: Wed, 30 Sep 2009 21:12:20 +0000 Subject: [PATCH] Alright, now that we know how to juggle multiple async fleshing calls for util.list, let's go ahead and use the newly added objects we get from the checkin call payload instead of fetching them ourselves. :) git-svn-id: svn://svn.open-ils.org/ILS/trunk@14242 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/xul/staff_client/server/circ/checkin.js | 55 ++++++++++-------------- Open-ILS/xul/staff_client/server/circ/util.js | 1 + 2 files changed, 23 insertions(+), 33 deletions(-) diff --git a/Open-ILS/xul/staff_client/server/circ/checkin.js b/Open-ILS/xul/staff_client/server/circ/checkin.js index 6c528b71b5..21b68514b0 100644 --- a/Open-ILS/xul/staff_client/server/circ/checkin.js +++ b/Open-ILS/xul/staff_client/server/circ/checkin.js @@ -293,40 +293,28 @@ circ.checkin.prototype = { var row = params.row; if (typeof params.on_retrieve == 'function') params.on_retrieve(row); - if (row.my.circ && ( document.getElementById('no_change_label') || document.getElementById('fine_tally') ) ) { - obj.network.simple_request('FM_MBTS_RETRIEVE.authoritative',[ses(),row.my.circ.id()], function(req) { - JSAN.use('util.money'); - var bill = req.getResultObject(); - row.my.mbts = bill; - if (typeof params.on_retrieve == 'function') params.on_retrieve(row); - if (Number(bill.balance_owed()) == 0) { return; } - if (document.getElementById('no_change_label')) { - var m = document.getElementById('no_change_label').getAttribute('value'); - document.getElementById('no_change_label').setAttribute( - 'value', - m + document.getElementById('circStrings').getFormattedString('staff.circ.utils.billable.amount', [row.my.acp.barcode(), util.money.sanitize(bill.balance_owed())]) + ' ' - ); - document.getElementById('no_change_label').setAttribute('hidden','false'); - } - if (document.getElementById('fine_tally')) { - var amount = Number( document.getElementById('fine_tally').getAttribute('amount') ) + Number( bill.balance_owed() ); - document.getElementById('fine_tally').setAttribute('amount',amount); - document.getElementById('fine_tally').setAttribute( - 'value', - document.getElementById('circStrings').getFormattedString('staff.circ.utils.fine_tally_text', [ util.money.sanitize( amount ) ]) - ); - document.getElementById('fine_tally').setAttribute('hidden','false'); - } - }); - - if (row.my.circ) { - obj.network.simple_request('FM_AU_FLESHED_RETRIEVE_VIA_ID.authoritative', [ses(),row.my.circ.usr()], function(req) { - var au_obj = req.getResultObject(); - row.my.au = au_obj; - if (typeof params.on_retrieve == 'function') params.on_retrieve(row); - } ); + if (row.my.mbts && ( document.getElementById('no_change_label') || document.getElementById('fine_tally') ) ) { + var bill = row.my.mbts; + if (Number(bill.balance_owed()) == 0) { return; } + if (document.getElementById('no_change_label')) { + var m = document.getElementById('no_change_label').getAttribute('value'); + document.getElementById('no_change_label').setAttribute( + 'value', + m + document.getElementById('circStrings').getFormattedString('staff.circ.utils.billable.amount', [row.my.acp.barcode(), util.money.sanitize(bill.balance_owed())]) + ' ' + ); + document.getElementById('no_change_label').setAttribute('hidden','false'); + } + if (document.getElementById('fine_tally')) { + var amount = Number( document.getElementById('fine_tally').getAttribute('amount') ) + Number( bill.balance_owed() ); + document.getElementById('fine_tally').setAttribute('amount',amount); + document.getElementById('fine_tally').setAttribute( + 'value', + document.getElementById('circStrings').getFormattedString('staff.circ.utils.fine_tally_text', [ util.money.sanitize( amount ) ]) + ); + document.getElementById('fine_tally').setAttribute('hidden','false'); } } + } catch(E) { alert('Error in checkin.js, list_retrieve_row(): ' + E); } @@ -437,15 +425,16 @@ circ.checkin.prototype = { 'row' : { 'my' : { 'circ' : checkin.circ, + 'mbts' : checkin.circ ? checkin.circ.billable_transaction().summary() : null, 'mvr' : checkin.record, 'acp' : checkin.copy, + 'au' : checkin.patron, 'status' : checkin.status, 'route_to' : checkin.route_to, 'message' : checkin.message } }, 'to_top' : true - //I could override map_row_to_column here } ); obj.list.node.view.selection.select(0); diff --git a/Open-ILS/xul/staff_client/server/circ/util.js b/Open-ILS/xul/staff_client/server/circ/util.js index 94dbe882ec..2e2be787f7 100644 --- a/Open-ILS/xul/staff_client/server/circ/util.js +++ b/Open-ILS/xul/staff_client/server/circ/util.js @@ -2191,6 +2191,7 @@ circ.util.checkin_via_barcode2 = function(session,params,backdate,auto_print,che if (check.payload && check.payload.copy) { check.copy = check.payload.copy; } if (check.payload && check.payload.record) { check.record = check.payload.record; } if (check.payload && check.payload.circ) { check.circ = check.payload.circ; } + if (check.payload && check.payload.patron) { check.patron = check.payload.patron; } if (!check.route_to) { check.route_to = ' '; } -- 2.11.0