[open-ils-commits] r7903 - branches/rel_1_2/Open-ILS/xul/staff_client/server/patron

svn at svn.open-ils.org svn at svn.open-ils.org
Mon Oct 22 01:52:41 EDT 2007


Author: phasefx
Date: 2007-10-22 01:39:11 -0400 (Mon, 22 Oct 2007)
New Revision: 7903

Modified:
   branches/rel_1_2/Open-ILS/xul/staff_client/server/patron/holds.js
Log:
patron display refresh tweaks and offer to cancel transits on hold retargeting

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-10-22 05:32:14 UTC (rev 7902)
+++ branches/rel_1_2/Open-ILS/xul/staff_client/server/patron/holds.js	2007-10-22 05:39:11 UTC (rev 7903)
@@ -76,6 +76,7 @@
 									params.row_node.setAttribute('retrieve_id', 
 										js2JSON({
 											'copy_id':copy_id,
+                                            'barcode':row.my.acp ? row.my.acp.barcode() : null,
 											'id':row.my.ahr.id(),
 											'type':row.my.ahr.hold_type(),
 											'target':row.my.ahr.target(),
@@ -431,7 +432,7 @@
 										var robj = obj.network.simple_request('FM_AHR_UPDATE',[ ses(), hold ]);
 										if (typeof robj.ilsevent != 'undefined') throw(robj);
 									}
-									obj.retrieve();
+									obj.retrieve(true);
 								}
 							} catch(E) {
 								obj.error.standard_unexpected_error_alert('Holds not likely modified.',E);
@@ -489,7 +490,7 @@
 										var robj = obj.network.simple_request('FM_AHR_UPDATE',[ ses(), hold ]);
 										if (typeof robj.ilsevent != 'undefined') throw(robj);
 									}
-									obj.retrieve();
+									obj.retrieve(true);
 								}
 							} catch(E) {
 								obj.error.standard_unexpected_error_alert('Holds not likely modified.',E);
@@ -531,7 +532,7 @@
 										var robj = obj.network.simple_request('FM_AHR_UPDATE',[ ses(), hold ]);
 										if (typeof robj.ilsevent != 'undefined') throw(robj);
 									}
-									obj.retrieve();
+									obj.retrieve(true);
 								}
 							} catch(E) {
 								obj.error.standard_unexpected_error_alert('Holds not likely modified.',E);
@@ -543,7 +544,7 @@
 						function() {
 							try {
 								var xml = '<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" flex="1" style="overflow: vertical">';
-								xml += '<description>Send email notifications (when appropriate)?  The email address used is found in the hold recepient account.</description>';
+								xml += '<description>Send email notifications (when appropriate)?  The email address used is found in the hold recipient account.</description>';
 								xml += '<hbox><button value="email" label="Email" accesskey="E" name="fancy_submit"/>';
 								xml += '<button value="noemail" label="No Email" accesskey="N" name="fancy_submit"/></hbox>';
 								xml += '</vbox>';
@@ -572,15 +573,13 @@
 										var robj = obj.network.simple_request('FM_AHR_UPDATE',[ ses(), hold ]);
 										if (typeof robj.ilsevent != 'undefined') throw(robj);
 									}
-									obj.retrieve();
+									obj.retrieve(true);
 								}
 							} catch(E) {
 								obj.error.standard_unexpected_error_alert('Holds not likely modified.',E);
 							}
 						}
 					],
-
-
 					'cmd_holds_retarget' : [
 						['command'],
 						function() {
@@ -610,10 +609,39 @@
 								var msg = 'Are you sure you would like to cancel hold' + ( obj.retrieve_ids.length > 1 ? 's ' : ' ') + util.functional.map_list( obj.retrieve_ids, function(o){return o.id;}).join(', ') + '?';
 								var r = obj.error.yns_alert(msg,'Cancelling Holds','Yes','No',null,'Check here to confirm this message');
 								if (r == 0) {
+                                    var transits = [];
 									for (var i = 0; i < obj.retrieve_ids.length; i++) {
+                                        if (obj.holds_map[ obj.retrieve_ids[i].id ].transit()) {
+                                            transits.push( obj.retrieve_ids[i].barcode );
+                                        }
 										var robj = obj.network.simple_request('FM_AHR_CANCEL',[ ses(), obj.retrieve_ids[i].id]);
 										if (typeof robj.ilsevent != 'undefined') throw(robj);
 									}
+                                    if (transits.length > 0) {
+                                        var msg2 = 'For barcodes ' + transits.join(', ') + ' cancel the transits as well?';
+                                        var r2 = obj.error.yns_alert(msg2,'Cancelling Transits','Yes','No',null,'Check here to confirm this message');
+                                        if (r2 == 0) {
+                                            try {
+                                                for (var i = 0; i < transits.length; i++) {
+                                                    var robj = obj.network.simple_request('FM_ATC_VOID',[ ses(), { 'barcode' : transits[i] } ]);
+                                                    if (typeof robj.ilsevent != 'undefined') {
+                                                        switch(robj.ilsevent) {
+                                                            case 1225 /* TRANSIT_ABORT_NOT_ALLOWED */ :
+                                                                alert(robj.desc);
+                                                            break;
+                                                            case 5000 /* PERM_FAILURE */ :
+                                                            break;
+                                                            default:
+                                                                throw(robj);
+                                                            break;
+                                                        }
+										            }
+                                                }
+                                            } catch(E) {
+    								            obj.error.standard_unexpected_error_alert('Hold-transits not likely cancelled.',E);
+                                            }
+                                        }
+                                    }
 									obj.retrieve();
 								}
 							} catch(E) {



More information about the open-ils-commits mailing list