X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=C4%2FBiblio.pm;h=2de61b52b809f1a026ed1f2445f5812284a2ce10;hb=6863ca9e9245724ac417f13f91616662093d5d8f;hp=566365d0c1c3696d9b4b35b92b86bcdc30d667a6;hpb=f33e65499b0d00637dc7627c6ead4f6849cc2a96;p=koha.git diff --git a/C4/Biblio.pm b/C4/Biblio.pm index 566365d0c1..2de61b52b8 100755 --- a/C4/Biblio.pm +++ b/C4/Biblio.pm @@ -2268,6 +2268,7 @@ sub PrepareItemrecordDisplay { my ( $bibnum, $itemnum, $defaultvalues ) = @_; my $dbh = C4::Context->dbh; + my $today_iso = C4::Dates->today('iso'); my $frameworkcode = &GetFrameworkCode( $bibnum ); my ( $itemtagfield, $itemtagsubfield ) = &GetMarcFromKohaField( "items.itemnumber", $frameworkcode ); @@ -2305,9 +2306,15 @@ sub PrepareItemrecordDisplay { if ($itemrecord) { ( $x, $value ) = _find_value( $tag, $subfield, $itemrecord ); } - if (!defined $value) { - $value = q||; - } + unless ($value) { + $value = $tagslib->{$tag}->{$subfield}->{defaultvalue}; + $value ||= $defaultvalues->{$tagslib->{$tag}->{$subfield}->{'kohafield'}}; + # get today date & replace YYYY, MM, DD if provided in the default value + my ( $year, $month, $day ) = split ',', $today_iso; # FIXME: iso dates don't have commas! + $value =~ s/YYYY/$year/g; + $value =~ s/MM/$month/g; + $value =~ s/DD/$day/g; + } $value =~ s/"/"/g; # search for itemcallnumber if applicable