[Koha-cvs] CVS: koha/misc rebuildthesaurus.pl,1.1.2.1,1.1.2.2

Paul POULAIN tipaul at users.sourceforge.net
Mon Jan 26 11:40:34 CET 2004


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

Modified Files:
      Tag: rel_2_0
	rebuildthesaurus.pl 
Log Message:
modifying rebuildthesaurus command line parameters : script more versatile.

Index: rebuildthesaurus.pl
===================================================================
RCS file: /cvsroot/koha/koha/misc/Attic/rebuildthesaurus.pl,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -C2 -r1.1.2.1 -r1.1.2.2
*** rebuildthesaurus.pl	20 Jan 2004 12:59:28 -0000	1.1.2.1
--- rebuildthesaurus.pl	26 Jan 2004 10:40:31 -0000	1.1.2.2
***************
*** 20,24 ****
      'd' => \$delete,
      't' => \$test_parameter,
-     'f:s' => \$field,
      's:s' => \$subfields,
      'v' => \$verbose,
--- 20,23 ----
***************
*** 34,43 ****
  \tv : verbose mode.
  \tt : test mode : parses the file, saying what he would do, but doing nothing.
- \tf : the field
  \ts : the subfields
  \d : delete every entry of the selected category before doing work.
  
! SAMPLE : ./bulkmarcimport.pl -c NP -f 700 -s "\$a, \$b (\$c ; \$d)" => will build authority file NP with value constructed with 700 field \$a, \$b, \$c & \$d subfields
! In UNIMARC this rebuild author authority file.
  EOF
  ;#
--- 33,42 ----
  \tv : verbose mode.
  \tt : test mode : parses the file, saying what he would do, but doing nothing.
  \ts : the subfields
  \d : delete every entry of the selected category before doing work.
  
! SAMPLES :
!  ./rebuildthesaurus.pl -c NP -s "##700#a, ##700#b (##700#c ; ##700#d)" => will build authority file NP with value constructed with 700 field \$a, \$b, \$c & \$d subfields In UNIMARC this rebuild author authority file.
!  ./rebuildthesaurus.pl -c EDITORS -s "##210#c -- ##225#a" => will build authority for editor and collection. The EDITORS authority category is used with plugins for 210 & 225 in UNIMARC.
  EOF
  ;#
***************
*** 63,70 ****
  	my $record = MARCgetbiblio($dbh,$bibid);
  #	warn $record->as_formatted;
! 	foreach my $fieldwanted ($record->field($field)) {
! 		my $resultstring = $subfields;
  		foreach my $pair ( $fieldwanted->subfields() ) {
! 			$resultstring =~ s/\$$pair->[0]/$pair->[1]/g;
  		}
  		# deals empty subfields
--- 62,72 ----
  	my $record = MARCgetbiblio($dbh,$bibid);
  #	warn $record->as_formatted;
! 	my $resultstring = $subfields;
! 	foreach my $fieldwanted ($record->fields) {
! 		next if $fieldwanted->tag()<=10;
  		foreach my $pair ( $fieldwanted->subfields() ) {
! 			my $fieldvalue = $fieldwanted->tag();
! #			warn "$fieldvalue ==> #$fieldvalue#$pair->[0]/$pair->[1]";
! 			$resultstring =~ s/##$fieldvalue##$pair->[0]/$pair->[1]/g;
  		}
  		# deals empty subfields
***************
*** 72,80 ****
  			$resultstring =~ s/\$$empty//g;
  		}
! 		warn "result : $resultstring" if $verbose;
  		&newauthority($dbh,$category,$resultstring);
  		$i++;
  	}
- 
  }
  my $timeneeded = gettimeofday - $starttime;
--- 74,82 ----
  			$resultstring =~ s/\$$empty//g;
  		}
! 		warn "RRR $resultstring";
! 		if ($resultstring ne $subfields && $resultstring &&
  		&newauthority($dbh,$category,$resultstring);
  		$i++;
  	}
  }
  my $timeneeded = gettimeofday - $starttime;





More information about the Koha-cvs mailing list