For checkouts (and checkouts converted into renewals), this updates the item out
count in the patron summary sidebar, and under the Items Out navigation button.
It also updates the Items Out sub-interface if that interface has been opened.
However, we are adding an extra network call to update the summary sidebar. We
may want to have the checkout method return that data (the checkout count
summary) instead.
Signed-off-by: Jason Etheridge <jason@esilibrary.com>
Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Mike Rylander <mrylander@gmail.com>
//I could override map_row_to_column here
}
);
+ var is_renewal = (
+ get_bool(checkout.payload.circ.opac_renewal())
+ ||get_bool(checkout.payload.circ.phone_renewal())
+ ||get_bool(checkout.payload.circ.desk_renewal())
+ );
try {
obj.error.work_log(
document.getElementById('circStrings').getFormattedString(
- (get_bool(checkout.payload.circ.opac_renewal())||get_bool(checkout.payload.circ.phone_renewal())||get_bool(checkout.payload.circ.desk_renewal())) ?
- 'staff.circ.work_log_renew.message' : 'staff.circ.work_log_checkout.message',
+ is_renewal
+ ? 'staff.circ.work_log_renew.message'
+ : 'staff.circ.work_log_checkout.message',
[
ses('staff_usrname'),
xulG.patron.family_name(),
}
*/
if (typeof window.xulG == 'object' && typeof window.xulG.on_list_change == 'function') {
- window.xulG.on_list_change(checkout.payload);
+ window.xulG.on_list_change(checkout.payload,is_renewal);
} else {
obj.error.sdump('D_CIRC','circ.checkout: No external .on_checkout()\n');
}
'patron_id' : obj.patron.id(),
'patron' : obj.patron,
'check_stop_checkouts' : function() { return obj.check_stop_checkouts(); },
- 'on_list_change' : function(checkout) {
+ 'on_list_change_old' : function(checkout) {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var x = obj.summary_window.g.summary.controller.view.patron_checkouts;
var n = Number(x.getAttribute('value'));
x.setAttribute('value',n+1);
},
- 'on_list_change_old' : function(checkout) {
+ 'on_list_change' : function(checkout,is_renewal) {
- /* this stops noncats from getting pushed into Items Out */
- if (!checkout.circ.id()) return;
-
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
+ // Downside here: an extra network call, open-ils.actor.user.checked_out.count.authoritative
obj.summary_window.g.summary.controller.render('patron_checkouts');
obj.summary_window.g.summary.controller.render('patron_standing_penalties');
+
+ /* this stops noncats from getting pushed into Items Out */
+ if (!checkout.circ.id()) return;
+
if (obj.items_window) {
- obj.items_window.g.items.list.append(
- {
- 'row' : {
- 'my' : {
- 'circ_id' : checkout.circ.id()
- }
+ if (is_renewal) {
+ var original_circ_id = obj.items_window.g.items.list_circ_map_by_copy[ checkout.circ.target_copy() ];
+ obj.items_window.g.items.list_circ_map[ original_circ_id ].row.my.circ = checkout.circ;
+ obj.items_window.g.items.list_circ_map[ checkout.circ.id() ] =
+ obj.items_window.g.items.list_circ_map[ original_circ_id ];
+ obj.items_window.g.items.refresh( checkout.circ.id() );
+ } else {
+ var nparams = obj.items_window.g.items.list.append(
+ {
+ 'row' : {
+ 'my' : {
+ 'circ_id' : checkout.circ.id()
+ }
+ },
+ 'to_bottom' : true
}
- }
- )
+ )
+ obj.items_window.g.items.list_circ_map[ checkout.circ.id() ] = nparams;
+ obj.items_window.g.items.list_circ_map_by_copy[ checkout.circ.target_copy() ] = checkout.circ.id();
+ }
}
},
'get_barcode' : xulG.get_barcode,
patron.items.prototype = {
'list_circ_map' : {},
+ 'list_circ_map_by_copy' : {},
'init' : function( params ) {
obj.list_circ_map[ circ_id ].row.my.mvr = r[0].payload.record;
// A renewed circ is a new circ, and has a new circ_id.
obj.list_circ_map[ r[0].payload.circ.id() ] = obj.list_circ_map[ circ_id ];
+ obj.list_circ_map_by_copy[ r[0].payload.copy.id() ] = r[0].payload.circ.id();
} else {
var msg = $("patronStrings").getFormattedString('staff.patron.items.items_renew.not_renewed',[bc, r[0].textcode + r[0].desc]);
l.setAttribute('value', msg);
var robj = obj.network.simple_request('FM_CIRC_EDIT_DUE_DATE',[ses(),circs[i],my_xulG.timestamp]);
if (typeof robj.ilsevent != 'undefined') { if (robj.ilsevent != 0) throw(robj); }
obj.list_circ_map[ circs[i] ].row.my.circ = robj;
+ obj.list_circ_map_by_copy[ robj.target_copy() ] = circs[i];
obj.refresh(circs[i]);
}
}
}
params.treeitem_node.setAttribute( 'retrieve_id', js2JSON({'copy_id':copy_id,'circ_id':row.my.circ.id(),'barcode':row.my.acp.barcode(),'doc_id': ( row.my.record ? row.my.record.id() : null ) }) );
+
+ obj.list_circ_map_by_copy[ copy_id ] = row.my.circ.id();
if (typeof params.on_retrieve == 'function') {
params.on_retrieve(row);