gui for Edit Shelf Expire Time for holds
authorphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 4 Nov 2009 19:32:28 +0000 (19:32 +0000)
committerphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 4 Nov 2009 19:32:28 +0000 (19:32 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@14768 dcc99617-32d9-48b4-a31d-7c20da2025e4

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

index 5b678b6..68792cc 100644 (file)
 <!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.edit_shelf_expire_time "Edit Shelf Expire Time">
+<!ENTITY staff.circ.holds.edit_shelf_expire_time.accesskey "X">
 <!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 cf5f81a..f489bb8 100644 (file)
@@ -389,6 +389,10 @@ staff.circ.holds.expire_time.prompt.plural=Please enter an Expiration Date (or l
 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.shelf_expire_time.prompt=Please enter a Shelf Expiration Date (or leave blank to unset) for hold %1$s.
+staff.circ.holds.shelf_expire_time.prompt.plural=Please enter a Shelf Expiration Date (or leave blank to unset) for holds %1$s.
+staff.circ.holds.shelf_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 f5245ec..b72b65a 100644 (file)
@@ -141,6 +141,7 @@ patron.holds.prototype = {
                         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_shelf_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');
@@ -161,6 +162,7 @@ patron.holds.prototype = {
                         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_shelf_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');
@@ -831,8 +833,48 @@ patron.holds.prototype = {
                             }
                         }
                     ],
+                    'cmd_holds_edit_shelf_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.shelf_expire_time.invalid_date')); }
+                                        return true;
+                                    } catch(E) {
+                                        alert(E);
+                                        return false;
+                                    }
+                                }
 
-
+                                var hold_list = util.functional.map_list(obj.retrieve_ids, function(o){return o.id;});
+                                var msg_singular = document.getElementById('circStrings').getFormattedString('staff.circ.holds.shelf_expire_time.prompt',[hold_list.join(', ')]);
+                                var msg_plural = document.getElementById('circStrings').getFormattedString('staff.circ.holds.shelf_expire_time.prompt',[hold_list.join(', ')]);
+                                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 shelf_expire_time; var invalid = true;
+                                while(invalid) {
+                                    shelf_expire_time = window.prompt(msg,value,title);
+                                    if (shelf_expire_time) {
+                                        invalid = ! check_date(shelf_expire_time);
+                                    } else {
+                                        invalid = false;
+                                    }
+                                }
+                                if (shelf_expire_time || shelf_expire_time == '') {
+                                    circ.util.batch_hold_update(
+                                        hold_list, 
+                                        { 'shelf_expire_time' : shelf_expire_time == '' ? null : util.date.formatted_date(shelf_expire_time + ' 00:00:00','%{iso8601}') }, 
+                                        { 'progressmeter' : progressmeter, 'oncomplete' :  function() { 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 7571f10..7f17564 100644 (file)
@@ -26,6 +26,7 @@
         <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_edit_shelf_expire_time" />
         <command id="cmd_holds_activate" />
         <command id="cmd_holds_suspend" />
         <command id="cmd_holds_cut_in_line" />
@@ -55,6 +56,7 @@
             <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_expire_time;" command="cmd_holds_edit_expire_time" accesskey="&staff.circ.holds.edit_expire_time.accesskey;"/>
+            <menuitem label="&staff.circ.holds.edit_shelf_expire_time;" command="cmd_holds_edit_shelf_expire_time" accesskey="&staff.circ.holds.edit_shelf_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_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_expire_time;" command="cmd_holds_edit_expire_time" accesskey="&staff.circ.holds.edit_expire_time.accesskey;"/>
+                    <menuitem label="&staff.circ.holds.edit_shelf_expire_time;" command="cmd_holds_edit_shelf_expire_time" accesskey="&staff.circ.holds.edit_shelf_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;"/>