[open-ils-commits] r8293 -
trunk/Open-ILS/xul/staff_client/server/patron
svn at svn.open-ils.org
svn at svn.open-ils.org
Wed Jan 2 11:01:51 EST 2008
Author: phasefx
Date: 2008-01-02 10:38:16 -0500 (Wed, 02 Jan 2008)
New Revision: 8293
Modified:
trunk/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: trunk/Open-ILS/xul/staff_client/server/patron/holds.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/patron/holds.js 2008-01-02 15:33:48 UTC (rev 8292)
+++ trunk/Open-ILS/xul/staff_client/server/patron/holds.js 2008-01-02 15:38:16 UTC (rev 8293)
@@ -23,6 +23,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;
@@ -61,6 +66,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;
@@ -290,7 +296,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);
}
@@ -349,7 +355,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);
}
@@ -392,7 +398,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);
}
@@ -434,7 +440,7 @@
for (var i = 0; i < obj.retrieve_ids.length; i++) {
var hold = obj.holds_map[ obj.retrieve_ids[i].id ];
hold.email_notify( email ); 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);
}
@@ -480,7 +486,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);
}
@@ -526,7 +532,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