Bug 5103: (follow-up) Using mapped item fields instead of hardcoding subfields

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
This commit is contained in:
Aleisha Amohia 2020-03-11 03:08:12 +00:00 committed by Joy Nelson
parent 16d756791e
commit 37de3685a4
3 changed files with 19 additions and 5 deletions

View File

@ -289,8 +289,12 @@ foreach my $field (@fields) {
$norequests = 0 if $tagslib->{ $field->tag() }->{ $subf[$i][0] }->{kohafield} eq 'items.notforloan' and $subf[$i][1] == 0;
if ( $subf[$i][0] eq 'd' || $subf[$i][0] eq 'q' || $subf[$i][0] eq 'r' || $subf[$i][0] eq 's' || $subf[$i][0] eq 'w' ){
# date accessioned || on loan || date last seen || date last borrowed || replacement price date
if ( $tagslib->{ $field->tag() }->{ $subf[$i][0] }->{kohafield} eq 'items.dateaccessioned' ||
$tagslib->{ $field->tag() }->{ $subf[$i][0] }->{kohafield} eq 'items.onloan' ||
$tagslib->{ $field->tag() }->{ $subf[$i][0] }->{kohafield} eq 'items.datelastseen' ||
$tagslib->{ $field->tag() }->{ $subf[$i][0] }->{kohafield} eq 'items.datelastborrowed' ||
$tagslib->{ $field->tag() }->{ $subf[$i][0] }->{kohafield} eq 'items.replacementpricedate'
){
$item->{$subf[$i][0]} = output_pref({ dt => dt_from_string( $item->{$subf[$i][0]} ), dateonly => 1 });
}
}

View File

@ -861,7 +861,13 @@ for my $row ( @big_array ) {
} else {
$item_field->{field} = '';
}
if ( $key eq 'd' || $key eq 'q' || $key eq 'r' || $key eq 's' || $key eq 'w' ){
my ($tmpa, $dateaccessioned) = &GetMarcFromKohaField( "items.dateaccessioned" );
my ($tmpb, $onloan) = &GetMarcFromKohaField( "items.onloan" );
my ($tmpc, $datelastseen) = &GetMarcFromKohaField( "items.datelastseen" );
my ($tmpd, $datelastborrowed) = &GetMarcFromKohaField( "items.datelastborrowed" );
my ($tmpe, $replacementpricedate) = &GetMarcFromKohaField( "items.replacementpricedate" );
if ( $key eq $dateaccessioned || $key eq $onloan || $key eq $datelastseen || $key eq $datelastborrowed || $key eq $replacementpricedate ){
# date accessioned || on loan || date last seen || date last borrowed || replacement price date
$item_field->{field} = output_pref({ dt => dt_from_string( $row->{$key} ), dateonly => 1 });
}

View File

@ -313,8 +313,12 @@ foreach my $field (@fields) {
$subf[$i][1], '', $tagslib, '', 'opac' );
}
if ( $subf[$i][0] eq 'd' || $subf[$i][0] eq 'q' || $subf[$i][0] eq 'r' || $subf[$i][0] eq 's' || $subf[$i][0] eq 'w' ){
# date accessioned || on loan || date last seen || date last borrowed || replacement price date
if ( $tagslib->{ $field->tag() }->{ $subf[$i][0] }->{kohafield} eq 'items.dateaccessioned' ||
$tagslib->{ $field->tag() }->{ $subf[$i][0] }->{kohafield} eq 'items.onloan' ||
$tagslib->{ $field->tag() }->{ $subf[$i][0] }->{kohafield} eq 'items.datelastseen' ||
$tagslib->{ $field->tag() }->{ $subf[$i][0] }->{kohafield} eq 'items.datelastborrowed' ||
$tagslib->{ $field->tag() }->{ $subf[$i][0] }->{kohafield} eq 'items.replacementpricedate'
){
$item->{$subf[$i][0]} = output_pref({ dt => dt_from_string( $item->{$subf[$i][0]} ), dateonly => 1 });;
}
}