=cut
sub GetISBDView {
- my $biblionumber = shift;
+ my ($biblionumber, $template) = @_;
my $record = GetMarcBiblio($biblionumber);
my $itemtype = &GetFrameworkCode($biblionumber);
my ($holdingbrtagf,$holdingbrtagsubf) = &GetMarcFromKohaField("items.holdingbranch",$itemtype);
my $tagsubf = $tag . $subfvalue;
$calculated =~
s/\{(.?.?.?.?)$tagsubf(.*?)\}/$1$subfieldvalue$2\{$1$tagsubf$2\}/g;
- $calculated =~s#/cgi-bin/koha/[^/]+/([^.]*.pl\?.*)$#opac-$1#g;
+ $calculated =~s#/cgi-bin/koha/[^/]+/([^.]*.pl\?.*)$#opac-$1#g if ($template eq "opac");
# field builded, store the result
if ( $calculated && !$hasputtextbefore )
$calculated =~
s/\{(.?.?.?.?)$tagsubf(.*?)\}/$1$subfieldvalue$2\{$1$tagsubf$2\}/g;
- $calculated =~s#/cgi-bin/koha/[^/]+/([^.]*.pl\?.*)$#opac-$1#g;
+ $calculated =~s#/cgi-bin/koha/[^/]+/([^.]*.pl\?.*)$#opac-$1#g if ($template eq "opac");
}
# field builded, store the result
my $prevtag = -1;
my $first = 1;
my $j = -1;
+ @$indicator=map{sprintf("%2s",$_) unless ( length($_)<2)}@$indicator;
for ( my $i = 0 ; $i < @$tags ; $i++ ) {
if (C4::Context->preference('marcflavour') eq 'UNIMARC' and @$tags[$i] eq "100" and @$subfields[$i] eq "a") {
# if we have a 100 field and it's values are not correct, skip them.
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 );
my $tagslib = &GetMarcStructure( 1, $frameworkcode );
my $itemrecord = C4::Items::GetMarcItem( $bibnum, $itemnum) if ($itemnum);
+ # FIXME : I'd rather have GetMarcBiblio called out of this.
+ # Since it gets the whole Biblio record for each item
+ my $marcrecord = GetMarcBiblio( $bibnum) if ($bibnum);
my @loop_data;
my $authorised_values_sth =
$dbh->prepare(
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
substr( C4::Context->preference('itemcallnumber'), 0, 3 );
my $CNsubfield =
substr( C4::Context->preference('itemcallnumber'), 3, 1 );
- my $temp = $itemrecord->field($CNtag) if ($itemrecord);
+ my $temp = $marcrecord->field($CNtag) if ($marcrecord);
if ($temp) {
$value = $temp->subfield($CNsubfield);
}