]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/src/support-scripts/test-scripts/checkout.pl
fixed some bugs in circulate to get the noncat stuff working
[Evergreen.git] / Open-ILS / src / support-scripts / test-scripts / checkout.pl
1 #!/usr/bin/perl
2
3 #----------------------------------------------------------------
4 # Code for testing the container API
5 #----------------------------------------------------------------
6
7 require '../oils_header.pl';
8 use vars qw/ $apputils $memcache $user $authtoken $authtime /;
9 use strict; use warnings;
10
11 err("usage: $0 <config> <oils_login_username> ".
12         " <oils_login_password> <patronid> <copy_barcode> [<type>]\n".
13         "Where <type> is one of:\n".
14         "\t'permit' to run the permit only\n".
15         "\t'noncat_permit' to run the permit script against a noncat item\n".
16         "\t'noncat' to check out a noncat item\n".
17         "\tblahk to do a regular checkout\n" ) unless $ARGV[4];
18
19 my $config              = shift; 
20 my $username    = shift;
21 my $password    = shift;
22 my $patronid    = shift;
23 my $barcode             = shift;
24 my $type                        = shift;
25
26 my $method = 'open-ils.circ.checkout_permit_';
27
28 sub go {
29         osrf_connect($config);
30         oils_login($username, $password);
31         do_permit($patronid, $barcode, $type =~ /noncat/ ); 
32         do_checkout($patronid, $barcode, $type =~ /noncat/ ) unless ($type =~ /permit/);
33         oils_logout();
34 }
35
36 go();
37
38 #----------------------------------------------------------------
39
40
41 sub do_permit {
42         my( $patronid, $barcode, $noncat ) = @_;
43
44         my @args = ( $authtoken, 'patron', $patronid );
45         push(@args, ('barcode', $barcode)) unless $noncat;
46         push(@args, ('noncat', 1)) if $noncat;
47
48         my $resp = simplereq( 
49                 CIRC(), 'open-ils.circ.permit_checkout_', @args );
50         
51         oils_event_die($resp);
52         printl("Permit succeeded for patron $patronid");
53 }
54
55 sub do_checkout {
56 }
57