[Koha-cvs] CVS: koha/C4 Acquisitions.pm,1.18,1.19 Biblio.pm,1.1,1.2

Paul POULAIN tipaul at users.sourceforge.net
Thu Jun 20 23:07:32 CEST 2002


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

Modified Files:
	Acquisitions.pm Biblio.pm 
Log Message:
* Acquisition synchronised with rel-1-2
* Update of biblio.pm and catalogue.pm that continuates MARC stuff. Lot of explanations at the beginning of Biblio.pm


Index: Acquisitions.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Acquisitions.pm,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -r1.18 -r1.19
*** Acquisitions.pm	23 May 2002 22:59:37 -0000	1.18
--- Acquisitions.pm	20 Jun 2002 21:07:30 -0000	1.19
***************
*** 1,8 ****
! package C4::Acquisitions; #asummes C4/Acquisitions.pm
  
  use strict;
  require Exporter;
  use C4::Database;
! 
  use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
  
--- 1,9 ----
! package C4::Acquisitions; #assumes C4/Acquisitions.pm
  
  use strict;
  require Exporter;
  use C4::Database;
! use warnings;
!  #use C4::Biblio;
  use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
  
***************
*** 97,104 ****
    my ($bi,$bib)=@_;
    my $dbh=C4Connect;
!   my $query="Select ordernumber from aqorders where biblionumber=$bib and
!   biblioitemnumber='$bi'";
    my $sth=$dbh->prepare($query);
!   $sth->execute;
    my $ordnum=$sth->fetchrow_hashref;
    $sth->finish;
--- 98,106 ----
    my ($bi,$bib)=@_;
    my $dbh=C4Connect;
!   my $query="Select ordernumber 
!  	from aqorders 
!  	where biblionumber=? and biblioitemnumber=?";
    my $sth=$dbh->prepare($query);
!   $sth->execute($bib,$bi);
    my $ordnum=$sth->fetchrow_hashref;
    $sth->finish;
***************
*** 113,122 ****
    my $dbh=C4Connect;
    my $query="Select * from biblio,biblioitems,aqorders,aqorderbreakdown 
!   where aqorders.ordernumber='$ordnum' 
    and biblio.biblionumber=aqorders.biblionumber and
    biblioitems.biblioitemnumber=aqorders.biblioitemnumber and
    aqorders.ordernumber=aqorderbreakdown.ordernumber";
    my $sth=$dbh->prepare($query);
!   $sth->execute;
    my $data=$sth->fetchrow_hashref;
    $sth->finish;
--- 115,124 ----
    my $dbh=C4Connect;
    my $query="Select * from biblio,biblioitems,aqorders,aqorderbreakdown 
!   where aqorders.ordernumber=? 
    and biblio.biblionumber=aqorders.biblionumber and
    biblioitems.biblioitemnumber=aqorders.biblioitemnumber and
    aqorders.ordernumber=aqorderbreakdown.ordernumber";
    my $sth=$dbh->prepare($query);
!   $sth->execute($ordnum);
    my $data=$sth->fetchrow_hashref;
    $sth->finish;
***************
*** 151,158 ****
    my $query="Select * from aqorders,biblio,biblioitems where booksellerid='$supid'
    and (cancelledby is NULL or cancelledby = '')
!   and (quantityreceived < quantity or quantityreceived is NULL)
!   and biblio.biblionumber=aqorders.biblionumber and biblioitems.biblioitemnumber=
!   aqorders.biblioitemnumber
!   group by aqorders.biblioitemnumber
    order by
    biblio.title";
--- 153,159 ----
    my $query="Select * from aqorders,biblio,biblioitems where booksellerid='$supid'
    and (cancelledby is NULL or cancelledby = '')
!   and biblio.biblionumber=aqorders.biblionumber and biblioitems.biblioitemnumber=                    
!   aqorders.biblioitemnumber 
!   group by aqorders.biblioitemnumber 
    order by
    biblio.title";
***************
*** 197,215 ****
  
  sub ordersearch {
!   my ($search,$biblio,$catview) = @_;
!   my $dbh   = C4Connect;
!   my $query = "Select *,biblio.title from aqorders,biblioitems,biblio
! where aqorders.biblioitemnumber = biblioitems.biblioitemnumber
! and biblio.biblionumber=aqorders.biblionumber
! and ((datecancellationprinted is NULL)
! or (datecancellationprinted = '0000-00-00'))
! and ((";
!   my @data  = split(' ',$search);
!   my $count = @data;
!   for (my $i = 0; $i < $count; $i++) {
!     $query .= "(biblio.title like '$data[$i]%' or biblio.title like '% $data[$i]%') and ";
    }
    $query=~ s/ and $//;
!   $query.=" ) or biblioitems.isbn='$search'
    or (aqorders.ordernumber='$search' and aqorders.biblionumber='$biblio')) ";
    if ($catview ne 'yes'){
--- 198,216 ----
  
  sub ordersearch {
!   my ($search,$biblio,$catview)=@_;
!   my $dbh=C4Connect;
!   my $query="Select *,biblio.title from aqorders,biblioitems,biblio
! 	where aqorders.biblioitemnumber = biblioitems.biblioitemnumber
! 	and biblio.biblionumber=aqorders.biblionumber
! 	and ((datecancellationprinted is NULL)
! 	or (datecancellationprinted = '0000-00-00')
!   and ((";
!   my @data=split(' ',$search);
!   my $count=@data;
!   for (my $i=0;$i<$count;$i++){
!     $query.= "(biblio.title like '$data[$i]%' or biblio.title like '% $data[$i]%') and ";
    }
    $query=~ s/ and $//;
!   $query.=" ) or biblioitems.isbn='$search' 
    or (aqorders.ordernumber='$search' and aqorders.biblionumber='$biblio')) ";
    if ($catview ne 'yes'){
***************
*** 218,221 ****
--- 219,223 ----
    $query.=" group by aqorders.ordernumber";
    my $sth=$dbh->prepare($query);
+ #  print $query;
    $sth->execute;
    my $i=0;
***************
*** 291,295 ****
    if ($supplier ne ''){
      $query.=" and aqorders.booksellerid='$supplier'";
!   }
    $query.=" group by aqorders.ordernumber";
    my $sth=$dbh->prepare($query);
--- 293,297 ----
    if ($supplier ne ''){
      $query.=" and aqorders.booksellerid='$supplier'";
!   } 
    $query.=" group by aqorders.ordernumber";
    my $sth=$dbh->prepare($query);
***************
*** 323,327 ****
    my $dbh=C4Connect;
    my $query="Select * from aqbookfund,aqbudget where aqbookfund.bookfundid
!   =aqbudget.bookfundid
    group by aqbookfund.bookfundid order by bookfundname";
    my $sth=$dbh->prepare($query);
--- 325,330 ----
    my $dbh=C4Connect;
    my $query="Select * from aqbookfund,aqbudget where aqbookfund.bookfundid
!   =aqbudget.bookfundid 
!    and aqbudget.startdate='2001-07-01'
    group by aqbookfund.bookfundid order by bookfundname";
    my $sth=$dbh->prepare($query);
***************
*** 339,357 ****
  
  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
  
--- 342,360 ----
  
  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
  
***************
*** 361,365 ****
    my $query="Select quantity,datereceived,freight,unitprice,listprice,ecost,quantityreceived,subscription
    from aqorders,aqorderbreakdown where bookfundid='$id' and 
!   aqorders.ordernumber=aqorderbreakdown.ordernumber
    and (datecancellationprinted is NULL or
    datecancellationprinted='0000-00-00')";
--- 364,370 ----
    my $query="Select quantity,datereceived,freight,unitprice,listprice,ecost,quantityreceived,subscription
    from aqorders,aqorderbreakdown where bookfundid='$id' and 
!    aqorders.ordernumber=aqorderbreakdown.ordernumber and ((budgetdate >=
!    '2001-07-01' and budgetdate <'2002-07-01') or
!    (datereceived >= '2001-07-01' and datereceived < '2002-07-01'))
    and (datecancellationprinted is NULL or
    datecancellationprinted='0000-00-00')";

Index: Biblio.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Biblio.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** Biblio.pm	14 Jun 2002 16:47:33 -0000	1.1
--- Biblio.pm	20 Jun 2002 21:07:30 -0000	1.2
***************
*** 5,12 ****
--- 5,37 ----
  # bibliosubject, bibliosubtitle
  
+ # move from 1.2 to 1.4 version : 
+ # 1.2 and previous version uses a specific API to manage biblios. This API uses old-DB style parameters.
+ # In the 1.4 version, we want to do 2 differents things :
+ #  - keep populating the old-DB, that has a LOT less datas than MARC
+ #  - populate the MARC-DB
+ # To populate the DBs we have 2 differents sources :
+ #  - the standard acquisition system (through book sellers), that does'nt use MARC data
[...3799 lines suppressed...]
! 	$sth->execute;
! 	if ($item->{'restricted'}) {
! 	    my ($Subfield_ID, $Subfield_Key) = addSubfield($Record_ID, '876', 'h', 'Restricted', $Subfield876_ID);
! 	    logchange('marc', 'add', $Record_ID, '876', 'h', $Subfield_Key, 'Restricted');
! 	} else {
! 	    my ($Subfield_ID, $Subfield_Key) = deleteSubfield($Record_ID, '876', 'h', 'Restricted', $Subfield876_ID);
! 	    logchange('marc', 'delete', $Record_ID, '876', 'h', $Subfield_Key, 'Restricted');
! 	}
!     }
!     $sth->finish;
      $dbh->disconnect;
  }
  
! #
! #
! # END OF UNUSEFUL SUBs
! #
! #
  
  END { }       # module clean-up code here (global destructor)





More information about the Koha-cvs mailing list