From 4e2b0943ffa07f18730ef05404b097424ecc2f88 Mon Sep 17 00:00:00 2001 From: phasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4> Date: Wed, 4 Nov 2009 19:32:28 +0000 Subject: [PATCH] gui for Edit Shelf Expire Time for holds 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 | 2 + .../server/locale/en-US/circ.properties | 4 ++ Open-ILS/xul/staff_client/server/patron/holds.js | 44 +++++++++++++++++++++- .../staff_client/server/patron/holds_overlay.xul | 3 ++ 4 files changed, 52 insertions(+), 1 deletion(-) diff --git a/Open-ILS/web/opac/locale/en-US/lang.dtd b/Open-ILS/web/opac/locale/en-US/lang.dtd index 5b678b6bb3..68792ccfdf 100644 --- a/Open-ILS/web/opac/locale/en-US/lang.dtd +++ b/Open-ILS/web/opac/locale/en-US/lang.dtd @@ -2043,6 +2043,8 @@ <!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"> 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 cf5f81aa22..f489bb87e2 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 @@ -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 diff --git a/Open-ILS/xul/staff_client/server/patron/holds.js b/Open-ILS/xul/staff_client/server/patron/holds.js index f5245ec633..b72b65ab9a 100644 --- a/Open-ILS/xul/staff_client/server/patron/holds.js +++ b/Open-ILS/xul/staff_client/server/patron/holds.js @@ -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'], 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 7571f108ce..7f175643a5 100644 --- a/Open-ILS/xul/staff_client/server/patron/holds_overlay.xul +++ b/Open-ILS/xul/staff_client/server/patron/holds_overlay.xul @@ -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;"/> @@ -130,6 +132,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;"/> -- 2.11.0