[Koha-cvs] CVS: koha/C4 Biblio.pm,1.87,1.88 Koha.pm,1.17,1.18

Paul POULAIN tipaul at users.sourceforge.net
Tue May 18 17:23:53 CEST 2004


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

Modified Files:
	Biblio.pm Koha.pm 
Log Message:
framework management : 1 MARC framework for each itemtype


Index: Biblio.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Biblio.pm,v
retrieving revision 1.87
retrieving revision 1.88
diff -C2 -r1.87 -r1.88
*** Biblio.pm	18 May 2004 11:54:07 -0000	1.87
--- Biblio.pm	18 May 2004 15:23:49 -0000	1.88
***************
*** 34,68 ****
  #
  @EXPORT = qw(
! 	     &updateBiblio &updateBiblioItem &updateItem
! 	     &itemcount &newbiblio &newbiblioitem
! 	     &modnote &newsubject &newsubtitle
! 	     &modbiblio &checkitems
! 	     &newitems &modbibitem
! 	     &modsubtitle &modsubject &modaddauthor &moditem &countitems
! 	     &delitem &deletebiblioitem &delbiblio
! 	     &getbiblio
! 	     &getbiblioitembybiblionumber
! 	     &getbiblioitem &getitemsbybiblioitem
! 	     &skip
! 	     &newcompletebiblioitem
! 
! 	     &MARCfind_oldbiblionumber_from_MARCbibid
! 	     &MARCfind_MARCbibid_from_oldbiblionumber
! 		&MARCfind_marc_from_kohafield
! 	     &MARCfindsubfield
! 	     &MARCgettagslib
! 
! 		&NEWnewbiblio &NEWnewitem
! 		&NEWmodbiblio &NEWmoditem
! 		&NEWdelbiblio &NEWdelitem
! 
! 	     &MARCaddbiblio &MARCadditem
! 	     &MARCmodsubfield &MARCaddsubfield
! 	     &MARCmodbiblio &MARCmoditem
! 	     &MARCkoha2marcBiblio &MARCmarc2koha
! 		&MARCkoha2marcItem &MARChtml2marc
! 	     &MARCgetbiblio &MARCgetitem
! 	     &MARCaddword &MARCdelword
! 		&char_decode
   );
  
--- 34,69 ----
  #
  @EXPORT = qw(
! 	&updateBiblio &updateBiblioItem &updateItem
! 	&itemcount &newbiblio &newbiblioitem
! 	&modnote &newsubject &newsubtitle
! 	&modbiblio &checkitems
! 	&newitems &modbibitem
! 	&modsubtitle &modsubject &modaddauthor &moditem &countitems
! 	&delitem &deletebiblioitem &delbiblio
! 	&getbiblio
! 	&getbiblioitembybiblionumber
! 	&getbiblioitem &getitemsbybiblioitem
! 	&skip
! 	&newcompletebiblioitem
! 
! 	&MARCfind_oldbiblionumber_from_MARCbibid
! 	&MARCfind_MARCbibid_from_oldbiblionumber
! 	&MARCfind_marc_from_kohafield
! 	&MARCfindsubfield
! 	&MARCfind_itemtype
! 	&MARCgettagslib
! 
! 	&NEWnewbiblio &NEWnewitem
! 	&NEWmodbiblio &NEWmoditem
! 	&NEWdelbiblio &NEWdelitem
! 
! 	&MARCaddbiblio &MARCadditem
! 	&MARCmodsubfield &MARCaddsubfield
! 	&MARCmodbiblio &MARCmoditem
! 	&MARCkoha2marcBiblio &MARCmarc2koha
! 	&MARCkoha2marcItem &MARChtml2marc
! 	&MARCgetbiblio &MARCgetitem
! 	&MARCaddword &MARCdelword
! 	&char_decode
   );
  
***************
*** 130,136 ****
  =over 4
  
! =item @tagslib = &MARCgettagslib($dbh,1|0);
  
  last param is 1 for liblibrarian and 0 for libopac
  returns a hash with tag/subfield meaning
  =item ($tagfield,$tagsubfield) = &MARCfind_marc_from_kohafield($dbh,$kohafield);
--- 131,138 ----
  =over 4
  
! =item @tagslib = &MARCgettagslib($dbh,1|0,$itemtype);
  
  last param is 1 for liblibrarian and 0 for libopac
+ $itemtype contains the itemtype framework reference. If empty or does not exist, the default one is used
  returns a hash with tag/subfield meaning
  =item ($tagfield,$tagsubfield) = &MARCfind_marc_from_kohafield($dbh,$kohafield);
***************
*** 220,228 ****
  
  sub MARCgettagslib {
! 	my ($dbh,$forlibrarian)= @_;
  	my $sth;
  	my $libfield = ($forlibrarian eq 1)? 'liblibrarian' : 'libopac';
! 	$sth=$dbh->prepare("select tagfield,$libfield as lib,mandatory from marc_tag_structure order by tagfield");
! 	$sth->execute;
  	my ($lib,$tag,$res,$tab,$mandatory,$repeatable);
  	while ( ($tag,$lib,$mandatory) = $sth->fetchrow) {
--- 222,236 ----
  
  sub MARCgettagslib {
! 	my ($dbh,$forlibrarian,$itemtype)= @_;
! 	$itemtype="" unless $itemtype;
  	my $sth;
  	my $libfield = ($forlibrarian eq 1)? 'liblibrarian' : 'libopac';
! 	# check that itemtype framework exists
! 	$sth=$dbh->prepare("select count(*) from marc_tag_structure where itemtype=? order by ?");
! 	$sth->execute($itemtype,$itemtype);
! 	my ($total) = $sth->fetchrow;
! 	$itemtype="" unless ($total >0);
! 	$sth=$dbh->prepare("select tagfield,$libfield as lib,mandatory from marc_tag_structure where itemtype=? order by tagfield");
! 	$sth->execute($itemtype);
  	my ($lib,$tag,$res,$tab,$mandatory,$repeatable);
  	while ( ($tag,$lib,$mandatory) = $sth->fetchrow) {
***************
*** 232,237 ****
  	}
  
! 	$sth=$dbh->prepare("select tagfield,tagsubfield,$libfield as lib,tab, mandatory, repeatable,authorised_value,thesaurus_category,value_builder,kohafield,seealso from marc_subfield_structure order by tagfield,tagsubfield");
! 	$sth->execute;
  
  	my $subfield;
--- 240,245 ----
  	}
  
! 	$sth=$dbh->prepare("select tagfield,tagsubfield,$libfield as lib,tab, mandatory, repeatable,authorised_value,thesaurus_category,value_builder,kohafield,seealso from marc_subfield_structure where itemtype=? order by tagfield,tagsubfield");
! 	$sth->execute($itemtype);
  
  	my $subfield;
***************
*** 692,695 ****
--- 700,711 ----
  }
  
+ sub MARCfind_itemtype {
+ 	my ($dbh,$bibid) = @_;
+ 	my ($tagfield,$tagsubfield) = MARCfind_marc_from_kohafield($dbh,"biblioitems.itemtype");
+ 	my $sth = $dbh->prepare("select subfieldvalue from marc_subfield_table where bibid=? and tag=? and subfieldcode=?");
+ 	$sth->execute($bibid,$tagfield,$tagsubfield);
+ 	my ($subfieldvalue) = $sth->fetchrow;
+ 	return $subfieldvalue;
+ }
  sub MARCdelsubfield {
  # delete a subfield for $bibid / tag / tagorder / subfield / subfieldorder
***************
*** 2179,2182 ****
--- 2195,2201 ----
  # $Id$
  # $Log$
+ # Revision 1.88  2004/05/18 15:23:49  tipaul
+ # framework management : 1 MARC framework for each itemtype
+ #
  # Revision 1.87  2004/05/18 11:54:07  tipaul
  # getitemtypes moved in Koha.pm

Index: Koha.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Koha.pm,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -r1.17 -r1.18
*** Koha.pm	18 May 2004 11:54:07 -0000	1.17
--- Koha.pm	18 May 2004 15:23:49 -0000	1.18
***************
*** 200,204 ****
  	my %branches;
  	my $dbh = C4::Context->dbh;
! 	my $sth=$dbh->prepare("select * from branches");
  	$sth->execute;
  	while (my $branch=$sth->fetchrow_hashref) {
--- 200,204 ----
  	my %branches;
  	my $dbh = C4::Context->dbh;
! 	my $sth=$dbh->prepare("select * from branches order by branchname");
  	$sth->execute;
  	while (my $branch=$sth->fetchrow_hashref) {
***************
*** 264,268 ****
  	my %itemtypes;
  	my $dbh = C4::Context->dbh;
! 	my $sth=$dbh->prepare("select * from itemtypes");
  	$sth->execute;
  	while (my $IT=$sth->fetchrow_hashref) {
--- 264,268 ----
  	my %itemtypes;
  	my $dbh = C4::Context->dbh;
! 	my $sth=$dbh->prepare("select * from itemtypes order by description");
  	$sth->execute;
  	while (my $IT=$sth->fetchrow_hashref) {





More information about the Koha-cvs mailing list