From cc78e1abcc6cfff7455c6171d5a341f41e7b4b8e Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Wed, 30 Aug 2023 14:53:01 +0000 Subject: [PATCH] Bug 34657: Merge cataloging plugins for UNIMARC 123d, e, f, and g This patch removes some UNIMARC cataloging plugins which were essentially duplicates of each other and renaming the remaining version to reflect that it's for use with multiple subfields. UNIMARC 123$d, e, f, and g can all be filled with unimarc_field_123defg.pl It's easiest to test if you have UNIMARC sample data. In KTD, run 'reset_all_unimarc' - Apply the patch and run the database update process. - Go to Cataloging and create or edit a bibliographic record. - Under tab 1, look for tag 123. - Test the plugin link for subfields d, e, f, and g - In each case the popup window should have the heading "UNIMARC field 123d/e/f/g builder" - Fill out the form each time and confirm that the values are copied to the correct field in the MARC editor window. --- ...field_123d.pl => unimarc_field_123defg.pl} | 4 +- .../value_builder/unimarc_field_123e.pl | 70 ---------------- .../value_builder/unimarc_field_123f.pl | 71 ----------------- .../value_builder/unimarc_field_123g.pl | 70 ---------------- ...ug-34657-update-unimarc-123defg-plugins.pl | 18 +++++ .../value_builder/unimarc_field_123d.tt | 78 ------------------ ...field_123e.tt => unimarc_field_123defg.tt} | 6 +- .../value_builder/unimarc_field_123f.tt | 79 ------------------- .../value_builder/unimarc_field_123g.tt | 79 ------------------- 9 files changed, 23 insertions(+), 452 deletions(-) rename cataloguing/value_builder/{unimarc_field_123d.pl => unimarc_field_123defg.pl} (90%) delete mode 100755 cataloguing/value_builder/unimarc_field_123e.pl delete mode 100755 cataloguing/value_builder/unimarc_field_123f.pl delete mode 100755 cataloguing/value_builder/unimarc_field_123g.pl create mode 100755 installer/data/mysql/atomicupdate/bug-34657-update-unimarc-123defg-plugins.pl delete mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_123d.tt rename koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/{unimarc_field_123e.tt => unimarc_field_123defg.tt} (94%) delete mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_123f.tt delete mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_123g.tt diff --git a/cataloguing/value_builder/unimarc_field_123d.pl b/cataloguing/value_builder/unimarc_field_123defg.pl similarity index 90% rename from cataloguing/value_builder/unimarc_field_123d.pl rename to cataloguing/value_builder/unimarc_field_123defg.pl index 0ca2f9c14c..2630fcc783 100755 --- a/cataloguing/value_builder/unimarc_field_123d.pl +++ b/cataloguing/value_builder/unimarc_field_123defg.pl @@ -35,7 +35,7 @@ my $res=" function Clic$function_name(event) { event.preventDefault(); defaultvalue=document.getElementById(event.data.id).value; - newin=window.open(\"../cataloguing/plugin_launcher.pl?plugin_name=unimarc_field_123g.pl&index=\" + event.data.id + \"&result=\"+defaultvalue,\"unimarc_field_123g\",'width=1000,height=375,toolbar=false,scrollbars=yes'); + newin=window.open(\"../cataloguing/plugin_launcher.pl?plugin_name=unimarc_field_123defg.pl&index=\" + event.data.id + \"&result=\"+defaultvalue,\"unimarc_field_123defg\",'width=1000,height=375,toolbar=false,scrollbars=yes'); } @@ -52,7 +52,7 @@ my ($input) = @_; my $dbh = C4::Context->dbh; my ($template, $loggedinuser, $cookie) - = get_template_and_user({template_name => "cataloguing/value_builder/unimarc_field_123g.tt", + = get_template_and_user({template_name => "cataloguing/value_builder/unimarc_field_123defg.tt", query => $input, type => "intranet", flagsrequired => {editcatalogue => '*'}, diff --git a/cataloguing/value_builder/unimarc_field_123e.pl b/cataloguing/value_builder/unimarc_field_123e.pl deleted file mode 100755 index 0ca2f9c14c..0000000000 --- a/cataloguing/value_builder/unimarc_field_123e.pl +++ /dev/null @@ -1,70 +0,0 @@ -#!/usr/bin/perl - - -# Copyright 2000-2002 Katipo Communications -# -# 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 CGI qw ( -utf8 ); -use C4::Context; - -use C4::Search; -use C4::Output qw( output_html_with_http_headers ); - -sub plugin_javascript { -my ($dbh,$record,$tagslib,$field_number) = @_; -my $function_name= $field_number; -my $res=" - -"; - -return ($function_name,$res); -} -sub plugin { -my ($input) = @_; - my $index= $input->param('index'); - my $result= $input->param('result'); - - - my $dbh = C4::Context->dbh; - -my ($template, $loggedinuser, $cookie) - = get_template_and_user({template_name => "cataloguing/value_builder/unimarc_field_123g.tt", - query => $input, - type => "intranet", - flagsrequired => {editcatalogue => '*'}, - }); - my $f1 = substr($result,0,1); - my $f2 = substr($result,1,3); - my $f3 = substr($result,4,2); - my $f4 = substr($result,6,2); - $template->param(index => $index, - "f1$f1" => 1, - f2 => $f2, - f3 => $f3, - f4 => $f4); - output_html_with_http_headers $input, $cookie, $template->output; -} diff --git a/cataloguing/value_builder/unimarc_field_123f.pl b/cataloguing/value_builder/unimarc_field_123f.pl deleted file mode 100755 index 3ca266631f..0000000000 --- a/cataloguing/value_builder/unimarc_field_123f.pl +++ /dev/null @@ -1,71 +0,0 @@ -#!/usr/bin/perl - - -# Copyright 2000-2002 Katipo Communications -# -# 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 CGI qw ( -utf8 ); -use C4::Context; - -use C4::Search; -use C4::Output qw( output_html_with_http_headers ); - -sub plugin_javascript { -my ($dbh,$record,$tagslib,$field_number) = @_; -my $function_name= $field_number; -my $res=" - -"; - -return ($function_name,$res); -} -sub plugin { -my ($input) = @_; - - my $index= $input->param('index'); - my $result= $input->param('result'); - - - my $dbh = C4::Context->dbh; - -my ($template, $loggedinuser, $cookie) - = get_template_and_user({template_name => "cataloguing/value_builder/unimarc_field_123g.tt", - query => $input, - type => "intranet", - flagsrequired => {editcatalogue => '*'}, - }); - my $f1 = substr($result,0,1); - my $f2 = substr($result,1,3); - my $f3 = substr($result,4,2); - my $f4 = substr($result,6,2); - $template->param(index => $index, - "f1$f1" => 1, - f2 => $f2, - f3 => $f3, - f4 => $f4); - output_html_with_http_headers $input, $cookie, $template->output; -} diff --git a/cataloguing/value_builder/unimarc_field_123g.pl b/cataloguing/value_builder/unimarc_field_123g.pl deleted file mode 100755 index 0ca2f9c14c..0000000000 --- a/cataloguing/value_builder/unimarc_field_123g.pl +++ /dev/null @@ -1,70 +0,0 @@ -#!/usr/bin/perl - - -# Copyright 2000-2002 Katipo Communications -# -# 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 CGI qw ( -utf8 ); -use C4::Context; - -use C4::Search; -use C4::Output qw( output_html_with_http_headers ); - -sub plugin_javascript { -my ($dbh,$record,$tagslib,$field_number) = @_; -my $function_name= $field_number; -my $res=" - -"; - -return ($function_name,$res); -} -sub plugin { -my ($input) = @_; - my $index= $input->param('index'); - my $result= $input->param('result'); - - - my $dbh = C4::Context->dbh; - -my ($template, $loggedinuser, $cookie) - = get_template_and_user({template_name => "cataloguing/value_builder/unimarc_field_123g.tt", - query => $input, - type => "intranet", - flagsrequired => {editcatalogue => '*'}, - }); - my $f1 = substr($result,0,1); - my $f2 = substr($result,1,3); - my $f3 = substr($result,4,2); - my $f4 = substr($result,6,2); - $template->param(index => $index, - "f1$f1" => 1, - f2 => $f2, - f3 => $f3, - f4 => $f4); - output_html_with_http_headers $input, $cookie, $template->output; -} diff --git a/installer/data/mysql/atomicupdate/bug-34657-update-unimarc-123defg-plugins.pl b/installer/data/mysql/atomicupdate/bug-34657-update-unimarc-123defg-plugins.pl new file mode 100755 index 0000000000..74bec0d467 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug-34657-update-unimarc-123defg-plugins.pl @@ -0,0 +1,18 @@ +use Modern::Perl; + +return { + bug_number => "34657", + description => "Update MARC frameworks to use renamed UNIMARC plugin", + up => sub { + my ($args) = @_; + my ( $dbh, $out ) = @$args{qw(dbh out)}; + + # Do you stuffs here + $dbh->do(q{ + UPDATE `marc_subfield_structure` SET `value_builder` = 'unimarc_field_123defg.pl' WHERE (`value_builder` = 'unimarc_field_123d.pl' OR `value_builder` = 'unimarc_field_123e.pl' OR `value_builder` = 'unimarc_field_123f.pl' OR `value_builder` = 'unimarc_field_123g.pl' ); + }); + + say $out "Update complete: MARC subfields which were configured to use unimarc_field123d.pl, unimarc_field123e.pl, unimarc_field123f.pl, or unimarc_field123g.pl will now use unimarc_field123defg.pl"; + + }, +}; diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_123d.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_123d.tt deleted file mode 100644 index 40371f4360..0000000000 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_123d.tt +++ /dev/null @@ -1,78 +0,0 @@ -[% USE raw %] -[% PROCESS 'i18n.inc' %] -[% SET footerjs = 1 %] -[% INCLUDE 'doc-head-open.inc' %] -[% FILTER collapse %] - [% t("UNIMARC field 123d builder") | html %] › - [% t("Cataloguing") | html %] › - [% t("Koha") | html %] -[% END %] -[% INCLUDE 'doc-head-close.inc' %] - - -

UNIMARC field 123d builder

-
-
- - - - - - - - - - - - - - -
- -
-
Cancel
-
-
- -[% MACRO jsinclude BLOCK %] - -[% END %] - -[% INCLUDE 'intranet-bottom.inc' popup_window=1 %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_123e.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_123defg.tt similarity index 94% rename from koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_123e.tt rename to koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_123defg.tt index 9369278178..cf7aaa7b46 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_123e.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_123defg.tt @@ -3,14 +3,14 @@ [% SET footerjs = 1 %] [% INCLUDE 'doc-head-open.inc' %] [% FILTER collapse %] - [% t("UNIMARC field 123e builder") | html %] › + [% t("UNIMARC field 123d/e/f/g builder") | html %] › [% t("Cataloguing") | html %] › [% t("Koha") | html %] [% END %] [% INCLUDE 'doc-head-close.inc' %] - -

UNIMARC field 123e builder

+ +

UNIMARC field 123d/e/f/g builder

diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_123f.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_123f.tt deleted file mode 100644 index 5567d49056..0000000000 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_123f.tt +++ /dev/null @@ -1,79 +0,0 @@ -[% USE raw %] -[% PROCESS 'i18n.inc' %] -[% SET footerjs = 1 %] -[% INCLUDE 'doc-head-open.inc' %] -[% FILTER collapse %] - [% t("UNIMARC field 123f builder") | html %] › - [% t("Cataloguing") | html %] › - [% t("Koha") | html %] -[% END %] -[% INCLUDE 'doc-head-close.inc' %] - - -

UNIMARC field 123f builder

-
- -
- - - - - - - - - - - - - -
- -
-
Cancel
-
-
- -[% MACRO jsinclude BLOCK %] - -[% END %] - -[% INCLUDE 'intranet-bottom.inc' popup_window=1 %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_123g.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_123g.tt deleted file mode 100644 index 070f9664c9..0000000000 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_123g.tt +++ /dev/null @@ -1,79 +0,0 @@ -[% USE raw %] -[% PROCESS 'i18n.inc' %] -[% SET footerjs = 1 %] -[% INCLUDE 'doc-head-open.inc' %] -[% FILTER collapse %] - [% t("UNIMARC field 123g builder") | html %] › - [% t("Cataloguing") | html %] › - [% t("Koha") | html %] -[% END %] -[% INCLUDE 'doc-head-close.inc' %] - - -

UNIMARC field 123g builder

-
-
- - - - - - - - - - - - - - -
- -
-
Cancel
-
-
- -[% MACRO jsinclude BLOCK %] - -[% END %] - -[% INCLUDE 'intranet-bottom.inc' popup_window=1 %] -- 2.30.2