Koha/C4/SIP/interactive_item_dump.pl
Joe Atzberger (siptest 01ec1e0a3d Expand interactive SIP tests.
Also tweak interactive item dump to suppress huge fields (marc, marcxml).

Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
2009-06-17 11:42:44 -05:00

44 lines
1.1 KiB
Perl
Executable file

#!/usr/bin/perl
#
use warnings;
use strict;
use ILS::Item;
use Data::Dumper;
my $compare = (@ARGV) ? shift : 0;
while (1) {
print "Enter item barcode: ";
my $in = <>;
defined($in) or last;
chomp($in);
last unless $in;
my $item = ILS::Item->new($in);
unless ($item) {
print "No item ($in)";
next;
}
for (qw(marc marcxml)) {
$item->{$_} = 'suppressed...';
}
my $queue = $item->hold_queue();
print "Item ($in): ", Dumper($item);
print "hold_queue: ", Dumper($queue);
my $holdernumber;
if ($queue and scalar(@$queue)) {
$holdernumber = $queue->[0]->{borrowernumber};
print "first borrowernumber: $holdernumber\n";
}
if ($compare) {
print "Enter patron barcode: ";
my $barcode = <>;
defined($barcode) or next;
chomp($barcode);
next unless $barcode;
my $x = ILS::Item::_barcode_to_borrowernumber($barcode) || 'UNDEF';
print " converts to: $x\n";
printf " compares as: %s\n",
($item->barcode_is_borrowernumber($barcode,$holdernumber) ? 'TRUE' : 'FALSE');
}
}