-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' ) {
- my $type = shift;
- my $section = shift;
- my $item = shift;
- my $original = shift;
- my $new = shift;
-
- # print STDERR "KOHA: $type $section $item $original $new\n";
- }
- elsif ( $database eq 'marc' ) {
- my $type = shift;
- my $Record_ID = shift;
- my $tag = shift;
- my $mark = shift;
- my $subfield_ID = shift;
- my $original = shift;
- my $new = shift;
-
-# print STDERR "MARC: $type $Record_ID $tag $mark $subfield_ID $original $new\n";
- }
-}
-
-#------------------------------------------------
-
-#---------------------------------------
-# Find a biblio entry, or create a new one if it doesn't exist.
-# If a "subtitle" entry is in hash, add it to subtitle table
-sub getoraddbiblio {
-
- # input params
- my (
- $dbh, # db handle
- # FIXME - Unused argument
- $biblio, # hash ref to fields
- ) = @_;
-
- # return
- my $biblionumber;
-
- my $debug = 0;
- my $sth;
- my $error;
-
- #-----
- $dbh = C4::Context->dbh;
-
- print "<PRE>Looking for biblio </PRE>\n" if $debug;
- $sth = $dbh->prepare( "select biblionumber
- from biblio
- where title=? and author=?
- and copyrightdate=? and seriestitle=?"
- );
- $sth->execute(
- $biblio->{title}, $biblio->{author},
- $biblio->{copyright}, $biblio->{seriestitle}
- );
- if ( $sth->rows ) {
- ($biblionumber) = $sth->fetchrow;
- print "<PRE>Biblio exists with number $biblionumber</PRE>\n" if $debug;
- }
- else {
-
- # Doesn't exist. Add new one.
- print "<PRE>Adding biblio</PRE>\n" if $debug;
- ( $biblionumber, $error ) = &newbiblio($biblio);
- if ($biblionumber) {
- print "<PRE>Added with biblio number=$biblionumber</PRE>\n"
- if $debug;
- if ( $biblio->{subtitle} ) {
- &newsubtitle( $biblionumber, $biblio->{subtitle} );
- } # if subtitle
- }
- else {
- print "<PRE>Couldn't add biblio: $error</PRE>\n" if $debug;
- } # if added
- }
-
- return $biblionumber, $error;
-
-} # sub getoraddbiblio
-