[Koha-cvs] CVS: koha/value_builder unimarc_field_210c.pl,1.5,1.6 unimarc_field_225a.pl,1.7,1.8

Paul POULAIN tipaul at users.sourceforge.net
Thu Sep 23 18:33:16 CEST 2004


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

Modified Files:
	unimarc_field_210c.pl unimarc_field_225a.pl 
Log Message:
value builder for 210c (editor) and 225a (collection)
* create a authority category called "EDITORS"
* set :
200$a => ISBN
200$b => editor
200$c => (repeatable) collection.

Then enter, for example :
$a 23
$b Hachette Litterature
$c collection1|collection2|collection3

map your "editor" field to plugin 210c, your "collection" field to plugin 225a
Once you arrive on the editor field, if the beginning of the ISBN exists, the editor is automatically found.
Once you arrive on collection field, click on ... you can choose in the collection list.

The 210c / 225a comes from the UNIMARC editor/collection field, but should work as well with MARC21.

Index: unimarc_field_210c.pl
===================================================================
RCS file: /cvsroot/koha/koha/value_builder/unimarc_field_210c.pl,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** unimarc_field_210c.pl	7 Jun 2004 10:07:40 -0000	1.5
--- unimarc_field_210c.pl	23 Sep 2004 16:33:13 -0000	1.6
***************
*** 58,69 ****
  #---- the editor list is built from the "EDITORS" thesaurus
  #---- this thesaurus category must be filled as follow :
! #---- isbn_identifier authorityseparator editor authorityseparator collection
! #---- sample : 2224 -- Cerf -- Sources chrétiennes
! my $sth = $dbh->prepare("select father,stdlib from bibliothesaurus where category='EDITORS' and level=2");
  $sth->execute;
  my @editors;
  my $authoritysep = C4::Context->preference("authoritysep");
! while (my ($father,$stdlib) = $sth->fetchrow) {
! 	push(@editors,"$father $stdlib");
  }
  my $res  = "
--- 58,75 ----
  #---- the editor list is built from the "EDITORS" thesaurus
  #---- this thesaurus category must be filled as follow :
! #---- 200$a for isbn
! #---- 200$b for editor
! #---- 200$c (repeated) for collections
! my $sth = $dbh->prepare("select auth_subfield_table.authid,subfieldvalue from auth_subfield_table 
! 						left join auth_header on auth_subfield_table.authid=auth_header.authid 
! 						where authtypecode='EDITORS' and tag='200' and subfieldcode='a'");
! my $sth2 = $dbh->prepare("select subfieldvalue from auth_subfield_table where tag='200' and subfieldcode='b' and authid=?");
  $sth->execute;
  my @editors;
  my $authoritysep = C4::Context->preference("authoritysep");
! while (my ($authid,$isbn) = $sth->fetchrow) {
! 	$sth2->execute($authid);
! 	my ($editor) = $sth2->fetchrow;
! 	push(@editors,"$isbn $authoritysep $editor");
  }
  my $res  = "
***************
*** 98,102 ****
  function Clic$function_name(subfield_managed) {
  	defaultvalue=escape(document.forms[0].field_value[subfield_managed].value);
! 	newin=window.open(\"../plugin_launcher.pl?plugin_name=unimarc_field_210c.pl&result=\"+defaultvalue+\"&index=$field_number\",\"value builder\",'width=500,height=400,toolbar=false,scrollbars=yes');
  
  }
--- 104,108 ----
  function Clic$function_name(subfield_managed) {
  	defaultvalue=escape(document.forms[0].field_value[subfield_managed].value);
! 	newin=window.open(\"../authorities/authorities-home.pl\",\"value builder\",'width=500,height=400,toolbar=false,scrollbars=yes');
  
  }

Index: unimarc_field_225a.pl
===================================================================
RCS file: /cvsroot/koha/koha/value_builder/unimarc_field_225a.pl,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** unimarc_field_225a.pl	7 Jun 2004 10:07:40 -0000	1.7
--- unimarc_field_225a.pl	23 Sep 2004 16:33:13 -0000	1.8
***************
*** 120,130 ****
  		my @collections;
  	if ($isbn_found) {
! 		my $sth = $dbh->prepare("select stdlib from bibliothesaurus where father=? and category='EDITORS' order by stdlib");
  		my @splited = split //, $isbn_found;
  		my $isbn_rebuild='';
  		foreach my $x (@splited) {
  			$isbn_rebuild.=$x;
! 			$sth->execute("$isbn_rebuild $authoritysep $editor_found $authoritysep");
! 			while (my ($line)= $sth->fetchrow) {
  				push @collections,$line;
  			}
--- 120,135 ----
  		my @collections;
  	if ($isbn_found) {
! 		my $sth = $dbh->prepare("select auth_subfield_table.authid,subfieldvalue from auth_subfield_table 
! 						left join auth_header on auth_subfield_table.authid=auth_header.authid 
! 						where authtypecode='EDITORS' and tag='200' and subfieldcode='a' and subfieldvalue=?");
! 		my $sth2 = $dbh->prepare("select subfieldvalue from auth_subfield_table where tag='200' and subfieldcode='c' and authid=?");
  		my @splited = split //, $isbn_found;
  		my $isbn_rebuild='';
  		foreach my $x (@splited) {
  			$isbn_rebuild.=$x;
! 			$sth->execute($isbn_rebuild);
! 			my ($authid) = $sth->fetchrow;
! 			$sth2->execute($authid);
! 			while (my ($line)= $sth2->fetchrow) {
  				push @collections,$line;
  			}





More information about the Koha-cvs mailing list