From 6863ca9e9245724ac417f13f91616662093d5d8f Mon Sep 17 00:00:00 2001 From: Henri-Damien LAURENT Date: Tue, 6 Oct 2009 14:27:15 +0200 Subject: [PATCH] Adding defaultvalues management in Serials Items management Previously, defaultvalues from items was not managed --- C4/Biblio.pm | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) 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 -- 2.39.5