Bug 5877 : Offline circulation improvements : upload all files, apply at once
[koha.git] / offline_circ / list.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::Output;
23 use C4::Auth;
24 use C4::Koha;
25 use C4::Context;
26 use C4::Circulation;
27 use C4::Branch;
28 use C4::Members;
29 use C4::Biblio;
30
31 my $query = CGI->new;
32
33 my ($template, $loggedinuser, $cookie) = get_template_and_user({
34     template_name => "offline_circ/list.tmpl",
35     query => $query,
36     type => "intranet",
37     authnotrequired => 0,
38     flagsrequired   => { circulate => "circulate_remaining_permissions" },
39 });
40
41 my $operations = GetOfflineOperations;
42
43 for (@$operations) {
44         my $biblio             = GetBiblioFromItemNumber(undef, $_->{'barcode'});
45         $_->{'bibliotitle'}    = $biblio->{'title'};
46         $_->{'biblionumber'}   = $biblio->{'biblionumber'};
47         my $borrower           = GetMemberDetails(undef,$_->{'cardnumber'});
48         $_->{'borrowernumber'} = $borrower->{'borrowernumber'};
49         $_->{'borrower'}       = join(' ', $borrower->{'firstname'}, $borrower->{'surname'});
50         $_->{'actionissue'}    = $_->{'action'} eq 'issue';
51         $_->{'actionreturn'}   = $_->{'action'} eq 'return';
52 }
53 $template->param(pending_operations => $operations);
54
55 output_html_with_http_headers $query, $cookie, $template->output;