koha-cvs
[Top][All Lists]
Advanced

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

[Koha-cvs] CVS: koha/C4 Catalogue.pm,1.14,1.15


From: Steve Tonnesen
Subject: [Koha-cvs] CVS: koha/C4 Catalogue.pm,1.14,1.15
Date: Wed, 29 May 2002 15:47:22 -0700

Update of /cvsroot/koha/koha/C4
In directory usw-pr-cvs1:/tmp/cvs-serv25811

Modified Files:
        Catalogue.pm 
Log Message:
Started modifications to match new marc schema


Index: Catalogue.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Catalogue.pm,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -r1.14 -r1.15
*** Catalogue.pm        18 May 2002 07:01:27 -0000      1.14
--- Catalogue.pm        29 May 2002 22:47:20 -0000      1.15
***************
*** 110,117 ****
      my ( $subfieldid, $subfieldvalue )address@hidden;
  
-     my $firstdigit="?";
- 
      my $dbh=&c4connect;  
!     my $sth=$dbh->prepare("update marc_$firstdigit\XX_subfield_table set 
subfieldvalue=? where subfieldid=?");
      $sth->execute($subfieldvalue, $subfieldid);
  
--- 110,115 ----
      my ( $subfieldid, $subfieldvalue )address@hidden;
  
      my $dbh=&c4connect;  
!     my $sth=$dbh->prepare("update marc_subfield_table set subfieldvalue=? 
where subfieldid=?");
      $sth->execute($subfieldvalue, $subfieldid);
  
***************
*** 120,123 ****
--- 118,144 ----
  }
  
+ sub findSubfield {
+ # find a subfieldid given bibid, tag, subfieldcode, subfieldvalue this is
+ # inherently dangerous.  There could be multiple subfields that match the 
given
+ # parameters.  What then?  What if no subfields match?  That one's easy, just
+ # return 0
+     my ($bibid,$tag,$subfieldcode,$subfieldvalue) = @_;
+     my $resultcounter=0;
+     my $subfieldid=0;
+     my $dbh=&c4connect;
+     my $sth=$dbh->prepare("select tagid from marc_$firstdigit\XX_tag_table 
where bibid=$bibid");
+     $sth->execute;
+     my $sti=$dbh->prepare("select subfieldid from marc_subfield_table where 
tag=? and subfieldcode=? and subfieldvalue=?");
+     $sti->execute($tag, $subfieldcode,$subfieldvalue);
+     while (($subfieldid) = $sti->fetchrow) {
+       $resultcounter++;
+     }
+     if ($resultcounter>1) {
+       # Error condition.  Values given did not resolve into a unique record.  
Don't know what to edit
+       return -1;
+     } else {
+       return $subfieldid;
+     }
+ }
  
  sub addSubfield {
***************
*** 128,136 ****
      my $subfieldvalue=shift;
      my $subfieldorder=shift;
-     my $firstdigit="?";
  
      my $dbh=&c4connect;  
      unless ($subfieldorder) {
!       my $sth=$dbh->prepare("select max(subfieldorder) from 
marc_$firstdigit\XX_subfield_table where tagid=$tagid");
        $sth->execute;
        if ($sth->rows) {
--- 149,156 ----
      my $subfieldvalue=shift;
      my $subfieldorder=shift;
  
      my $dbh=&c4connect;  
      unless ($subfieldorder) {
!       my $sth=$dbh->prepare("select max(subfieldorder) from 
marc_subfield_table where tagid=$tagid");
        $sth->execute;
        if ($sth->rows) {
***************
*** 141,145 ****
        }
      }
!     my $sth=$dbh->prepare("insert into marc_$firstdigit\XX_subfield_table 
(tagid,bibid,subfieldorder,subfieldcode,subfieldvalue) values (?,?,?,?,?)");
      $sth->execute($tagid,$bibid,$subfieldorder,$subfieldcode,$subfieldvalue);
  }
--- 161,165 ----
        }
      }
!     my $sth=$dbh->prepare("insert into marc_subfield_table 
(tagid,bibid,subfieldorder,subfieldcode,subfieldvalue) values (?,?,?,?,?)");
      $sth->execute($tagid,$bibid,$subfieldorder,$subfieldcode,$subfieldvalue);
  }
***************
*** 184,188 ****
      
  # Obtain a list of MARC Record_ID's that are tied to this biblio
!     $sth=$dbh->prepare("select T.bibid from marc_0XX_tag_table T, 
marc_0XX_subfield_table S where T.tagid=S.tagid and T.tagnumber='090' and 
S.subfieldvalue=$biblionumber and S.subfieldcode='c'");
      $sth->execute;
      my @marcrecords;
--- 204,208 ----
      
  # Obtain a list of MARC Record_ID's that are tied to this biblio
!     $sth=$dbh->prepare("select bibid from marc_subfield_table where tag='090' 
and subfieldvalue=$biblionumber and subfieldcode='c'");
      $sth->execute;
      my @marcrecords;
***************
*** 344,347 ****
--- 364,369 ----
  sub logchange {
  # Subroutine to log changes to databases
+ # Eventually, this subroutine will be used to create a log of all changes 
made,
+ # with the possibility of "undo"ing some changes
      my $database=shift;
      if ($database eq 'kohadb') {




reply via email to

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