3 #----------------------------------------------------------------
4 # Code for testing the container API
5 #----------------------------------------------------------------
7 require '../oils_header.pl';
8 use vars qw/ $apputils $memcache $user $authtoken $authtime /;
9 use strict; use warnings;
11 #----------------------------------------------------------------
12 err("\nusage: $0 <config> <oils_login_username> ".
13 " <oils_login_password> <patronid> <copy_barcode> [<type>, <noncat_type>]\n".
14 "Where <type> is one of:\n".
15 "\t'permit' to run the permit only\n".
16 "\t'noncat_permit' to run the permit script against a noncat item\n".
17 "\t'noncat' to check out a noncat item\n".
18 "\t(blank) to do a regular checkout\n" ) unless $ARGV[4];
19 #----------------------------------------------------------------
26 my $type = shift || "";
30 osrf_connect($config);
31 oils_login($username, $password);
32 do_permit($patronid, $barcode, $type =~ /noncat/ );
33 do_checkout($patronid, $barcode, $type =~ /noncat/, $nc_type ) unless ($type =~ /permit/);
39 #----------------------------------------------------------------
42 my( $patronid, $barcode, $noncat ) = @_;
44 my $args = { patron => $patronid };
46 $args->{barcode} = $barcode;
49 $args->{noncat_type} = $nc_type;
53 CIRC(), 'open-ils.circ.checkout.permit', $authtoken, $args );
55 oils_event_die($resp);
56 printl("Permit succeeded for patron $patronid");
60 my( $patronid, $barcode, $noncat, $nc_type ) = @_;
62 my $args = { patron => $patronid };
63 $args->{barcode} = $barcode;
66 $args->{noncat_type} = $nc_type;
69 my $resp = osrf_request(
71 'open-ils.circ.checkout', $authtoken, $args );
73 oils_event_die($resp);
74 printl("Checkout succeeded");