From 729c69edbc3a31e1f9e4f5eb7b8bc05afd64b5e0 Mon Sep 17 00:00:00 2001 From: Julian Maurice Date: Tue, 18 Jan 2022 14:36:34 +0100 Subject: [PATCH] Bug 30604: Add value builders for UNIMARC 146 ($a, $h and $i) Content-Type: text/plain; charset=utf-8 Test plan: 1. Configure the default MARC framework to use those value builders: - unimarc_field_146a for 146$a - unimarc_field_146h for 146$h - unimarc_field_146i for 146$i 2. Verify that they all work correctly according to https://www.ifla.org/files/assets/uca/unimarc_updates/BIBLIOGRAPHIC/u-b_146.pdf Signed-off-by: David Nind Signed-off-by: Marcel de Rooy --- .../value_builder/unimarc_field_146a.pl | 71 +++++++++++++++ .../value_builder/unimarc_field_146h.pl | 89 +++++++++++++++++++ .../value_builder/unimarc_field_146i.pl | 89 +++++++++++++++++++ .../value_builder/unimarc_field_146a.tt | 47 ++++++++++ .../value_builder/unimarc_field_146h.tt | 58 ++++++++++++ .../value_builder/unimarc_field_146i.tt | 58 ++++++++++++ 6 files changed, 412 insertions(+) create mode 100755 cataloguing/value_builder/unimarc_field_146a.pl create mode 100755 cataloguing/value_builder/unimarc_field_146h.pl create mode 100755 cataloguing/value_builder/unimarc_field_146i.pl create mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_146a.tt create mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_146h.tt create mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_146i.tt diff --git a/cataloguing/value_builder/unimarc_field_146a.pl b/cataloguing/value_builder/unimarc_field_146a.pl new file mode 100755 index 0000000000..51f0861325 --- /dev/null +++ b/cataloguing/value_builder/unimarc_field_146a.pl @@ -0,0 +1,71 @@ +#!/usr/bin/perl + +# This file is part of Koha. +# +# Koha is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# Koha is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Koha; if not, see . + +use Modern::Perl; + +use C4::Auth qw( get_template_and_user ); +use C4::Output qw( output_html_with_http_headers ); + +use Koha::I18N; + +my $builder = sub { + my $params = shift; + my $id = $params->{id}; + + return qq| +|; +}; + +my $launcher = sub { + my $params = shift; + my $cgi = $params->{cgi}; + my ( $template, $loggedinuser, $cookie ) = get_template_and_user({ + template_name => "cataloguing/value_builder/unimarc_field_146a.tt", + query => $cgi, + type => 'intranet', + flagsrequired => { editcatalogue => '*' }, + }); + + my @options = ( + { value => 'a', label => __('vocal a cappella music') }, + { value => 'b', label => __('instrumental music') }, + { value => 'c', label => __('vocal and instrumental music') }, + { value => 'd', label => __('electroacoustic music') }, + { value => 'e', label => __('mixed media music (electroacoustic and other media)') }, + { value => 'u', label => __('undefined, variable (e.g. Renaissance vocal or instrumental music)') }, + { value => 'z', label => __('other (e.g. ordinary objects or natural sounds)') }, + ); + + $template->param( + id => scalar $cgi->param('id'), + value => scalar $cgi->param('value'), + options => \@options, + ); + output_html_with_http_headers $cgi, $cookie, $template->output; +}; + +return { builder => $builder, launcher => $launcher }; diff --git a/cataloguing/value_builder/unimarc_field_146h.pl b/cataloguing/value_builder/unimarc_field_146h.pl new file mode 100755 index 0000000000..84ad417b1a --- /dev/null +++ b/cataloguing/value_builder/unimarc_field_146h.pl @@ -0,0 +1,89 @@ +#!/usr/bin/perl + +# This file is part of Koha. +# +# Koha is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# Koha is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Koha; if not, see . + +use Modern::Perl; + +use C4::Auth qw( get_template_and_user ); +use C4::Output qw( output_html_with_http_headers ); + +use Koha::I18N; + +my $builder = sub { + my $params = shift; + my $id = $params->{id}; + + return qq| +|; +}; + +my $launcher = sub { + my $params = shift; + my $cgi = $params->{cgi}; + my ( $template, $loggedinuser, $cookie ) = get_template_and_user({ + template_name => "cataloguing/value_builder/unimarc_field_146h.tt", + query => $cgi, + type => 'intranet', + flagsrequired => { editcatalogue => '*' }, + }); + + my @options = ( + { value => 'a', label => __('performers total') }, + { value => 'b', label => __('brass instruments') }, + { value => 'c', label => __('choirs') }, + { value => 'd', label => __('wind instruments') }, + { value => 'e', label => __('electro-acoustic instruments') }, + { value => 'i', label => __('instruments total') }, + { value => 'j', label => __('solo instruments') }, + { value => 'k', label => __('keyboard instruments') }, + { value => 'l', label => __('solo voices') }, + { value => 'm', label => __('miscellaneous, other instruments') }, + { value => 'o', label => __('orchestras') }, + { value => 'p', label => __('percussion instruments') }, + { value => 'q', label => __('conductors') }, + { value => 's', label => __('bowed string instruments') }, + { value => 't', label => __('plucked string instruments') }, + { value => 'v', label => __('voices total') }, + { value => 'w', label => __('woodwind instruments') }, + { value => 'x', label => __('choral voices') }, + { value => 'y', label => __('ensemble instruments') }, + { value => 'z', label => __('devices, other performers') }, + ); + + my $value = $cgi->param('value'); + my $number = substr($value, 0, 3); + my $category = substr($value, 3, 1); + + $template->param( + id => scalar $cgi->param('id'), + number => $number, + category => $category, + options => \@options, + ); + output_html_with_http_headers $cgi, $cookie, $template->output; +}; + +return { builder => $builder, launcher => $launcher }; diff --git a/cataloguing/value_builder/unimarc_field_146i.pl b/cataloguing/value_builder/unimarc_field_146i.pl new file mode 100755 index 0000000000..609218db4e --- /dev/null +++ b/cataloguing/value_builder/unimarc_field_146i.pl @@ -0,0 +1,89 @@ +#!/usr/bin/perl + +# This file is part of Koha. +# +# Koha is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# Koha is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Koha; if not, see . + +use Modern::Perl; + +use C4::Auth qw( get_template_and_user ); +use C4::Output qw( output_html_with_http_headers ); + +use Koha::I18N; + +my $builder = sub { + my $params = shift; + my $id = $params->{id}; + + return qq| +|; +}; + +my $launcher = sub { + my $params = shift; + my $cgi = $params->{cgi}; + my ( $template, $loggedinuser, $cookie ) = get_template_and_user({ + template_name => "cataloguing/value_builder/unimarc_field_146i.tt", + query => $cgi, + type => 'intranet', + flagsrequired => { editcatalogue => '*' }, + }); + + my @options = ( + { value => 'a', label => __('performers total') }, + { value => 'b', label => __('brass instruments') }, + { value => 'c', label => __('choirs') }, + { value => 'd', label => __('wind instruments') }, + { value => 'e', label => __('electro-acoustic instruments') }, + { value => 'i', label => __('instruments total') }, + { value => 'j', label => __('solo instruments') }, + { value => 'k', label => __('keyboard instruments') }, + { value => 'l', label => __('solo voices') }, + { value => 'm', label => __('miscellaneous, other instruments') }, + { value => 'o', label => __('orchestras') }, + { value => 'p', label => __('percussion instruments') }, + { value => 'q', label => __('conductors') }, + { value => 's', label => __('bowed string instruments') }, + { value => 't', label => __('plucked string instruments') }, + { value => 'v', label => __('voices total') }, + { value => 'w', label => __('woodwind instruments') }, + { value => 'x', label => __('choral voices') }, + { value => 'y', label => __('ensemble instruments') }, + { value => 'z', label => __('devices, other performers') }, + ); + + my $value = $cgi->param('value'); + my $number = substr($value, 0, 3); + my $category = substr($value, 3, 1); + + $template->param( + id => scalar $cgi->param('id'), + number => $number, + category => $category, + options => \@options, + ); + output_html_with_http_headers $cgi, $cookie, $template->output; +}; + +return { builder => $builder, launcher => $launcher }; diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_146a.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_146a.tt new file mode 100644 index 0000000000..4e0b5d021c --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_146a.tt @@ -0,0 +1,47 @@ +[% INCLUDE 'doc-head-open.inc' %] +Framework plugin unimarc_field_146a › Cataloguing › Koha +[% INCLUDE 'doc-head-close.inc' %] + + + +
+

Framework plugin for UNIMARC 146$a

+ +
+ + +
+ +
+ +
+
+ +
+
+ + Cancel +
+
+
+
+ + + +[% INCLUDE 'popup-bottom.inc' %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_146h.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_146h.tt new file mode 100644 index 0000000000..a8c736ddda --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_146h.tt @@ -0,0 +1,58 @@ +[% INCLUDE 'doc-head-open.inc' %] +Framework plugin unimarc_field_146h › Cataloguing › Koha +[% INCLUDE 'doc-head-close.inc' %] + + + +
+

Framework plugin for UNIMARC 146$h

+ +
+ + +
+ +
+ +

+ A number between 0 and 999 (inclusive) +

+
+
+
+ +
+ +
+
+ +
+
+ + Cancel +
+
+
+
+ + + +[% INCLUDE 'popup-bottom.inc' %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_146i.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_146i.tt new file mode 100644 index 0000000000..189219b0bd --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_146i.tt @@ -0,0 +1,58 @@ +[% INCLUDE 'doc-head-open.inc' %] +Framework plugin unimarc_field_146i › Cataloguing › Koha +[% INCLUDE 'doc-head-close.inc' %] + + + +
+

Framework plugin for UNIMARC 146$i

+ +
+ + +
+ +
+ +

+ A number between 0 and 999 (inclusive) +

+
+
+
+ +
+ +
+
+ +
+
+ + Cancel +
+
+
+
+ + + +[% INCLUDE 'popup-bottom.inc' %] -- 2.20.1