[open-ils-commits] r16951 - in trunk/Open-ILS: src/perlmods/OpenILS/Application 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
Thu Jul 15 17:34:27 EDT 2010
Author: phasefx
Date: 2010-07-15 17:34:21 -0400 (Thu, 15 Jul 2010)
New Revision: 16951
Modified:
trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ.pm
trunk/Open-ILS/xul/staff_client/server/locale/en-US/patron.properties
trunk/Open-ILS/xul/staff_client/server/patron/items.js
Log:
Have open-ils.circ.circulation.due_date.update return the circ instead of the circ id so that modified rows in Items Out refresh correctly, and have Items Out -> Edit Due Date, -> Renew with Specific Date, and -> Mark Claimed Returned use the date/timepicker dialog
Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ.pm 2010-07-15 21:34:16 UTC (rev 16950)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ.pm 2010-07-15 21:34:21 UTC (rev 16951)
@@ -514,7 +514,7 @@
$e->update_action_circulation($circ) or return $e->die_event;
$e->commit;
- return $circ->id;
+ return $circ;
}
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 2010-07-15 21:34:16 UTC (rev 16950)
+++ trunk/Open-ILS/xul/staff_client/server/locale/en-US/patron.properties 2010-07-15 21:34:21 UTC (rev 16951)
@@ -301,19 +301,18 @@
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.description=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
staff.patron.items.items_edit.edit_due_date.plural=Edit Due Dates
+staff.patron.items.items_edit.edit_due_date.description=Due Date
staff.patron.items.items_edit.new_due_date=Enter a new due date for these items: %1$s
staff.patron.items.items_edit.dates_not_modified=The due dates were not likely modified.
staff.patron.items.items_edit.mark_barcode_lost=Mark barcode lost = %1$s
staff.patron.items.items_edit.item_barcode=Item Barcode %1$s\n%2$s
staff.patron.items.items_edit.items_not_marked_lost=The items were not likely marked lost.
-staff.patron.items.items_claimed_returned.date_cannot_be_in_future=Claims Returned Date cannot be in the future.
staff.patron.items.items_claimed_returned.claimed_returned=Claimed Returned
+staff.patron.items.items_claimed_returned.claimed_returned.description=Date Claimed
staff.patron.items.items_claimed_returned.enter_returned_date=Enter a claimed returned date for these items: %1$s
staff.patron.items.items_claimed_returned.not_marked_claimed_returned=The items were not likely marked Claimed Returned.
staff.patron.items.set_claim_returned_failure=Override set claimed returned failure?
Modified: trunk/Open-ILS/xul/staff_client/server/patron/items.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/patron/items.js 2010-07-15 21:34:16 UTC (rev 16950)
+++ trunk/Open-ILS/xul/staff_client/server/patron/items.js 2010-07-15 21:34:21 UTC (rev 16951)
@@ -320,42 +320,30 @@
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;
+ var msg = $("patronStrings").getFormattedString('staff.patron.items.items_edit.renew_with_date.prompt', [util.functional.map_list(retrieve_ids,function(o){return o.barcode;}).join(', ')]);
+ var desc = $("patronStrings").getString('staff.patron.items.items_edit.renew_with_date.description');
+
+ JSAN.use('util.window'); var win = new util.window();
+ var my_xulG = win.open(
+ urls.XUL_TIMESTAMP_DIALOG, 'edit_renew_due_date', 'chrome,resizable,modal',
+ {
+ 'title' : title,
+ 'description' : desc,
+ 'msg' : msg,
+ 'allow_unset' : false,
+ 'disallow_future_dates' : false,
+ 'disallow_past_dates' : false,
+ 'disallow_today' : false,
+ 'time_readonly' : false
}
+ );
+
+ if (my_xulG.complete) {
+ params.due_date = my_xulG.timestamp;
}
- params.due_date = due_date;
}
function gen_renew(bc,circ_id) {
@@ -412,26 +400,6 @@
try {
var retrieve_ids = ( which == 2 ? obj.retrieve_ids2 : obj.retrieve_ids );
if (!retrieve_ids || retrieve_ids.length == 0) return;
- 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('Due date needs to be after today.');
- }
- */
- return true;
- } catch(E) {
- alert(E);
- return false;
- }
- }
JSAN.use('util.functional');
var title = '';
@@ -441,28 +409,36 @@
title += $("patronStrings").getString('staff.patron.items.items_edit.edit_due_date.singular');
}
var value = 'YYYY-MM-DD';
- var text = $("patronStrings").getFormattedString('staff.patron.items.items_edit.new_due_date', [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);
- } else {
- invalid = false;
+ var msg = $("patronStrings").getFormattedString('staff.patron.items.items_edit.new_due_date', [util.functional.map_list(retrieve_ids,function(o){return o.barcode;}).join(', ')]);
+ var desc = $("patronStrings").getString('staff.patron.items.items_edit.edit_due_date.description');
+
+ JSAN.use('util.window'); var win = new util.window();
+ var my_xulG = win.open(
+ urls.XUL_TIMESTAMP_DIALOG, 'edit_due_date', 'chrome,resizable,modal',
+ {
+ 'title' : title,
+ 'description' : desc,
+ 'msg' : msg,
+ 'allow_unset' : false,
+ 'disallow_future_dates' : false,
+ 'disallow_past_dates' : false,
+ 'disallow_today' : false,
+ 'time_readonly' : false
}
- }
- if (due_date) {
+ );
+
+ if (my_xulG.complete) {
// XXX We need to append the time component from the original due date to the entered
// date here, if (circ interval % 1 day == 0)
+ // XXX I think the middle layer is doing this now
var circs = util.functional.map_list(retrieve_ids,function(o){return o.circ_id;});
for (var i = 0; i < circs.length; i++) {
- var robj = obj.network.simple_request('FM_CIRC_EDIT_DUE_DATE',[ses(),circs[i],due_date]);
+ var robj = obj.network.simple_request('FM_CIRC_EDIT_DUE_DATE',[ses(),circs[i],my_xulG.timestamp]);
if (typeof robj.ilsevent != 'undefined') { if (robj.ilsevent != 0) throw(robj); }
+ obj.list_circ_map[ circs[i] ].row.my.circ = robj;
+ obj.refresh(circs[i]);
}
}
- for (var i = 0; i < retrieve_ids.length; i++) {
- obj.refresh(retrieve_ids[i].circ_id);
- }
} catch(E) {
obj.error.standard_unexpected_error_alert($("patronStrings").getString('staff.patron.items.items_edit.dates_not_modified'),E);
}
@@ -498,48 +474,37 @@
try {
JSAN.use('util.date');
var retrieve_ids = ( which == 2 ? obj.retrieve_ids2 : obj.retrieve_ids );
- if (!retrieve_ids || retrieve_ids.length == 0) return;
- function check_date(value) {
- try {
- if (! util.date.check('YYYY-MM-DD',value) ) {
- throw($("patronStrings").getString('staff.patron.items.items_edit.invalid_date'));
- }
- if ( util.date.formatted_date(new Date(),'%F') == value) {
- return true;
- }
- if (! util.date.check_past('YYYY-MM-DD',value) ) {
- throw($("patronStrings").getString('staff.patron.items.items_claimed_returned.date_cannot_be_in_future'));
- }
- return true;
- } catch(E) {
- alert(E);
- return false;
- }
- }
JSAN.use('util.functional');
var title = $("patronStrings").getString('staff.patron.items.items_claimed_returned.claimed_returned');
var value = 'YYYY-MM-DD';
- var text = $("patronStrings").getFormattedString('staff.patron.items.items_claimed_returned.enter_returned_date',
+ var msg = $("patronStrings").getFormattedString('staff.patron.items.items_claimed_returned.enter_returned_date',
[util.functional.map_list(retrieve_ids,function(o){return o.barcode;}).join(', ')]);
- var backdate; var invalid = true;
- while(invalid) {
- backdate = window.prompt(text,value,title);
- if (backdate) {
- invalid = ! check_date(backdate);
- } else {
- invalid = false;
+ var desc = $("patronStrings").getString('staff.patron.items.items_claimed_returned.claimed_returned.description');
+
+ JSAN.use('util.window'); var win = new util.window();
+ var my_xulG = win.open(
+ urls.XUL_TIMESTAMP_DIALOG, 'edit_claimed_returned', 'chrome,resizable,modal',
+ {
+ 'title' : title,
+ 'description' : desc,
+ 'msg' : msg,
+ 'allow_unset' : false,
+ 'disallow_future_dates' : true,
+ 'disallow_past_dates' : false,
+ 'disallow_today' : false,
+ 'time_readonly' : false
}
- }
- //alert('backdate = ' + backdate);
- if (backdate) {
- backdate = util.date.formatted_date(backdate,'%{iso8601}');
+ );
+
+
+ if (my_xulG.complete) {
var barcodes = util.functional.map_list(retrieve_ids,function(o){return o.barcode;});
var do_not_move_these = {};
for (var i = 0; i < barcodes.length; i++) {
var robj = obj.network.simple_request(
'MARK_ITEM_CLAIM_RETURNED',
- [ ses(), { barcode: barcodes[i], backdate: backdate } ],
+ [ ses(), { barcode: barcodes[i], backdate: my_xulG.timestamp } ],
null,
{
'title' : $("patronStrings").getString('staff.patron.items.set_claim_returned_failure'),
More information about the open-ils-commits
mailing list