Continuing work on Z39.50 search tool. Daemon now forks up to 12 processes
[koha.git] / C4 / Stock.pm
1 package C4::Stock; #asummes C4/Stock.pm
2
3 use strict;
4 require Exporter;
5
6 use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
7 use C4::Database;
8
9 # set the version for version checking
10 $VERSION = 0.01;
11
12 @ISA = qw(Exporter);
13 @EXPORT = qw(&stockreport);
14 %EXPORT_TAGS = ( );     # eg: TAG => [ qw!name1 name2! ],
15
16 # your exported package globals go here,
17 # as well as any optionally exported functions
18
19 @EXPORT_OK   = qw($Var1 %Hashit);
20
21
22 # non-exported package globals go here
23 use vars qw(@more $stuff);
24
25 # initalize package globals, first exported ones
26
27 my $Var1   = '';
28 my %Hashit = ();
29
30
31 # then the others (which are still accessible as $Some::Module::stuff)
32 my $stuff  = '';
33 my @more   = ();
34
35 # all file-scoped lexicals must be created before
36 # the functions below that use them.
37
38 # file-private lexicals go here
39 my $priv_var    = '';
40 my %secret_hash = ();
41
42 # here's a file-private function as a closure,
43 # callable as &$priv_func;  it cannot be prototyped.
44 my $priv_func = sub {
45   # stuff goes here.
46   };
47   
48 # make all your functions, whether exported or not;
49
50 sub stockreport {
51   my $dbh=C4Connect;
52   my @results;
53   my $query="Select count(*) from items where homebranch='C'";
54   my $sth=$dbh->prepare($query);
55   $sth->execute;
56   my $count=$sth->fetchrow_hashref;
57   $results[0]="$count->{'count'}\t Levin";
58   $sth->finish;
59   $query="Select count(*) from items where homebranch='F'";
60   $sth=$dbh->prepare($query);
61   $sth->execute;
62   $count=$sth->fetchrow_hashref;
63   $results[1]="$count->{'count'}\t Foxton";
64   $sth->finish;
65   $dbh->disconnect;
66   return(@results);
67 }
68
69 END { }       # module clean-up code here (global destructor)
70   
71