bug 2254 [3/3]: add authority type check
Added a test to the MARC framework checks to verify that all authority types used in a framework are defined. Documentation changes: possible new screenshots and text to describe the new test. NOTE: This patch adds strings to the checkmarc template, and thus violates the string freeze for 3.0. I'm submitting anyway because 2254 is a blocker, but if no exception is made, it is safe to not apply this patch for 3.0. Signed-off-by: Joshua Ferraro <jmf@liblime.com>
This commit is contained in:
parent
10127d15a6
commit
91b47af583
2 changed files with 52 additions and 1 deletions
|
@ -208,7 +208,7 @@ if ($res) {
|
||||||
$total++;
|
$total++;
|
||||||
}
|
}
|
||||||
|
|
||||||
# verify that all of a field's subfields (except the ones explicitly ignore)
|
# verify that all of a field's subfields (except the ones explicitly ignored)
|
||||||
# are in the same tab
|
# are in the same tab
|
||||||
$sth = $dbh->prepare("SELECT tagfield, frameworkcode, frameworktext, GROUP_CONCAT(DISTINCT tab) AS tabs
|
$sth = $dbh->prepare("SELECT tagfield, frameworkcode, frameworktext, GROUP_CONCAT(DISTINCT tab) AS tabs
|
||||||
FROM marc_subfield_structure
|
FROM marc_subfield_structure
|
||||||
|
@ -224,6 +224,23 @@ if (scalar(@$inconsistent_tabs) > 0) {
|
||||||
$template->param(tab_info => $inconsistent_tabs);
|
$template->param(tab_info => $inconsistent_tabs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# verify that authtypecodes used in the framework
|
||||||
|
# are defined in auth_types
|
||||||
|
$sth = $dbh->prepare("SELECT frameworkcode, frameworktext, tagfield, tagsubfield, authtypecode
|
||||||
|
FROM marc_subfield_structure
|
||||||
|
LEFT JOIN biblio_framework USING (frameworkcode)
|
||||||
|
WHERE authtypecode IS NOT NULL
|
||||||
|
AND authtypecode <> ''
|
||||||
|
AND authtypecode NOT IN (SELECT authtypecode FROM auth_types)
|
||||||
|
ORDER BY frameworkcode, tagfield, tagsubfield");
|
||||||
|
$sth->execute;
|
||||||
|
my $invalid_authtypecodes = $sth->fetchall_arrayref({});
|
||||||
|
if (scalar(@$invalid_authtypecodes) > 0) {
|
||||||
|
$total++;
|
||||||
|
$template->param(invalid_authtypecodes => 1);
|
||||||
|
$template->param(authtypecode_info => $invalid_authtypecodes);
|
||||||
|
}
|
||||||
|
|
||||||
$template->param(total => $total,
|
$template->param(total => $total,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -188,6 +188,40 @@
|
||||||
</tr>
|
</tr>
|
||||||
<!-- /TMPL_IF -->
|
<!-- /TMPL_IF -->
|
||||||
|
|
||||||
|
<!-- TMPL_IF NAME="invalid_authtypecodes" -->
|
||||||
|
<tr>
|
||||||
|
<td style="vertical-align:top;">invalid authority types</td>
|
||||||
|
<td>Not all authority types referred to by the frameworks are defined.
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<th>Framework code</th>
|
||||||
|
<th>Framework description</th>
|
||||||
|
<th>Tag</th>
|
||||||
|
<th>Subfield</th>
|
||||||
|
<th>Invalid authority type</th>
|
||||||
|
</tr>
|
||||||
|
<!-- TMPL_LOOP NAME="authtypecode_info" -->
|
||||||
|
<tr>
|
||||||
|
<td><!-- TMPL_VAR NAME="frameworkcode" --></td>
|
||||||
|
<!-- TMPL_IF NAME="frameworkcode" -->
|
||||||
|
<td><!-- TMPL_VAR NAME="frameworktext" --></td>
|
||||||
|
<!-- TMPL_ELSE -->
|
||||||
|
<td>Default framework</td>
|
||||||
|
<!-- /TMPL_IF -->
|
||||||
|
<td><!-- TMPL_VAR NAME="tagfield" --></td>
|
||||||
|
<td><!-- TMPL_VAR NAME="tagsubfield" --></td>
|
||||||
|
<td><!-- TMPL_VAR NAME="authtypecode" --></td>
|
||||||
|
</tr>
|
||||||
|
<!-- /TMPL_LOOP -->
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<!-- TMPL_ELSE -->
|
||||||
|
<tr>
|
||||||
|
<td>OK</td>
|
||||||
|
<td>all authority types used in the frameworks are defined</td>
|
||||||
|
</tr>
|
||||||
|
<!-- /TMPL_IF -->
|
||||||
<!-- -->
|
<!-- -->
|
||||||
<!-- TMPL_IF name="total" -->
|
<!-- TMPL_IF name="total" -->
|
||||||
<tr>
|
<tr>
|
||||||
|
|
Loading…
Reference in a new issue