Bug 5877 : Offline circulation improvements : upload all files, apply at once
[koha.git] / offline_circ / process.pl
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 $query = CGI->new;
26
27 my ($template, $loggedinuser, $cookie) = get_template_and_user({
28     template_name => "offline_circ/list.tmpl",
29     query => $query,
30     type => "intranet",
31     authnotrequired => 0,
32     flagsrequired   => { circulate => "circulate_remaining_permissions" },
33 });
34
35 my $operationid = $query->param('operationid');
36 my $action = $query->param('action');
37 my $result;
38
39 if ( $action eq 'process' ) {
40     my $operation = GetOfflineOperation( $operationid );
41     $result = ProcessOfflineOperation( $operation );
42 } elsif ( $action eq 'delete' ) {
43     $result = DeleteOfflineOperation( $operationid );
44 }
45
46 print CGI::header('-type'=>'text/plain', '-charset'=>'utf-8');
47 print $result;