From 7450abe5c5bdc61010f2a5a8da0aee880393e319 Mon Sep 17 00:00:00 2001 From: Paul Poulain Date: Thu, 7 Apr 2011 10:54:45 +0200 Subject: [PATCH] BZ6106: add item not respecting framework in acq The PrepareItemrecordDisplay sub builds an item framework for later use in ACQ Some cases were missing : item subfield connected to a plugin, hidden subfield, long size subfield. --- C4/Biblio.pm | 34 ++++++++++++++++++++++++++++++++++ 1 files changed, 34 insertions(+), 0 deletions(-) diff --git a/C4/Biblio.pm b/C4/Biblio.pm index 75e9a3d..66dbf26 100644 --- a/C4/Biblio.pm +++ b/C4/Biblio.pm @@ -2465,6 +2465,40 @@ sub PrepareItemrecordDisplay { -tabindex => '', -multiple => 0, ); + } elsif ( $tagslib->{$tag}->{$subfield}->{value_builder} ) { + # opening plugin + my $plugin = C4::Context->intranetdir . "/cataloguing/value_builder/" . $tagslib->{$tag}->{$subfield}->{'value_builder'}; + if (do $plugin) { + my $temp; + my $extended_param = plugin_parameters( $dbh, $temp, $tagslib, $subfield_data{id}, undef ); + my ( $function_name, $javascript ) = plugin_javascript( $dbh, $temp, $tagslib, $subfield_data{id}, undef ); + $subfield_data{random} = int(rand(1000000)); # why do we need 2 different randoms? + my $index_subfield = int(rand(1000000)); + $subfield_data{id} = "tag_".$tag."_subfield_".$subfield."_".$index_subfield; + $subfield_data{marc_value} = qq[ + ... + $javascript]; + } else { + warn "Plugin Failed: $plugin"; + $subfield_data{marc_value} = qq(); # supply default input form + } + } + elsif ( $tag eq '' ) { # it's an hidden field + $subfield_data{marc_value} = qq(); + } + elsif ( $tagslib->{$tag}->{$subfield}->{'hidden'} ) { # FIXME: shouldn't input type be "hidden" ? + $subfield_data{marc_value} = qq(); + } + elsif ( length($defaultvalue) > 100 + or (C4::Context->preference("marcflavour") eq "UNIMARC" and + 300 <= $tag && $tag < 400 && $subfield eq 'a' ) + or (C4::Context->preference("marcflavour") eq "MARC21" and + 500 <= $tag && $tag < 600 ) + ) { + # oversize field (textarea) + $subfield_data{marc_value} = qq(\n"); } else { $subfield_data{marc_value} = ""; } -- 1.7.1