3 # This file is part of Koha.
5 # Koha is free software; you can redistribute it and/or modify it under the
6 # terms of the GNU General Public License as published by the Free Software
7 # Foundation; either version 2 of the License, or (at your option) any later
10 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
11 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
12 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License along with
15 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
16 # Suite 330, Boston, MA 02111-1307 USA
21 This script displays lost items.
33 use C4
::Koha
; # GetItemTypes
34 use C4
::Branch
; # GetBranches
35 use C4
::Dates qw
/format_date/;
38 my ( $template, $loggedinuser, $cookie ) = get_template_and_user
(
40 template_name
=> "reports/itemslost.tmpl",
44 flagsrequired
=> { reports
=> '*' },
49 my $params = $query->Vars;
50 my $get_items = $params->{'get_items'};
53 my $orderbyfilter = $params->{'orderbyfilter'} || undef;
54 my $branchfilter = $params->{'branchfilter'} || undef;
55 my $barcodefilter = $params->{'barcodefilter'} || undef;
56 my $itemtypesfilter = $params->{'itemtypesfilter'} || undef;
57 my $loststatusfilter = $params->{'loststatusfilter'} || undef;
60 $where{'homebranch'} = $branchfilter if defined $branchfilter;
61 $where{'barcode'} = $barcodefilter if defined $barcodefilter;
62 $where{'authorised_value'} = $loststatusfilter if defined $loststatusfilter;
64 my $itype = C4
::Context
->preference('item-level_itypes') ?
"itype" : "itemtype";
65 $where{$itype} = $itemtypesfilter if defined $itemtypesfilter;
67 my $items = GetLostItems
( \
%where, $orderbyfilter );
68 foreach my $it (@
$items) {
69 $it->{'datelastseen'} = format_date
($it->{'datelastseen'});
72 total
=> scalar @
$items,
74 get_items
=> $get_items,
75 itype_level
=> C4
::Context
->preference('item-level_itypes'),
79 # getting all branches.
80 #my $branches = GetBranches;
81 #my $branch = C4::Context->userenv->{"branchname"};
83 # getting all itemtypes
84 my $itemtypes = &GetItemTypes
();
86 foreach my $thisitemtype ( sort {$itemtypes->{$a}->{description
} cmp $itemtypes->{$b}->{description
}} keys %$itemtypes ) {
88 value
=> $thisitemtype,
89 description
=> $itemtypes->{$thisitemtype}->{'description'},
91 push @itemtypesloop, \
%row;
95 my $lost_status_loop = C4
::Koha
::GetAuthorisedValues
( 'LOST' );
97 $template->param( branchloop
=> GetBranchesLoop
(C4
::Context
->userenv->{'branch'}),
98 itemtypeloop
=> \
@itemtypesloop,
99 loststatusloop
=> $lost_status_loop,
102 # writing the template
103 output_html_with_http_headers
$query, $cookie, $template->output;