{CF => $details->{hold_queue_length}},
{CK => $details->{media_type}},
{CM => $details->{hold_pickup_date}},
+ {CR => $details->{collection_code}},
+ {CS => $details->{call_number}},
{CT => $details->{destination_loc}},
{CY => $details->{hold_patron_barcode}},
- $SC->stat_cat_sip_fields($details->{item})
+ $SC->asset_stat_cat_sip_fields($details->{item})
]
};
}
{BL => $SC->sipbool(1)}, # valid patron
{BV => $details->{balance_owed}}, # fee amount
{CQ => $SC->sipbool($details->{valid_patron_password})},
- $SC->stat_cat_sip_fields($patron),
+ $SC->actor_stat_cat_sip_fields($patron),
]
};
return_date => $return_date
);
- my $screen_msg = $checkin_details->{screen_msg};
my $magnetic = $item_details->{magnetic_media};
- my $hold_bc = $checkin_details->{hold_patron_barcode};
- my $hold_name = $checkin_details->{hold_patron_name};
- my $dest_loc = $checkin_details->{destination_loc};
return {
code => '10',
{AO => $config->{institution}},
{AP => $checkin_details->{current_loc}},
{AQ => $checkin_details->{permanent_loc}},
+ {BF => $checkin_details->{hold_patron_phone}},
{BG => $item_details->{owning_loc}},
{BT => $item_details->{fee_type}},
{CI => 0}, # security inhibit
{CK => $item_details->{media_type}},
+ {CR => $item_details->{collection_code}},
+ {CS => $item_details->{call_number}},
{CV => $checkin_details->{alert_type}},
- $screen_msg ? {AF => $screen_msg} : (),
- $dest_loc ? {CT => $dest_loc} : (),
- $hold_bc ? {CY => $hold_bc} : (),
- $hold_name ? {DA => $hold_name} : ()
+ {AF => $checkin_details->{screen_msg}},
+ {CT => $checkin_details->{destination_loc}},
+ {CY => $checkin_details->{hold_patron_barcode}},
+ {DA => $checkin_details->{hold_patron_name}},
]
};
}
$details->{hold_patron_barcode} = $card->barcode;
}
+ $details->{hold_patron_phone} =
+ $holder->day_phone || $holder->evening_phone || $holder->other_phone;
+
if (ref $hold->pickup_lib) {
$pickup_lib_id = $hold->pickup_lib->id;
$pickup_lib_sn = $hold->pickup_lib->shortname;
);
}
-# $source is either an actor.usr or an asset.copy.
+sub format_stat_cat_sip_field {
+ my ($field, $value, $format) = @_;
+
+ if ($format) {
+
+ if ($format =~ /^\|(.*)\|$/) { # Is format a regex?
+
+ if ($value =~ /($1)/) {
+ # Regex has matched.
+
+ if (defined $2) {
+ # We have an embedded capture group. Use it.
+ $value = $2;
+ } else {
+ # No embedded capture group
+ $value = $1; # Use our outer one
+ }
+ } else {
+ # No match
+ # Empty string. Will be checked for below.
+ $value = '';
+ }
+ } else { # Not a regex
+
+ # Try sprintf match (looking for a %s, if any)
+ $value = sprintf($format, $value);
+ }
+ }
+
+ return length($value) > 0 ? ({$field => $value}) : ();
+}
+
# Returns a list of extra fields.
-sub stat_cat_sip_fields {
- my ($class, $source) = @_;
+sub actor_stat_cat_sip_fields {
+ my ($class, $patron) = @_;
my @extras;
- for my $entry_map (@{$source->stat_cat_entries}) {
+ for my $entry_map (@{$patron->stat_cat_entries}) {
my $stat_cat = $entry_map->stat_cat;
next unless $stat_cat->sip_field;
my $value = $entry_map->stat_cat_entry;
my $format = $stat_cat->sip_format;
- if ($format) {
-
- if ($format =~ /^\|(.*)\|$/) { # Is format a regex?
+ push(@extras,
+ format_stat_cat_sip_field($stat_cat->sip_field, $value, $format));
+ }
- if ($value =~ /($1)/) {
- # Regex has matched.
+ return @extras;
+}
- if (defined $2) {
- # We have an embedded capture group. Use it.
- $value = $2;
- } else {
- # No embedded capture group
- $value = $1; # Use our outer one
- }
- } else {
- # No match
- # Empty string. Will be checked for below.
- $value = '';
- }
- } else { # Not a regex
+# Returns a list of extra fields.
+sub asset_stat_cat_sip_fields {
+ my ($class, $item) = @_;
+ my @extras;
- # Try sprintf match (looking for a %s, if any)
- $value = sprintf($format, $value);
- }
- }
+ for my $entry_map (@{$item->stat_cat_entry_copy_maps}) {
+ my $stat_cat = $entry_map->stat_cat;
+ next unless $stat_cat->sip_field;
- next unless length($value) > 0; # No value = no export
+ my $value = $entry_map->stat_cat_entry->value;
+ my $format = $stat_cat->sip_format;
- push(@extras, {$stat_cat->sip_field => $value});
+ push(@extras,
+ format_stat_cat_sip_field($stat_cat->sip_field, $value, $format));
}
return @extras;
my $details = {
item => $item,
+ call_number => $item->call_number->label,
security_marker => '02', # matches SIP/Item.pm
owning_loc => $item->call_number->owning_lib->shortname,
current_loc => $item->circ_lib->shortname,
destination_loc => $item->circ_lib->shortname # maybe replaced below
};
+ # use the non-translated version of the copy location as the
+ # collection code, since it may be used for additional routing
+ # purposes by the SIP client. Config option?
+ $details->{collection_code} = $e->retrieve_asset_copy_location(
+ [$item->location, {no_i18n => 1}])->name;
+
$details->{circ} = $e->search_action_circulation([{
target_copy => $item->id,
checkin_time => undef,