From 70604606f5d586a1d88ae07bf56bf764e4f95e54 Mon Sep 17 00:00:00 2001 From: Dobrica Pavlinusic Date: Fri, 25 Mar 2011 23:02:01 +0100 Subject: [PATCH] Bug #5955 - value_builder support for PrepareItemrecordDisplay --- C4/Biblio.pm | 25 +++++++++++++++++++++++++ 1 files changed, 25 insertions(+), 0 deletions(-) diff --git a/C4/Biblio.pm b/C4/Biblio.pm index 1b378df..f9a19dd 100644 --- a/C4/Biblio.pm +++ b/C4/Biblio.pm @@ -2376,6 +2376,31 @@ 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'}; + my $id = "tag_".$tag."_subfield_".$subfield; + my $attributes = " id=\"$id\" type=\"text\" name=\"field_value\" value=\"$defaultvalue\" size=\"50\" maxlength=\"255\" "; + if (do $plugin) { + my $temp; + my $loop_data; + my $random = int(rand(1000000)); + my $extended_param = plugin_parameters( $dbh, $temp, $tagslib, $id, $loop_data ); + my ( $function_name, $javascript ) = plugin_javascript( $dbh, $temp, $tagslib, $id, $loop_data ); + my $change = index($javascript, 'function Change') > -1 ? + "return Change$function_name($random, '$id');" : + 'return 1;'; + $subfield_data{marc_value} = qq[ + ... + $javascript]; + } else { + warn "Plugin Failed: $plugin"; + $subfield_data{marc_value} = ""; # supply default input form + } } else { $subfield_data{marc_value} = ""; } -- 1.7.2.5