Bug 14365 - Populate never used saved_sql column last_run when execute_query is called
[koha.git] / reports / itemslost.pl
index b84dbc5..00f2b99 100755 (executable)
@@ -34,8 +34,7 @@ use C4::Output;
 use C4::Biblio;
 use C4::Items;
 use C4::Koha;                  # GetItemTypes
-use C4::Branch; # GetBranches
-use C4::Dates qw/format_date/;
+use Koha::DateUtils;
 
 my $query = new CGI;
 my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
@@ -68,8 +67,10 @@ if ( $get_items ) {
 
     my $items = GetLostItems( \%where );
     foreach my $it (@$items) {
-        $it->{'datelastseen'} = format_date($it->{'datelastseen'});
+        $it->{'datelastseen'} = eval { output_pref( { dt => dt_from_string( $it->{'datelastseen'} ), dateonly => 1 }); }
+                   if ( $it->{'datelastseen'} );
     }
+
     $template->param(
                      total       => scalar @$items,
                      itemsloop   => $items,
@@ -78,17 +79,13 @@ if ( $get_items ) {
                  );
 }
 
-# getting all branches.
-#my $branches = GetBranches;
-#my $branch   = C4::Context->userenv->{"branchname"};
-
 # getting all itemtypes
 my $itemtypes = &GetItemTypes();
 my @itemtypesloop;
-foreach my $thisitemtype ( sort {$itemtypes->{$a}->{description} cmp $itemtypes->{$b}->{description}} keys %$itemtypes ) {
+foreach my $thisitemtype ( sort {$itemtypes->{$a}->{translated_description} cmp $itemtypes->{$b}->{translated_description}} keys %$itemtypes ) {
     my %row = (
         value       => $thisitemtype,
-        description => $itemtypes->{$thisitemtype}->{'description'},
+        description => $itemtypes->{$thisitemtype}->{'translated_description'},
     );
     push @itemtypesloop, \%row;
 }
@@ -96,7 +93,7 @@ foreach my $thisitemtype ( sort {$itemtypes->{$a}->{description} cmp $itemtypes-
 # get lost statuses
 my $lost_status_loop = C4::Koha::GetAuthorisedValues( 'LOST' );
 
-$template->param( branchloop     => GetBranchesLoop(C4::Context->userenv->{'branch'}),
+$template->param(
                   itemtypeloop   => \@itemtypesloop,
                   loststatusloop => $lost_status_loop,
 );