last bugfixes before 1.3.3 : systempref table correctly filled
[koha.git] / telnet / startint.pl
1 #!/usr/bin/perl
2
3
4 # Copyright 2000-2002 Katipo Communications
5 #
6 # This file is part of Koha.
7 #
8 # Koha is free software; you can redistribute it and/or modify it under the
9 # terms of the GNU General Public License as published by the Free Software
10 # Foundation; either version 2 of the License, or (at your option) any later
11 # version.
12 #
13 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
14 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
15 # A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
16 #
17 # You should have received a copy of the GNU General Public License along with
18 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
19 # Suite 330, Boston, MA  02111-1307 USA
20
21 use strict;
22 #use C4::Security;
23 #use C4::Database;
24 use C4::Circulation::Main;
25 #use C4::Circulation::Issues;
26 #use C4::Circulation::Returns;
27 #use C4::Circulation::Renewals;
28 #use C4::Circulation::Borrower;
29 #use C4::Reserves;
30 use C4::InterfaceCDK;
31 #use C4::Security;
32
33
34 # set up environment array
35 # branchcode - logged on branch
36 # usercode - current user
37 # proccode - current or last procedure
38 # borrowernumber - current or last borrowernumber
39 # logintime - time logged on
40 # lasttime - lastime security checked
41 # tempuser - temporary user
42 my %env = (
43   branchcode => "", usercode => "", proccode => "lgon", borrowernumber => "",
44   logintime  => "", lasttime => "", tempuser => "", debug => "9"
45   );
46
47 $env{'branchcode'} = "C";
48 $env{'usercode'} = `whoami`;
49 $env{'telnet'} = "Y";
50
51
52 #start interface
53 &startint(\%env,'Circulation');
54 getbranch(\%env);
55 getprinter(\%env);
56 my $donext = 'Circ';
57 my $reason;
58 my $data;
59 while ($donext ne 'Quit') {
60   if ($donext  eq "Circ") {
61     ($reason,$data) = menu(\%env,'console','Circulation',
62     ('Issues','Returns','Select Branch','Select Printer'));
63   } else {
64     $data = $donext;
65   }
66   if ($data eq 'Issues') {
67    my @args=('issuewrapper.pl',"$env{'branchcode'}","$env{'usercode'}","$env{'telnet'}","$env{'queue'}","$env{'printtype'}","$env{'brdata'}","$env{'lasttime'}");
68   open (FILE,">>/tmp/$<_$$");
69    my $time=localtime(time);
70    print FILE "Start issues $time \n";
71    close FILE;
72    system(@args);
73   } elsif ($data eq 'Returns') {
74    my @args=('returnswrapper.pl',"$env{'branchcode'}","$env{'usercode'}","$env{'telnet'}","$env{'queue'}","$env{'printtype'}","$env{'brdata'}");
75    open (FILE,">>/tmp/$<_$$");
76    my $time=localtime(time);
77    print FILE "Start returns $time \n";
78    close FILE;
79    system(@args);
80 #    $donext=Returns(\%env); #C4::Circulation::Returns
81   } elsif ($data eq 'Select Branch') {
82     getbranch(\%env);
83   } elsif ($data eq 'Select Printer') {
84     getprinter(\%env);
85 #  } elsif ($data eq 'Borrower Enquiries') {
86     #  $donext=Borenq($env); #C4::Circulation::Borrower - conversion
87 #  } elsif ($data eq 'Reserves'){
88 #    $donext=EnterReserves(\%env); #C4::Reserves
89   } elsif ($data eq 'Quit') {
90     $donext = $data;
91     &endint(\%env);
92     die;
93   }
94 }
95     &endint(\%env);
96     die;