Checking that all fields mapped to the item marc field (995 in UNIMARC) are mapped...
authortipaul <tipaul>
Fri, 4 Jul 2003 13:24:52 +0000 (13:24 +0000)
committertipaul <tipaul>
Fri, 4 Jul 2003 13:24:52 +0000 (13:24 +0000)
Previously, you had a warning only if fields mapped to item SQL-table was in more than 1 item marc field.

admin/checkmarc.pl

index 359fc35..7b3cc9a 100755 (executable)
@@ -68,6 +68,7 @@ if ($res && $res2 && ($res eq $res2) && $tab==-1 && $tab2==-1) {
 }
 
 # checks all item fields are in the same tag and in tab 10
+
 $sth = $dbh->prepare("select tagfield,tab,kohafield from marc_subfield_structure where kohafield like \"items.%\"");
 $sth->execute;
 my $field;
@@ -81,6 +82,14 @@ while (($res,$res2,$field) = $sth->fetchrow) {
                $subtotal++;
        }
 }
+$sth = $dbh->prepare("select kohafield from marc_subfield_structure where tagfield=$tagfield");
+$sth->execute;
+while (($res2) = $sth->fetchrow) {
+       if (!$res2 || $res2 =~ /^items/) {
+       } else {
+               $subtotal++;
+       }
+}
 if ($subtotal eq 0) {
        $template->param(itemfields => 0);
 } else {
@@ -91,7 +100,6 @@ if ($subtotal eq 0) {
 $sth = $dbh->prepare("select tagfield,tab,authorised_value from marc_subfield_structure where kohafield = \"biblioitems.itemtype\"");
 $sth->execute;
 ($res,$res2,$field) = $sth->fetchrow;
-warn "==> $res / $res2 / $field";
 if ($res && $res2>=0 && $field eq "itemtypes") {
        $template->param(itemtype => 0);
 } else {