bug 3435: SIP2 - 3M extension for SmartChute checkin.
Implement the optional fields: CR CS CT CV CY and DA. Also silenced some outstanding debugging print statements. Consolidated similar accesseor subs in Patron.pm to use x_items. Adjust SIP tests to specify correct AP (location). Add a 3rd item to SIPtext.pm for later use. Note CT (destination) is currently populated with destination branch code. We can adjust that to be destination branch name, or some combination in a subsequent patch if necessary. This work was sponsored by the Northeast Kansas Library system. Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
This commit is contained in:
parent
51e8fc2cb6
commit
d24d147831
|
|
@ -82,8 +82,8 @@ sub supports {
|
|||
sub check_inst_id {
|
||||
my ($self, $id, $whence) = @_;
|
||||
if ($id ne $self->{institution}->{id}) {
|
||||
syslog("LOG_WARNING", "%s: received institution '%s', expected '%s'",
|
||||
$whence, $id, $self->{institution}->{id});
|
||||
syslog("LOG_WARNING", "%s: received institution '%s', expected '%s'", $whence, $id, $self->{institution}->{id});
|
||||
# Just an FYI check, we don't expect the user to change location from that in SIPconfig.xml
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -396,8 +396,12 @@ sub renew {
|
|||
my $j = 0;
|
||||
my $count = scalar @{$patron->{items}};
|
||||
foreach my $i (@{$patron->{items}}) {
|
||||
syslog("LOG_DEBUG", "checking item %s of %s: $item_id vs. %s", ++$j, $count, $i);
|
||||
if ($i eq $item_id) {
|
||||
unless (defined $i->{barcode}) { # FIXME: using data instead of objects may violate the abstraction layer
|
||||
syslog("LOG_ERR", "No barcode for item %s of %s: $item_id", $j+1, $count);
|
||||
next;
|
||||
}
|
||||
syslog("LOG_DEBUG", "checking item %s of %s: $item_id vs. %s", ++$j, $count, $i->{barcode});
|
||||
if ($i->{barcode} eq $item_id) {
|
||||
# We have it checked out
|
||||
$item = new ILS::Item $item_id;
|
||||
last;
|
||||
|
|
@ -408,26 +412,19 @@ sub renew {
|
|||
$trans->item($item);
|
||||
|
||||
if (!defined($item)) {
|
||||
# It's not checked out to $patron_id
|
||||
$trans->screen_msg("Item not checked out to " . $patron->name);
|
||||
$trans->screen_msg("Item not checked out to " . $patron->name); # not checked out to $patron_id
|
||||
$trans->ok(0);
|
||||
} elsif (!$item->available($patron_id)) {
|
||||
$trans->screen_msg("Item unavailable due to outstanding holds");
|
||||
$trans->ok(0);
|
||||
} else {
|
||||
$trans->renewal_ok(1);
|
||||
$trans->desensitize(0); # It's already checked out
|
||||
$trans->do_renew();
|
||||
syslog("LOG_DEBUG", "done renew (%s): %s renews %s", $trans->renewal_ok(1),$patron_id,$item_id);
|
||||
syslog("LOG_DEBUG", "done renew (ok:%s): %s renews %s", $trans->renewal_ok, $patron_id, $item_id);
|
||||
|
||||
# if ($no_block eq 'Y') {
|
||||
# $item->{due_date} = $nb_due_date;
|
||||
# } else {
|
||||
# $item->{due_date} = time + (14*24*60*60); # two weeks
|
||||
# }
|
||||
# if ($item_props) {
|
||||
# $item->{sip_item_properties} = $item_props;
|
||||
# }
|
||||
# $trans->ok(1);
|
||||
# return $trans;
|
||||
# $item->{due_date} = $nb_due_date if $no_block eq 'Y';
|
||||
# $item->{sip_item_properties} = $item_props if $item_props;
|
||||
}
|
||||
|
||||
return $trans;
|
||||
|
|
@ -442,11 +439,9 @@ sub renew_all {
|
|||
|
||||
$trans->patron($patron = new ILS::Patron $patron_id);
|
||||
if (defined $patron) {
|
||||
syslog("LOG_DEBUG", "ILS::renew_all: patron '%s': renew_ok: %s",
|
||||
$patron->name, $patron->renew_ok);
|
||||
syslog("LOG_DEBUG", "ILS::renew_all: patron '%s': renew_ok: %s", $patron->name, $patron->renew_ok);
|
||||
} else {
|
||||
syslog("LOG_DEBUG", "ILS::renew_all: Invalid patron id: '%s'",
|
||||
$patron_id);
|
||||
syslog("LOG_DEBUG", "ILS::renew_all: Invalid patron id: '%s'", $patron_id);
|
||||
}
|
||||
|
||||
if (!defined($patron)) {
|
||||
|
|
|
|||
|
|
@ -138,16 +138,19 @@ my %fields = (
|
|||
|
||||
sub next_hold {
|
||||
my $self = shift or return;
|
||||
foreach (@$self->{hold_shelf}) { # If this item was taken from the hold shelf, then that reserve still governs
|
||||
# use Data::Dumper; warn "next_hold() hold_shelf: " . Dumper($self->{hold_shelf}); warn "next_hold() pending_queue: " . $self->{pending_queue};
|
||||
foreach (@{$self->hold_shelf}) { # If this item was taken from the hold shelf, then that reserve still governs
|
||||
next unless ($_->{itemnumber} and $_->{itemnumber} == $self->{itemnumber});
|
||||
return $_;
|
||||
}
|
||||
if (scalar @$self->{pending_queue}) { # Otherwise, if there is at least one hold, the first (best priority) gets it
|
||||
if (scalar @{$self->{pending_queue}}) { # Otherwise, if there is at least one hold, the first (best priority) gets it
|
||||
return $self->{pending_queue}->[0];
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
# hold_patron_id is NOT the barcode. It's the borrowernumber.
|
||||
# That's because the reserving patron may not have a barcode, or may be from an different system entirely (ILL)!
|
||||
sub hold_patron_id {
|
||||
my $self = shift or return;
|
||||
my $hold = $self->next_hold() or return;
|
||||
|
|
@ -162,11 +165,11 @@ sub hold_patron_name {
|
|||
syslog("LOG_ERR", "While checking hold, GetMember failed for borrowernumber '$borrowernumber'");
|
||||
return;
|
||||
}
|
||||
my $email = $holder{email} || '';
|
||||
my $phone = $holder{phone} || '';
|
||||
my $email = $holder->{email} || '';
|
||||
my $phone = $holder->{phone} || '';
|
||||
my $extra = ($email and $phone) ? " ($email, $phone)" : # both populated, employ comma
|
||||
($email or $phone) ? " ($email$phone)" : # only 1 populated, we don't care which: no comma
|
||||
"" ; # niether populated, empty string
|
||||
"" ; # neither populated, empty string
|
||||
my $name = $holder->{firstname} ? $holder->{firstname} . ' ' : '';
|
||||
$name .= $holder->{surname} . $extra;
|
||||
# $self->{hold_patron_name} = $name; # TODO: consider caching
|
||||
|
|
@ -175,7 +178,7 @@ sub hold_patron_name {
|
|||
sub destination_loc {
|
||||
my $self = shift or return;
|
||||
my $hold = $self->next_hold();
|
||||
return ($hold ? $hold->{branchcode}
|
||||
return ($hold ? $hold->{branchcode} : '');
|
||||
}
|
||||
|
||||
our $AUTOLOAD;
|
||||
|
|
|
|||
|
|
@ -98,7 +98,9 @@ sub new {
|
|||
$debug and warn "patron fines: $ilspatron{fines} ... amountoutstanding: $kp->{amountoutstanding} ... CHARGES->amount: $flags->{CHARGES}->{amount}";
|
||||
for (qw(CHARGES CREDITS GNA LOST DBARRED NOTES)) {
|
||||
($flags->{$_}) or next;
|
||||
$ilspatron{screen_msg} .= ($flags->{$_}->{message} || '') ;
|
||||
if ($_ ne 'NOTES' and $flags->{$_}->{message}) {
|
||||
$ilspatron{screen_msg} .= " -- " . $flags->{$_}->{message}; # show all but internal NOTES
|
||||
}
|
||||
if ($flags->{$_}->{noissues}) {
|
||||
foreach my $toggle (qw(charge_ok renew_ok recall_ok hold_ok inet)) {
|
||||
$ilspatron{$toggle} = 0; # if we get noissues, disable everything
|
||||
|
|
@ -203,17 +205,6 @@ sub language {
|
|||
return $self->{language} || '000'; # Unspecified
|
||||
}
|
||||
|
||||
#
|
||||
# List of outstanding holds placed
|
||||
#
|
||||
sub hold_items {
|
||||
my ($self, $start, $end) = @_;
|
||||
$self->{hold_items} or return [];
|
||||
$start = 1 unless defined($start);
|
||||
$end = scalar @{$self->{hold_items}} unless defined($end);
|
||||
return [@{$self->{hold_items}}[$start-1 .. $end-1]]; # SIP "start item" and "end item" values are 1-indexed, not 0 like perl arrays
|
||||
}
|
||||
|
||||
#
|
||||
# remove the hold on item item_id from my hold queue.
|
||||
# return true if I was holding the item, false otherwise.
|
||||
|
|
@ -235,46 +226,48 @@ sub drop_hold {
|
|||
return $result;
|
||||
}
|
||||
|
||||
# Accessor method for array_ref values, designed to get the "start" and "end" values
|
||||
# from the SIP request. Note those incoming values are 1-indexed, not 0-indexed.
|
||||
#
|
||||
sub x_items {
|
||||
my $self = shift or return;
|
||||
my $array_var = shift or return;
|
||||
my ($start, $end) = @_;
|
||||
$self->{$array_var} or return [];
|
||||
$start = 1 unless defined($start);
|
||||
$end = scalar @{$self->{$array_var}} unless defined($end);
|
||||
# syslog("LOG_DEBUG", "$array_var: start = %d, end = %d; items(%s)", $start, $end, join(', ', @{$self->{items}}));
|
||||
|
||||
return [@{$self->{$array_var}}[$start-1 .. $end-1]];
|
||||
}
|
||||
|
||||
#
|
||||
# List of outstanding holds placed
|
||||
#
|
||||
sub hold_items {
|
||||
my $self = shift or return;
|
||||
return $self->x_items('hold_items', @_);
|
||||
}
|
||||
|
||||
sub overdue_items {
|
||||
my ($self, $start, $end) = @_;
|
||||
$self->{overdue_items} or return [];
|
||||
$start = 1 if !defined($start);
|
||||
$end = scalar @{$self->{overdue_items}} if !defined($end);
|
||||
return [@{$self->{overdue_items}}[$start-1 .. $end-1]];
|
||||
my $self = shift or return;
|
||||
return $self->x_items('overdue_items', @_);
|
||||
}
|
||||
|
||||
sub charged_items {
|
||||
my ($self, $start, $end) = shift;
|
||||
$self->{items} or return [];
|
||||
$start = 1 if !defined($start);
|
||||
$end = scalar @{$self->{items}} if !defined($end);
|
||||
syslog("LOG_DEBUG", "charged_items: start = %d, end = %d; items(%s)",
|
||||
$start, $end, join(', ', @{$self->{items}}));
|
||||
return [@{$self->{items}}[$start-1 .. $end-1]];
|
||||
my $self = shift or return;
|
||||
return $self->x_items('items', @_);
|
||||
}
|
||||
|
||||
sub fine_items {
|
||||
my ($self, $start, $end) = @_;
|
||||
$self->{fine_items} or return [];
|
||||
$start = 1 if !defined($start);
|
||||
$end = scalar @{$self->{fine_items}} if !defined($end);
|
||||
return [@{$self->{fine_items}}[$start-1 .. $end-1]];
|
||||
my $self = shift or return;
|
||||
return $self->x_items('fine_items', @_);
|
||||
}
|
||||
|
||||
sub recall_items {
|
||||
my ($self, $start, $end) = @_;
|
||||
$self->{recall_items} or return [];
|
||||
$start = 1 if !defined($start);
|
||||
$end = scalar @{$self->{recall_items}} if !defined($end);
|
||||
return [@{$self->{recall_items}}[$start-1 .. $end-1]];
|
||||
my $self = shift or return;
|
||||
return $self->x_items('recall_items', @_);
|
||||
}
|
||||
|
||||
sub unavail_holds {
|
||||
my ($self, $start, $end) = @_;
|
||||
$self->{unavail_holds} or return [];
|
||||
$start = 1 if !defined($start);
|
||||
$end = scalar @{$self->{unavail_holds}} if !defined($end);
|
||||
return [@{$self->{unavail_holds}}[$start-1 .. $end-1]];
|
||||
my $self = shift or return;
|
||||
return $self->x_items('unavail_holds', @_);
|
||||
}
|
||||
|
||||
sub block {
|
||||
|
|
@ -282,7 +275,7 @@ sub block {
|
|||
foreach my $field ('charge_ok', 'renew_ok', 'recall_ok', 'hold_ok', 'inet') {
|
||||
$self->{$field} = 0;
|
||||
}
|
||||
$self->{screen_msg} = "Feature not implemented"; # $blocked_card_msg || "Card Blocked. Please contact library staff";
|
||||
$self->{screen_msg} = "Block feature not implemented"; # $blocked_card_msg || "Card Blocked. Please contact library staff";
|
||||
# TODO: not really affecting patron record
|
||||
return $self;
|
||||
}
|
||||
|
|
@ -295,7 +288,7 @@ sub enable {
|
|||
syslog("LOG_DEBUG", "Patron(%s)->enable: charge: %s, renew:%s, recall:%s, hold:%s",
|
||||
$self->{id}, $self->{charge_ok}, $self->{renew_ok},
|
||||
$self->{recall_ok}, $self->{hold_ok});
|
||||
$self->{screen_msg} = "This feature not implemented."; # "All privileges restored."; # TODO: not really affecting patron record
|
||||
$self->{screen_msg} = "Enable feature not implemented."; # "All privileges restored."; # TODO: not really affecting patron record
|
||||
return $self;
|
||||
}
|
||||
|
||||
|
|
@ -315,7 +308,7 @@ sub excessive_fees {
|
|||
}
|
||||
sub excessive_fines {
|
||||
my $self = shift or return;
|
||||
return $self->excessive_fees; # same thing for Koha
|
||||
return $self->excessive_fees; # excessive_fines is the same thing as excessive_fees for Koha
|
||||
}
|
||||
|
||||
sub library_name {
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ use ILS;
|
|||
use ILS::Transaction;
|
||||
|
||||
use C4::Circulation;
|
||||
use C4::Debug;
|
||||
|
||||
our @ISA = qw(ILS::Transaction);
|
||||
|
||||
|
|
@ -45,28 +46,46 @@ sub do_checkin {
|
|||
my $self = shift;
|
||||
my $branch = @_ ? shift : 'SIP2' ;
|
||||
my $barcode = $self->{item}->id;
|
||||
$debug and warn "do_checkin() calling AddReturn($barcode, $branch)";
|
||||
my ($return, $messages, $iteminformation, $borrower) = AddReturn($barcode, $branch);
|
||||
$self->alert(!$return);
|
||||
# ignoring messages: NotIssued, IsPermanent, WasLost, WasTransfered
|
||||
|
||||
# biblionumber, biblioitemnumber, itemnumber
|
||||
# borrowernumber, reservedate, branchcode
|
||||
# cancellationdate, found, reservenotes, priority, timestamp
|
||||
|
||||
if ($messages->{BadBarcode}) {
|
||||
$self->alert_type('99');
|
||||
}
|
||||
# ignoring: NotIssued, IsPermanent
|
||||
if ($messages->{wthdrawn}) {
|
||||
$self->alert_type('99');
|
||||
}
|
||||
if ($messages->{ResFound}) {
|
||||
if ($self->hold($messages->{ResFound}->{ResFound})) {
|
||||
$self->alert_type('99');
|
||||
}
|
||||
if ($messages->{Wrongbranch}) {
|
||||
$self->destination_loc($messages->{Wrongbranch}->{Rightbranch});
|
||||
$self->alert_type('04'); # send to other branch
|
||||
}
|
||||
$self->alert(1) if defined $self->alert_type; # alert_type could be "00"
|
||||
if ($messages->{WrongTransfer}) {
|
||||
$self->destination_loc($messages->{WrongTransfer});
|
||||
$self->alert_type('04'); # send to other branch
|
||||
}
|
||||
if ($messages->{NeedsTransfer}) {
|
||||
$self->destination_loc($iteminformation->{homebranch});
|
||||
$self->alert_type('04'); # send to other branch
|
||||
}
|
||||
if ($messages->{ResFound}) {
|
||||
$self->hold($messages->{ResFound});
|
||||
$debug and warn "Item returned at $branch reserved at $messages->{ResFound}->{branchcode}";
|
||||
$self->alert_type(($branch eq $messages->{ResFound}->{branchcode}) ? '01' : '02');
|
||||
}
|
||||
$self->alert(1) if defined $self->alert_type; # alert_type could be "00", hypothetically
|
||||
$self->ok($return);
|
||||
}
|
||||
|
||||
sub resensitize {
|
||||
my $self = shift;
|
||||
unless ($self->{item}) {
|
||||
warn "no item found in object to resensitize";
|
||||
warn "resensitize(): no item found in object to resensitize";
|
||||
return;
|
||||
}
|
||||
return !$self->{item}->magnetic_media;
|
||||
|
|
@ -75,7 +94,7 @@ sub resensitize {
|
|||
sub patron_id {
|
||||
my $self = shift;
|
||||
unless ($self->{patron}) {
|
||||
warn "no patron found in object";
|
||||
warn "patron_id(): no patron found in object";
|
||||
return;
|
||||
}
|
||||
return $self->{patron}->id;
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@ sub do_renew_for ($$) {
|
|||
$self->screen_msg(($self->screen_msg || '') . " " . $renewerror);
|
||||
$self->renewal_ok(0);
|
||||
}
|
||||
$! and warn "do_renew_for error: $!";
|
||||
$self->ok(1) unless $!;
|
||||
return $self;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,11 +11,11 @@ PODFLAGS = --htmlroot=. --podroot=.
|
|||
pod2html $(PODFLAGS) --outfile=$@ --infile=$<
|
||||
|
||||
all:
|
||||
@echo Nothing to make. The command '"make run"' will run the server.
|
||||
@echo Nothing to make. Use make test.
|
||||
|
||||
# just run the server from the command line
|
||||
run:
|
||||
perl SIPServer.pm SIPconfig.xml
|
||||
# run:
|
||||
# perl SIPServer.pm SIPconfig.xml
|
||||
|
||||
test:
|
||||
cd t; $(MAKE) test
|
||||
|
|
|
|||
|
|
@ -639,6 +639,22 @@ sub handle_checkin {
|
|||
# item barcode is invalid or system doesn't support 'magnetic media' indicator
|
||||
$resp .= 'U';
|
||||
}
|
||||
|
||||
# apparently we can't trust the returns from Checkin yet (because C4::Circulation::AddReturn is faulty)
|
||||
# So we reproduce the alert logic here.
|
||||
if (not $status->alert) {
|
||||
if ($item->hold_patron_id) {
|
||||
$status->alert(1);
|
||||
if ($item->destination_loc and $item->destination_loc ne $current_loc) {
|
||||
$status->alert_type('02'); # hold at other library
|
||||
} else {
|
||||
$status->alert_type('01'); # hold at this library
|
||||
}
|
||||
} elsif ($item->destination_loc and $item->destination_loc ne $current_loc) {
|
||||
$status->alert(1);
|
||||
$status->alert_type('04'); # no hold, just send it
|
||||
}
|
||||
}
|
||||
$resp .= $status->alert ? 'Y' : 'N';
|
||||
$resp .= Sip::timestamp;
|
||||
$resp .= add_field(FID_INST_ID, $inst_id);
|
||||
|
|
@ -662,6 +678,10 @@ sub handle_checkin {
|
|||
$resp .= maybe_add(FID_DESTINATION_LOCATION, $item->destination_loc );
|
||||
$resp .= maybe_add(FID_HOLD_PATRON_ID, $item->hold_patron_id );
|
||||
$resp .= maybe_add(FID_HOLD_PATRON_NAME, $item->hold_patron_name );
|
||||
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;
|
||||
# just me being paranoid.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1569,7 +1589,7 @@ sub api_auth($$) {
|
|||
$query->param(userid => $username);
|
||||
$query->param(password => $password);
|
||||
my ($status, $cookie, $sessionID) = check_api_auth($query, {circulate=>1}, "intranet");
|
||||
print STDERR "check_api_auth returns " . ($status || 'undef') . "\n";
|
||||
# print STDERR "check_api_auth returns " . ($status || 'undef') . "\n";
|
||||
# print "api_auth userenv = " . &dump_userenv;
|
||||
return $status;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,8 +10,9 @@ use CGI;
|
|||
use Sip::Constants qw(:all);
|
||||
use SIPtest qw(
|
||||
:basic
|
||||
$user_barcode $item_barcode $item_title
|
||||
$user_barcode
|
||||
:diacritic
|
||||
:item1
|
||||
);
|
||||
|
||||
my $patron_enable_template = {
|
||||
|
|
@ -31,7 +32,7 @@ my $patron_disable_template = {
|
|||
|
||||
my $checkin_template = {
|
||||
id => 'Checkout: cleanup: check in item',
|
||||
msg => "09N20050102 08423620060113 084235APUnder the bed|AO$instid|AB$item_barcode|ACterminal password|",
|
||||
msg => "09N20050102 08423620060113 084235AP$item_owner|AO$instid|AB$item_barcode|ACterminal password|",
|
||||
pat => qr/^101YNN$datepat/o,
|
||||
fields => [],
|
||||
};
|
||||
|
|
|
|||
|
|
@ -182,6 +182,7 @@ push @tests, $test, $hold_count_test_template0; # 15
|
|||
# - valid item, not allowed to hold item
|
||||
# - multiple holds on item: correct queue position management
|
||||
# - setting and verifying hold expiry dates (requires ILS support)
|
||||
# - 3M checkin extensions for hold/ILL routing
|
||||
|
||||
SIPtest::run_sip_tests(@tests);
|
||||
|
||||
|
|
|
|||
|
|
@ -9,29 +9,32 @@ use Sip::Constants qw(:all);
|
|||
use SIPtest qw(:basic :user1 :item1);
|
||||
|
||||
my $checkin_test_template = {
|
||||
id => "Checkin: Item ($item_barcode) is checked out",
|
||||
msg => "09N20060102 08423620060113 084235APUnder the bed|AO$instid|AB$item_barcode|AC$password|",
|
||||
id => "Checkin: Item ($item_barcode) is checked out",
|
||||
msg => "09N20060102 08423620060113 084235AP$item_owner|AO$instid|AB$item_barcode|AC$password|",
|
||||
pat => qr/^101YNN$datepat/,
|
||||
fields => [
|
||||
$SIPtest::field_specs{(FID_INST_ID)},
|
||||
$SIPtest::field_specs{(FID_SCREEN_MSG)},
|
||||
$SIPtest::field_specs{(FID_PRINT_LINE)},
|
||||
{ field => FID_PATRON_ID,
|
||||
pat => qr/^$user_barcode$/,
|
||||
required => 1, },
|
||||
{ field => FID_ITEM_ID,
|
||||
pat => qr/^$item_barcode$/,
|
||||
required => 1, },
|
||||
{ field => FID_PERM_LOCN,
|
||||
pat => $textpat,
|
||||
required => 1, },
|
||||
{ field => FID_TITLE_ID,
|
||||
pat => qr/^$item_title\s*$/,
|
||||
required => 1, }, # not required by the spec.
|
||||
],};
|
||||
$SIPtest::field_specs{(FID_INST_ID )},
|
||||
$SIPtest::field_specs{(FID_SCREEN_MSG)},
|
||||
$SIPtest::field_specs{(FID_PRINT_LINE)},
|
||||
{ field => FID_PATRON_ID,
|
||||
pat => qr/^$user_barcode$/,
|
||||
required => 1, },
|
||||
{ field => FID_ITEM_ID,
|
||||
pat => qr/^$item_barcode$/,
|
||||
required => 1, },
|
||||
{ field => FID_PERM_LOCN,
|
||||
pat => $textpat,
|
||||
required => 1, },
|
||||
{ field => FID_TITLE_ID,
|
||||
pat => qr/^$item_title\s*$/,
|
||||
required => 1, }, # not required by the spec.
|
||||
{ field => FID_DESTINATION_LOCATION,
|
||||
pat => qr/^$item_owner\s*$/,
|
||||
required => 0, }, # 3M Extension
|
||||
],};
|
||||
|
||||
my $checkout_template = {
|
||||
id => "Checkin: prep: check out item ($item_barcode)",
|
||||
id => "Checkin: prep: check out item ($item_barcode)",
|
||||
msg => "11YN20060329 203000 AO$instid|AA$user_barcode|AB$item_barcode|AC|",
|
||||
pat => qr/^121NNY$datepat/,
|
||||
fields => [],
|
||||
|
|
@ -50,7 +53,7 @@ my $test;
|
|||
# is identical to the first case, except the header says that
|
||||
# the ILS didn't check the item in, and there's no patron id.
|
||||
$test = clone($checkin_test_template);
|
||||
$test->{id} = 'Checkin: Item not checked out';
|
||||
$test->{id} = 'Checkin: Item not checked out';
|
||||
$test->{pat} = qr/^100YNN$datepat/o;
|
||||
$test->{fields} = [grep $_->{field} ne FID_PATRON_ID, @{$test->{fields}}];
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ my $checkout_template = {
|
|||
|
||||
my $checkin_template = {
|
||||
id => "Renew: cleanup: check in item ($item_barcode)",
|
||||
msg => "09N20060102 08423620060113 084235APUnder the bed|AO$instid|AB$item_barcode|AC$password|",
|
||||
msg => "09N20060102 08423620060113 084235AP$item_owner|AO$instid|AB$item_barcode|AC$password|",
|
||||
pat => qr/^101YNN$datepat/,
|
||||
fields => [],
|
||||
};
|
||||
|
|
@ -71,6 +71,8 @@ my @tests = (
|
|||
$renew_test_template,
|
||||
);
|
||||
|
||||
SIPtest::run_sip_tests(@tests); exit; # debug hack
|
||||
|
||||
my $test;
|
||||
|
||||
# Renew: item checked out, identify by title
|
||||
|
|
@ -92,6 +94,9 @@ my $test;
|
|||
#
|
||||
#push @tests, $hold_template, $test, $cancel_hold_template;
|
||||
#
|
||||
#
|
||||
# Tests for impossible renewals.
|
||||
#
|
||||
# Renew: item not checked out. Basically the same, except
|
||||
# for the leader test.
|
||||
|
||||
|
|
|
|||
|
|
@ -29,11 +29,11 @@ my @checkout_templates = (
|
|||
|
||||
my @checkin_templates = (
|
||||
{ id => "Renew All: prep: check in $item_barcode",
|
||||
msg => "09N20060102 08423620060113 084235APUnder the bed|AO$instid|AB$item_barcode|AC$password|",
|
||||
msg => "09N20060102 08423620060113 084235AP$item_owner|AO$instid|AB$item_barcode|AC$password|",
|
||||
pat => qr/^101YNN$datepat/,
|
||||
fields => [],},
|
||||
{ id => "Renew All: prep: check in $item2_barcode",
|
||||
msg => "09N20060102 08423620060113 084235APUnder the bed|AO$instid|AB$item2_barcode|AC$password|",
|
||||
msg => "09N20060102 08423620060113 084235AP$item2_owner|AO$instid|AB$item2_barcode|AC$password|",
|
||||
pat => qr/^101YNN$datepat/,
|
||||
fields => [],}
|
||||
);
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ BEGIN {
|
|||
%EXPORT_TAGS = (
|
||||
auth => [qw(&api_auth)],
|
||||
basic => [qw($datepat $textpat $login_test $sc_status_test
|
||||
$instid $currency $server $username $password)],
|
||||
$instid $instid2 $currency $server $username $password)],
|
||||
user1 => [qw($user_barcode $user_pin $user_fullname $user_homeaddr $user_email
|
||||
$user_phone $user_birthday $user_ptype $user_inet)],
|
||||
item1 => [qw($item_barcode $item_title $item_owner )],
|
||||
|
|
@ -25,6 +25,11 @@ BEGIN {
|
|||
my @tags = @{$EXPORT_TAGS{$tag.'1'}}; # fresh array avoids side affect in map
|
||||
push @{$EXPORT_TAGS{$tag.'2'}}, map {s/($tag)\_/${1}2_/;$_} @tags;
|
||||
}
|
||||
# we've got item3_* also
|
||||
foreach my $tag (qw(item)) {
|
||||
my @tags = @{$EXPORT_TAGS{$tag.'1'}}; # fresh array avoids side affect in map
|
||||
push @{$EXPORT_TAGS{$tag.'3'}}, map {s/($tag)\_/${1}3_/;$_} @tags;
|
||||
}
|
||||
# From perldoc Exporter
|
||||
# Add all the other ":class" tags to the ":all" class, deleting duplicates
|
||||
my %seen;
|
||||
|
|
@ -47,15 +52,17 @@ use Sip::Constants qw(:all);
|
|||
use C4::Auth qw(&check_api_auth);
|
||||
use C4::Context;
|
||||
|
||||
# TODO: just read SIPconfig.xml and extract what we can....
|
||||
#
|
||||
# Configuration parameters to run the test suite
|
||||
#
|
||||
our $instid = 'CPL'; # 'UWOLS';
|
||||
our $instid = 'CPL'; # branchcode
|
||||
our $instid2 = 'FPL'; # branchcode
|
||||
our $currency = 'USD'; # 'CAD';
|
||||
our $server = 'localhost:6001'; # Address of the SIP server
|
||||
|
||||
# SIP username and password to connect to the server. See the
|
||||
# SIP config.xml for the correct values.
|
||||
# SIP username and password to connect to the server.
|
||||
# See SIPconfig.xml for the correct values.
|
||||
our $username = 'term1';
|
||||
our $password = 'term1';
|
||||
|
||||
|
|
@ -94,6 +101,11 @@ our $item2_barcode = '502326000011';
|
|||
our $item2_title = 'The biggest, smallest, fastest, tallest things you\'ve ever heard of /';
|
||||
our $item2_owner = 'CPL';
|
||||
|
||||
# A third valid item
|
||||
our $item3_barcode = '502326000240';
|
||||
our $item3_title = 'The girl who owned a city /';
|
||||
our $item3_owner = 'FPL';
|
||||
|
||||
# An item with a diacritical in the title
|
||||
our $item_diacritic_barcode = '502326001030';
|
||||
our $item_diacritic_titlea = 'Hari Poṭer u-geviʻa ha-esh /';
|
||||
|
|
|
|||
Loading…
Reference in New Issue