From bdc5ff98a40f5aa88c310052a017b2ca98dd802c Mon Sep 17 00:00:00 2001 From: Paul Poulain Date: Thu, 7 Apr 2011 17:15:53 +0200 Subject: [PATCH] Bug 6106: 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. Signed-off-by: Katrin Fischer Signed-off-by: Chris Cormack (cherry picked from commit e5ff05857e5b99ab19210bc272086f253ea9404b) Signed-off-by: Chris Nighswonger --- C4/Biblio.pm | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/C4/Biblio.pm b/C4/Biblio.pm index 034273f435..7eac9a7780 100755 --- a/C4/Biblio.pm +++ b/C4/Biblio.pm @@ -2371,6 +2371,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} = ""; } -- 2.39.5