From 7f725fb44174706f8c983bfa789b8f80da3a1d56 Mon Sep 17 00:00:00 2001
From: phasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Date: Fri, 11 Dec 2009 20:38:32 +0000
Subject: [PATCH] Edit Request Date action for more hold queue juggling

git-svn-id: svn://svn.open-ils.org/ILS/trunk@15148 dcc99617-32d9-48b4-a31d-7c20da2025e4
---
 Open-ILS/web/opac/locale/en-US/lang.dtd            |  2 ++
 .../server/locale/en-US/circ.properties            |  4 +++
 Open-ILS/xul/staff_client/server/patron/holds.js   | 37 ++++++++++++++++++++++
 .../staff_client/server/patron/holds_overlay.xul   |  3 ++
 4 files changed, 46 insertions(+)

diff --git a/Open-ILS/web/opac/locale/en-US/lang.dtd b/Open-ILS/web/opac/locale/en-US/lang.dtd
index e45233ba9b..895a83e512 100644
--- a/Open-ILS/web/opac/locale/en-US/lang.dtd
+++ b/Open-ILS/web/opac/locale/en-US/lang.dtd
@@ -2092,6 +2092,8 @@
 <!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_request_date "Edit Request Date">
+<!ENTITY staff.circ.holds.edit_request_date.accesskey "q">
 <!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">
diff --git a/Open-ILS/xul/staff_client/server/locale/en-US/circ.properties b/Open-ILS/xul/staff_client/server/locale/en-US/circ.properties
index b42964f7ef..70e80bfb8a 100644
--- a/Open-ILS/xul/staff_client/server/locale/en-US/circ.properties
+++ b/Open-ILS/xul/staff_client/server/locale/en-US/circ.properties
@@ -385,6 +385,10 @@ 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.request_date.prompt=Please enter a new Request Date for hold %1$s.
+staff.circ.holds.request_date.prompt.plural=Please enter a new Request Date for holds %1$s.
+staff.circ.holds.request_date.dialog.description=Request Date
+staff.circ.holds.request_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.
diff --git a/Open-ILS/xul/staff_client/server/patron/holds.js b/Open-ILS/xul/staff_client/server/patron/holds.js
index c6fa875929..6cc7f0a85b 100644
--- a/Open-ILS/xul/staff_client/server/patron/holds.js
+++ b/Open-ILS/xul/staff_client/server/patron/holds.js
@@ -143,6 +143,7 @@ patron.holds.prototype = {
                         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_edit_request_date.setAttribute('disabled','false');
                         obj.controller.view.cmd_holds_activate.setAttribute('disabled','false');
                         obj.controller.view.cmd_holds_suspend.setAttribute('disabled','false');
                         obj.controller.view.cmd_alt_view.setAttribute('disabled','false');
@@ -164,6 +165,7 @@ patron.holds.prototype = {
                         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_edit_request_date.setAttribute('disabled','true');
                         obj.controller.view.cmd_holds_activate.setAttribute('disabled','true');
                         obj.controller.view.cmd_holds_suspend.setAttribute('disabled','true');
                         obj.controller.view.cmd_alt_view.setAttribute('disabled','true');
@@ -872,7 +874,42 @@ patron.holds.prototype = {
                             }
                         }
                     ],
+                    'cmd_holds_edit_request_date' : [
+                        ['command'],
+                        function() {
+                            try {
+                                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.request_date.prompt',[hold_list.join(', ')]);
+                                var msg_plural = document.getElementById('circStrings').getFormattedString('staff.circ.holds.request_date.prompt.plural',[hold_list.join(', ')]);
+                                var msg = obj.retrieve_ids.length > 1 ? msg_plural : msg_singular;
+                                var title = document.getElementById('circStrings').getString('staff.circ.holds.modifying_holds');
+                                var desc = document.getElementById('circStrings').getString('staff.circ.holds.request_date.dialog.description');
 
+                                JSAN.use('util.window'); var win = new util.window();
+                                var my_xulG = win.open( 
+                                    urls.XUL_TIMESTAMP_DIALOG, 'edit_request_date', 'chrome,resizable,modal', 
+                                    { 
+                                        'title' : title, 
+                                        'description' : desc, 
+                                        'msg' : msg, 
+                                        'allow_unset' : false,
+                                        'disallow_future_dates' : true,
+                                        'disallow_past_dates' : false,
+                                        'disallow_today' : false
+                                    }
+                                );
+                                if (my_xulG.complete) {
+                                    circ.util.batch_hold_update(
+                                        hold_list, 
+                                        { 'request_time' : my_xulG.timestamp }, 
+                                        { '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'],
                         function() {
diff --git a/Open-ILS/xul/staff_client/server/patron/holds_overlay.xul b/Open-ILS/xul/staff_client/server/patron/holds_overlay.xul
index 7f175643a5..7ab83a609c 100644
--- a/Open-ILS/xul/staff_client/server/patron/holds_overlay.xul
+++ b/Open-ILS/xul/staff_client/server/patron/holds_overlay.xul
@@ -25,6 +25,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_request_date" />
         <command id="cmd_holds_edit_expire_time" />
         <command id="cmd_holds_edit_shelf_expire_time" />
         <command id="cmd_holds_activate" />
@@ -58,6 +59,7 @@
             <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.edit_request_date;" command="cmd_holds_edit_request_date" accesskey="&staff.circ.holds.edit_request_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;"/>
@@ -134,6 +136,7 @@
                     <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.edit_request_date;" command="cmd_holds_edit_request_date" accesskey="&staff.circ.holds.edit_request_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;"/>
-- 
2.11.0