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>.
20 #use warnings; FIXME - Bug 2505
30 use Koha
::BiblioFrameworks
;
33 =head1 branchoverdues.pl
35 this module is a new interface, allow to the librarian to check all items on overdues (based on the acountlines type 'FU' )
36 this interface is filtered by branches (automatically), and by location (optional) ....
41 my $dbh = C4
::Context
->dbh;
43 my ( $template, $loggedinuser, $cookie, $flags ) = get_template_and_user
({
44 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 $record = GetMarcBiblio
({ biblionumber
=> $num->{biblionumber
} });
80 $overdueforbranch{'subtitle'} = GetRecordValue
('subtitle',$record,'')->[0]->{subfield
};
82 my $dt = dt_from_string
($num->{date_due
}, 'sql');
83 $overdueforbranch{'date_due'} = output_pref
($dt);
84 $overdueforbranch{'title'} = $num->{'title'};
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;