$password_rc = $patron->check_password($patron_pwd);
}
- $resp .= patron_status_string($patron);
+ $resp .= patron_status_string( $patron, $server );
$resp .= $lang . timestamp();
if ( defined $server->{account}->{ae_field_template} ) {
$resp .= add_field( FID_PERSONAL_NAME, $patron->format( $server->{account}->{ae_field_template}, $server ) );
# 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, $fee_ack );
+ $status = $ils->checkout( $patron_id, $item_id, $sc_renewal_policy, $fee_ack, $account );
}
$item = $status->item;
}
}
+ $resp .= $item->build_additional_item_fields_string( $server ) if $item;
+
if ( $protocol_version >= 2 ) {
# Financials : return irrespective of ok status
siplog( "LOG_WARNING", "received no-block checkin from terminal '%s'", $account->{id} );
$status = $ils->checkin_no_block( $item_id, $trans_date, $return_date, $item_props, $cancel );
} else {
- $status = $ils->checkin( $item_id, $trans_date, $return_date, $my_branch, $item_props, $cancel, $account->{checked_in_ok}, $account->{cv_triggers_alert} );
+ $status = $ils->checkin( $item_id, $trans_date, $return_date, $my_branch, $item_props, $cancel, $account );
}
$patron = $status->patron;
if ($item) {
$resp .= add_field( FID_PERM_LOCN, $item->permanent_location, $server );
$resp .= maybe_add( FID_TITLE_ID, $item->title_id, $server );
+ $resp .= $item->build_additional_item_fields_string( $server );
}
if ( $protocol_version >= 2 ) {
$resp .= add_field( FID_PATRON_ID, $patron->id, $server );
}
if ($item) {
-$resp .= maybe_add( FID_MEDIA_TYPE, $item->sip_media_type, $server );
-$resp .= maybe_add( FID_ITEM_PROPS, $item->sip_item_properties, $server );
-$resp .= maybe_add( FID_COLLECTION_CODE, $item->collection_code, $server );
-$resp .= maybe_add( FID_CALL_NUMBER, $item->call_number, $server );
-$resp .= maybe_add( FID_HOLD_PATRON_ID, $item->hold_patron_bcode, $server );
-$resp .= add_field( FID_DESTINATION_LOCATION, $item->destination_loc, $server ) if ( $item->destination_loc || $server->{account}->{ct_always_send} );
-$resp .= maybe_add( FID_HOLD_PATRON_NAME, $item->hold_patron_name( $server->{account}->{da_field_template} ), $server );
+ $resp .= maybe_add( FID_MEDIA_TYPE, $item->sip_media_type, $server );
+ $resp .= maybe_add( FID_ITEM_PROPS, $item->sip_item_properties, $server );
+ $resp .= maybe_add( FID_CALL_NUMBER, $item->call_number, $server );
+ $resp .= maybe_add( FID_HOLD_PATRON_ID, $item->hold_patron_bcode, $server );
+ $resp .= add_field( FID_DESTINATION_LOCATION, $item->destination_loc, $server ) if ( $item->destination_loc || $server->{account}->{ct_always_send} );
+ $resp .= maybe_add( FID_HOLD_PATRON_NAME, $item->hold_patron_name( $server->{account}->{da_field_template} ), $server );
+
+ if ( my $CR = $server->{account}->{cr_item_field} ) {
+ $resp .= maybe_add( FID_COLLECTION_CODE, $item->{$CR}, $server );
+ } else {
+ $resp .= maybe_add( FID_COLLECTION_CODE, $item->collection_code, $server );
+ }
if ( $status->hold and $status->hold->{branchcode} ne $item->destination_loc ) {
warn 'SIP hold mismatch: $status->hold->{branchcode}=' . $status->hold->{branchcode} . '; $item->destination_loc=' . $item->destination_loc;
sub summary_info {
my ( $ils, $patron, $summary, $start, $end, $server ) = @_;
my $resp = '';
- my $summary_type;
#
# Map from offsets in the "summary" field of the Patron Information
{ func => $patron->can("unavail_holds"), fid => FID_UNAVAILABLE_HOLD_ITEMS },
);
- if ( ( $summary_type = index( $summary, 'Y' ) ) == -1 ) {
- return ''; # No detailed information required
- }
+ my $summary_type = index( $summary, 'Y' );
+ return q{} if $summary_type == -1; # No detailed information required.
+ return q{} if $summary_type > 5; # Positions 6-9 are not defined in the sip spec,
+ # and we have no extensions to handle them.
siplog( "LOG_DEBUG", "Summary_info: index == '%d', field '%s'", $summary_type, $summary_map[$summary_type]->{fid} );
$resp = (PATRON_INFO_RESP);
if ($patron) {
$patron->update_lastseen();
- $resp .= patron_status_string($patron);
+ $resp .= patron_status_string( $patron, $server );
$resp .= ( defined($lang) and length($lang) == 3 ) ? $lang : $patron->language;
$resp .= timestamp();
$resp .= maybe_add( FID_CURRENT_LOCN, $item->current_location, $server );
$resp .= maybe_add( FID_ITEM_PROPS, $item->sip_item_properties, $server );
+ if ( my $CR = $server->{account}->{cr_item_field} ) {
+ $resp .= maybe_add( FID_COLLECTION_CODE, $item->{$CR}, $server );
+ } else {
+ $resp .= maybe_add( FID_COLLECTION_CODE, $item->collection_code, $server );
+ }
+
if ( ( $i = $item->fee ) != 0 ) {
$resp .= add_field( FID_CURRENCY, $item->fee_currency, $server );
$resp .= add_field( FID_FEE_AMT, $i, $server );
$resp .= maybe_add( FID_SCREEN_MSG, $item->screen_msg, $server );
$resp .= maybe_add( FID_PRINT_LINE, $item->print_line, $server );
+
+ $resp .= $item->build_additional_item_fields_string( $server );
}
$self->write_msg( $resp, undef, $server->{account}->{terminator}, $server->{account}->{encoding} );
# Don't enable the patron if there was an invalid password
$status = $patron->enable;
}
- $resp .= patron_status_string($patron);
+ $resp .= patron_status_string( $patron, $server );
$resp .= $patron->language . timestamp();
$resp .= add_field( FID_PATRON_ID, $patron->id, $server );
#
sub patron_status_string {
my $patron = shift;
+ my $server = shift;
+
my $patron_status;
siplog( "LOG_DEBUG", "patron_status_string: %s charge_ok: %s", $patron->id, $patron->charge_ok );
denied( $patron->hold_ok ),
boolspace( $patron->card_lost ),
boolspace( $patron->too_many_charged ),
- boolspace( $patron->too_many_overdue ),
+ $server->{account}->{overdues_block_checkout} ? boolspace( $patron->too_many_overdue ) : q{ },
boolspace( $patron->too_many_renewal ),
boolspace( $patron->too_many_claim_return ),
boolspace( $patron->too_many_lost ),