Line 0
Link Here
|
0 |
- |
1 |
#!/usr/bin/perl |
|
|
2 |
|
3 |
# 2009 BibLibre <jeanandre.santoni@biblibre.com> |
4 |
|
5 |
# This file is part of Koha. |
6 |
# |
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. |
11 |
# |
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. |
15 |
# |
16 |
# You should have received a copy of the GNU General Public License along with |
17 |
# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place, |
18 |
# Suite 330, Boston, MA 02111-1307 USA |
19 |
# |
20 |
|
21 |
use CGI; |
22 |
use C4::Auth; |
23 |
use C4::Circulation; |
24 |
|
25 |
my $cgi = CGI->new; |
26 |
|
27 |
# get the status of the user, this will check his credentials and rights |
28 |
my ($status, $cookie, $sessionId) = C4::Auth::check_api_auth($cgi, undef); |
29 |
|
30 |
my $result; |
31 |
|
32 |
if ($status eq 'ok') { # if authentication is ok |
33 |
if ( $cgi->param('pending') eq 'true' ) { # if the 'pending' flag is true, we store the operation in the db instead of directly processing them |
34 |
$result = AddOfflineOperation( |
35 |
$cgi->param('userid') || '', |
36 |
$cgi->param('branchcode') || '', |
37 |
$cgi->param('timestamp') || '', |
38 |
$cgi->param('action') || '', |
39 |
$cgi->param('barcode') || '', |
40 |
$cgi->param('cardnumber') || '', |
41 |
); |
42 |
} else { |
43 |
$result = ProcessOfflineOperation( |
44 |
{ |
45 |
'userid' => $cgi->param('userid'), |
46 |
'branchcode' => $cgi->param('branchcode'), |
47 |
'timestamp' => $cgi->param('timestamp'), |
48 |
'action' => $cgi->param('action'), |
49 |
'barcode' => $cgi->param('barcode'), |
50 |
'cardnumber' => $cgi->param('cardnumber'), |
51 |
} |
52 |
); |
53 |
} |
54 |
} else { |
55 |
$result = "Authentication failed." |
56 |
} |
57 |
|
58 |
print CGI::header('-type'=>'text/plain', '-charset'=>'utf-8'); |
59 |
print $result; |
60 |
|