Bug 13937: (follow-up) Correct error call to use self
[koha.git] / C4 / SIP / interactive_item_dump.pl
blob5636a219ff1ecd8105fc2c3503f525b9ddd040da
1 #!/usr/bin/perl
4 use warnings;
5 use strict;
7 use C4::SIP::ILS::Item;
8 use Data::Dumper;
10 my $compare = (@ARGV) ? shift : 0;
11 while (1) {
12 print "Enter item barcode: ";
13 my $in = <>;
14 defined($in) or last;
15 chomp($in);
16 last unless $in;
17 my $item = C4::SIP::ILS::Item->new($in);
18 unless ($item) {
19 print "No item ($in)";
20 next;
22 for (qw(marc marcxml)) { # Letting it just in case but should not longer be useful
23 $item->{$_} = 'suppressed...';
25 my $queue = $item->hold_queue();
26 print "Item ($in): ", Dumper($item);
27 print "hold_queue: ", Dumper($queue);
28 my $holdernumber;
29 if ($queue and scalar(@$queue)) {
30 $holdernumber = $queue->[0]->{borrowernumber};
31 print "first borrowernumber: $holdernumber\n";
33 if ($compare) {
34 print "Enter patron barcode: ";
35 my $barcode = <>;
36 defined($barcode) or next;
37 chomp($barcode);
38 next unless $barcode;
39 my $x = ILS::Item::_barcode_to_borrowernumber($barcode) || 'UNDEF';
40 print " converts to: $x\n";
41 printf " compares as: %s\n",
42 ($item->barcode_is_borrowernumber($barcode,$holdernumber) ? 'TRUE' : 'FALSE');