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[5];
19 #----------------------------------------------------------------
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 = ( $authtoken, 'patron', $patronid );
45 push(@args, (barcode => $barcode)) unless $noncat;
46 push(@args, (noncat => 1, noncat_type => $nc_type )) if $noncat;
49 CIRC(), 'open-ils.circ.permit_checkout_', @args );
51 oils_event_die($resp);
52 printl("Permit succeeded for patron $patronid");
56 my( $patronid, $barcode, $noncat, $nc_type ) = @_;
58 my @args = ($authtoken, 'patron', $patronid);
59 push(@args, (barcode => $barcode)) unless $noncat;
60 push(@args, (noncat => 1, noncat_type => $nc_type )) if $noncat;
62 my $resp = osrf_request(
64 'open-ils.circ.checkout', @args );
65 oils_event_die($resp);
66 printl("Checkout succeeded");