koha-cvs
[Top][All Lists]
Advanced

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

[Koha-cvs] CVS: koha/C4 Acquisitions.pm,1.9,1.10 Search.pm,1.24,1.25


From: Gynn Lomax
Subject: [Koha-cvs] CVS: koha/C4 Acquisitions.pm,1.9,1.10 Search.pm,1.24,1.25
Date: Sun, 12 May 2002 11:08:22 -0700

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

Modified Files:
        Acquisitions.pm Search.pm 
Log Message:
Changes to allow modifications to the website biblioitems
Changes to way that website biblioitems are shown on the details page


Index: Acquisitions.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Acquisitions.pm,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -r1.9 -r1.10
*** Acquisitions.pm     12 May 2002 15:37:53 -0000      1.9
--- Acquisitions.pm     12 May 2002 18:08:19 -0000      1.10
***************
*** 564,582 ****
  } # sub modsubject
  
  sub modbibitem {
!   my 
($bibitemnum,$itemtype,$isbn,$publishercode,$publicationdate,$classification,$dewey,$subclass,$illus,$pages,$volumeddesc,$notes,$size,$place)address@hidden;
!   my $dbh=C4Connect;
!   my $query="update biblioitems set itemtype='$itemtype',
!   
isbn='$isbn',publishercode='$publishercode',publicationyear='$publicationdate',
!   
classification='$classification',dewey='$dewey',subclass='$subclass',illus='$illus',
!   
pages='$pages',volumeddesc='$volumeddesc',notes='$notes',size='$size',place='$place'
!   where
!   biblioitemnumber=$bibitemnum";
!   my $sth=$dbh->prepare($query);
! #    print $query;
!   $sth->execute;
!   $sth->finish;
!   $dbh->disconnect;
! }
  
  sub modnote {
--- 564,608 ----
  } # sub modsubject
  
+ 
  sub modbibitem {
!     my ($biblioitem) = @_;
!     my $dbh   = C4Connect;
!     my $query;
! 
!     $biblioitem->{'itemtype'}        = $dbh->quote($biblioitem->{'itemtype'});
!     $biblioitem->{'isbn'}            = $dbh->quote($biblioitem->{'isbn'});
!     $biblioitem->{'publishercode'}   = 
$dbh->quote($biblioitem->{'publishercode'});
!     $biblioitem->{'publicationyear'} = 
$dbh->quote($biblioitem->{'publicationyear'});
!     $biblioitem->{'classification'}  = 
$dbh->quote($biblioitem->{'classification'});
!     $biblioitem->{'dewey'}         = $dbh->quote($biblioitem->{'dewey'});
!     $biblioitem->{'subclass'}      = $dbh->quote($biblioitem->{'subclass'});
!     $biblioitem->{'illus'}           = $dbh->quote($biblioitem->{'illus'});
!     $biblioitem->{'pages'}           = $dbh->quote($biblioitem->{'pages'});
!     $biblioitem->{'volumeddesc'}     = 
$dbh->quote($biblioitem->{'volumeddesc'});
!     $biblioitem->{'notes'}           = $dbh->quote($biblioitem->{'notes'});
!     $biblioitem->{'size'}            = $dbh->quote($biblioitem->{'size'});
!     $biblioitem->{'place'}           = $dbh->quote($biblioitem->{'place'});
! 
!     $query = "Update biblioitems set
! itemtype        = $biblioitem->{'itemtype'},
! isbn            = $biblioitem->{'isbn'},
! publishercode   = $biblioitem->{'publishercode'},
! publicationyear = $biblioitem->{'publicationyear'},
! classification  = $biblioitem->{'classification'},
! dewey           = $biblioitem->{'dewey'},
! subclass        = $biblioitem->{'subclass'},
! illus           = $biblioitem->{'illus'},
! pages           = $biblioitem->{'pages'},
! volumeddesc     = $biblioitem->{'volumeddesc'},
! notes                 = $biblioitem->{'notes'},
! size          = $biblioitem->{'size'},
! place         = $biblioitem->{'place'}
! where biblioitemnumber = $biblioitem->{'biblioitemnumber'}";
! 
!     $dbh->do($query);
! 
!     $dbh->disconnect;
! } # sub modbibitem
! 
  
  sub modnote {
***************
*** 612,615 ****
--- 638,642 ----
    $biblioitem->{'volumedate'}      = $dbh->quote($biblioitem->{'volumedate'});
    $biblioitem->{'volumeddesc'}     = 
$dbh->quote($biblioitem->{'volumeddesc'});  $biblioitem->{'illus'}            = 
$dbh->quote($biblioitem->{'illus'});
+   $biblioitem->{'illus'}         = $dbh->quote($biblioitem->{'illus'});
    $biblioitem->{'pages'}           = $dbh->quote($biblioitem->{'pages'});
    $biblioitem->{'notes'}           = $dbh->quote($biblioitem->{'notes'});

Index: Search.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Search.pm,v
retrieving revision 1.24
retrieving revision 1.25
diff -C2 -r1.24 -r1.25
*** Search.pm   12 May 2002 15:37:53 -0000      1.24
--- Search.pm   12 May 2002 18:08:19 -0000      1.25
***************
*** 22,26 ****
  &getboracctrecord &ItemType &itemissues &subject &subtitle
  &addauthor &bibitems &barcodes &findguarantees &allissues &systemprefs
! &findguarantor &getwebsites);
  %EXPORT_TAGS = ( );     # eg: TAG => [ qw!name1 name2! ],
                  
--- 22,26 ----
  &getboracctrecord &ItemType &itemissues &subject &subtitle
  &addauthor &bibitems &barcodes &findguarantees &allissues &systemprefs
! &findguarantor &getwebsites &getwebbiblioitems);
  %EXPORT_TAGS = ( );     # eg: TAG => [ qw!name1 name2! ],
                  
***************
*** 588,605 ****
  
  sub ItemInfo {
!   my ($env,$biblionumber,$type)address@hidden;
!   my $dbh = &C4Connect;
!   my $query="Select * from items,biblio,biblioitems,branches 
!   where (items.biblioitemnumber = biblioitems.biblioitemnumber)
!   and biblioitems.biblionumber=biblio.biblionumber
!   and biblio.biblionumber='$biblionumber' and branches.branchcode=
!   items.holdingbranch ";
! #  print $type;
    if ($type ne 'intra'){
!     $query.=" and ((items.itemlost<>1 and items.itemlost <> 2)
      or items.itemlost is NULL)
      and (wthdrawn <> 1 or wthdrawn is NULL)";
    }
!   $query=$query."order by items.dateaccessioned desc";
    my $sth=$dbh->prepare($query);
    $sth->execute;
--- 588,605 ----
  
  sub ItemInfo {
!     my ($env,$biblionumber,$type) = @_;
!     my $dbh   = &C4Connect;
!     my $query = "Select * from items, biblio, biblioitems, branches
! where (items.biblioitemnumber = biblioitems.biblioitemnumber)
! and biblioitems.biblionumber = biblio.biblionumber
! and biblio.biblionumber = '$biblionumber'
! and branches.branchcode = items.holdingbranch";
! 
    if ($type ne 'intra'){
!     $query .= " and ((items.itemlost<>1 and items.itemlost <> 2)
      or items.itemlost is NULL)
      and (wthdrawn <> 1 or wthdrawn is NULL)";
    }
!   $query .= " order by items.dateaccessioned desc";
    my $sth=$dbh->prepare($query);
    $sth->execute;
***************
*** 725,732 ****
  }
  
  sub bibdata {
!   my ($bibnum, $type)address@hidden;
!   my $dbh   = C4Connect;
!   my $query = "Select *, biblio.notes  
  from biblio, biblioitems 
  left join bibliosubtitle on
--- 725,733 ----
  }
  
+ 
  sub bibdata {
!     my ($bibnum, $type) = @_;
!     my $dbh   = C4Connect;
!     my $query = "Select *, biblio.notes  
  from biblio, biblioitems 
  left join bibliosubtitle on
***************
*** 734,770 ****
  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;
-   return($data);
- }
  
  sub bibitemdata {
!   my ($bibitem)address@hidden;
!   my $dbh=C4Connect;
!   my $query="Select *,biblioitems.notes as bnotes from 
biblio,biblioitems,itemtypes where biblio.biblionumber=
!   biblioitems.biblionumber and biblioitemnumber=$bibitem and
!   biblioitems.itemtype=itemtypes.itemtype";
! #  print $query;
!   my $sth=$dbh->prepare($query);
!   $sth->execute;
!   my $data=$sth->fetchrow_hashref;
!   $sth->finish;
!   $dbh->disconnect;
!   return($data);
! }
  
  sub subject {
--- 735,777 ----
  where biblio.biblionumber = $bibnum
  and biblioitems.biblionumber = $bibnum";
+     my $sth   = $dbh->prepare($query);
+     my $data;
  
!     $sth->execute;
!     $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'}";
!     } # while
  
!     $sth->finish;
!     $dbh->disconnect;
!     return($data);
! } # sub bibdata
  
  
  sub bibitemdata {
!     my ($bibitem) = @_;
!     my $dbh   = C4Connect;
!     my $query = "Select *,biblioitems.notes as bnotes from biblio, 
biblioitems,itemtypes
! where biblio.biblionumber = biblioitems.biblionumber
! and biblioitemnumber = $bibitem
! and biblioitems.itemtype = itemtypes.itemtype";
!     my $sth   = $dbh->prepare($query);
!     my $data;
! 
!     $sth->execute;
! 
!     $data = $sth->fetchrow_hashref;
! 
!     $sth->finish;
!     $dbh->disconnect;
!     return($data);
! } # sub bibitemdata
! 
  
  sub subject {
***************
*** 822,870 ****
  
  sub itemissues {
!   my ($bibitem, $biblio)address@hidden;
!   my $dbh=C4Connect;
!   my $query="Select * from items where 
!   items.biblioitemnumber='$bibitem'";
!   my $sth=$dbh->prepare($query) || die $dbh->errstr;
!   $sth->execute || die $sth->errstr;
!   my $i=0;
!   my @results;
!   while (my $data=$sth->fetchrow_hashref) {
!     my $query2="select * from issues,borrowers where 
itemnumber=$data->{'itemnumber'}
!     and returndate is NULL and 
issues.borrowernumber=borrowers.borrowernumber";
!     my $sth2=$dbh->prepare($query2);
!     $sth2->execute;
!     if (my $data2=$sth2->fetchrow_hashref) {
!       $data->{'date_due'}=$data2->{'date_due'};
!       $data->{'card'}=$data2->{'cardnumber'};
!     } else {
!       if ($data->{'wthdrawn'} eq '1') {
!         $data->{'date_due'}='Cancelled';
!       } else {
!           $data->{'date_due'}='Available';
!       }
!     }
!     $sth2->finish;
!     $query2="select * from issues,borrowers where 
itemnumber='$data->{'itemnumber'}'
!     and issues.borrowernumber=borrowers.borrowernumber 
!     order by date_due desc";
!     my $sth2=$dbh->prepare($query2) || die $dbh->errstr;
!     $sth2->execute || die $sth2->errstr;
!     for (my $i2=0;$i2<2;$i2++){
!       if (my $data2=$sth2->fetchrow_hashref){
!         $data->{"timestamp$i2"}=$data2->{'timestamp'};
!         $data->{"card$i2"}=$data2->{'cardnumber'};
!       $data->{"borrower$i2"}=$data2->{'borrowernumber'};
!       }
      }
!     $sth2->finish;
!     $results[$i]=$data;
!     $i++;
!   }
!   $sth->finish;
!   $dbh->disconnect;
!   return(@results);
  }
  
  sub itemnodata {
    my ($env,$dbh,$itemnumber) = @_;
--- 829,892 ----
  
  sub itemissues {
!     my ($bibitem, $biblio)address@hidden;
!     my $dbh   = C4Connect;
!     my $query = "Select * from items where 
! items.biblioitemnumber = '$bibitem'";
!     my $sth   = $dbh->prepare($query)
!       || die $dbh->errstr;
!     my $i     = 0;
!     my @results;
!   
!     $sth->execute
!       || die $sth->errstr;
! 
!     while (my $data = $sth->fetchrow_hashref) {
!         my $query2 = "select * from issues,borrowers
! where itemnumber = $data->{'itemnumber'}
! and returndate is NULL
! and issues.borrowernumber = borrowers.borrowernumber";
!         my $sth2   = $dbh->prepare($query2);
! 
!         $sth2->execute;       
!         if (my $data2 = $sth2->fetchrow_hashref) {
!             $data->{'date_due'} = $data2->{'date_due'};
!             $data->{'card'}     = $data2->{'cardnumber'};
!         } else {
!             if ($data->{'wthdrawn'} eq '1') {
!                 $data->{'date_due'} = 'Cancelled';
!             } else {
!                 $data->{'date_due'} = 'Available';
!             } # else
!         } # else
! 
!         $sth2->finish;
!         $query2 = "select * from issues, borrowers
! where itemnumber = '$data->{'itemnumber'}'
! and issues.borrowernumber = borrowers.borrowernumber 
! order by date_due desc";
!         $sth2 = $dbh->prepare($query2)
!           || die $dbh->errstr;
!         $sth2->execute
!           || die $sth2->errstr;
! 
!         for (my $i2 = 0; $i2 < 2; $i2++) {
!             if (my $data2 = $sth2->fetchrow_hashref) {
!                 $data->{"timestamp$i2"} = $data2->{'timestamp'};
!                 $data->{"card$i2"}      = $data2->{'cardnumber'};
!                 $data->{"borrower$i2"}  = $data2->{'borrowernumber'};
!             } # if
!         } # for
! 
!         $sth2->finish;
!         $results[$i] = $data;
!         $i++;
      }
! 
!     $sth->finish;
!     $dbh->disconnect;
!     return(@results);
  }
  
+ 
  sub itemnodata {
    my ($env,$dbh,$itemnumber) = @_;
***************
*** 1126,1148 ****
  }
  
  sub bibitems {
!   my ($bibnum)address@hidden;
!   my $dbh=C4Connect;
!   my $query="Select * from biblioitems,itemtypes,items where
!   biblioitems.biblionumber='$bibnum' and 
biblioitems.itemtype=itemtypes.itemtype and
!   biblioitems.biblioitemnumber=items.biblioitemnumber group by
!   items.biblioitemnumber";
!   my $sth=$dbh->prepare($query);
!   $sth->execute;
!   my $i=0;
!   my @results;
!   while (my $data=$sth->fetchrow_hashref){
!     $results[$i]=$data;
!     $i++;
!   }
!   $sth->finish;
!   $dbh->disconnect;
!   return($i,@results);
! }
  
  sub barcodes{
--- 1148,1176 ----
  }
  
+ 
  sub bibitems {
!     my ($bibnum) = @_;
!     my $dbh   = C4Connect;
!     my $query = "Select * from biblioitems, itemtypes, items
! where biblioitems.biblionumber = '$bibnum'
! and biblioitems.itemtype = itemtypes.itemtype
! and biblioitems.biblioitemnumber = items.biblioitemnumber
! group by items.biblioitemnumber";
!     my $sth   = $dbh->prepare($query);
!     my $count = 0;
!     my @results;
! 
!     $sth->execute;
! 
!     while (my $data = $sth->fetchrow_hashref) {
!         $results[$count] = $data;
!         $count++;
!     } # while
!     
!     $sth->finish;
!     $dbh->disconnect;
!     return($count, @results);
! } # sub bibitems
! 
  
  sub barcodes{
***************
*** 1154,1158 ****
     and ((itemlost <> 1 and itemlost <> 2) or itemlost is NULL) and
     (wthdrawn <> 1 or wthdrawn is NULL)";
! #   print $query;
    my $sth=$dbh->prepare($query);
    $sth->execute;
--- 1182,1186 ----
     and ((itemlost <> 1 and itemlost <> 2) or itemlost is NULL) and
     (wthdrawn <> 1 or wthdrawn is NULL)";
! 
    my $sth=$dbh->prepare($query);
    $sth->execute;
***************
*** 1188,1191 ****
--- 1216,1240 ----
      return($count, @results);
  } # sub getwebsites
+ 
+ 
+ sub getwebbiblioitems {
+     my ($biblionumber) = @_;
+     my $dbh   = C4Connect;
+     my $query = "Select * from biblioitems where biblionumber = $biblionumber
+ and itemtype = 'WEB'";
+     my $sth   = $dbh->prepare($query);
+     my $count = 0;
+     my @results;
+     
+     $sth->execute;
+     while (my $data = $sth->fetchrow_hashref) {
+         $results[$count] = $data;
+         $count++;
+     } # while
+     
+     $sth->finish;
+     $dbh->disconnect;
+     return($count, @results);
+ } # sub getwebbiblioitems
  
  




reply via email to

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