]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/src/support-scripts/test-scripts/in_house_use.pl
375f6b6a47cffec74528efea1a1a479ec03388cf
[Evergreen.git] / Open-ILS / src / support-scripts / test-scripts / in_house_use.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 #----------------------------------------------------------------
12 err("\nusage: $0 <config> <oils_username>  <oils_password> <copyid> <org_id> [<count>]\n".
13         "If <count> is defined, then <count> in-house uses will be ".
14         "created for the copy, otherwise 1 is created" ) unless $ARGV[4];
15 #----------------------------------------------------------------
16
17 my $config              = shift; 
18 my $username    = shift;
19 my $password    = shift;
20 my $copyid              = shift;
21 my $location    = shift;
22 my $count               = shift || 1;
23
24 my $method = 'open-ils.circ.in_house_use.create';
25
26 sub go {
27         osrf_connect($config);
28         oils_login($username, $password);
29         do_in_house_use($copyid, $location, $count);
30         oils_logout();
31 }
32
33 go();
34
35 #----------------------------------------------------------------
36
37
38 sub do_in_house_use {
39         my( $copyid, $location, $count ) = @_;
40         my $resp = simplereq(
41                 'open-ils.circ',
42                 'open-ils.circ.in_house_use.create', $authtoken, 
43                 copyid  => $copyid, 
44                 location        => $location, 
45                 count           => $count );
46
47         oils_event_die($resp);
48         printl("Successfully created " . scalar(@$resp) . " in house \n".
49         "use actions for copy $copyid and location $location");
50 }
51