work around a couple restrictions that the native stringbundle has
authorGalen Charlton <gmc@esilibrary.com>
Thu, 14 Feb 2013 23:52:53 +0000 (18:52 -0500)
committerGalen Charlton <gmc@esilibrary.com>
Thu, 14 Feb 2013 23:57:25 +0000 (18:57 -0500)
This patch fixes an issue where paying a fine would result
in the following error message in the staff client:

Error logging payment in bill.2js:[Exception… “Component returned failure code:0x80070057
(NS_ERROR_ILLEGAL_VALUE) [nsIStringBundle.formatStringFromName]” nsresult:”0x80070057
(NS_ERROR_ILLEGAL_VALUE)”  location: “JS frame::XStringBundle::getFormattedString::line33”
data:no]

The getFormattedString() method of the native XUL stringbundle
has a couple problems:

[1] There's an undocumented limit of 10 substitution parameters; if
    more than 10 are supplied, it throws an NS_ERROR_ILLEGAL_VALUE
    exception.
[2] It requires that *all* of the substitution parameters be
    listed in the format string; if you skip one, it throws (confusingly)
    an NS_ERROR_OUT_OF_MEMORY memory.

The two workarounds:

- arbitrarily drop three of the previous work_log variable for fine payments
  that used to be available
- include all of the positions in the format string, but use zero width
  for the ones we're not interested in including in the log message.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Open-ILS/xul/staff_client/chrome/locale/en-US/circ.properties
Open-ILS/xul/staff_client/server/patron/bill2.js

index 01ce638..9d71b7a 100644 (file)
@@ -432,12 +432,12 @@ staff.circ.work_log_checkin_attempt.reservation_shelf.message=%1$S attempted che
 staff.circ.work_log_checkin_attempt.cataloging.message=%1$S attempted checkin of %4$S, which is a pre-cat and was routed to Cataloging.  Route To = %5$S
 # 1 - Staff Username  2 - Patron Family  3 - Patron Barcode  4 - Item Barcode  5 - Route To text
 staff.circ.work_log_checkin_attempt.not_found.message=%1$S attempted checkin of %4$S, which was not found, and so was routed to Cataloging.  Route To = %5$S
-# 1 - Staff Username  2 - Patron Family  3 - Patron Barcode  4 - Original Balance  5 - Voided Balance  6 - Payment Received  7 - Payment Applied
-# 8 - Change Given  9 - Credit Given  10 - New Balance  11 - Payment Type  12 - Note  13 - API call result
-staff.circ.work_log_payment_attempt.success.message=%1$S received %6$S (%11$S) for %3$S (%2$S).
-# 1 - Staff Username  2 - Patron Family  3 - Patron Barcode  4 - Original Balance  5 - Voided Balance  6 - Payment Received  7 - Payment Applied
-# 8 - Change Given  9 - Credit Given  10 - New Balance  11 - Payment Type  12 - Note  13 - API call result
-staff.circ.work_log_payment_attempt.failure.message=%1$S attempted receipt of %6$S (%11$S) for %3$S (%2$S), which failed for this reason: %13$S
+# 1 - Staff Username  2 - Patron Family  3 - Patron Barcode  4 - Original Balance  5 - Voided Balance  6 - Payment Received
+# 7 - New Balance  8 - Payment Type  9 - Note  10 - API call result
+staff.circ.work_log_payment_attempt.success.message=%1$S received %6$S (%8$S) for %3$S (%2$S). %4$0.S %5$0.S %7$0.S %9$0.S %10$0.S
+# 1 - Staff Username  2 - Patron Family  3 - Patron Barcode  4 - Original Balance  5 - Voided Balance  6 - Payment Received
+# 7 - New Balance  8 - Payment Type  9 - Note  10 - API call result
+staff.circ.work_log_payment_attempt.failure.message=%1$S attempted receipt of %6$S (%8$S) for %3$S (%2$S), which failed for this reason: %10$S %4$0.S %5$0.S %7$0.S %9$0.S
 staff.circ.checkin.hold_capture=Hold Capture
 staff.circ.checkin.check_in.tab=Item Check In
 staff.circ.renew.tab.label=Renew Items
index 83bf51c..06b18f6 100644 (file)
@@ -930,13 +930,10 @@ function pay(payment_blob) {
                         g.previous_summary.original_balance, // 4 - Original Balance
                         g.previous_summary.voided_balance, // 5 - Voided Balance
                         g.previous_summary.payment_received, // 6 - Payment Received
-                        g.previous_summary.payment_applied, // 7 - Payment Applied
-                        g.previous_summary.change_given, // 8 - Change Given
-                        g.previous_summary.credit_given, // 9 - Credit Given
-                        g.previous_summary.new_balance, // 10 - New Balance
-                        g.previous_summary.payment_type, // 11 - Payment Type
-                        g.previous_summary.note, // 12 - Note
-                        robj && robj.textcode ? robj.textcode : robj // 13 - API call result
+                        g.previous_summary.new_balance, // 7 - New Balance
+                        g.previous_summary.payment_type, // 8 - Payment Type
+                        g.previous_summary.note, // 9 - Note
+                        robj && robj.textcode ? robj.textcode : robj // 10 - API call result
                     ]
                 ), {
                     'au_id' : g.patron.id(),