koha-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Koha-cvs] CVS: koha/C4 Biblio.pm,1.34,1.35 Koha.pm,1.10,1.11


From: Ambrose Li
Subject: [Koha-cvs] CVS: koha/C4 Biblio.pm,1.34,1.35 Koha.pm,1.10,1.11
Date: Mon, 03 Feb 2003 10:46:05 -0800

Update of /cvsroot/koha/koha/C4
In directory sc8-pr-cvs1:/tmp/cvs-serv3203/C4

Modified Files:
        Biblio.pm Koha.pm 
Log Message:
Minor factoring in C4/Biblio.pm, plus change to export the per-tag
'mandatory' property to a per-subfield 'tag_mandatory' template parameter,
so that addbiblio.tmpl can distinguish between mandatory subfields in a
mandatory tag and mandatory subfields in an optional tag

Not-minor factoring in acqui.simple/addbiblio.pl to make the if-else blocks
smaller, and to add some POD; need further testing for this

Added function to check if a MARC subfield name is "koha-internal" (instead
of checking it for 'lib' and 'tag' everywhere); temporarily added to Koha.pm

Use above function in acqui.simple/additem.pl and search.marc/search.pl


Index: Biblio.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Biblio.pm,v
retrieving revision 1.34
retrieving revision 1.35
diff -C2 -r1.34 -r1.35
*** Biblio.pm   28 Jan 2003 14:50:04 -0000      1.34
--- Biblio.pm   3 Feb 2003 18:46:00 -0000       1.35
***************
*** 2,5 ****
--- 2,19 ----
  # $Id$
  # $Log$
+ # Revision 1.35  2003/02/03 18:46:00  acli
+ # Minor factoring in C4/Biblio.pm, plus change to export the per-tag
+ # 'mandatory' property to a per-subfield 'tag_mandatory' template parameter,
+ # so that addbiblio.tmpl can distinguish between mandatory subfields in a
+ # mandatory tag and mandatory subfields in an optional tag
+ #
+ # Not-minor factoring in acqui.simple/addbiblio.pl to make the if-else blocks
+ # smaller, and to add some POD; need further testing for this
+ #
+ # Added function to check if a MARC subfield name is "koha-internal" (instead
+ # of checking it for 'lib' and 'tag' everywhere); temporarily added to Koha.pm
+ #
+ # Use above function in acqui.simple/additem.pl and search.marc/search.pl
+ #
  # Revision 1.34  2003/01/28 14:50:04  tipaul
  # fixing MARCmodbiblio API and reindenting code
***************
*** 377,397 ****
        my ($dbh,$forlibrarian)= @_;
        my $sth;
!       if ($forlibrarian eq 1) {
!               $sth=$dbh->prepare("select tagfield,liblibrarian as lib from 
marc_tag_structure order by tagfield");
!       } else {
!               $sth=$dbh->prepare("select tagfield,libopac as lib from 
marc_tag_structure order by tagfield");
!       }
        $sth->execute;
        my ($lib,$tag,$res,$tab,$mandatory,$repeatable);
!       while ( ($tag,$lib,$tab) = $sth->fetchrow) {
                $res->{$tag}->{lib}=$lib;
!               $res->{$tab}->{tab}="";
        }
  
!       if ($forlibrarian eq 1) {
!               $sth=$dbh->prepare("select tagfield,tagsubfield,liblibrarian as 
lib,tab, mandatory, 
repeatable,authorised_value,thesaurus_category,value_builder from 
marc_subfield_structure order by tagfield,tagsubfield");
!       } else {
!               $sth=$dbh->prepare("select tagfield,tagsubfield,libopac as 
lib,tab, mandatory, 
repeatable,authorised_value,thesaurus_category,value_builder from 
marc_subfield_structure order by tagfield,tagsubfield");
!       }
        $sth->execute;
  
--- 391,405 ----
        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) {
                $res->{$tag}->{lib}=$lib;
!               $res->{$tab}->{tab}=""; # XXX
!               $res->{$tag}->{mandatory}=$mandatory;
        }
  
!       $sth=$dbh->prepare("select tagfield,tagsubfield,$libfield as lib,tab, 
mandatory, repeatable,authorised_value,thesaurus_category,value_builder from 
marc_subfield_structure order by tagfield,tagsubfield");
        $sth->execute;
  

Index: Koha.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Koha.pm,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -r1.10 -r1.11
*** Koha.pm     11 Oct 2002 12:39:34 -0000      1.10
--- Koha.pm     3 Feb 2003 18:46:02 -0000       1.11
***************
*** 55,58 ****
--- 55,59 ----
             &borrowercategories
             &ethnicitycategories
+            &subfield_is_koha_internal_p
             $DEBUG);
  
***************
*** 149,152 ****
--- 150,164 ----
      $sth->finish;
      return(address@hidden,\%labels);
+ }
+ 
+ # FIXME.. this should be moved to a MARC-specific module
+ sub subfield_is_koha_internal_p ($) {
+     my($subfield) = @_;
+ 
+     # We could match on 'lib' and 'tab' (and 'mandatory', & more to come!)
+     # But real MARC subfields are always single-character
+     # so it really is safer just to check the length
+ 
+     return length $subfield != 1;
  }
  




reply via email to

[Prev in Thread] Current Thread [Next in Thread]