[Koha-cvs] CVS: koha/misc/migration_tools check_marc_definition.pl,1.1.2.2,1.1.2.3

Paul POULAIN tipaul at users.sourceforge.net
Thu Jun 16 17:46:01 CEST 2005


Update of /cvsroot/koha/koha/misc/migration_tools
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19752/misc/migration_tools

Modified Files:
      Tag: rel_2_2
	check_marc_definition.pl 
Log Message:
improving script with a new parameter to show all the subfields usage.

Index: check_marc_definition.pl
===================================================================
RCS file: /cvsroot/koha/koha/misc/migration_tools/check_marc_definition.pl,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -C2 -r1.1.2.2 -r1.1.2.3
*** check_marc_definition.pl	7 Apr 2005 12:00:57 -0000	1.1.2.2
--- check_marc_definition.pl	16 Jun 2005 15:45:59 -0000	1.1.2.3
***************
*** 15,22 ****
  use Getopt::Long;
  my ( $input_marc_file, $number) = ('',0);
! my ($version,$confirm);
  GetOptions(
      'h' => \$version,
      'c' => \$confirm,
  );
  
--- 15,23 ----
  use Getopt::Long;
  my ( $input_marc_file, $number) = ('',0);
! my ($version,$confirm,$all);
  GetOptions(
      'h' => \$version,
      'c' => \$confirm,
+ 	'a' => \$all,
  );
  
***************
*** 26,29 ****
--- 27,32 ----
  It show all fields/subfields that are in the MARC DB but NOT in any tab (= fields used but not visible) Usually, this means you made an error in your MARC editor. Sometimes, this is something normal.
  
+ options
+ \t-a : will show all subfields usages, not only subfields in tab ignore that are used.
  Enter $0 -c to run this script (the -c being here only to "confirm"
  EOF
***************
*** 38,47 ****
  my %tags;
  my $sth2 = $dbh->prepare("select tab,liblibrarian,kohafield from marc_subfield_structure where tagfield=? and tagsubfield=? and frameworkcode=?");
  while (my ($total,$tag,$subfield,$frameworkcode) = $sth->fetchrow) {
  	$sth2->execute($tag,$subfield,$frameworkcode);
  	$tags{$frameworkcode." / ".$tag." / ".$subfield} ++;
  	my ($tab,$liblibrarian,$kohafield) = $sth2->fetchrow;
! 	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";
  	}
  }
--- 41,57 ----
  my %tags;
  my $sth2 = $dbh->prepare("select tab,liblibrarian,kohafield from marc_subfield_structure where tagfield=? and tagsubfield=? and frameworkcode=?");
+ if ($all) {
+ 	print "framework|tag|subfield|value|used|tab\n";
+ }
  while (my ($total,$tag,$subfield,$frameworkcode) = $sth->fetchrow) {
  	$sth2->execute($tag,$subfield,$frameworkcode);
  	$tags{$frameworkcode." / ".$tag." / ".$subfield} ++;
  	my ($tab,$liblibrarian,$kohafield) = $sth2->fetchrow;
! 	if ($all) {
! 		print $frameworkcode."|".$tag.'|$'.$subfield."|".$liblibrarian."|".$total."|".$tab."\n";
! 	} 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";
! 		}
  	}
  }





More information about the Koha-cvs mailing list