Bug 2774 - Path to theme is hard-coded in many places
[koha.git] / offline_circ / service.pl
blob38f46d8013681b4c4682cf8b695210090693f363
1 #!/usr/bin/perl
3 # 2009 BibLibre <jeanandre.santoni@biblibre.com>
5 # This file is part of Koha.
7 # Koha is free software; you can redistribute it and/or modify it under the
8 # terms of the GNU General Public License as published by the Free Software
9 # Foundation; either version 2 of the License, or (at your option) any later
10 # version.
12 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License along
17 # with Koha; if not, write to the Free Software Foundation, Inc.,
18 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 use strict;
22 use warnings;
24 use CGI;
25 use C4::Auth;
26 use C4::Circulation;
28 my $cgi = CGI->new;
30 # get the status of the user, this will check his credentials and rights
31 my ($status, $cookie, $sessionId) = C4::Auth::check_api_auth($cgi, undef);
33 my $result;
35 if ($status eq 'ok') { # if authentication is ok
37 my $userid = $cgi->param('userid') || '';
38 my $branchcode = $cgi->param('branchcode') || '';
39 my $timestamp = $cgi->param('timestamp') || '';
40 my $action = $cgi->param('action') || '';
41 my $barcode = $cgi->param('barcode') || '';
42 $barcode =~ s/^\s+//;
43 $barcode =~ s/\s+$//;
44 my $cardnumber = $cgi->param('cardnumber') || '';
45 $cardnumber =~ s/^\s+//;
46 $cardnumber =~ s/\s+$//;
48 if ( $cgi->param('pending') eq 'true' ) { # if the 'pending' flag is true, we store the operation in the db instead of directly processing them
49 $result = AddOfflineOperation(
50 $userid,
51 $branchcode,
52 $timestamp,
53 $action,
54 $barcode,
55 $cardnumber,
57 } else {
58 $result = ProcessOfflineOperation(
60 'userid' => $userid,
61 'branchcode' => $branchcode,
62 'timestamp' => $timestamp,
63 'action' => $action,
64 'barcode' => $barcode,
65 'cardnumber' => $cardnumber,
69 } else {
70 $result = "Authentication failed."
73 print CGI::header('-type'=>'text/plain', '-charset'=>'utf-8');
74 print $result;