[Koha-patches] [PATCH] Expand interactive SIP tests.

Joe Atzberger joe.atzberger at liblime.com
Tue Jun 16 19:11:35 CEST 2009


From: Joe Atzberger (siptest <atz4sip at arwen.metavore.com>

Also tweak interactive item dump to suppress huge fields (marc, marcxml).
---
 C4/SIP/interactive_item_dump.pl    |   30 ++++++++++++++++++++++++++++--
 C4/SIP/interactive_members_dump.pl |    2 +-
 C4/SIP/interactive_patron_dump.pl  |    2 +-
 3 files changed, 30 insertions(+), 4 deletions(-)

diff --git a/C4/SIP/interactive_item_dump.pl b/C4/SIP/interactive_item_dump.pl
index ece250e..2fa0db2 100755
--- a/C4/SIP/interactive_item_dump.pl
+++ b/C4/SIP/interactive_item_dump.pl
@@ -7,12 +7,38 @@ 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 $patron = ILS::Item->new($in);
-	print Dumper($patron);
+	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');
+    }
 }
diff --git a/C4/SIP/interactive_members_dump.pl b/C4/SIP/interactive_members_dump.pl
index 8df6ea4..e477486 100755
--- a/C4/SIP/interactive_members_dump.pl
+++ b/C4/SIP/interactive_members_dump.pl
@@ -15,7 +15,7 @@ while (1) {
 	last unless $in;
 	print "GetMember : \n",  Dumper(GetMember($in, 'cardnumber'));
 	my ($member) = GetMemberDetails(undef, $in);
-	my $flags = $member->{flags};
+	my $flags = $member->{authflags};
 	print "GetMemberDetails (member) : \n", Dumper($member);
 	print "GetMemberDetails ( flags) : \n", Dumper($flags);
 	print "=" x 10, "\n";
diff --git a/C4/SIP/interactive_patron_dump.pl b/C4/SIP/interactive_patron_dump.pl
index 557d2f7..6788ce0 100755
--- a/C4/SIP/interactive_patron_dump.pl
+++ b/C4/SIP/interactive_patron_dump.pl
@@ -14,5 +14,5 @@ while (1) {
 	chomp($in);
 	last unless $in;
 	my $patron = ILS::Patron->new($in);
-	print Dumper($patron);
+	print "Patron ($in):\n", Dumper($patron);
 }
-- 
1.5.6.5




More information about the Koha-patches mailing list