[Koha-cvs] koha/misc/migration_tools check_marc_definition.pl [rel_2_2]

paul poulain paul at koha-fr.org
Fri Oct 13 11:59:59 CEST 2006


CVSROOT:	/cvsroot/koha
Module name:	koha
Branch:		rel_2_2
Changes by:	paul poulain <tipaul>	06/10/13 09:59:59

Modified files:
	misc/migration_tools: check_marc_definition.pl 

Log message:
	improving & fixing a bug. Run without parameter to see what is new

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/misc/migration_tools/check_marc_definition.pl?cvsroot=koha&only_with_tag=rel_2_2&r1=1.1.2.4&r2=1.1.2.5

Patches:
Index: check_marc_definition.pl
===================================================================
RCS file: /cvsroot/koha/koha/misc/migration_tools/check_marc_definition.pl,v
retrieving revision 1.1.2.4
retrieving revision 1.1.2.5
diff -u -b -r1.1.2.4 -r1.1.2.5
--- check_marc_definition.pl	12 Sep 2006 09:27:39 -0000	1.1.2.4
+++ check_marc_definition.pl	13 Oct 2006 09:59:59 -0000	1.1.2.5
@@ -47,7 +47,7 @@
 if ($all) {
 	print "framework|tag|subfield|value|used|tab\n";
 }
-my $sth3 = $dbh->prepare("update marc_subfield_structure set tab=1 where frameworkcode=? and tagfield=? and tagsubfield=?");
+my $sth3 = $dbh->prepare("update marc_subfield_structure set tab=0 where frameworkcode=? and tagfield=? and tagsubfield=?");
 while (my ($total,$tag,$subfield,$frameworkcode) = $sth->fetchrow) {
 	$sth2->execute($tag,$subfield,$frameworkcode);
 	$tags{$frameworkcode." / ".$tag." / ".$subfield} ++;
@@ -57,10 +57,12 @@
 	} else {
 		if ($tab eq -1 && $kohafield ne "biblio.biblionumber" && $kohafield ne "biblioitems.biblioitemnumber" && $kohafield ne "items.itemnumber") {
 			print "Tab ignore for framework $frameworkcode, $tag\$$subfield - $liblibrarian (used $total times)\n";
-			$sth3->execute($frameworkcode,$tag,$subfield) if $autoactivate && tab eq -1;
-			
 		}
 	}
+	if ($autoactivate && $total>0 && $kohafield ne "biblio.biblionumber" && $kohafield ne "biblioitems.biblioitemnumber" && !($kohafield=~/^items/)) {
+	   $sth3->execute($frameworkcode,$tag,$subfield);
+	   print "auto activate $frameworkcode $tag $subfield ($kohafield)\n";
+    }
 }
 
 $sth = $dbh->prepare("select frameworkcode,tagfield,tagsubfield from marc_subfield_structure where tab<>-1 order by frameworkcode,tagfield,tagsubfield");
@@ -70,8 +72,10 @@
 my $sth2 = $dbh->prepare("update marc_subfield_structure set tab=-1 where frameworkcode=? and tagfield=? and tagsubfield=?");
 while (my ($frameworkcode,$tag,$subfield) = $sth->fetchrow) {
 	print "$tag, $subfield in framework $frameworkcode is active, but never filled" unless $tags{$frameworkcode." / ".$tag." / ".$subfield};
+	unless ($tags{$frameworkcode." / ".$tag." / ".$subfield}) {
 	print "... auto cleaned" if $autoclean;
-	print "\n" unless $tags{$frameworkcode." / ".$tag." / ".$subfield};
+        print "\n";
 	$sth2->execute($frameworkcode,$tag,$subfield) if $autoclean;
+    }
 }
 print "Done\n";





More information about the Koha-cvs mailing list