staff function for editing expiration date for arbitrary holds in various hold interfaces
authorphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 22 Sep 2008 20:52:22 +0000 (20:52 +0000)
committerphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 22 Sep 2008 20:52:22 +0000 (20:52 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@10687 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/web/opac/locale/en-US/lang.dtd
Open-ILS/xul/staff_client/server/circ/util.js
Open-ILS/xul/staff_client/server/locale/en-US/circ.properties
Open-ILS/xul/staff_client/server/locale/en-US/common.properties
Open-ILS/xul/staff_client/server/patron/holds.js
Open-ILS/xul/staff_client/server/patron/holds.xul
Open-ILS/xul/staff_client/server/patron/holds_overlay.xul

index d7eb188..a8884ae 100644 (file)
 <!ENTITY staff.circ.holds.set_email_notification.accesskey "E">
 <!ENTITY staff.circ.holds.edit_activation_date "Edit Activation Date">
 <!ENTITY staff.circ.holds.edit_activation_date.accesskey "D">
+<!ENTITY staff.circ.holds.edit_expire_time "Edit Expiration Date">
+<!ENTITY staff.circ.holds.edit_expire_time.accesskey "E">
 <!ENTITY staff.circ.holds.activate_hold "Activate Hold">
 <!ENTITY staff.circ.holds.activate_hold.accesskey "A">
 <!ENTITY staff.circ.holds.suspend_hold "Suspend Hold">
index 1fc236c..0ed5408 100644 (file)
@@ -1521,6 +1521,15 @@ circ.util.hold_columns = function(modify,params) {
                },
                {
                        'persist' : 'hidden width ordinal',
+                       'id' : 'expire_date',
+                       'label' : document.getElementById('commonStrings').getString('staff.ahr_expire_date_label'),
+                       'flex' : 1,
+                       'primary' : false,
+                       'hidden' : true,
+                       'render' : function(my) { return my.ahr.expire_time() ? my.ahr.expire_time().toString().substr(0,10) : ''; }
+               },
+               {
+                       'persist' : 'hidden width ordinal',
                        'id' : 'fulfillment_time',
                        'label' : document.getElementById('commonStrings').getString('staff.ahr_fulfillment_time_label'),
                        'flex' : 1,
index ebea81d..744ff9b 100644 (file)
@@ -322,6 +322,11 @@ staff.circ.holds.activation_date.prompt=Please enter an Activation Date (or leav
 staff.circ.holds.activation_date.prompt.plural=Please enter an Activation Date (or leave blank to unset) for holds %1$s.  This will also Suspend the holds.
 staff.circ.holds.activation_date.too_early.error=Activation Date needs to be either unset or set to fall on a future date.
 staff.circ.holds.activation_date.invalid_date=Invalid Date
+staff.circ.holds.expire_time.prompt=Please enter an Expiration Date (or leave blank to unset) for hold %1$s.
+staff.circ.holds.expire_time.prompt.plural=Please enter an Expiration Date (or leave blank to unset) for holds %1$s.
+staff.circ.holds.expire_time.too_early.error=Expiration Date needs to be either unset or set to fall on a future date.
+staff.circ.holds.expire_time.invalid_date=Invalid Date
+
 staff.circ.holds.modifying_holds=Modifying Holds
 staff.circ.holds.modifying_holds.yes=Yes
 staff.circ.holds.modifying_holds.no=No
index d7e1891..963fcc9 100644 (file)
@@ -43,6 +43,7 @@ staff.ahr_current_copy_label=Current Copy
 staff.ahr_current_copy_location_label=Current Copy Location
 staff.ahr_email_notify_label=Email Notify
 staff.ahr_expire_time_label=Expire Time
+staff.ahr_expire_date_label=Expire Date
 staff.ahr_fulfillment_time_label=Fulfillment Time
 staff.ahr_hold_type_label=Type
 staff.ahr_holdable_formats_label=Holdable Formats
index 19677eb..5964bd3 100644 (file)
@@ -128,6 +128,7 @@ patron.holds.prototype = {
                                                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_expire_time.setAttribute('disabled','false');
                                                obj.controller.view.cmd_holds_edit_thaw_date.setAttribute('disabled','false');
                                                obj.controller.view.cmd_holds_activate.setAttribute('disabled','false');
                                                obj.controller.view.cmd_holds_suspend.setAttribute('disabled','false');
@@ -145,6 +146,7 @@ patron.holds.prototype = {
                                                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_expire_time.setAttribute('disabled','true');
                                                obj.controller.view.cmd_holds_edit_thaw_date.setAttribute('disabled','true');
                                                obj.controller.view.cmd_holds_activate.setAttribute('disabled','true');
                                                obj.controller.view.cmd_holds_suspend.setAttribute('disabled','true');
@@ -662,6 +664,56 @@ patron.holds.prototype = {
                                                        }
                                                }
                                        ],
+                    'cmd_holds_edit_expire_time' : [
+                                               ['command'],
+                                               function() {
+                                                       try {
+                                JSAN.use('util.date');
+                                function check_date(value) {
+                                    try {
+                                        if (! util.date.check('YYYY-MM-DD',value) ) { throw(document.getElementById('circStrings').getString('staff.circ.holds.expire_time.invalid_date')); }
+                                        if (util.date.check_past('YYYY-MM-DD',value) || util.date.formatted_date(new Date(),'%F') == value ) { 
+                                            throw(document.getElementById('circStrings').getString('staff.circ.holds.expire_time.too_early.error'));
+                                        }
+                                        return true;
+                                    } catch(E) {
+                                        alert(E);
+                                        return false;
+                                    }
+                                }
+
+                                var hold_ids = util.functional.map_list( obj.retrieve_ids, function(o){return o.id;}).join(', ');
+                                                               var msg_singular = document.getElementById('circStrings').getFormattedString('staff.circ.holds.expire_time.prompt',[hold_ids]);
+                                                               var msg_plural = document.getElementById('circStrings').getFormattedString('staff.circ.holds.expire_time.prompt',[hold_ids]);
+                                var msg = obj.retrieve_ids.length > 1 ? msg_plural : msg_singular;
+                                var value = 'YYYY-MM-DD';
+                                var title = document.getElementById('circStrings').getString('staff.circ.holds.modifying_holds');
+                                                               var expire_time; var invalid = true;
+                                while(invalid) {
+                                    expire_time = window.prompt(msg,value,title);
+                                    if (expire_time) {
+                                        invalid = ! check_date(expire_time);
+                                    } else { 
+                                        invalid = false;
+                                    }
+                                }
+                                if (expire_time || expire_time == '') {
+                                    for (var i = 0; i < obj.retrieve_ids.length; i++) {
+                                        var hold = obj.holds_map[ obj.retrieve_ids[i].id ];
+                                        hold.expire_time(  expire_time == '' ? null : util.date.formatted_date(expire_time + ' 00:00:00','%{iso8601}') ); hold.ischanged('1');
+                                        hold = obj.flatten_copy(hold);
+                                        var robj = obj.network.simple_request('FM_AHR_UPDATE',[ ses(), hold ]);
+                                        if (typeof robj.ilsevent != 'undefined') throw(robj);
+                                    }
+                                                                       obj.clear_and_retrieve(true);
+                                }
+                                                       } catch(E) {
+                                                               obj.error.standard_unexpected_error_alert(document.getElementById('circStrings').getString('staff.circ.holds.unexpected_error.not_likely_modified'),E);
+                                                       }
+                                               }
+                                       ],
+
+
 
                                        'cmd_holds_retarget' : [
                                                ['command'],
index 7ec7c4e..f64a58a 100644 (file)
@@ -90,6 +90,7 @@
                <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_expire_time" />
                <command id="cmd_holds_activate" />
                <command id="cmd_holds_suspend" />
                <command id="cmd_holds_edit_selection_depth" />
index 321262b..52698d8 100644 (file)
@@ -22,7 +22,8 @@
                <menuitem label="&staff.circ.holds.edit_pickup_library;" command="cmd_holds_edit_pickup_lib" accesskey="&staff.circ.holds.edit_pickup_library.accesskey;"/>
                <menuitem label="&staff.circ.holds.edit_phone_notification;" command="cmd_holds_edit_phone_notify" accesskey="&staff.circ.holds.edit_phone_notification.accesskey;"/>
                <menuitem label="&staff.circ.holds.set_email_notification;" command="cmd_holds_edit_email_notify" accesskey="&staff.circ.holds.set_email_notification.accesskey;"/>
-               <menuitem label="&staff.circ.holds.edit_activation_date;" command="cmd_holds_edit_thaw_date" accesskey="&staff.circ.holds.edit_activation_date;"/>
+               <menuitem label="&staff.circ.holds.edit_expire_time;" command="cmd_holds_edit_expire_time" accesskey="&staff.circ.holds.edit_expire_time.accesskey;"/>
+               <menuitem label="&staff.circ.holds.edit_activation_date;" command="cmd_holds_edit_thaw_date" accesskey="&staff.circ.holds.edit_activation_date.accesskey;"/>
                <menuitem label="&staff.circ.holds.activate_hold;" command="cmd_holds_activate" accesskey="&staff.circ.holds.activate_hold.accesskey;"/>
                <menuitem label="&staff.circ.holds.suspend_hold;" command="cmd_holds_suspend" accesskey="&staff.circ.holds.suspend_hold.accesskey;"/>
                <menuitem label="&staff.circ.holds.edit_hold_range;" class="edit_hold_range" command="cmd_holds_edit_selection_depth" accesskey="&staff.circ.holds.edit_hold_range.accesskey;"/>
@@ -84,7 +85,8 @@
                 <menuitem label="&staff.circ.holds.edit_pickup_library;" command="cmd_holds_edit_pickup_lib" accesskey="&staff.circ.holds.edit_pickup_library.accesskey;"/>
                 <menuitem label="&staff.circ.holds.edit_phone_notification;" command="cmd_holds_edit_phone_notify" accesskey="&staff.circ.holds.edit_phone_notification.accesskey;"/>
                 <menuitem label="&staff.circ.holds.set_email_notification;" command="cmd_holds_edit_email_notify" accesskey="&staff.circ.holds.set_email_notification.accesskey;"/>
-                <menuitem label="&staff.circ.holds.edit_activation_date;" command="cmd_holds_edit_thaw_date" accesskey="&staff.circ.holds.edit_activation_date;"/>
+                       <menuitem label="&staff.circ.holds.edit_expire_time;" command="cmd_holds_edit_expire_time" accesskey="&staff.circ.holds.edit_expire_time.accesskey;"/>
+                <menuitem label="&staff.circ.holds.edit_activation_date;" command="cmd_holds_edit_thaw_date" accesskey="&staff.circ.holds.edit_activation_date.accesskey;"/>
                 <menuitem label="&staff.circ.holds.activate_hold;" command="cmd_holds_activate" accesskey="&staff.circ.holds.activate_hold.accesskey;"/>
                 <menuitem label="&staff.circ.holds.suspend_hold;" command="cmd_holds_suspend" accesskey="&staff.circ.holds.suspend_hold.accesskey;"/>
                 <menuitem label="&staff.circ.holds.edit_hold_range;" class="edit_hold_range" command="cmd_holds_edit_selection_depth" accesskey="&staff.circ.holds.edit_hold_range.accesskey;"/>