Bugzilla – Attachment 141288 Details for
Bug 31372
Value builder for UNIMARC field 325
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 31372: Value builder for field 325
Bug-31372-Value-builder-for-field-325.patch (text/plain), 15.37 KB, created by
Katrin Fischer
on 2022-10-03 19:41:58 UTC
(
hide
)
Description:
Bug 31372: Value builder for field 325
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2022-10-03 19:41:58 UTC
Size:
15.37 KB
patch
obsolete
>From c467988e45580442c724af302ec7c3e06b0b7e5a Mon Sep 17 00:00:00 2001 >From: jeremy breuillard <jeremy.breuillard@biblibre.com> >Date: Wed, 20 Jul 2022 15:45:16 +0200 >Subject: [PATCH] Bug 31372: Value builder for field 325 >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >On page cataloging some plugins were added for subfields $h and $h from field $325 > >Test plan: > 1)Go to Home > Cataloging > New record > 2)Section 3 - field 325 : it contains lots of subfields (g, h, i, j...) > 3)Inputs are writable but notice that no plugins are suggested > 4)Apply patch and repeat 1) to 3) > 5)Values builders plugins are available for $h and $j > >Signed-off-by: Thibault Keromnès <thibault.keromnes@univ-paris8.fr> > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >--- > .../value_builder/unimarc_field_325h.pl | 72 ++++++++ > .../value_builder/unimarc_field_325j.pl | 78 +++++++++ > .../value_builder/unimarc_field_325h.tt | 53 ++++++ > .../value_builder/unimarc_field_325j.tt | 164 ++++++++++++++++++ > 4 files changed, 367 insertions(+) > create mode 100755 cataloguing/value_builder/unimarc_field_325h.pl > create mode 100755 cataloguing/value_builder/unimarc_field_325j.pl > create mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_325h.tt > create mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_325j.tt > >diff --git a/cataloguing/value_builder/unimarc_field_325h.pl b/cataloguing/value_builder/unimarc_field_325h.pl >new file mode 100755 >index 0000000000..e2d4a33f7a >--- /dev/null >+++ b/cataloguing/value_builder/unimarc_field_325h.pl >@@ -0,0 +1,72 @@ >+#!/usr/bin/perl >+ >+# Copyright 2014 Rijksmuseum >+# >+# 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 <http://www.gnu.org/licenses>. >+ >+ >+ >+######### ATTENTION c'est le contenu du fichier unimarc_field_181-2.tt %] ############# >+ >+use Modern::Perl; >+ >+use Date::Calc; >+ >+use Koha::Util::FrameworkPlugin qw(wrapper); >+use C4::Auth qw( get_template_and_user ); >+use CGI qw ( -utf8 ); >+use C4::Context; >+use C4::Output qw( output_html_with_http_headers ); >+ >+my $builder= sub { >+ my $params = shift; >+ my $id = $params->{id}; >+ >+ return qq| >+<script> >+ >+function Click$id(event) { >+ var fieldvalue=\$('#'+event.data.id).val(); >+ window.open(\"../cataloguing/plugin_launcher.pl?plugin_name=unimarc_field_325h.pl&index=\"+event.data.id+\"&result=\"+fieldvalue,\"tag_editor\",'width=700,height=700,toolbar=false,scrollbars=yes'); >+ return false; /* prevents scrolling */ >+} >+</script>|; >+}; >+ >+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_325h.tt", >+ query => $cgi, >+ type => "intranet", >+ flagsrequired => {editcatalogue => '*'}, >+ }); >+ my $results = scalar $cgi->param('result'); >+ my $input_a = substr $results, 0, 1; >+ >+ $template->param( >+ index => scalar $cgi->param('index'), >+ result => $results, >+ f0 => $input_a, >+ ); >+ output_html_with_http_headers $cgi, $cookie, $template->output; >+}; >+ >+# Return the hashref with the builder and launcher to FrameworkPlugin object. >+# NOTE: If you do not need a popup but only use e.g. Focus, Blur etc. for a >+# particular plugin, you only need to define and return the builder. >+return { builder => $builder, launcher => $launcher }; >\ No newline at end of file >diff --git a/cataloguing/value_builder/unimarc_field_325j.pl b/cataloguing/value_builder/unimarc_field_325j.pl >new file mode 100755 >index 0000000000..9a97833b8c >--- /dev/null >+++ b/cataloguing/value_builder/unimarc_field_325j.pl >@@ -0,0 +1,78 @@ >+#!/usr/bin/perl >+ >+# Copyright 2014 Rijksmuseum >+# >+# 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 <http://www.gnu.org/licenses>. >+ >+ >+ >+######### ATTENTION c'est le contenu du fichier unimarc_field_181-2.tt %] ############# >+ >+use Modern::Perl; >+ >+use Date::Calc; >+ >+use Koha::Util::FrameworkPlugin qw(wrapper); >+use C4::Auth qw( get_template_and_user ); >+use CGI qw ( -utf8 ); >+use C4::Context; >+use C4::Output qw( output_html_with_http_headers ); >+ >+my $builder= sub { >+ my $params = shift; >+ my $id = $params->{id}; >+ >+ return qq| >+<script> >+ >+function Click$id(event) { >+ var fieldvalue=\$('#'+event.data.id).val(); >+ window.open(\"../cataloguing/plugin_launcher.pl?plugin_name=unimarc_field_325j.pl&index=\"+event.data.id+\"&result=\"+fieldvalue,\"tag_editor\",'width=700,height=700,toolbar=false,scrollbars=yes'); >+ return false; /* prevents scrolling */ >+} >+</script>|; >+}; >+ >+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_325j.tt", >+ query => $cgi, >+ type => "intranet", >+ flagsrequired => {editcatalogue => '*'}, >+ }); >+ my $results = scalar $cgi->param('result'); >+ >+ $template->param( >+ index => scalar $cgi->param('index'), >+ result => $results, >+ ); >+ >+ # Return the result of the position in the string, ex: abcde = 1=a, 2=b, 3=c... >+ my @x = split(//, $results); >+ my $i = 0; >+ for my $fresult (@x) { >+ $template->param("f$i" => $fresult); >+ ++$i; >+ } >+ output_html_with_http_headers $cgi, $cookie, $template->output; >+}; >+ >+# Return the hashref with the builder and launcher to FrameworkPlugin object. >+# NOTE: If you do not need a popup but only use e.g. Focus, Blur etc. for a >+# particular plugin, you only need to define and return the builder. >+return { builder => $builder, launcher => $launcher }; >\ No newline at end of file >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_325h.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_325h.tt >new file mode 100644 >index 0000000000..4d8d4abc02 >--- /dev/null >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_325h.tt >@@ -0,0 +1,53 @@ >+[%# ATTENTION c'est le contenu du fichier unimarc_field_181-2.tt %] >+ >+ >+[% INCLUDE 'doc-head-open.inc' %] >+<title>Framework plugin example › Cataloguing › Koha</title> >+[% INCLUDE 'doc-head-close.inc' %] >+</head> >+ >+<body id="cat_unimarc_field_325h" class="cat" style="padding:1em;"> >+ >+<h3>UNIMARC field 325h builder</h3> >+ >+<form name="f_pop" action=""> >+<table> >+ <tr> >+ <td><label for="f0">Completeness of the reproduction code :</label></td> >+ <td> >+ <select name="f0" id="f0"> >+ [% IF ( f0 == "" ) %] >+ <option value=" " selected="selected"># - undetermined</option> >+ [% ELSE %] >+ <option value=" "># - undetermined</option> >+ [% END %] >+ >+ [% IF ( f0 == "0" ) %] >+ <option value="0" selected="selected">0 - reproduction is not complete</option> >+ [% ELSE %] >+ <option value="0">0 - reproduction is not complete</option> >+ [% END %] >+ >+ [% IF ( f0 == "1" ) %] >+ <option value="1" selected="selected">1 - reproduction is complete</option> >+ [% ELSE %] >+ <option value="1">1 - reproduction is complete</option> >+ [% END %] >+ </select> >+ </td> >+ </tr> >+</table> >+<p><input type="button" value="OK" onclick="submitMyForm();" /> <a href="#" class="cancel close">Cancel</a> </p> >+</form> >+ >+<script> >+ >+ function submitMyForm() { >+ var doc = opener.document; >+ var field = doc.getElementById("[% index | html %]"); >+ >+ field.value = document.f_pop.f0.value; >+ window.close(); >+ return false; >+ } >+</script> >\ No newline at end of file >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_325j.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_325j.tt >new file mode 100644 >index 0000000000..41461a5640 >--- /dev/null >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_325j.tt >@@ -0,0 +1,164 @@ >+[% INCLUDE 'doc-head-open.inc' %] >+<title>Framework plugin example › Cataloguing › Koha</title> >+[% INCLUDE 'doc-head-close.inc' %] >+</head> >+ >+<body id="cat_unimarc_field_325j" class="cat" style="padding:1em;"> >+ >+<h3>UNIMARC field 325j builder</h3> >+ >+<form name="f_pop" action="" id="form"> >+<table> >+ <tr> >+ <td><label for="f0">Terms of access to the reproduction :</label></td> >+ <td> >+ <select name="f0" id="f0"> >+ [% IF ( f0 == "1" ) %] >+ <option value="1" selected="selected">1 - free-to-read</option> >+ [% ELSE %] >+ <option value="1">1 - free-to-read</option> >+ [% END %] >+ >+ [% IF ( f0 == "2" ) %] >+ <option value="2" selected="selected">2 - free-to-read, partly</option> >+ [% ELSE %] >+ <option value="2">2 - free-to-read, partly</option> >+ [% END %] >+ >+ [% IF ( f0 == "3" ) %] >+ <option value="3" selected="selected">3 - free-to-read, after embargo</option> >+ [% ELSE %] >+ <option value="3">3 - free-to-read, after embargo</option> >+ [% END %] >+ >+ [% IF ( f0 == "4" ) %] >+ <option value="4" selected="selected">4 - fully</option> >+ [% ELSE %] >+ <option value="4">4 - fully</option> >+ [% END %] >+ >+ [% IF ( f0 == "5" ) %] >+ <option value="5" selected="selected">5 - free-to-read upon subscription (requires signing up)</option> >+ [% ELSE %] >+ <option value="5">5 - free-to-read upon subscription (requires signing up)</option> >+ [% END %] >+ </select> >+ </td> >+ </tr> >+ <tr> >+ <td><label for="f1">Qualifier type :</label></td> >+ <td> >+ <select name="f1" id="f1"> >+ [% IF ( f1 == "l" ) %] >+ <option value="l" selected="selected">l - latest</option> >+ [% ELSE %] >+ <option value="l" >l - latest</option> >+ [% END %] >+ >+ [% IF ( f1 == "p" ) %] >+ <option value="p" selected="selected">p - previous</option> >+ [% ELSE %] >+ <option value="p">p - previous</option> >+ [% END %] >+ >+ [% IF ( f1 == "x" ) %] >+ <option value="" selected="selected">x - not applicable</option> >+ [% ELSE %] >+ <option value="">x - not applicable</option> >+ [% END %] >+ >+ [% IF ( f1 == "#" ) %] >+ <option value="#" selected="selected"># - no attempt to code</option> >+ [% ELSE %] >+ <option value="#"># - no attempt to code</option> >+ [% END %] >+ </select> >+ </td> >+ </tr> >+ <tr> >+ <td><label for="f2">Unit under embargo :</label></td> >+ <td> >+ <select name="f2" id="f2"> >+ [% IF ( f2 == "m" ) %] >+ <option value="m" selected="selected">m - month(s) time</option> >+ [% ELSE %] >+ <option value="m">m - month(s) time</option> >+ [% END %] >+ >+ [% IF ( f2 == "w" ) %] >+ <option value="w" selected="selected">w - week(s) time</option> >+ [% ELSE %] >+ <option value="w">w - week(s) time</option> >+ [% END %] >+ >+ [% IF ( f2 == "y" ) %] >+ <option value="y" selected="selected">y - year(s) time</option> >+ [% ELSE %] >+ <option value="y">y - year(s) time</option> >+ [% END %] >+ >+ [% IF ( f2 == "i" ) %] >+ <option value="i" selected="selected">i - issue(s) part</option> >+ [% ELSE %] >+ <option value="i">i - issue(s) part</option> >+ [% END %] >+ >+ [% IF ( f2 == "x" ) %] >+ <option value="" selected="selected">x - not applicable</option> >+ [% ELSE %] >+ <option value="">x - not applicable</option> >+ [% END %] >+ >+ [% IF ( f2 == "#" ) %] >+ <option value="#" selected="selected"># - no attempt to code</option> >+ [% ELSE %] >+ <option value="#"># - no attempt to code</option> >+ [% END %] >+ </select> >+ </td> >+ </tr> >+ <tr> >+ <td><label for="f3">Number of units under embargo :</label></td> >+ <td> >+ <input name="f3" id="f3" inputmode="numeric" pattern="\d{1,2}" value="[% f3 | html %]"></input> >+ </td> >+ </tr> >+</table> >+<p><input type="submit" value="OK" /> <a href="#" class="cancel close">Cancel</a> </p> >+</form> >+ >+<script> >+ $("#form").on('submit', submitMyForm); >+ $("#f0").on('change', function() { >+ document.f_pop.f1.disabled = false; >+ document.f_pop.f2.disabled = false; >+ document.f_pop.f3.disabled = false; >+ >+ if ( document.f_pop.f0.value != "3" ) { >+ document.f_pop.f1.value = "x"; >+ document.f_pop.f2.value = "x"; >+ document.f_pop.f1.disabled = true; >+ document.f_pop.f2.disabled = true; >+ document.f_pop.f3.disabled = true; >+ } >+ }); >+ $("#f0").trigger('change'); >+ >+ function submitMyForm(event) { >+ event.preventDefault(); >+ var doc = opener.document; >+ var field = doc.getElementById("[% index | html %]"); >+ if ( document.f_pop.f0.value == "3" ) { >+ var f3v = document.f_pop.f3.value.padStart(2, '0'); >+ document.f_pop.f3.value = f3v; >+ } >+ >+ field.value = document.f_pop.f0.value+ >+ document.f_pop.f1.value+ >+ document.f_pop.f2.value+ >+ document.f_pop.f3.value; >+ window.close(); >+ } >+</script> >+ >+[% INCLUDE 'popup-bottom.inc' %] >\ No newline at end of file >-- >2.30.2
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 31372
:
139246
|
140098
| 141288