[open-ils-commits] r8291 -
branches/rel_1_2/Open-ILS/xul/staff_client/server/patron
svn at svn.open-ils.org
svn at svn.open-ils.org
Wed Jan 2 10:51:08 EST 2008
Author: phasefx
Date: 2008-01-02 10:27:31 -0500 (Wed, 02 Jan 2008)
New Revision: 8291
Modified:
branches/rel_1_2/Open-ILS/xul/staff_client/server/patron/holds.js
Log:
refactor the flattening of hold copies, and disallow editing the pickup locations for intransit or ready for pickup holds
Modified: branches/rel_1_2/Open-ILS/xul/staff_client/server/patron/holds.js
===================================================================
--- branches/rel_1_2/Open-ILS/xul/staff_client/server/patron/holds.js 2007-12-28 21:03:22 UTC (rev 8290)
+++ branches/rel_1_2/Open-ILS/xul/staff_client/server/patron/holds.js 2008-01-02 15:27:31 UTC (rev 8291)
@@ -16,6 +16,11 @@
'holds_map' : {},
+ 'flatten_copy' : function(hold) {
+ try { if ( hold.current_copy() && typeof hold.current_copy() == 'object') hold.current_copy( hold.current_copy().id() ); } catch(E) { alert('FIXME: Error flattening hold before hold update: ' + E); }
+ return hold;
+ },
+
'init' : function( params ) {
var obj = this;
@@ -54,6 +59,7 @@
if (typeof blob.ilsevent != 'undefined') throw(blob);
row.my.ahr = blob.hold;
row.my.status = blob.status;
+ row.my.ahr.status( blob.status );
row.my.acp = blob.copy;
row.my.acn = blob.volume;
row.my.mvr = blob.mvr;
@@ -406,7 +412,7 @@
for (var i = 0; i < obj.retrieve_ids.length; i++) {
var hold = obj.holds_map[ obj.retrieve_ids[i].id ];
hold.selection_depth( obj.data.hash.aout[selection].depth() ); hold.ischanged('1');
- try { if ( typeof hold.current_copy() == 'object') hold.current_copy( hold.current_copy().id() ); } catch(E) { alert('IFXME: Error flattening hold before hold update: ' + E); }
+ hold = obj.flatten_copy(hold);
var robj = obj.network.simple_request('FM_AHR_UPDATE',[ ses(), hold ]);
if (typeof robj.ilsevent != 'undefined') throw(robj);
}
@@ -423,6 +429,17 @@
function() {
try {
JSAN.use('util.widgets'); JSAN.use('util.functional');
+
+ var deny_edit_because_of_transit = false;
+ for (var i = 0; i < obj.retrieve_ids.length; i++) {
+ var hold = obj.holds_map[ obj.retrieve_ids[i].id ];
+ if (hold.status() > 2 /* Which means holds that are In-Transit or Ready for Pickup */) deny_edit_because_of_transit = true;
+ }
+ if (deny_edit_because_of_transit) {
+ alert('You may not edit the pickup library for holds that are in-transit or ready for pickup.');
+ return;
+ }
+
var list = util.functional.map_list(
obj.data.list.aou,
function(o) {
@@ -465,7 +482,7 @@
for (var i = 0; i < obj.retrieve_ids.length; i++) {
var hold = obj.holds_map[ obj.retrieve_ids[i].id ];
hold.pickup_lib( pickup_lib ); hold.ischanged('1');
- try { if ( typeof hold.current_copy() == 'object') hold.current_copy( hold.current_copy().id() ); } catch(E) { alert('IFXME: Error flattening hold before hold update: ' + E); }
+ hold = obj.flatten_copy(hold);
var robj = obj.network.simple_request('FM_AHR_UPDATE',[ ses(), hold ]);
if (typeof robj.ilsevent != 'undefined') throw(robj);
}
@@ -508,7 +525,7 @@
for (var i = 0; i < obj.retrieve_ids.length; i++) {
var hold = obj.holds_map[ obj.retrieve_ids[i].id ];
hold.phone_notify( phone ); hold.ischanged('1');
- try { if ( typeof hold.current_copy() == 'object') hold.current_copy( hold.current_copy().id() ); } catch(E) { alert('IFXME: Error flattening hold before hold update: ' + E); }
+ hold = obj.flatten_copy(hold);
var robj = obj.network.simple_request('FM_AHR_UPDATE',[ ses(), hold ]);
if (typeof robj.ilsevent != 'undefined') throw(robj);
}
@@ -595,7 +612,7 @@
hold.thaw_date( null );
}
hold.ischanged('1');
- try { if ( typeof hold.current_copy() == 'object') hold.current_copy( hold.current_copy().id() ); } catch(E) { alert('IFXME: Error flattening hold before hold update: ' + E); }
+ hold = obj.flatten_copy(hold);
var robj = obj.network.simple_request('FM_AHR_UPDATE',[ ses(), hold ]);
if (typeof robj.ilsevent != 'undefined') throw(robj);
}
@@ -641,7 +658,7 @@
for (var i = 0; i < obj.retrieve_ids.length; i++) {
var hold = obj.holds_map[ obj.retrieve_ids[i].id ];
hold.thaw_date( thaw_date == '' ? null : util.date.formatted_date(thaw_date + ' 00:00:00','%{iso8601}') ); hold.ischanged('1');
- try { if ( typeof hold.current_copy() == 'object') hold.current_copy( hold.current_copy().id() ); } catch(E) { alert('IFXME: Error flattening hold before hold update: ' + E); }
+ hold = obj.flatten_copy(hold);
var robj = obj.network.simple_request('FM_AHR_UPDATE',[ ses(), hold ]);
if (typeof robj.ilsevent != 'undefined') throw(robj);
}
More information about the open-ils-commits
mailing list