3 # Copyright Liblime 2007
4 # Copyright Biblibre 2009
6 # This file is part of Koha.
8 # Koha is free software; you can redistribute it and/or modify it
9 # under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 3 of the License, or
11 # (at your option) any later version.
13 # Koha is distributed in the hope that it will be useful, but
14 # WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with Koha; if not, see <http://www.gnu.org/licenses>.
24 This script displays lost items.
39 my ( $template, $loggedinuser, $cookie ) = get_template_and_user
(
41 template_name
=> "reports/itemslost.tt",
45 flagsrequired
=> { reports
=> '*' },
50 my $params = $query->Vars;
51 my $get_items = $params->{'get_items'};
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 );
68 foreach my $it (@
$items) {
69 $it->{'datelastseen'} = eval { output_pref
( { dt
=> dt_from_string
( $it->{'datelastseen'} ), dateonly
=> 1 }); }
70 if ( $it->{'datelastseen'} );
74 total
=> scalar @
$items,
76 get_items
=> $get_items,
77 itype_level
=> C4
::Context
->preference('item-level_itypes'),
81 # getting all itemtypes
82 my $itemtypes = Koha
::ItemTypes
->search_with_localization;
85 my $lost_status_loop = C4
::Koha
::GetAuthorisedValues
( 'LOST' );
88 itemtypes
=> $itemtypes,
89 loststatusloop
=> $lost_status_loop,
92 # writing the template
93 output_html_with_http_headers
$query, $cookie, $template->output;