koha-devel
[Top][All Lists]
Advanced

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

[Koha-devel] CVS: koha/C4 Catalogue.pm,1.10,1.11


From: Steve Tonnesen
Subject: [Koha-devel] CVS: koha/C4 Catalogue.pm,1.10,1.11
Date: Tue Nov 6 10:16:04 2001

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

Modified Files:
        Catalogue.pm 
Log Message:
Working out problems with MARC record support.


Index: Catalogue.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Catalogue.pm,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -r1.10 -r1.11
*** Catalogue.pm        2001/11/03 07:29:36     1.10
--- Catalogue.pm        2001/11/06 18:15:34     1.11
***************
*** 137,141 ****
      } elsif ($Subfield_ID) {
         # Subfield_ID does not make the record unique.  Could be multiple
!        # records with the same mark.  This is a bad situatoin.
        my $sth=$dbh->prepare("select Subfield_Key, Subfield_Value from 
$firstdigit\XX_Subfield_Table where Subfield_Mark='$Subfield_Mark' and 
Subfield_ID=$Subfield_ID");
        $sth->execute;
--- 137,141 ----
      } elsif ($Subfield_ID) {
         # Subfield_ID does not make the record unique.  Could be multiple
!        # records with the same mark.  This is a bad situation.
        my $sth=$dbh->prepare("select Subfield_Key, Subfield_Value from 
$firstdigit\XX_Subfield_Table where Subfield_Mark='$Subfield_Mark' and 
Subfield_ID=$Subfield_ID");
        $sth->execute;
***************
*** 191,195 ****
        $origadditionalauthors->{$author}=1;
      }
!     $sth=$dbh->prepare("select subject from bibliosubjects where 
biblionumber=$biblionumber");
      $sth->execute;
      my $origsubjects;
--- 191,195 ----
        $origadditionalauthors->{$author}=1;
      }
!     $sth=$dbh->prepare("select subject from bibliosubject where 
biblionumber=$biblionumber");
      $sth->execute;
      my $origsubjects;
***************
*** 294,298 ****
        } else {
            my $q_newsubject=$dbh->quote($newsubject);
!           my $sth=$dbh->prepare("insert into bibliosubjects 
(subject,biblionumber) values ($q_newsubject, $biblionumber)");
            $sth->execute;
            logchange('kohadb', 'add', 'biblio', 'subject', $newsubject);
--- 294,298 ----
        } else {
            my $q_newsubject=$dbh->quote($newsubject);
!           my $sth=$dbh->prepare("insert into bibliosubject 
(subject,biblionumber) values ($q_newsubject, $biblionumber)");
            $sth->execute;
            logchange('kohadb', 'add', 'biblio', 'subject', $newsubject);
***************
*** 313,321 ****
            my $q_origsubject=$dbh->quote($origsubject);
            logchange('kohadb', 'delete', 'biblio', '$biblionumber', 'subject', 
$origsubject);
!           my $sth=$dbh->prepare("delete from bibliosubjects where 
biblionumber=$biblionumber and subject=$q_origsubject");
            $sth->execute;
        }
      }
  
      $dbh->disconnect;
  }
--- 313,359 ----
            my $q_origsubject=$dbh->quote($origsubject);
            logchange('kohadb', 'delete', 'biblio', '$biblionumber', 'subject', 
$origsubject);
!           my $sth=$dbh->prepare("delete from bibliosubject where 
biblionumber=$biblionumber and subject=$q_origsubject");
            $sth->execute;
        }
      }
  
+ sub skip {
+ # At the moment this is just a straight copy of the subject code.  Needs heavy
+ # modification to work for additional authors, obviously.
+ # Check for additional author changes
+     
+     my $newadditionalauthor='';
+     my $additionalauthors;
+     foreach $newadditionalauthor (@{$biblio->{'additionalauthor'}}) {
+       $additionalauthors->{$newadditionalauthor}=1;
+       if ($origadditionalauthors->{$newadditionalauthor}) {
+           $additionalauthors->{$newadditionalauthor}=2;
+       } else {
+           my $q_newadditionalauthor=$dbh->quote($newadditionalauthor);
+           my $sth=$dbh->prepare("insert into biblioadditionalauthors 
(additionalauthor,biblionumber) values ($q_newadditionalauthor, 
$biblionumber)");
+           $sth->execute;
+           logchange('kohadb', 'add', 'biblio', 'additionalauthor', 
$newadditionalauthor);
+           my $subfields;
+           $subfields->{1}->{'Subfield_Mark'}='a';
+           $subfields->{1}->{'Subfield_Value'}=$newadditionalauthor;
+           my $tag='650';
+           my $Record_ID;
+           foreach $Record_ID (@marcrecords) {
+               addTag($env, $Record_ID, $tag, ' ', ' ', $subfields);
+               logchange('marc', 'add', $Record_ID, '650', 'a', 
$newadditionalauthor);
+           }
+       }
+     }
+     my $origadditionalauthor;
+     foreach $origadditionalauthor (keys %$origadditionalauthors) {
+       if ($additionalauthors->{$origadditionalauthor} == 1) {
+           my $q_origadditionalauthor=$dbh->quote($origadditionalauthor);
+           logchange('kohadb', 'delete', 'biblio', '$biblionumber', 
'additionalauthor', $origadditionalauthor);
+           my $sth=$dbh->prepare("delete from biblioadditionalauthors where 
biblionumber=$biblionumber and additionalauthor=$q_origadditionalauthor");
+           $sth->execute;
+       }
+     }
+ 
+ }
      $dbh->disconnect;
  }
***************
*** 330,334 ****
        my $original=shift;
        my $new=shift;
!       print "KOHA: $type $section $item $original $new\n";
      } elsif ($database eq 'marc') {
        my $type=shift;
--- 368,372 ----
        my $original=shift;
        my $new=shift;
!       print STDERR "KOHA: $type $section $item $original $new\n";
      } elsif ($database eq 'marc') {
        my $type=shift;
***************
*** 339,343 ****
        my $original=shift;
        my $new=shift;
!       print "MARC: $type $Record_ID $tag $mark $subfield_ID $original $new\n";
      }
  }
--- 377,381 ----
        my $original=shift;
        my $new=shift;
!       print STDERR "MARC: $type $Record_ID $tag $mark $subfield_ID $original 
$new\n";
      }
  }




reply via email to

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