added another check to MARC framework test
Check verifies that all subfields for each tag are assigned to the same editor tab (or are ignored). This situation can lead to data corruption, because if an incoming MARC record has a field whose subfields are assigned to different tabs, the first time that record is saved in the bib editor, the field will be split into multiple versions, each containing the subfields assigned to a given tab. Errors identified by this test known in the MARC21 frameworks - I'm working on a patch to correct those. Signed-off-by: Joshua Ferraro <jmf@liblime.com>
This commit is contained in:
parent
8d8eb29e59
commit
ac08aef495
2 changed files with 50 additions and 0 deletions
|
@ -181,6 +181,23 @@ if ($res) {
|
||||||
$total++;
|
$total++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# verify that all of a field's subfields (except the ones explicitly ignore)
|
||||||
|
# are in the same tab
|
||||||
|
$sth = $dbh->prepare("SELECT tagfield, frameworkcode, frameworktext, GROUP_CONCAT(DISTINCT tab) AS tabs
|
||||||
|
FROM marc_subfield_structure
|
||||||
|
LEFT JOIN biblio_framework USING (frameworkcode)
|
||||||
|
WHERE tab != -1
|
||||||
|
GROUP BY tagfield, frameworkcode, frameworktext
|
||||||
|
HAVING COUNT(DISTINCT tab) > 1");
|
||||||
|
$sth->execute;
|
||||||
|
my $inconsistent_tabs = $sth->fetchall_arrayref({});
|
||||||
|
if (scalar(@$inconsistent_tabs) > 0) {
|
||||||
|
$total++;
|
||||||
|
$template->param(inconsistent_tabs => 1);
|
||||||
|
$template->param(tab_info => $inconsistent_tabs);
|
||||||
|
}
|
||||||
|
|
||||||
$template->param(total => $total,
|
$template->param(total => $total,
|
||||||
);
|
);
|
||||||
|
|
||||||
output_html_with_http_headers $input, $cookie, $template->output;
|
output_html_with_http_headers $input, $cookie, $template->output;
|
||||||
|
|
|
@ -155,6 +155,39 @@
|
||||||
</tr>
|
</tr>
|
||||||
<!-- /TMPL_IF -->
|
<!-- /TMPL_IF -->
|
||||||
|
|
||||||
|
<!-- TMPL_IF NAME="inconsistent_tabs" -->
|
||||||
|
<tr>
|
||||||
|
<td style="vertical-align:top;">subfields not in same tabs</td>
|
||||||
|
<td>Not all subfields for the following tags are in the same tab (or marked 'ignored').
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<th>Codek</th>
|
||||||
|
<th>Description</th>
|
||||||
|
<th>Tag</th>
|
||||||
|
<th>Tabs in use</th>
|
||||||
|
</tr>
|
||||||
|
<!-- TMPL_LOOP NAME="tab_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="tabs" --></td>
|
||||||
|
</tr>
|
||||||
|
<!-- /TMPL_LOOP -->
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<!-- TMPL_ELSE -->
|
||||||
|
<tr>
|
||||||
|
<td>OK</td>
|
||||||
|
<td>all subfields for each tag are in the same tab (or ignored)</td>
|
||||||
|
</tr>
|
||||||
|
<!-- /TMPL_IF -->
|
||||||
|
|
||||||
<!-- -->
|
<!-- -->
|
||||||
<!-- TMPL_IF name="total" -->
|
<!-- TMPL_IF name="total" -->
|
||||||
<tr>
|
<tr>
|
||||||
|
|
Loading…
Reference in a new issue