4 # This file is part of Koha.
6 # Koha is free software; you can redistribute it and/or modify it
7 # under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 3 of the License, or
9 # (at your option) any later version.
11 # Koha is distributed in the hope that it will be useful, but
12 # WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with Koha; if not, see <http://www.gnu.org/licenses>.
29 use Koha
::BiblioFrameworks
;
32 =head1 branchoverdues.pl
34 This view is used to display all overdue items to the librarian.
36 It is automatically filtered by branch and can optionally be filtered
42 my $dbh = C4
::Context
->dbh;
44 my ( $template, $loggedinuser, $cookie, $flags ) = get_template_and_user
({
45 template_name
=> "circ/branchoverdues.tt",
48 flagsrequired
=> { circulate
=> "circulate_remaining_permissions" },
52 my $default = C4
::Context
->userenv->{'branch'};
54 # Deal with the vars recept from the template
55 my $borrowernumber = $input->param('borrowernumber');
56 my $itemnumber = $input->param('itemnumber');
57 my $method = $input->param('method');
58 my $overduelevel = $input->param('overduelevel');
59 my $location = $input->param('location');
61 # FIXME: better check that borrowernumber is defined and valid.
62 # FIXME: same for itemnumber and other variables passed in here.
65 my @getoverdues = GetOverduesForBranch
( $default, $location );
66 $debug and warn "HERE : $default / $location" . Dumper
(@getoverdues);
67 # search for location authorised value
68 my ($tag,$subfield) = GetMarcFromKohaField
( 'items.location' );
69 my $tagslib = &GetMarcStructure
(1,'');
70 if ($tagslib->{$tag}->{$subfield}->{authorised_value
}) {
71 my $values= GetAuthorisedValues
($tagslib->{$tag}->{$subfield}->{authorised_value
});
72 for (@
$values) { $_->{selected
} = 1 if $location eq $_->{authorised_value
} }
73 $template->param(locationsloop
=> $values);
76 foreach my $num (@getoverdues) {
78 my $dt = dt_from_string
($num->{date_due
}, 'sql');
79 $overdueforbranch{'date_due'} = output_pref
($dt);
80 $overdueforbranch{'title'} = $num->{'title'};
81 $overdueforbranch{'subtitle'} = $num->{'subtitle'};
82 $overdueforbranch{'medium'} = $num->{'medium'};
83 $overdueforbranch{'part_number'} = $num->{'part_number'};
84 $overdueforbranch{'part_name'} = $num->{'part_name'};
85 $overdueforbranch{'description'} = $num->{'description'};
86 $overdueforbranch{'barcode'} = $num->{'barcode'};
87 $overdueforbranch{'biblionumber'} = $num->{'biblionumber'};
88 $overdueforbranch{'author'} = $num->{'author'};
89 $overdueforbranch{'borrowersurname'} = $num->{'surname'};
90 $overdueforbranch{'borrowerfirstname'} = $num->{'firstname'};
91 $overdueforbranch{'borrowerphone'} = $num->{'phone'};
92 $overdueforbranch{'borroweremail'} = $num->{'email'};
93 $overdueforbranch{'homebranch'} = $num->{'homebranch'};
94 $overdueforbranch{'itemcallnumber'} = $num->{'itemcallnumber'};
95 $overdueforbranch{'borrowernumber'} = $num->{'borrowernumber'};
96 $overdueforbranch{'itemnumber'} = $num->{'itemnumber'};
97 $overdueforbranch{'cardnumber'} = $num->{'cardnumber'};
99 push( @overduesloop, \
%overdueforbranch );
102 # initiate the templates for the overdueloop
104 overduesloop
=> \
@overduesloop,
105 location
=> $location,
108 # Checking if there is a Fast Cataloging Framework
109 $template->param( fast_cataloging
=> 1 ) if Koha
::BiblioFrameworks
->find( 'FA' );
111 output_html_with_http_headers
$input, $cookie, $template->output;