Bugzilla – Attachment 123973 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: Move hardcoded value to module
Bug-27461-Move-hardcoded-value-to-module.patch (text/plain), 4.03 KB, created by
Marcel de Rooy
on 2021-08-19 13:56:25 UTC
(
hide
)
Description:
Bug 27461: Move hardcoded value to module
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2021-08-19 13:56:25 UTC
Size:
4.03 KB
patch
obsolete
>From b223b833b1c103bafa84a9de868c18a5cdcb68db Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Thu, 19 Aug 2021 09:52:14 +0000 >Subject: [PATCH] Bug 27461: Move hardcoded value to module >Content-Type: text/plain; charset=utf-8 > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > Koha/Util/FrameworkPlugin.pm | 22 ++++++++++++++- > cataloguing/value_builder/marc21_field_008.pl | 28 ++++--------------- > 2 files changed, 27 insertions(+), 23 deletions(-) > >diff --git a/Koha/Util/FrameworkPlugin.pm b/Koha/Util/FrameworkPlugin.pm >index d3fcbb9ac8..bc2c8dabd5 100644 >--- a/Koha/Util/FrameworkPlugin.pm >+++ b/Koha/Util/FrameworkPlugin.pm >@@ -22,11 +22,13 @@ package Koha::Util::FrameworkPlugin; > > use Modern::Perl; > >+use constant DEFAULT_008_POS_6_39 => 'b |||||||| |||| 00| 0 eng d'; >+ > our ( @ISA, @EXPORT_OK ); > BEGIN { > require Exporter; > @ISA = qw( Exporter ); >- @EXPORT_OK = qw( wrapper date_entered ); >+ @EXPORT_OK = qw( wrapper date_entered biblio_008 ); > } > > =head1 NAME >@@ -65,4 +67,22 @@ sub date_entered { > return substr($year,2,2).sprintf ("%0.2d", $mon).sprintf ("%0.2d",$mday); > } > >+=head2 biblio_008 >+ >+ Returns a default value for MARC21 field 008 for biblio records. >+ Depends on prefs DefaultCountryField008, DefaultLanguageField008. >+ >+=cut >+ >+sub biblio_008 { >+ my $result = date_entered() . DEFAULT_008_POS_6_39; >+ if( C4::Context->preference('DefaultCountryField008') ) { >+ substr( $result, 15, 3 ) = pack( "A3", C4::Context->preference('DefaultCountryField008') ); >+ } >+ if( C4::Context->preference('DefaultLanguageField008') ) { >+ substr( $result, 35, 3 ) = pack( "A3", C4::Context->preference('DefaultLanguageField008' ) ); >+ } >+ return $result; >+} >+ > 1; >diff --git a/cataloguing/value_builder/marc21_field_008.pl b/cataloguing/value_builder/marc21_field_008.pl >index 9f87ae393b..060715afcf 100755 >--- a/cataloguing/value_builder/marc21_field_008.pl >+++ b/cataloguing/value_builder/marc21_field_008.pl >@@ -28,29 +28,20 @@ use C4::Search; > use C4::Output qw( output_html_with_http_headers ); > > use XML::LibXML; >-use Koha::Util::FrameworkPlugin qw|date_entered|; >+use Koha::Util::FrameworkPlugin qw( biblio_008 ); > > my $builder = sub { > my ( $params ) = @_; > >- my $lang = C4::Context->preference('DefaultLanguageField008' ); >- $lang = "eng" unless $lang; >- $lang = pack("A3", $lang); >- my $country = C4::Context->preference('DefaultCountryField008'); >- $country = "|||" unless $country; >- $country = pack("A3", $country); >- > my $function_name = $params->{id}; >- my $dateentered = date_entered(); >+ my $default008 = biblio_008(); > my $res = " > <script> > > function Focus$function_name(event) { >- if ( document.getElementById(event.data.id).value ) { >- } >- else { >- document.getElementById(event.data.id).value='$dateentered' + 'b $country||||| |||| 00| 0 $lang d'; >- } >+ if( !document.getElementById(event.data.id).value ) { >+ document.getElementById(event.data.id).value='$default008'; >+ } > return 1; > } > >@@ -75,14 +66,9 @@ function Click$function_name(event) { > my $launcher = sub { > my ( $params ) = @_; > my $input = $params->{cgi}; >- my $lang = C4::Context->preference('DefaultLanguageField008' ); >- $lang = "eng" unless $lang; >- $lang = pack("A3", $lang); >- my $country = C4::Context->preference('DefaultCountryField008') // "xxu"; >- $country = pack("A3", $country); > > my $index = $input->param('index'); >- my $result = $input->param('result'); >+ my $result = $input->param('result') || biblio_008(); > my $leader = $input->param('leader'); > > my $material_configuration; >@@ -142,8 +128,6 @@ my $launcher = sub { > } > ); > >- my $dateentered = date_entered(); >- $result = "$dateentered" . "b $country||||| |||| 00| 0 $lang d" unless $result; > my $errorXml = ''; > # Check if the xml, xsd exists and is validated > my $dir = C4::Context->config('intrahtdocs') . '/prog/' . $template->{lang} . '/data/'; >-- >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