diff --git a/cataloguing/value_builder/marc21_field_008.pl b/cataloguing/value_builder/marc21_field_008.pl index 060715afcf..08b1540f69 100755 --- a/cataloguing/value_builder/marc21_field_008.pl +++ b/cataloguing/value_builder/marc21_field_008.pl @@ -67,8 +67,9 @@ my $launcher = sub { my ( $params ) = @_; my $input = $params->{cgi}; + my $default008 = biblio_008(); my $index = $input->param('index'); - my $result = $input->param('result') || biblio_008(); + my $result = $input->param('result') || $default008; my $leader = $input->param('leader'); my $material_configuration; @@ -148,6 +149,7 @@ my $launcher = sub { result => $result, errorXml => $errorXml, material_configuration => $material_configuration, + default008 => $default008, ); output_html_with_http_headers $input, $cookie, $template->output; }; diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/marc21_field_008.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/marc21_field_008.tt index 202dac95eb..b30076da74 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/marc21_field_008.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/marc21_field_008.tt @@ -62,6 +62,8 @@ var h4_result; function loadXmlValues(){ + $("#result").val( fix_field_008( $("#result").val() ) ); // fix field before loading elements + [% IF ( errorXml ) %] alert("[% errorXml | html %]"); [% ELSE %] @@ -94,6 +96,20 @@ return false; } + function fix_field_008( myfield ) { + // If field length < 40, append from default008 starting at last complete data element + + var j, position = [ 6, 7, 11, 15, 18, 35, 38, 39, 40 ], defaultvalue = '[% default008 | $raw %]'; + for( j=0; j [% END %]