Bug 27855: Implement Koha::Patron::Attribute->to_api_mapping
[srvgit] / opac / opac-MARCdetail.pl
index 545af32..39cb10e 100755 (executable)
@@ -63,6 +63,7 @@ use Koha::Items;
 use Koha::ItemTypes;
 use Koha::Patrons;
 use Koha::RecordProcessor;
+use Koha::DateUtils;
 
 my $query = CGI->new();
 
@@ -154,7 +155,6 @@ if (C4::Context->preference("RequestOnOpac")) {
 
 # fill arrays
 my @loop_data = ();
-my $tag;
 
 # loop through each tab 0 through 9
 for ( my $tabloop = 0 ; $tabloop <= 9 ; $tabloop++ ) {
@@ -290,6 +290,7 @@ foreach my $field (@fields) {
         my $sf_def = $tagslib->{ $field->tag() }->{ $subf[$i][0] };
         next if ( ($sf_def->{tab}||0) != 10 );
         next if ( ($sf_def->{hidden}||0) > 0 );
+
         push @item_subfield_codes, $subf[$i][0];
         $witness{ $subf[$i][0] } = $sf_def->{lib};
 
@@ -310,6 +311,12 @@ foreach my $field (@fields) {
             $item->{ $subf[$i][0] } .= GetAuthorisedValueDesc( $field->tag(), $subf[$i][0],
                 $subf[$i][1], '', $tagslib, '', 'opac' );
         }
+
+        my $kohafield = $tagslib->{ $field->tag() }->{ $subf[$i][0] }->{kohafield};
+        $item->{ $subf[$i][0] } = output_pref( { str => $item->{ $subf[$i][0] }, dateonly => 1 } )
+          if grep { $kohafield eq $_ }
+              qw( items.dateaccessioned items.onloan items.datelastseen items.datelastborrowed items.replacementpricedate );
+
     }
     push @item_loop, $item if $item;
 }