[open-ils-commits] r14235 - trunk/Open-ILS/xul/staff_client/server/circ (phasefx)
svn at svn.open-ils.org
svn at svn.open-ils.org
Wed Sep 30 16:09:39 EDT 2009
Author: phasefx
Date: 2009-09-30 16:09:34 -0400 (Wed, 30 Sep 2009)
New Revision: 14235
Modified:
trunk/Open-ILS/xul/staff_client/server/circ/checkin.js
trunk/Open-ILS/xul/staff_client/server/circ/util.js
Log:
Adds patron and bill columns to the checkin list. Moves the bill fetching call to the row retrieval function so the data can be added to the list
Modified: trunk/Open-ILS/xul/staff_client/server/circ/checkin.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/circ/checkin.js 2009-09-30 20:04:26 UTC (rev 14234)
+++ trunk/Open-ILS/xul/staff_client/server/circ/checkin.js 2009-09-30 20:09:34 UTC (rev 14235)
@@ -19,7 +19,7 @@
var obj = this;
- JSAN.use('circ.util');
+ JSAN.use('circ.util'); JSAN.use('patron.util');
var columns = circ.util.columns(
{
'barcode' : { 'hidden' : false },
@@ -34,13 +34,20 @@
{
'except_these' : [ 'uses', 'checkin_time_full' ]
}
- );
+ ).concat(
+ patron.util.columns( {} )
+ ).concat(
+ patron.util.mbts_columns( {}, { 'except_these' : [ 'total_paid', 'total_owed', 'xact_start', 'xact_finish', 'xact_type' ] } )
+
+ ).sort( function(a,b) { if (a.label < b.label) return -1; if (a.label > b.label) return 1; return 0; } );
+
JSAN.use('util.list'); obj.list = new util.list('checkin_list');
obj.list.init(
{
'columns' : columns,
'map_row_to_columns' : circ.util.std_map_row_to_columns(),
+ 'retrieve_row' : obj.gen_list_retrieve_row_func(),
'on_select' : function(ev) {
try {
JSAN.use('util.functional');
@@ -279,6 +286,46 @@
},
+ 'gen_list_retrieve_row_func' : function() {
+ var obj = this;
+ return function(params) {
+ try {
+ 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');
+ }
+ });
+ }
+ } catch(E) {
+ alert('Error in checkin.js, list_retrieve_row(): ' + E);
+ }
+ return row;
+ };
+ },
+
'test_barcode' : function(bc) {
var obj = this;
var x = document.getElementById('strict_barcode');
Modified: trunk/Open-ILS/xul/staff_client/server/circ/util.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/circ/util.js 2009-09-30 20:04:26 UTC (rev 14234)
+++ trunk/Open-ILS/xul/staff_client/server/circ/util.js 2009-09-30 20:09:34 UTC (rev 14235)
@@ -1711,7 +1711,7 @@
},
{
'persist' : 'hidden width ordinal',
- 'id' : 'id',
+ 'id' : 'ahr_id',
'label' : document.getElementById('commonStrings').getString('staff.ahr_id_label'),
'flex' : 1,
'primary' : false,
@@ -2200,31 +2200,6 @@
document.getElementById('no_change_label').setAttribute('hidden','true');
}
- if (check.circ && ( document.getElementById('no_change_label') || document.getElementById('fine_tally') ) ) {
- network.simple_request('FM_MBTS_RETRIEVE.authoritative',[ses(),check.circ.id()], function(req) {
- JSAN.use('util.money');
- var bill = req.getResultObject();
- 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', [params.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');
- }
- });
- }
-
var msg = '';
var print_list = [];
var print_data = {
More information about the open-ils-commits
mailing list