From 2529e3b8ccc9d94e14b29a5e8b64c3d7c4f5f467 Mon Sep 17 00:00:00 2001 From: senator Date: Fri, 20 Aug 2010 18:53:12 +0000 Subject: [PATCH] Booking: more progress on the forward-port from rel_1_6 This completes the merging of changes from r15878 except for those to Circulate.pm, which are more involved and call for more untangling. More to come soon. git-svn-id: svn://svn.open-ils.org/ILS/trunk@17291 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../xul/staff_client/server/circ/checkout.js | 6 +- Open-ILS/xul/staff_client/server/circ/util.js | 80 +++++++++++++++++++ .../server/locale/en-US/circ.properties | 13 +++ .../xul/staff_client/server/patron/display.js | 6 +- .../server/patron/display_horiz_overlay.xul | 2 +- .../server/patron/display_overlay.xul | 2 +- .../xul/staff_client/server/patron/summary.js | 1 + .../staff_client/server/patron/summary.xul | 1 + 8 files changed, 105 insertions(+), 6 deletions(-) diff --git a/Open-ILS/xul/staff_client/server/circ/checkout.js b/Open-ILS/xul/staff_client/server/circ/checkout.js index 366017a818..d2706eff9a 100644 --- a/Open-ILS/xul/staff_client/server/circ/checkout.js +++ b/Open-ILS/xul/staff_client/server/circ/checkout.js @@ -639,7 +639,11 @@ circ.checkout.prototype = { return document.getElementById('circStrings').getString('staff.circ.checkout.override.item_rental_fee_required.warning'); }, '7004' : function(r) { - return r.payload.status().name(); + try { + return r.payload.status().name(); + } catch (E) { + return "copy not available: (Unexpected error: payload not available)"; // XXX + } }, '7010' : function(r) { return r.payload; diff --git a/Open-ILS/xul/staff_client/server/circ/util.js b/Open-ILS/xul/staff_client/server/circ/util.js index b31c5235fa..53c9c10c67 100644 --- a/Open-ILS/xul/staff_client/server/circ/util.js +++ b/Open-ILS/xul/staff_client/server/circ/util.js @@ -2692,6 +2692,86 @@ circ.util.checkin_via_barcode2 = function(session,params,backdate,auto_print,che document.getElementById('no_change_label').setAttribute('hidden','false'); } break; + case 15: // ON_RESERVATION_SHELF + check.route_to = 'RESERVATION SHELF'; + if (check.payload.reservation) { + if (check.payload.reservation.pickup_lib() != data.list.au[0].ws_ou()) { + msg += document.getElementById('commonStrings').getString('common.error'); + msg += '\nFIXME: '; + msg += document.getElementById('circStrings').getString('staff.circ.utils.route_item_error'); + msg += '\n'; + } else { + msg += document.getElementById('circStrings').getFormattedString('staff.circ.utils.route_to.msg', [check.route_to]); + msg += '.\n'; + } + } else { + msg += document.getElementById('commonStrings').getString('common.error'); + msg += '\nFIXME: '; + msg += document.getElementById('circStrings').getString('staff.circ.utils.reservation_status_error'); + msg += '\n'; + } + JSAN.use('util.date'); + if (check.payload.reservation) { + JSAN.use('patron.util'); + msg += '\n'; + msg += document.getElementById('circStrings').getFormattedString('staff.circ.utils.payload.reservation.barcode', [check.payload.copy.barcode()]); + msg += '\n'; + var payload_title = (check.payload.record ? check.payload.record.title() : check.payload.copy.dummy_title() ); + msg += document.getElementById('circStrings').getFormattedString('staff.circ.utils.payload.reservation.title', [payload_title]); + msg += '\n'; + var au_obj = + typeof(check.payload.reservation.usr().card) == "function" ? + check.payload.reservation.usr() : + patron.util.retrieve_fleshed_au_via_id(session, check.payload.reservation.usr()); + msg += '\n'; + if (au_obj.alias()) { + msg += document.getElementById('circStrings').getFormattedString('staff.circ.utils.payload.reservation.patron_alias', [au_obj.alias()]); + } else { + msg += document.getElementById('circStrings').getFormattedString('staff.circ.utils.payload.reservation.patron', [au_obj.family_name() || "", au_obj.first_given_name() || "", au_obj.second_given_name() || ""]); + } + msg += '\n'; + msg += document.getElementById('circStrings').getFormattedString('staff.circ.utils.payload.reservation.barcode', [au_obj.card().barcode()]); + msg += '\n'; + msg += document.getElementById('circStrings').getFormattedString('staff.circ.utils.payload.reservation.request_date', [util.date.formatted_date(check.payload.reservation.request_time(),'%F %H:%M')]); + msg += '\n'; + + msg += document.getElementById('circStrings').getFormattedString('staff.circ.utils.payload.reservation.start_date', [util.date.formatted_date(check.payload.reservation.start_time(),'%F %H:%M')]); + msg += '\n'; + } + var rv = 0; + msg += document.getElementById('circStrings').getFormattedString('staff.circ.utils.payload.reservation.slip_date', [util.date.formatted_date(new Date(),'%F')]); + msg += '\n'; + if (!auto_print) { + rv = error.yns_alert_formatted( + msg, + document.getElementById('circStrings').getString('staff.circ.utils.reservation_slip'), + document.getElementById('circStrings').getString('staff.circ.utils.reservation_slip.print.yes'), + document.getElementById('circStrings').getString('staff.circ.utils.reservation_slip.print.no'), + null, + document.getElementById('circStrings').getString('staff.circ.confirm.msg'), + '/xul/server/skin/media/images/turtle.gif' + ); + } + if (rv == 0) { + try { + JSAN.use('util.print'); var print = new util.print(); + msg = msg.replace(/&/g, '&').replace(//g, '>').replace(/\n/g,'
'); + print.simple( msg , { 'no_prompt' : true, 'content_type' : 'text/html' } ); + } catch(E) { + var err_msg = document.getElementById('commonStrings').getString('common.error'); + err_msg += '\nFIXME: ' + E + '\n'; + dump(err_msg); + alert(err_msg); + } + } + msg = ''; + if (document.getElementById('no_change_label')) { + var m = document.getElementById('no_change_label').getAttribute('value'); + m += document.getElementById('circStrings').getFormattedString('staff.circ.utils.reservation_capture', [params.barcode]); + document.getElementById('no_change_label').setAttribute('value', m); + document.getElementById('no_change_label').setAttribute('hidden','false'); + } + break; default: check.what_happened = 'error'; msg += document.getElementById('commonStrings').getString('common.error'); 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 5a84b422bb..f972b67ae9 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 @@ -341,6 +341,7 @@ staff.circ.utils.item_not_cataloged=ITEM_NOT_CATALOGED event but copy status is staff.circ.utils.route_to.msg=This item needs to be routed to %1$s staff.circ.utils.route_item_error=We should have received a ROUTE_ITEM staff.circ.utils.route_item_status_error=status of Holds Shelf, but no actual hold found. +staff.circ.utils.reservation_status_error=status of Reservation Shelf, but no actual hold found. staff.circ.utils.payload.hold.barcode=Barcode: %1$s staff.circ.utils.payload.hold.title=Title: %1$s staff.circ.utils.ahr_mint_condition=Copy Quality @@ -360,6 +361,17 @@ staff.circ.utils.payload.hold.notes.patron_note=Patron Note: %1$s : %2$s staff.circ.utils.hold_slip=Hold Slip staff.circ.utils.hold_slip.print.yes=Print staff.circ.utils.hold_slip.print.no=Do Not Print +staff.circ.utils.payload.reservation.barcode=Barcode: %1$s +staff.circ.utils.payload.reservation.title=Title: %1$s +# Hold for patron familyName, firstName secondName +staff.circ.utils.payload.reservation.patron=Reservation for patron %1$s, %2$s %3$s +staff.circ.utils.payload.reservation.patron_alias=Reservation for patron %1$s +staff.circ.utils.payload.reservation.request_date=Request Date: %1$s +staff.circ.utils.payload.reservation.start_date=Start Date: %1$s +staff.circ.utils.payload.reservation.slip_date=Slip Date: %1$s +staff.circ.utils.reservation_slip=Reservation Slip +staff.circ.utils.reservation_slip.print.yes=Print +staff.circ.utils.reservation_slip.print.no=Do Not Print staff.circ.utils.transit_slip=Transit Slip staff.circ.utils.transit_slip.print.yes=Print staff.circ.utils.transit_slip.print.no=Do Not Print @@ -367,6 +379,7 @@ staff.circ.utils.hold_capture_delayed.description=This item could fulfill a hold staff.circ.utils.hold_capture_delayed.titlebar=Hold Capture Delayed staff.circ.utils.hold_capture_delayed.prompt_for_nocapture=Do Not Capture staff.circ.utils.hold_capture_delayed.prompt_for_capture=Capture +staff.circ.utils.reservation_capture=%1$s has been captured for a reservation. staff.circ.utils.capture=%1$s has been captured for a hold. staff.circ.utils.needs_cataloging=%1$s needs to be cataloged. staff.circ.utils.copy_status.error=FIXME -- this case "%1$s" is unhandled. diff --git a/Open-ILS/xul/staff_client/server/patron/display.js b/Open-ILS/xul/staff_client/server/patron/display.js index 3aa8f41cf8..a3c305a624 100644 --- a/Open-ILS/xul/staff_client/server/patron/display.js +++ b/Open-ILS/xul/staff_client/server/patron/display.js @@ -390,7 +390,7 @@ patron.display.prototype = { xulG.new_tab( "/eg/booking/reservation", { - "tab_name": offlineStrings.getString( + "tab_name": $("offlineStrings").getString( "menu.cmd_booking_reservation.tab" ), "browser": false @@ -411,7 +411,7 @@ patron.display.prototype = { xulG.new_tab( "/eg/booking/pickup", { - "tab_name": offlineStrings.getString( + "tab_name": $("offlineStrings").getString( "menu.cmd_booking_reservation_pickup.tab" ), "browser": false @@ -432,7 +432,7 @@ patron.display.prototype = { xulG.new_tab( "/eg/booking/return", { - "tab_name": offlineStrings.getString( + "tab_name": $("offlineStrings").getString( "menu.cmd_booking_reservation_return.tab" ), "browser": false diff --git a/Open-ILS/xul/staff_client/server/patron/display_horiz_overlay.xul b/Open-ILS/xul/staff_client/server/patron/display_horiz_overlay.xul index 358701fbe9..5feb7197ca 100644 --- a/Open-ILS/xul/staff_client/server/patron/display_horiz_overlay.xul +++ b/Open-ILS/xul/staff_client/server/patron/display_horiz_overlay.xul @@ -94,7 +94,7 @@ - + diff --git a/Open-ILS/xul/staff_client/server/patron/display_overlay.xul b/Open-ILS/xul/staff_client/server/patron/display_overlay.xul index e7b6a1c447..3be2d9f23c 100644 --- a/Open-ILS/xul/staff_client/server/patron/display_overlay.xul +++ b/Open-ILS/xul/staff_client/server/patron/display_overlay.xul @@ -94,7 +94,7 @@ - + diff --git a/Open-ILS/xul/staff_client/server/patron/summary.js b/Open-ILS/xul/staff_client/server/patron/summary.js index df6a166a2b..571a97ff5e 100644 --- a/Open-ILS/xul/staff_client/server/patron/summary.js +++ b/Open-ILS/xul/staff_client/server/patron/summary.js @@ -2,6 +2,7 @@ dump('entering patron.summary.js\n'); function $(id) { return document.getElementById(id); } var patronStrings = $('patronStrings'); +var offlineStrings = $('offlineStrings'); if (typeof patron == 'undefined') patron = {}; patron.summary = function (params) { diff --git a/Open-ILS/xul/staff_client/server/patron/summary.xul b/Open-ILS/xul/staff_client/server/patron/summary.xul index b80e4afb5f..290d57edc4 100644 --- a/Open-ILS/xul/staff_client/server/patron/summary.xul +++ b/Open-ILS/xul/staff_client/server/patron/summary.xul @@ -141,6 +141,7 @@ + -- 2.43.2