[Koha-devel] CVS: koha/C4 Acquisitions.pm,1.7,1.8 Output.pm,1.6,1.7 Search.pm,1.21,1.22

Gynn Lomax truth_nz at users.sourceforge.net
Wed May 8 18:08:03 CEST 2002


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

Modified Files:
	Acquisitions.pm Output.pm Search.pm 
Log Message:
Update to catalogue to allow change of biblio abstracts.
Related modifications to acqui system to match changes in Acquisition.pm
detail.pm changed to show abstract - still working on how to show url's


Index: Acquisitions.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Acquisitions.pm,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** Acquisitions.pm	3 May 2002 02:47:33 -0000	1.7
--- Acquisitions.pm	9 May 2002 01:07:36 -0000	1.8
***************
*** 339,356 ****
  
  sub branches {
!   my $dbh=C4Connect;
!   my $query="Select * from branches";
!   my $sth=$dbh->prepare($query);
!   $sth->execute;
!   my @results;
!   my $i=0;
!   while (my $data=$sth->fetchrow_hashref){
!     $results[$i]=$data;
!     $i++;
!   }
!   $sth->finish;
!   $dbh->disconnect;
!   return($i, at results);
! }
  
  sub bookfundbreakdown {
--- 339,358 ----
  
  sub branches {
!     my $dbh   = C4Connect;
!     my $query = "Select * from branches";
!     my $sth   = $dbh->prepare($query);
!     my $i     = 0;
!     my @results;
! 
!     $sth->execute;
!     while (my $data = $sth->fetchrow_hashref) {
!         $results[$i] = $data;
!     	$i++;
!     } # while
! 
!     $sth->finish;
!     $dbh->disconnect;
!     return($i, @results);
! } # sub branches
  
  sub bookfundbreakdown {
***************
*** 420,436 ****
  }
  
  sub modbiblio {
!   my ($bibnum, $title, $author, $copyright, $seriestitle, $serial, $unititle, $notes)=@_;
    my $dbh   = C4Connect;
!   my $query = "Update biblio set
! title         = '$title',
! author        = '$author',
! copyrightdate = '$copyright',
! seriestitle   = '$seriestitle',
! serial        = '$serial',
! unititle      = '$unititle',
! notes         = '$notes'
! where biblionumber = $bibnum";
!   my $sth   = $dbh->prepare($query);
  
    $sth->execute;
--- 422,452 ----
  }
  
+ 
  sub modbiblio {
!   my ($biblio) = @_;
    my $dbh   = C4Connect;
!   my $query;
!   my $sth;
!   
!   $biblio->{'title'}         = $dbh->quote($biblio->{'title'});
!   $biblio->{'author'}        = $dbh->quote($biblio->{'author'});
!   $biblio->{'abstract'}      = $dbh->quote($biblio->{'abstract'});
!   $biblio->{'copyrightdate'} = $dbh->quote($biblio->{'copyrightdate'});
!   $biblio->{'seriestitle'}   = $dbh->quote($biblio->{'serirestitle'});
!   $biblio->{'serial'}        = $dbh->quote($biblio->{'serial'});
!   $biblio->{'unititle'}      = $dbh->quote($biblio->{'unititle'});
!   $biblio->{'notes'}         = $dbh->quote($biblio->{'notes'});
! 
!   $query = "Update biblio set
! title         = $biblio->{'title'},
! author        = $biblio->{'author'},
! abstract      = $biblio->{'abstract'},
! copyrightdate = $biblio->{'copyrightdate'},
! seriestitle   = $biblio->{'seriestitle'},
! serial        = $biblio->{'serial'},
! unititle      = $biblio->{'unititle'},
! notes         = $biblio->{'notes'}
! where biblionumber = $biblio->{'biblionumber'}";
!   $sth   = $dbh->prepare($query);
  
    $sth->execute;
***************
*** 438,453 ****
    $sth->finish;
    $dbh->disconnect;
!   return($bibnum);
! }
  
  sub modsubtitle {
!   my ($bibnum,$subtitle)=@_;
!   my $dbh=C4Connect;
!   my $query="update bibliosubtitle set subtitle='$subtitle' where biblionumber=$bibnum";
!   my $sth=$dbh->prepare($query);
    $sth->execute;
    $sth->finish;
    $dbh->disconnect;
! }
  
  sub modaddauthor {
--- 454,474 ----
    $sth->finish;
    $dbh->disconnect;
!   return($biblio->{'biblionumber'});
! } # sub modbiblio
! 
  
  sub modsubtitle {
!   my ($bibnum, $subtitle) = @_;
!   my $dbh   = C4Connect;
!   my $query = "update bibliosubtitle set
! subtitle = '$subtitle'
! where biblionumber = $bibnum";
!   my $sth   = $dbh->prepare($query);
! 
    $sth->execute;
    $sth->finish;
    $dbh->disconnect;
! } # sub modsubtitle
! 
  
  sub modaddauthor {
***************
*** 476,537 ****
  
  sub modsubject {
!   my ($bibnum,$force, at subject)=@_;
!   my $dbh=C4Connect;
!   my $count=@subject;
    my $error;
!   for (my $i=0;$i<$count;$i++){
!     $subject[$i]=~ s/^ //g;
!     $subject[$i]=~ s/ $//g;
!     my $query="select * from catalogueentry where entrytype='s' and
!     catalogueentry='$subject[$i]'";
!     my $sth=$dbh->prepare($query);
      $sth->execute;
!     if (my $data=$sth->fetchrow_hashref){
!       
      } else {
!       if ($force eq $subject[$i]){
!          #subject not in aut, chosen to force anway
! 	 #so insert into cataloguentry so its in auth file
! 	 $query="Insert into catalogueentry (entrytype,catalogueentry)
! 	 values ('s','$subject[$i]')";
! 	 my $sth2=$dbh->prepare($query);
! #	 print $query;
  	 $sth2->execute;
  	 $sth2->finish;
!       } else {      
!         $error="$subject[$i]\n does not exist in the subject authority file";
!         $query= "Select * from catalogueentry where
!         entrytype='s' and (catalogueentry like '$subject[$i] %' or 
!         catalogueentry like '% $subject[$i] %' or catalogueentry like
!         '% $subject[$i]')";
!         my $sth2=$dbh->prepare($query);
! #        print $query;
          $sth2->execute;
!         while (my $data=$sth2->fetchrow_hashref){
!           $error=$error."<br>$data->{'catalogueentry'}";
!         }
          $sth2->finish;
! #       $error=$error."<br>$query";
!      }
!    }
      $sth->finish;
!   }
!   if ($error eq ''){  
!     my $query="Delete from bibliosubject where biblionumber=$bibnum";
! #  print $query;
!     my $sth=$dbh->prepare($query);
! #  print $query;
      $sth->execute;
      $sth->finish;
!     for (my $i=0;$i<$count;$i++){
!       $sth=$dbh->prepare("Insert into bibliosubject values ('$subject[$i]',$bibnum)");
! #     print $subject[$i];
        $sth->execute;
        $sth->finish;
!     }
!   }
    $dbh->disconnect;
    return($error);
! }
  
  sub modbibitem {
--- 497,566 ----
  
  sub modsubject {
!   my ($bibnum, $force, @subject) = @_;
!   my $dbh   = C4Connect;
!   my $count = @subject;
    my $error;
!   for (my $i = 0; $i < $count; $i++) {
!     $subject[$i] =~ s/^ //g;
!     $subject[$i] =~ s/ $//g;
!     my $query = "select * from catalogueentry
! where entrytype = 's'
! and catalogueentry = '$subject[$i]'";
!     my $sth   = $dbh->prepare($query);
      $sth->execute;
! 
!     if (my $data = $sth->fetchrow_hashref) {
      } else {
!       if ($force eq $subject[$i]) {
! 
!          # subject not in aut, chosen to force anway
!          # so insert into cataloguentry so its in auth file
! 	 $query = "Insert into catalogueentry
! (entrytype,catalogueentry)
! values ('s','$subject[$i]')";
! 	 my $sth2 = $dbh->prepare($query);
! 
  	 $sth2->execute;
  	 $sth2->finish;
! 
!       } else {
! 
!         $error = "$subject[$i]\n does not exist in the subject authority file";
!         $query = "Select * from catalogueentry
! where entrytype = 's'
! and (catalogueentry like '$subject[$i] %'
! or catalogueentry like '% $subject[$i] %'
! or catalogueentry like '% $subject[$i]')";
!         my $sth2 = $dbh->prepare($query);
! 
          $sth2->execute;
!         while (my $data = $sth2->fetchrow_hashref) {
!           $error = $error."<br>$data->{'catalogueentry'}";
!         } # while
          $sth2->finish;
!       } # else
!     } # else
      $sth->finish;
!   } # else
! 
!   if ($error eq '') {
!     my $query = "Delete from bibliosubject where biblionumber = $bibnum";
!     my $sth   = $dbh->prepare($query);
! 
      $sth->execute;
      $sth->finish;
! 
!     for (my $i = 0; $i < $count; $i++) {
!       $sth = $dbh->prepare("Insert into bibliosubject
! values ('$subject[$i]', $bibnum)");
! 
        $sth->execute;
        $sth->finish;
!     } # for
!   } # if
! 
    $dbh->disconnect;
    return($error);
! } # sub modsubject
  
  sub modbibitem {

Index: Output.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Output.pm,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** Output.pm	21 Apr 2002 04:45:21 -0000	1.6
--- Output.pm	9 May 2002 01:07:36 -0000	1.7
***************
*** 216,229 ****
  }
  
! sub mkform3{
!   my ($action,%inputs)=@_;
!   my $string="<form action=$action method=post>\n";
!   $string=$string.mktablehdr();
    my $key;
!   my @keys=sort keys %inputs;
    my @order;  
!   my $count=@keys;
!   my $i2=0;
!   while ( $i2<$count) {
      my $value=$inputs{$keys[$i2]};
      my @data=split('\t',$value);
--- 216,229 ----
  }
  
! sub mkform3 {
!   my ($action, %inputs) = @_;
!   my $string = "<form action=\"$action\" method=\"post\">\n";
!   $string   .= mktablehdr();
    my $key;
!   my @keys = sort(keys(%inputs));
    my @order;  
!   my $count = @keys;
!   my $i2 = 0;
!   while ($i2 < $count) {
      my $value=$inputs{$keys[$i2]};
      my @data=split('\t',$value);

Index: Search.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Search.pm,v
retrieving revision 1.21
retrieving revision 1.22
diff -C2 -r1.21 -r1.22
*** Search.pm	7 May 2002 00:08:20 -0000	1.21
--- Search.pm	9 May 2002 01:07:36 -0000	1.22
***************
*** 726,751 ****
  
  sub bibdata {
!   my ($bibnum,$type)=@_;
!   my $dbh=C4Connect;
!   my $query="Select *,biblio.notes  
!   from biblio,biblioitems 
!   left join bibliosubtitle on                                                
!   biblio.biblionumber=bibliosubtitle.biblionumber
!   
!   where biblio.biblionumber=$bibnum
!   and biblioitems.biblionumber=$bibnum"; 
! #  print $query;
!   my $sth=$dbh->prepare($query);
    $sth->execute;
!   my $data=$sth->fetchrow_hashref;
    $sth->finish;
!   $query="Select * from bibliosubject where biblionumber='$bibnum'";
    $sth=$dbh->prepare($query);
    $sth->execute;
!   while (my $dat=$sth->fetchrow_hashref){
!     $data->{'subject'}.=" | $dat->{'subject'}";
  
    }
!   #print $query;
    $sth->finish;
    $dbh->disconnect;
--- 726,751 ----
  
  sub bibdata {
!   my ($bibnum, $type)=@_;
!   my $dbh   = C4Connect;
!   my $query = "Select *, biblio.notes  
! from biblio, biblioitems 
! left join bibliosubtitle on
! biblio.biblionumber = bibliosubtitle.biblionumber
! where biblio.biblionumber = $bibnum
! and biblioitems.biblionumber = $bibnum";
! 
!   my $sth   = $dbh->prepare($query);
    $sth->execute;
!   my $data  = $sth->fetchrow_hashref;
    $sth->finish;
! 
!   $query = "Select * from bibliosubject where biblionumber = '$bibnum'";
    $sth=$dbh->prepare($query);
    $sth->execute;
!   while (my $dat = $sth->fetchrow_hashref){
!     $data->{'subject'} .= " | $dat->{'subject'}";
  
    }
! 
    $sth->finish;
    $dbh->disconnect;





More information about the Koha-devel mailing list