-# insert "wrongplace" to all scanned items that are not supposed to be in this range
-# note this list is always displayed, whatever the librarian has choosen for comparison
-my $moddatecount = 0;
-foreach my $item ( @scanned_items ) {
-
- # Saving notforloan code before it's replaced by it's authorised value for later comparison
- $item->{notforloancode} = $item->{notforloan};
-
- # Populating with authorised values
- foreach my $field ( keys %$item ) {
- # If the koha field is mapped to a marc field
- my $fc = $item->{'frameworkcode'} || '';
- my ($f, $sf) = GetMarcFromKohaField("items.$field", $fc);
- if ($f and $sf) {
- # We replace the code with it's description
- my $authvals = C4::Koha::GetKohaAuthorisedValuesFromField($f, $sf, $fc);
- if ($authvals and defined $item->{$field} and defined $authvals->{$item->{$field}}) {
- $item->{$field} = $authvals->{$item->{$field}};
- }
+ $item->{notforloancode} = $item->{notforloan}; # save for later use
+ my $fc = $item->{'frameworkcode'} || '';
+
+ # Populating with authorised values description
+ foreach my $field (qw/ location notforloan itemlost damaged withdrawn /) {
+ my $av = Koha::AuthorisedValues->get_description_by_koha_field(
+ { frameworkcode => $fc, kohafield => "items.$field", authorised_value => $item->{$field} } );
+ if ( $av and defined $item->{$field} and defined $av->{lib} ) {
+ $item->{$field} = $av->{lib};