Bug 24698: QA fixes

This is a squashed patch of the following patches:

Bug 24698: (QA follow-up) Fix errors caused by more strict exports being introduced

The original patch "Bug 24698: Add plugin and template files for
unimarc authority leader" doesn't work without explictly importing the
methods from C4::Auth and C4::Output due to the default exports being
changed in those modules after the patch was made.

Signed-off-by: George Veranis <gveranis@dataly.gr>

Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>

Bug 24698: (QA follow-up) Remove debug info being outputted to the template

This is only needed during development.

Signed-off-by: George Veranis <gveranis@dataly.gr>

Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>

Bug 24698: (QA follow-up) Align variables with whitespace

Signed-off-by: George Veranis <gveranis@dataly.gr>

Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>

Bug 24698: (QA follow-up) Remove dead code

These were left off from the copy&paste taken from
unimarc_field_100_authorities.pl

Signed-off-by: George Veranis <gveranis@dataly.gr>

Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>

Bug 24698: (QA follow-up) Fix formatting and typos

Signed-off-by: George Veranis <gveranis@dataly.gr>

Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>

Bug 24698: (QA follow-up) Remove passing of authnotrequired parameter

It should only be used when we want to override the default of auth
being required.

Signed-off-by: George Veranis <gveranis@dataly.gr>

Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>

Bug 24698: (QA follow-up) Make plugin script executable

Signed-off-by: George Veranis <gveranis@dataly.gr>

Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>

Bug 24698: (QA follow-up) Use spaces instead of tabs

This makes the QA script happy.

Signed-off-by: George Veranis <gveranis@dataly.gr>

Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>

Bug 24698: (QA follow-up) Filter untrusted input to prevent XSS

Signed-off-by: George Veranis <gveranis@dataly.gr>

Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>

Bug 24698: (QA follow-up) Don't specify select element's size if it is 1

This is to make the QA script happy, in order to not to break
Bootstrap CSS rules, see Bug 28066 for more info

Signed-off-by: George Veranis <gveranis@dataly.gr>

Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>

Bug 24698: (QA follow-up) Don't specify script type explictly

It's makes the QA script complain because the option doesn't have any
effect nowadays:

https://www.w3.org/TR/2017/REC-html52-20171214/obsolete.html#warnings-for-obsolete-but-conforming-features
Signed-off-by: George Veranis <gveranis@dataly.gr>

Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>

Bug 24698: (follow-up) remove HTML select option for Series

The IFLA authorities format specification defines only the letters a-l
as possible values for authority leader 000 character position 9 ("Type
of entity"). Therefore, the first option from the HTML select dropdown
menu (" - Series") must be removed.

Mentored-by: Andreas Roussos <a.roussos@dataly.gr>

Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Joonas Kylmälä 2021-10-03 11:51:22 +00:00 committed by Jonathan Druart
parent 208f715855
commit 082d53a6ca
2 changed files with 162 additions and 176 deletions

22
cataloguing/value_builder/unimarc_leader_authorities.pl Normal file → Executable file
View File

@ -20,10 +20,10 @@
use Modern::Perl;
use Koha::Util::FrameworkPlugin qw(wrapper);
use C4::Auth;
use C4::Auth qw( get_template_and_user );
use CGI qw ( -utf8 );
use C4::Context;
use C4::Output;
use C4::Output qw( output_html_with_http_headers );
sub plugin_javascript {
@ -52,35 +52,27 @@ sub plugin {
my $index = $input->param('index');
my $result = $input->param('result');
my $dbh = C4::Context->dbh;
#my $defaultlanguage = C4::Context->preference("UNIMARCField100Language");
# $defaultlanguage = "fre" if (!$defaultlanguage || length($defaultlanguage) != 3);
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
{
template_name => "cataloguing/value_builder/unimarc_leader_authorities.tt",
query => $input,
type => "intranet",
authnotrequired => 0,
flagsrequired => { editcatalogue => '*' },
debug => 1,
}
);
$result = " nz a22 3 4500" unless $result;
my $f5 = substr( $result, 5, 1 ); $f5 = wrapper( $f5 ) if $f5;
my $f6 = substr( $result, 6, 1 ); $f6 = wrapper( $f6 ) if $f6;
my $f9 = substr( $result, 9, 1 ); $f9 = wrapper( $f9 ) if $f9;
my $f17 = substr( $result, 17, 1 ); $f17 = wrapper( $f17 ) if $f17;
my $f5 = substr( $result, 5, 1 ); $f5 = wrapper( $f5 ) if $f5;
my $f6 = substr( $result, 6, 1 ); $f6 = wrapper( $f6 ) if $f6;
my $f9 = substr( $result, 9, 1 ); $f9 = wrapper( $f9 ) if $f9;
my $f17 = substr( $result, 17, 1 ); $f17 = wrapper( $f17 ) if $f17;
$template->param(
index => $index,
"f5$f5" => 1,
"f6$f6" => 1,
"f9$f9" => 1,
"f17$f17" => 1,
"f17$f17" => 1,
);
output_html_with_http_headers $input, $cookie, $template->output;
}

View File

@ -8,193 +8,187 @@
<input name="plugin_name" value="unimarc_leader_authorities.pl" type="hidden">
<table>
<tr>
<td>1-4 Record length</td>
<td>(auto-calculated)</td>
</tr>
<tr>
<td><label for="f5">5- Record status</label></td>
<td>
<select name="f5" id="f5" size="1">
[% IF ( f5c ) %]
<option value="c" selected="selected">c - Corrected or revised</option>
[% ELSE %]
<option value="c">c - Corrected or revised</option>
[% END %]
[% IF ( f5d ) %]
<option value="d" selected="selected">d - Deleted</option>
[% ELSE %]
<option value="d">d - Deleted</option>
[% END %]
[% IF ( f5n ) %]
<option value="n" selected="selected">n - New</option>
[% ELSE %]
<option value="n">n - New</option>
[% END %]
</select>
</td>
</tr>
<tr>
<td><label for="f6">6- Type of record</label></td>
<td>
<select name="f6" id="f6" size="1">
[% IF ( f6x ) %]
<option value="x" selected="selected">x - Authority entry record</option>
[% ELSE %]
<option value="x">x - Authority entry record</option>
[% END %]
<tr>
<td>1-4 Record length</td>
<td>(auto-calculated)</td>
</tr>
<tr>
<td><label for="f5">5- Record status</label></td>
<td>
<select name="f5" id="f5">
[% IF ( f5c ) %]
<option value="c" selected="selected">c - Corrected or revised</option>
[% ELSE %]
<option value="c">c - Corrected or revised</option>
[% END %]
[% IF ( f5d ) %]
<option value="d" selected="selected">d - Deleted</option>
[% ELSE %]
<option value="d">d - Deleted</option>
[% END %]
[% IF ( f5n ) %]
<option value="n" selected="selected">n - New</option>
[% ELSE %]
<option value="n">n - New</option>
[% END %]
</select>
</td>
</tr>
<tr>
<td><label for="f6">6- Type of record</label></td>
<td>
<select name="f6" id="f6">
[% IF ( f6x ) %]
<option value="x" selected="selected">x - Authority entry record</option>
[% ELSE %]
<option value="x">x - Authority entry record</option>
[% END %]
[% IF ( f6y ) %]
<option value="y" selected="selected">y - Reference entry record</option>
[% ELSE %]
<option value="y">y - Reference entry record</option>
[% END %]
[% IF ( f6y ) %]
<option value="y" selected="selected">y - Reference entry record</option>
[% ELSE %]
<option value="y">y - Reference entry record</option>
[% END %]
[% IF ( f6z ) %]
<option value="z" selected="selected">z - General explanatory entry record</option>
[% ELSE %]
<option value="z">z - General explanatory entry record</option>
[% END %]
[% IF ( f6z ) %]
<option value="z" selected="selected">z - General explanatory entry record</option>
[% ELSE %]
<option value="z">z - General explanatory entry record</option>
[% END %]
</select>
</td>
</tr>
<tr>
<td><label for="f7">7-8 Undefined</label></td>
<td></td>
</tr>
</select>
</td>
</tr>
<tr>
<td><label for="f7">7-8 Undefined</label></td>
<td></td>
</tr>
<tr>
<td><label for="f9">9- Type of entity</label></td>
<td>
<select name="f9" id="f9" size="1">
[% IF ( f9 ) %]
<option value=" " selected="selected"> - Series</option>
[% ELSE %]
<option value=" "> - Series</option>
[% END %]
<tr>
<td><label for="f9">9- Type of entity</label></td>
<td>
<select name="f9" id="f9">
[% IF ( f9a ) %]
<option value="a" selected="selected">a - Personal name entry</option>
[% ELSE %]
<option value="a">a - Personal name entry</option>
[% END %]
[% IF ( f9a ) %]
<option value="a" selected="selected">a - Personal name entry</option>
[% ELSE %]
<option value="a">a - Personal name entry</option>
[% END %]
[% IF ( f9b ) %]
<option value="b" selected="selected">b - Corporate name entry</option>
[% ELSE %]
<option value="b">b - Corporate name entry</option>
[% END %]
[% IF ( f9b ) %]
<option value="b" selected="selected">b - Corporate name entry</option>
[% ELSE %]
<option value="b">b - Corporate name entry</option>
[% END %]
[% IF ( f9c ) %]
<option value="c" selected="selected">c - Territorial or geographical name</option>
[% ELSE %]
<option value="c">c - Territorial or geographical name</option>
[% END %]
[% IF ( f9c ) %]
<option value="c" selected="selected">c - Territorial o geographical name</option>
[% ELSE %]
<option value="c">c - Territorial o geographical name</option>
[% END %]
[% IF ( f9d ) %]
<option value="d" selected="selected">d - Trademark</option>
[% ELSE %]
<option value="d">d - Trademark</option>
[% END %]
[% IF ( f9d ) %]
<option value="d" selected="selected">d - Trademark</option>
[% ELSE %]
<option value="d">d - Trademark</option>
[% END %]
[% IF ( f9e ) %]
<option value="e" selected="selected">e - Family name</option>
[% ELSE %]
<option value="e">e - Family name</option>
[% END %]
[% IF ( f9e ) %]
<option value="e" selected="selected">e - Family name</option>
[% ELSE %]
<option value="e">e - Family name</option>
[% END %]
[% IF ( f9f ) %]
<option value="f" selected="selected">f - Uniform name</option>
[% ELSE %]
<option value="f">f - Uniform name</option>
[% END %]
[% IF ( f9f ) %]
<option value="f" selected="selected">f - Uniform name</option>
[% ELSE %]
<option value="f">f - Uniform name</option>
[% END %]
[% IF ( f9g ) %]
<option value="g" selected="selected">g - Collective uniform name</option>
[% ELSE %]
<option value="g">g - Collective uniform name</option>
[% END %]
[% IF ( f9g ) %]
<option value="g" selected="selected">g - Collective uniform name</option>
[% ELSE %]
<option value="g">g - Collective uniform name</option>
[% END %]
[% IF ( f9h ) %]
<option value="h" selected="selected">h - Name/title</option>
[% ELSE %]
<option value="h">h - Name/title</option>
[% END %]
[% IF ( f9h ) %]
<option value="h" selected="selected">h - Name/title</option>
[% ELSE %]
<option value="h">h - Name/title</option>
[% END %]
[% IF ( f9i ) %]
<option value="i" selected="selected">i - Name/collective uniform title</option>
[% ELSE %]
<option value="i">i - Name/collective uniform title</option>
[% END %]
[% IF ( f9i ) %]
<option value="i" selected="selected">i - Name/collective uniform title</option>
[% ELSE %]
<option value="i">i - Name/collective uniform title</option>
[% END %]
[% IF ( f9j ) %]
<option value="j" selected="selected">j - Topical subject</option>
[% ELSE %]
<option value="j">j - Topical subject</option>
[% END %]
[% IF ( f9j ) %]
<option value="j" selected="selected">j - Topical subject</option>
[% ELSE %]
<option value="j">j - Topical subject</option>
[% END %]
[% IF ( f9k ) %]
<option value="k" selected="selected">k - Place access</option>
[% ELSE %]
<option value="k">k - Place access</option>
[% END %]
[% IF ( f9k ) %]
<option value="k" selected="selected">k - Place access</option>
[% ELSE %]
<option value="k">k - Place access</option>
[% END %]
[% IF ( f9l ) %]
<option value="l" selected="selected">l - Form, genre or physical characteristics</option>
[% ELSE %]
<option value="l">l - Form, genre or physical characteristics</option>
[% END %]
[% IF ( f9l ) %]
<option value="l" selected="selected">l - Form, genre or physical characteristics</option>
[% ELSE %]
<option value="l">l - Form, genre or physical characteristics</option>
[% END %]
</select>
</td>
</tr>
<tr>
<td><label for="f10">10-16 indicator/subfields/size</label></td>
<td>(auto-calculated)</td>
</tr>
</select>
</td>
</tr>
<tr>
<td><label for="f10">10-16 indicator/subfields/size</label></td>
<td>(auto-calculated)</td>
</tr>
<tr>
<td><label for="f17">17- Encoding level</label></td>
<td>
<select name="f17" id="f17">
[% IF ( f17space ) %]
<option value=" " selected="selected"> - Full</option>
[% ELSE %]
<option value=" "> - Full</option>
[% END %]
[% IF ( f183 ) %]
<option value="3" selected="selected">3 - Partial</option>
[% ELSE %]
<option value="3">3 - Partial</option>
[% END %]
</select>
</td>
</tr>
<tr>
<td><label for="f17">17- Encoding level</label></td>
<td>
<select name="f17" id="f17" size="1">
[% IF ( f17space ) %]
<option value=" " selected="selected"> - Full</option>
[% ELSE %]
<option value=" "> - Full</option>
[% END %]
[% IF ( f183 ) %]
<option value="3" selected="selected">3- Partial</option>
[% ELSE %]
<option value="3">3- Partial</option>
[% END %]
</select>
</td>
</tr>
<tr>
<td>18-19 Undefined</td>
<td></td>
</tr>
<tr>
<td>18-19 Undefined</td>
<td></td>
</tr>
<tr>
<td>20-24 Entry map &amp; lengths</td>
<td>(auto-filled)</td>
</tr>
<tr>
<td>20-24 Entry map &amp; lengths</td>
<td>(auto-filled)</td>
</tr>
</table>
<fieldset class="action"><input type="submit" value="OK" onclick="report();" /> <a href="#" class="cancel close">Cancel</a></fieldset>
</form>
<script type="text/javascript">
<script>
//<![CDATA[
function report() {
var doc = opener.document;
var field = doc.getElementById("[% index %]");
var doc = opener.document;
var field = doc.getElementById("[% index | html %]");
field.value =' '+document.f_pop.f5.value+document.f_pop.f6.value+' '+document.f_pop.f9.value+'22 '+document.f_pop.f17.value+' '+'45 ';
field.value =' '+document.f_pop.f5.value+document.f_pop.f6.value+' '+document.f_pop.f9.value+'22 '+document.f_pop.f17.value+' '+'45 ';
self.close();
return false;
}
self.close();
return false;
}
//]]>
</script>