From 48ddb6a6f5acd8aafe8806614b0123063021f7c0 Mon Sep 17 00:00:00 2001 From: Jason Stephenson Date: Thu, 30 Jun 2011 17:02:43 -0400 Subject: [PATCH] Support "chargeable loans" via SIP2. Pass FID_FEE_ACK to checkout message in MsgType.pm. Also return fee info when checkout fails, so patron can acknowledge the fee. Signed-off-by: Jason Stephenson Signed-off-by: Bill Erickson --- Sip/MsgType.pm | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Sip/MsgType.pm b/Sip/MsgType.pm index d1e3c2a..8aeb9f7 100644 --- a/Sip/MsgType.pm +++ b/Sip/MsgType.pm @@ -516,7 +516,7 @@ sub handle_checkout { my $inst = $ils->institution; my ($sc_renewal_policy, $no_block, $trans_date, $nb_due_date); my $fields; - my ($patron_id, $item_id, $status); + my ($patron_id, $item_id, $status, $fee_ack); my ($item, $patron); my $resp; @@ -526,6 +526,7 @@ sub handle_checkout { $patron_id = $fields->{(FID_PATRON_ID)}; $item_id = $fields->{(FID_ITEM_ID)}; + $fee_ack = $fields->{(FID_FEE_ACK)}; if ($no_block eq 'Y') { @@ -540,7 +541,7 @@ sub handle_checkout { } else { # Does the transaction date really matter for items that are # checkout out while the terminal is online? I'm guessing 'no' - $status = $ils->checkout($patron_id, $item_id, $sc_renewal_policy); + $status = $ils->checkout($patron_id, $item_id, $sc_renewal_policy, $fee_ack); } @@ -616,6 +617,13 @@ sub handle_checkout { $resp .= add_field(FID_VALID_PATRON_PWD, sipbool($patron->check_password($fields->{(FID_PATRON_PWD)}))); } + # For the patron to accept a fee in chargeable loans, we + # need to return fee information. + if ($status->fee_amount) { + $resp .= add_field(FID_FEE_AMT, $status->fee_amount); + $resp .= maybe_add(FID_CURRENCY, $status->sip_currency); + $resp .= maybe_add(FID_FEE_TYPE, $status->sip_fee_type); + } } } -- 2.11.0