4 # Copyright 2000-2002 Katipo Communications
6 # This file is part of Koha.
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
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.
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
21 # Modification by D.Ulm, actually works (as long as indep. branches not turned on)
22 # Someone let me know what indep. branches is supposed to do and I'll make that part work too
24 # The reserve pull lists *works* as long as not for indepencdant branches, I can fix!
31 use C4::Branch qw/GetBranches/;
32 use C4::Koha qw/GetItemTypes GetKohaAuthorisedValues/;
33 use C4::Dates qw/format_date format_date_in_iso/;
35 use C4::Reserves qw/GetPendingReserves/;
36 use Date::Calc qw/Today Add_Delta_YMD/;
40 my $order = $input->param('order');
41 my $startdate = $input->param('from');
42 my $enddate = $input->param('to');
45 my $template_name = $input->param('json') ? "cataloguing/value_builder/ajax.tmpl" : "circ/pendingreserves.tmpl";
47 my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
49 template_name => $template_name,
53 flagsrequired => { circulate => "circulate_remaining_permissions" },
58 if($input->param('json')){
60 my $startindex = $input->param('startIndex');
61 my $results = $input->param('results');
63 holdingbranches => $input->param('holdingbranches') || "",
64 locations => $input->param('locations') || "",
65 itemtypes => $input->param('itemtypes') || "",
67 my ($count, $reservedata) = C4::Reserves::GetPendingReserves($filters, $startindex, $results);
70 recordsReturned => scalar @$reservedata,
71 totalRecords => $count,
73 sort => "callnumbers",
76 records => $reservedata,
80 $template->param(return => to_json($jsondatas));
82 my (@itemtypesloop,@locationloop, @branch_loop);
83 my $itemtypes = GetItemTypes;
84 foreach my $thisitemtype (sort keys %$itemtypes) {
85 push @itemtypesloop, {
86 value => $thisitemtype,
87 description => $itemtypes->{$thisitemtype}->{'description'},
90 my $locs = GetKohaAuthorisedValues( 'items.location' );
91 foreach my $thisloc (sort keys %$locs) {
94 description => $locs->{$thisloc},
97 my $branches = GetBranches();
98 foreach my $branchcode (sort keys %{$branches}) {
100 value => $branchcode,
101 description => $branches->{$branchcode}->{branchname},
106 branches_loop => \@branch_loop,
107 itemtypes_loop => \@itemtypesloop,
108 locations_loop => \@locationloop,
109 "BiblioDefaultView".C4::Context->preference("BiblioDefaultView") => 1,
110 DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar(),
111 dateformat => C4::Context->preference("dateformat"),
114 output_html_with_http_headers $input, $cookie, $template->output;