- $size--;
- while ( my $row = $sth->fetchrow_hashref ) {
- $offset-- if ($offset);
- $row->{datelastseen}=format_date($row->{datelastseen});
- if ( ( !$offset ) && $size ) {
- push @results, $row;
- $size--;
+ my $tmpresults = $sth->fetchall_arrayref({});
+ $sth = $dbh->prepare("SELECT FOUND_ROWS()");
+ $sth->execute();
+ my ($iTotalRecords) = $sth->fetchrow_array();
+
+ foreach my $row (@$tmpresults) {
+ $row->{datelastseen} = format_date( $row->{datelastseen} );
+
+ # Auth values
+ foreach (keys %$row) {
+ # If the koha field is mapped to a marc field
+ my ($f, $sf) = GetMarcFromKohaField("items.$_", $row->{'frameworkcode'});
+ if ($f and $sf) {
+ # We replace the code with it's description
+ my $authvals = C4::Koha::GetKohaAuthorisedValuesFromField($f, $sf, $row->{'frameworkcode'});
+ $row->{$_} = $authvals->{$row->{$_}} if defined $authvals->{$row->{$_}};
+ }