[open-ils-commits] r14716 - in trunk/Open-ILS: web/opac/locale/en-US xul/staff_client/server/locale/en-US xul/staff_client/server/patron (phasefx)
svn at svn.open-ils.org
svn at svn.open-ils.org
Sun Nov 1 22:07:39 EST 2009
Author: phasefx
Date: 2009-11-01 22:07:37 -0500 (Sun, 01 Nov 2009)
New Revision: 14716
Modified:
trunk/Open-ILS/web/opac/locale/en-US/lang.dtd
trunk/Open-ILS/xul/staff_client/server/locale/en-US/patron.properties
trunk/Open-ILS/xul/staff_client/server/patron/items.js
trunk/Open-ILS/xul/staff_client/server/patron/items_overlay.xul
Log:
FEATURE: Renew with Specific Due Date option for Items Out interface. DEV NOTES: Some refactoring. Would this style of commit message be useful for change logs? Some keywords like FEATURE or BUGFIX for stuff meant to be more widely read? Or alternately, we could use development branches for intermediate work/commits, and reserve trunk and the release branches for changelog worthy commits? I personally don't mind reviewing 'typo' and 'oops' changesets that fly by. :)
Modified: trunk/Open-ILS/web/opac/locale/en-US/lang.dtd
===================================================================
--- trunk/Open-ILS/web/opac/locale/en-US/lang.dtd 2009-11-02 02:11:42 UTC (rev 14715)
+++ trunk/Open-ILS/web/opac/locale/en-US/lang.dtd 2009-11-02 03:07:37 UTC (rev 14716)
@@ -2788,6 +2788,7 @@
<!ENTITY staff.patron.items_overlay.items_claimed_returned.label "Mark Claimed Returned">
<!ENTITY staff.patron.items_overlay.items_renew.label "Renew">
<!ENTITY staff.patron.items_overlay.items_renew_all.label "Renew All">
+<!ENTITY staff.patron.items_overlay.items_renew_with_date.label "Renew with Specific Due Date">
<!ENTITY staff.patron.items_overlay.items_checkin.label "Check In">
<!ENTITY staff.patron.items_overlay.add_billing.label "Add Billing">
<!ENTITY staff.patron.items_overlay.save_columns.label "Save Columns">
Modified: trunk/Open-ILS/xul/staff_client/server/locale/en-US/patron.properties
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/locale/en-US/patron.properties 2009-11-02 02:11:42 UTC (rev 14715)
+++ trunk/Open-ILS/xul/staff_client/server/locale/en-US/patron.properties 2009-11-02 03:07:37 UTC (rev 14716)
@@ -263,6 +263,9 @@
staff.patron.items.items_renew.err_in_renew_via_barcode=Error in renew_via_barcode callback\nRenew probably did not happen for barcode %1$s
staff.patron.items.items_renew.no_renew_for_barcode=Renew probably did not happen for barcode %1$s
staff.patron.items.items_renew.no_renew=Renew probably did not happen.
+staff.patron.items.items_edit.renew_with_date.title=Renew with Due Date
+staff.patron.items.items_edit.renew_with_date.prompt=Enter a new due date for these items to be renewed: %1$s
+staff.patron.items.items_edit.cancel_renew_with_date=Missing Due Date. Renewal canceled.
staff.patron.items.items_edit.invalid_date=Invalid Date
staff.patron.items.items_edit.need_later_date=Due date needs to be after today.
staff.patron.items.items_edit.edit_due_date.singular=Edit Due Date
Modified: trunk/Open-ILS/xul/staff_client/server/patron/items.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/patron/items.js 2009-11-02 02:11:42 UTC (rev 14715)
+++ trunk/Open-ILS/xul/staff_client/server/patron/items.js 2009-11-02 03:07:37 UTC (rev 14716)
@@ -8,6 +8,7 @@
JSAN.use('util.error'); this.error = new util.error();
JSAN.use('util.network'); this.network = new util.network();
JSAN.use('OpenILS.data'); this.data = new OpenILS.data(); this.data.init({'via':'stash'});
+ JSAN.use('util.sound'); this.sound = new util.sound();
}
patron.items.prototype = {
@@ -91,9 +92,11 @@
'cmd_items_print2' : [ ['command'], function() { obj.items_print(2); } ],
'cmd_items_export' : [ ['command'], function() { obj.items_export(1); } ],
'cmd_items_export2' : [ ['command'], function() { obj.items_export(2); } ],
- 'cmd_items_renew' : [ ['command'], function() { obj.items_renew(1); /* obj.retrieve();*/ } ],
- 'cmd_items_renew_all' : [ ['command'], function() { obj.items_renew_all(); } ],
- 'cmd_items_renew2' : [ ['command'], function() { obj.items_renew(2); /* obj.retrieve();*/ } ],
+ 'cmd_items_renew' : [ ['command'], function() { obj.items_renew({which_list:1}); } ],
+ 'cmd_items_renew_with_date' : [ ['command'], function() { obj.items_renew({which_list:1,skip_prompt:true,get_date:true}); } ],
+ 'cmd_items_renew_all' : [ ['command'], function() { obj.items_renew_all({which_list:1}); } ],
+ 'cmd_items_renew2' : [ ['command'], function() { obj.items_renew({which_list:2}); } ],
+ 'cmd_items_renew_with_date2' : [ ['command'], function() { obj.items_renew({which_list:2,skip_prompt:true,get_date:true}); } ],
'cmd_items_edit' : [ ['command'], function() { obj.items_edit(1); /*obj.retrieve();*/ } ],
'cmd_items_edit2' : [ ['command'], function() { obj.items_edit(2); /*obj.retrieve();*/ } ],
'cmd_items_mark_lost' : [ ['command'], function() { obj.items_mark_lost(1); /*obj.retrieve();*/ } ],
@@ -127,12 +130,14 @@
obj.controller.view.sel_patron2.setAttribute('disabled','true');
obj.controller.view.cmd_items_claimed_returned.setAttribute('disabled','true');
obj.controller.view.cmd_items_renew.setAttribute('disabled','true');
+ obj.controller.view.cmd_items_renew_with_date.setAttribute('disabled','true');
obj.controller.view.cmd_items_checkin.setAttribute('disabled','true');
obj.controller.view.cmd_items_edit.setAttribute('disabled','true');
obj.controller.view.cmd_items_mark_lost.setAttribute('disabled','true');
obj.controller.view.cmd_show_catalog.setAttribute('disabled','true');
obj.controller.view.cmd_items_claimed_returned2.setAttribute('disabled','true');
obj.controller.view.cmd_items_renew2.setAttribute('disabled','true');
+ obj.controller.view.cmd_items_renew_with_date2.setAttribute('disabled','true');
obj.controller.view.cmd_items_checkin2.setAttribute('disabled','true');
obj.controller.view.cmd_items_edit2.setAttribute('disabled','true');
obj.controller.view.cmd_items_mark_lost2.setAttribute('disabled','true');
@@ -223,8 +228,9 @@
}
},
- 'items_renew_all' : function() {
+ 'items_renew_all' : function(params) {
try {
+ if (!params) params = {};
var obj = this; var list = obj.list;
if (list.on_all_fleshed != null) {
var r = window.confirm($("patronStrings").getString('staff.patron.items.items_renew_all.list_is_busy'));
@@ -235,7 +241,9 @@
function flesh_callback() {
try {
obj.list.select_all();
- obj.items_renew(1,true);
+ params.skip_prompt = true;
+ if (!params.which_list) params.which_list = 1;
+ obj.items_renew(params);
setTimeout(function(){list.on_all_fleshed = null; /* obj.retrieve();*/ },0);
} catch(E) {
obj.error.standard_unexpected_error_alert($("patronStrings").getFormattedString('staff.patron.items.items_renew_all.items_not_renewed', ['2']),E);
@@ -248,14 +256,15 @@
}
},
- 'items_renew' : function(which,skip_prompt) {
+ 'items_renew' : function(params) {
var obj = this;
try{
+ if (!params) { params = {}; }
JSAN.use('circ.util');
- var retrieve_ids = ( which == 2 ? obj.retrieve_ids2 : obj.retrieve_ids );
+ var retrieve_ids = ( params.which_list == 2 ? obj.retrieve_ids2 : obj.retrieve_ids );
if (!retrieve_ids || retrieve_ids.length == 0) return;
JSAN.use('util.functional');
- if (!skip_prompt) {
+ if (!params.skip_prompt) {
var msg = '';
if(retrieve_ids.length > 1) {
msg += $("patronStrings").getFormattedString('staff.patron.items.items_renew.renew_item_plural',[util.functional.map_list( retrieve_ids, function(o){return o.barcode;}).join(', ')]);
@@ -268,6 +277,44 @@
var count = 0;
+ function check_date(value) {
+ JSAN.use('util.date');
+ try {
+ if (! util.date.check('YYYY-MM-DD',value) ) {
+ throw($("patronStrings").getString('staff.patron.items.items_edit.invalid_date'));
+ }
+ if (util.date.check_past('YYYY-MM-DD',value) ) {
+ throw($("patronStrings").getString('staff.patron.items.items_edit.need_later_date'));
+ }
+ if ( util.date.formatted_date(new Date(),'%F') == value) {
+ throw($("patronStrings").getString('staff.patron.items.items_edit.need_later_date'));
+ }
+ return true;
+ } catch(E) {
+ alert(E);
+ return false;
+ }
+ }
+
+ if (params.get_date) {
+ JSAN.use('util.functional');
+ var title = $("patronStrings").getString('staff.patron.items.items_edit.renew_with_date.title');
+ var value = 'YYYY-MM-DD';
+ var text = $("patronStrings").getFormattedString('staff.patron.items.items_edit.renew_with_date.prompt', [util.functional.map_list(retrieve_ids,function(o){return o.barcode;}).join(', ')]);
+ var due_date; var invalid = true;
+ while(invalid) {
+ due_date = window.prompt(text,value,title);
+ if (due_date) {
+ invalid = ! check_date(due_date);
+ if (invalid) obj.sound.circ_bad();
+ } else {
+ alert( $("patronStrings").getString('staff.patron.items.items_edit.cancel_renew_with_date') );
+ return;
+ }
+ }
+ params.due_date = due_date;
+ }
+
function gen_renew(bc,circ_id) {
var x = document.getElementById('renew_msgs');
if (x) {
@@ -275,7 +322,10 @@
l.setAttribute('value', $("patronStrings").getFormattedString('staff.patron.items.items_renew.renewing',[bc]));
x.appendChild(l);
}
- var renew = circ.util.renew_via_barcode( { 'barcode' : bc, 'patron' : obj.patron_id },
+ var p = { 'barcode' : bc, 'patron' : obj.patron_id };
+ if (params.due_date) p.due_date = params.due_date;
+ var renew = circ.util.renew_via_barcode(
+ p,
function(r) {
try {
if ( (typeof r[0].ilsevent != 'undefined' && r[0].ilsevent == 0) ) {
@@ -813,6 +863,7 @@
obj.controller.view.cmd_items_claimed_returned.setAttribute('disabled','false');
obj.controller.view.cmd_items_renew.setAttribute('disabled','false');
+ obj.controller.view.cmd_items_renew_with_date.setAttribute('disabled','false');
obj.controller.view.cmd_items_checkin.setAttribute('disabled','false');
obj.controller.view.cmd_items_edit.setAttribute('disabled','false');
obj.controller.view.cmd_items_mark_lost.setAttribute('disabled','false');
@@ -834,6 +885,7 @@
obj.controller.view.cmd_items_claimed_returned2.setAttribute('disabled','false');
obj.controller.view.cmd_items_renew2.setAttribute('disabled','false');
+ obj.controller.view.cmd_items_renew_with_date2.setAttribute('disabled','false');
obj.controller.view.cmd_items_checkin2.setAttribute('disabled','false');
obj.controller.view.cmd_items_edit2.setAttribute('disabled','false');
obj.controller.view.cmd_items_mark_lost2.setAttribute('disabled','false');
Modified: trunk/Open-ILS/xul/staff_client/server/patron/items_overlay.xul
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/patron/items_overlay.xul 2009-11-02 02:11:42 UTC (rev 14715)
+++ trunk/Open-ILS/xul/staff_client/server/patron/items_overlay.xul 2009-11-02 03:07:37 UTC (rev 14716)
@@ -17,6 +17,7 @@
<command id="cmd_items_export" />
<command id="cmd_items_renew" />
<command id="cmd_items_renew_all" />
+ <command id="cmd_items_renew_with_date" />
<command id="cmd_items_claimed_returned" />
<command id="cmd_items_checkin" />
<command id="cmd_items_edit" />
@@ -36,6 +37,7 @@
<command id="cmd_items_print2" />
<command id="cmd_items_export2" />
<command id="cmd_items_renew2" />
+ <command id="cmd_items_renew_with_date2" />
<command id="cmd_items_claimed_returned2" />
<command id="cmd_items_checkin2" />
<command id="cmd_items_edit2" />
@@ -61,6 +63,7 @@
<menuitem label="&staff.patron.items_overlay.items_claimed_returned.label;" command="cmd_items_claimed_returned" />
<menuitem label="&staff.patron.items_overlay.items_renew.label;" command="cmd_items_renew" />
<menuitem label="&staff.patron.items_overlay.items_renew_all.label;" command="cmd_items_renew_all" hidden="false"/>
+ <menuitem label="&staff.patron.items_overlay.items_renew_with_date.label;" command="cmd_items_renew_with_date" hidden="false"/>
<menuitem label="&staff.patron.items_overlay.items_checkin.label;" command="cmd_items_checkin" />
<menuitem label="&staff.patron.items_overlay.add_billing.label;" command="cmd_add_billing" />
<menuseparator />
@@ -77,6 +80,7 @@
<menuitem label="&staff.patron.items_overlay.items_mark_lost.label;" command="cmd_items_mark_lost2" />
<menuitem label="&staff.patron.items_overlay.items_claimed_returned.label;" command="cmd_items_claimed_returned2" />
<menuitem label="&staff.patron.items_overlay.items_renew.label;" command="cmd_items_renew2" />
+ <menuitem label="&staff.patron.items_overlay.items_renew_with_date.label;" command="cmd_items_renew_with_date2" />
<menuitem label="&staff.patron.items_overlay.items_checkin.label;" command="cmd_items_checkin2" />
<menuitem label="&staff.patron.items_overlay.add_billing.label;" command="cmd_add_billing2" />
<menuseparator />
@@ -131,6 +135,7 @@
<menuitem label="&staff.patron.items_overlay.items_claimed_returned.label;" command="cmd_items_claimed_returned" />
<menuitem label="&staff.patron.items_overlay.items_renew.label;" command="cmd_items_renew" />
<menuitem label="&staff.patron.items_overlay.items_renew_all.label;" command="cmd_items_renew_all" hidden="false"/>
+ <menuitem label="&staff.patron.items_overlay.items_renew_with_date.label;" command="cmd_items_renew_with_date" hidden="false"/>
<menuitem label="&staff.patron.items_overlay.items_checkin.label;" command="cmd_items_checkin" />
<menuitem label="&staff.patron.items_overlay.add_billing.label;" command="cmd_add_billing" />
<menuseparator />
@@ -155,6 +160,7 @@
<menuitem label="&staff.patron.items_overlay.items_mark_lost.label;" command="cmd_items_mark_lost2" />
<menuitem label="&staff.patron.items_overlay.items_claimed_returned.label;" command="cmd_items_claimed_returned2" />
<menuitem label="&staff.patron.items_overlay.items_renew.label;" command="cmd_items_renew2" />
+ <menuitem label="&staff.patron.items_overlay.items_renew_with_date.label;" command="cmd_items_renew_with_date2" hidden="false"/>
<menuitem label="&staff.patron.items_overlay.items_checkin.label;" command="cmd_items_checkin2" />
<menuitem label="&staff.patron.items_overlay.add_billing.label;" command="cmd_add_billing2" />
<menuseparator />
More information about the open-ils-commits
mailing list