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

svn at svn.open-ils.org svn at svn.open-ils.org
Mon Nov 19 10:58:42 EST 2007


Author: phasefx
Date: 2007-11-19 10:41:12 -0500 (Mon, 19 Nov 2007)
New Revision: 8084

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.xul
   branches/rel_1_2/Open-ILS/xul/staff_client/server/patron/holds_overlay.xul
Log:
hold thaw/freeze staff UI

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-11-19 03:31:43 UTC (rev 8083)
+++ branches/rel_1_2/Open-ILS/xul/staff_client/server/patron/holds.js	2007-11-19 15:41:12 UTC (rev 8084)
@@ -236,6 +236,8 @@
 						obj.controller.view.cmd_holds_edit_phone_notify.setAttribute('disabled','false');
 						obj.controller.view.cmd_holds_edit_email_notify.setAttribute('disabled','false');
 						obj.controller.view.cmd_holds_edit_selection_depth.setAttribute('disabled','false');
+						obj.controller.view.cmd_holds_edit_thaw_date.setAttribute('disabled','false');
+						obj.controller.view.cmd_holds_edit_freeze.setAttribute('disabled','false');
 						obj.controller.view.cmd_show_notifications.setAttribute('disabled','false');
 						obj.controller.view.cmd_holds_retarget.setAttribute('disabled','false');
 						obj.controller.view.cmd_holds_cancel.setAttribute('disabled','false');
@@ -250,6 +252,8 @@
 						obj.controller.view.cmd_holds_edit_phone_notify.setAttribute('disabled','true');
 						obj.controller.view.cmd_holds_edit_email_notify.setAttribute('disabled','true');
 						obj.controller.view.cmd_holds_edit_selection_depth.setAttribute('disabled','true');
+						obj.controller.view.cmd_holds_edit_thaw_date.setAttribute('disabled','true');
+						obj.controller.view.cmd_holds_edit_freeze.setAttribute('disabled','true');
 						obj.controller.view.cmd_show_notifications.setAttribute('disabled','true');
 						obj.controller.view.cmd_holds_retarget.setAttribute('disabled','true');
 						obj.controller.view.cmd_holds_cancel.setAttribute('disabled','true');
@@ -429,6 +433,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); }
 										var robj = obj.network.simple_request('FM_AHR_UPDATE',[ ses(), hold ]);
 										if (typeof robj.ilsevent != 'undefined') throw(robj);
 									}
@@ -487,6 +492,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); }
 										var robj = obj.network.simple_request('FM_AHR_UPDATE',[ ses(), hold ]);
 										if (typeof robj.ilsevent != 'undefined') throw(robj);
 									}
@@ -529,6 +535,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); }
 										var robj = obj.network.simple_request('FM_AHR_UPDATE',[ ses(), hold ]);
 										if (typeof robj.ilsevent != 'undefined') throw(robj);
 									}
@@ -580,6 +587,99 @@
 							}
 						}
 					],
+					'cmd_holds_edit_freeze' : [
+						['command'],
+						function() {
+							try {
+								var xml = '<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" flex="1" style="overflow: vertical">';
+								xml += '<description>Freeze or un-freeze these holds?</description>';
+								xml += '<hbox><button value="freeze" label="Freeze" accesskey="F" name="fancy_submit"/>';
+								xml += '<button value="unfreeze" label="Un-Freeze" accesskey="U" name="fancy_submit"/></hbox>';
+								xml += '</vbox>';
+								var bot_xml = '<hbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" flex="1" style="overflow: vertical">';
+								bot_xml += '<spacer flex="1"/><button label="Cancel" accesskey="C" name="fancy_cancel"/></hbox>';
+								netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect UniversalBrowserWrite');
+								//obj.data.temp_mid = xml; obj.data.stash('temp_mid');
+								//obj.data.temp_bot = bot_xml; obj.data.stash('temp_bot');
+								JSAN.use('util.window'); var win = new util.window();
+								var fancy_prompt_data = win.open(
+									urls.XUL_FANCY_PROMPT,
+									//+ '?xml_in_stash=temp_mid'
+									//+ '&bottom_xml_in_stash=temp_bot'
+									//+ '&title=' + window.escape('Set Email Notification for Holds'),
+									'fancy_prompt', 'chrome,resizable,modal',
+									{ 'xml' : xml, 'bottom_xml' : bot_xml, 'title' : 'Set Email Notification for Holds' }
+								);
+								if (fancy_prompt_data.fancy_status == 'incomplete') { return; }
+								var freeze = fancy_prompt_data.fancy_submit == 'freeze' ? get_db_true() : get_db_false();
+								var msg = 'Are you sure you would like to ' + ( get_bool( freeze ) ? 'freeze' : 'un-freeze' ) + ' 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,'Modifying Holds','Yes','No',null,'Check here to confirm this message');
+								if (r == 0) {
+									for (var i = 0; i < obj.retrieve_ids.length; i++) {
+										var hold = obj.holds_map[ obj.retrieve_ids[i].id ];
+										hold.frozen(  freeze ); 
+										if ( ! get_bool( freeze ) ) {
+											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); }
+										var robj = obj.network.simple_request('FM_AHR_UPDATE',[ ses(), hold ]);
+										if (typeof robj.ilsevent != 'undefined') throw(robj);
+									}
+									obj.retrieve(true);
+								}
+							} catch(E) {
+								obj.error.standard_unexpected_error_alert('Holds not likely modified.',E);
+							}
+						}
+					],
+
+                    'cmd_holds_edit_thaw_date' : [
+						['command'],
+						function() {
+							try {
+                                JSAN.use('util.date');
+                                function check_date(value) {
+                                    try {
+                                        if (! util.date.check('YYYY-MM-DD',value) ) { throw('Invalid Date'); }
+                                        if (util.date.check_past('YYYY-MM-DD',value) ) { 
+                                            throw('Thaw date for frozen holds needs to be after today.'); 
+                                        }
+                                        return true;
+                                    } catch(E) {
+                                        alert(E);
+                                        return false;
+                                    }
+                                }
+
+								var msg = 'Please enter a thaw date for hold' + ( obj.retrieve_ids.length > 1 ? 's ' : ' ') + util.functional.map_list( obj.retrieve_ids, function(o){return o.id;}).join(', ') + '\nOr set to blank to unset the thaw date for these holds.  Frozen holds without a thaw date will remain frozen until manually unfrozen, otherwise they unfreeze on the thaw date.';
+                                var value = 'YYYY-MM-DD';
+                                var title = 'Modifying Holds';
+								var thaw_date; var invalid = true;
+                                while(invalid) {
+                                    thaw_date = window.prompt(msg,value,title);
+                                    if (thaw_date) {
+                                        invalid = ! check_date(thaw_date);
+                                    } else { 
+                                        invalid = false;
+                                    }
+                                }
+                                if (thaw_date || thaw_date == '') {
+                                    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); }
+                                        var robj = obj.network.simple_request('FM_AHR_UPDATE',[ ses(), hold ]);
+                                        if (typeof robj.ilsevent != 'undefined') throw(robj);
+                                    }
+									obj.retrieve(true);
+                                }
+							} catch(E) {
+								obj.error.standard_unexpected_error_alert('Holds not likely modified.',E);
+							}
+						}
+					],
+
 					'cmd_holds_retarget' : [
 						['command'],
 						function() {
@@ -731,6 +831,8 @@
 		obj.controller.view.cmd_holds_edit_phone_notify.setAttribute('disabled','true');
 		obj.controller.view.cmd_holds_edit_email_notify.setAttribute('disabled','true');
 		obj.controller.view.cmd_holds_edit_selection_depth.setAttribute('disabled','true');
+		obj.controller.view.cmd_holds_edit_thaw_date.setAttribute('disabled','true');
+		obj.controller.view.cmd_holds_edit_freeze.setAttribute('disabled','true');
 		obj.controller.view.cmd_show_notifications.setAttribute('disabled','true');
 		obj.controller.view.cmd_holds_retarget.setAttribute('disabled','true');
 		obj.controller.view.cmd_holds_cancel.setAttribute('disabled','true');

Modified: branches/rel_1_2/Open-ILS/xul/staff_client/server/patron/holds.xul
===================================================================
--- branches/rel_1_2/Open-ILS/xul/staff_client/server/patron/holds.xul	2007-11-19 03:31:43 UTC (rev 8083)
+++ branches/rel_1_2/Open-ILS/xul/staff_client/server/patron/holds.xul	2007-11-19 15:41:12 UTC (rev 8084)
@@ -81,6 +81,8 @@
 		<command id="cmd_holds_edit_pickup_lib" />
 		<command id="cmd_holds_edit_phone_notify" />
 		<command id="cmd_holds_edit_email_notify" />
+		<command id="cmd_holds_edit_thaw_date" />
+		<command id="cmd_holds_edit_freeze" />
 		<command id="cmd_holds_edit_selection_depth" disabled="true" hidden="true"/>
 		<command id="cmd_broken" disabled="true" hidden="true"/>
 		<command id="cmd_holds_retarget"/>

Modified: branches/rel_1_2/Open-ILS/xul/staff_client/server/patron/holds_overlay.xul
===================================================================
--- branches/rel_1_2/Open-ILS/xul/staff_client/server/patron/holds_overlay.xul	2007-11-19 03:31:43 UTC (rev 8083)
+++ branches/rel_1_2/Open-ILS/xul/staff_client/server/patron/holds_overlay.xul	2007-11-19 15:41:12 UTC (rev 8084)
@@ -21,7 +21,9 @@
 		<menuseparator />
 		<menuitem label="Edit Pickup Library" command="cmd_holds_edit_pickup_lib" accesskey="L"/>
 		<menuitem label="Edit Phone Notification" command="cmd_holds_edit_phone_notify" accesskey="P"/>
-		<menuitem label="Toggle Email Notification" command="cmd_holds_edit_email_notify" accesskey="E"/>
+		<menuitem label="Set Email Notification" command="cmd_holds_edit_email_notify" accesskey="E"/>
+		<menuitem label="Edit Thaw Date" command="cmd_holds_edit_thaw_date" accesskey="T"/>
+		<menuitem label="Set Freeze" command="cmd_holds_edit_freeze" accesskey="F"/>
 		<!--
 		<menuitem label="Edit Hold Range" command="cmd_holds_edit_selection_depth" accesskey="R"/>
 		<menuitem label="Edit Hold Focus" command="cmd_broken" accesskey="F"/>
@@ -70,7 +72,9 @@
 				<menuseparator />
 				<menuitem label="Edit Pickup Library" command="cmd_holds_edit_pickup_lib" accesskey="L"/>
 				<menuitem label="Edit Phone Notification" command="cmd_holds_edit_phone_notify" accesskey="P"/>
-				<menuitem label="Toggle Email Notification" command="cmd_holds_edit_email_notify" accesskey="E" />
+				<menuitem label="Set Email Notification" command="cmd_holds_edit_email_notify" accesskey="E" />
+                <menuitem label="Edit Thaw Date" command="cmd_holds_edit_thaw_date" accesskey="T"/>
+                <menuitem label="Set Freeze" command="cmd_holds_edit_freeze" accesskey="F"/>
 				<!--
 				<menuitem label="Edit Hold Range" command="cmd_holds_edit_selection_depth" accesskey="R" />
 				<menuitem label="Edit Hold Focus" command="cmd_broken" accesskey="F" />



More information about the open-ils-commits mailing list