Bugzilla – Attachment 125351 Details for
Bug 27461
Fix field 008 length below 40 positions in cataloguing plugin
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 27461: Right pad with default elements for too short 008s
Bug-27461-Right-pad-with-default-elements-for-too-.patch (text/plain), 3.39 KB, created by
Martin Renvoize (ashimema)
on 2021-09-27 09:51:29 UTC
(
hide
)
Description:
Bug 27461: Right pad with default elements for too short 008s
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2021-09-27 09:51:29 UTC
Size:
3.39 KB
patch
obsolete
>From c6d93978c69c2e90f1a7a66737b29ae4cdede092 Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Thu, 19 Aug 2021 13:43:48 +0000 >Subject: [PATCH] Bug 27461: Right pad with default elements for too short 008s > >Note that we treat the elements 18-34 as one block of elements, >since its subdivision may vary. >E.g. if you pass 24 characters to the form, it will use the first >18 chars (until the last complete element) and pad with default >elements from position 18-39. > >Test plan: >[1] Go to addbiblio. Make sure that 008 is connected to the plugin. >[2] Backspace field 008 a bit, click on the plugin button. >[3] Verify that the last elements come from the default. >[4] Repeat for a few different lengths. > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Signed-off-by: Phil Ringnalda <phil@chetcolibrary.org> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > cataloguing/value_builder/marc21_field_008.pl | 4 +++- > .../value_builder/marc21_field_008.tt | 16 ++++++++++++++++ > 2 files changed, 19 insertions(+), 1 deletion(-) > >diff --git a/cataloguing/value_builder/marc21_field_008.pl b/cataloguing/value_builder/marc21_field_008.pl >index 060715afcfa..08b1540f69e 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 202dac95eb2..b30076da74e 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<position.length; j++ ) { >+ if( myfield.length < position[j] ) break; >+ } >+ if( j == 0 ) { >+ return defaultvalue; >+ } else if( j < position.length ) { >+ return myfield.substring( 0, position[j-1] ) + defaultvalue.substring( position[j-1] ); >+ } >+ return myfield; >+ } > </script> > [% END %] > >-- >2.20.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 27461
:
115247
|
115248
|
123973
|
123974
|
123975
|
124433
|
124434
|
124435
|
125349
|
125350
| 125351