Added checking for option to run unsafe database tests. The idea is that tests
[koha.git] / C4 / Circmain.pm
1 package C4::Circmain; #asummes C4/Circulation
2
3 #package to deal with circulation 
4
5 use strict;
6 require Exporter;
7 use DBI;
8 use C4::Database;
9 use C4::Circulation::Main;
10 use C4::Circulation::Issues;
11 use C4::Circulation::Returns;
12 use C4::Circulation::Renewals;
13 use C4::Circulation::Borrower;
14 use C4::Reserves;
15 use C4::InterfaceCDK;
16 use C4::Security;
17
18 use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
19   
20 # set the version for version checking
21 $VERSION = 0.01;
22     
23 @ISA = qw(Exporter);
24 @EXPORT = qw(&Start_circ);
25 %EXPORT_TAGS = ( );     # eg: TAG => [ qw!name1 name2! ],
26                   
27 # your exported package globals go here,
28 # as well as any optionally exported functions
29
30 @EXPORT_OK   = qw($Var1 %Hashit);
31
32
33 # non-exported package globals go here
34 use vars qw(@more $stuff);
35         
36 # initalize package globals, first exported ones
37
38 my $Var1   = '';
39 my %Hashit = ();
40                     
41 # then the others (which are still accessible as $Some::Module::stuff)
42 my $stuff  = '';
43 my @more   = ();
44         
45 # all file-scoped lexicals must be created before
46 # the functions below that use them.
47                 
48 # file-private lexicals go here
49 my $priv_var    = '';
50 my %secret_hash = ();
51                             
52 # here's a file-private function as a closure,
53 # callable as &$priv_func;  it cannot be prototyped.
54 my $priv_func = sub {
55   # stuff goes here.
56 };
57                                                     
58 # make all your functions, whether exported or not;
59
60 sub Start_circ{
61   my ($env)=@_;
62   #connect to database
63   #start interface
64   &startint($env,'Circulation');
65   getbranch($env);
66   getprinter($env);
67   my $donext = 'Circ';
68   my $reason;
69   my $data;
70   while ($donext ne 'Quit') {
71     if ($donext  eq "Circ") {
72       #($reason,$data) = menu($env,'console','Circulation', 
73       #  ('Issues','Returns','Borrower Enquiries','Reserves','Log In'));
74       #&startint($env,"Menu");
75       ($reason,$data) = menu($env,'console','Circulation',
76         ('Issues','Returns','Select Branch','Select Printer')); 
77     } else {
78       $data = $donext;
79     }
80     if ($data eq 'Issues') {  
81       $donext=Issue($env); #C4::Circulation::Issues 
82     } elsif ($data eq 'Returns') {
83       $donext=Returns($env); #C4::Circulation::Returns 
84     } elsif ($data eq 'Select Branch') {
85       getbranch($env);
86     } elsif ($data eq 'Select Printer') {
87       getprinter($env);      
88     } elsif ($data eq 'Borrower Enquiries') {
89       #  $donext=Borenq($env); #C4::Circulation::Borrower - conversion
90     } elsif ($data eq 'Reserves'){
91       $donext=EnterReserves($env); #C4::Reserves 
92     } elsif ($data eq 'Quit') { 
93       $donext = $data;
94     }
95   }
96   &endint($env)  
97 }
98
99
100 END { }       # module clean-up code here (global destructor)