[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Koha-devel] CVS: koha/C4 Acquisitions.pm,1.5,1.6
From: |
Gynn Lomax |
Subject: |
[Koha-devel] CVS: koha/C4 Acquisitions.pm,1.5,1.6 |
Date: |
Sun Apr 28 22:26:02 2002 |
Update of /cvsroot/koha/koha/C4
In directory usw-pr-cvs1:/tmp/cvs-serv26808/C4
Modified Files:
Acquisitions.pm
Log Message:
Modifications for new acqui.simple
Database includes new biblio abstract field and biblioitem url field
acqui/finishreceive.pl modified to use changed C4/Acquisitions.pm
Index: Acquisitions.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Acquisitions.pm,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** Acquisitions.pm 21 Apr 2002 06:33:32 -0000 1.5
--- Acquisitions.pm 29 Apr 2002 05:25:41 -0000 1.6
***************
*** 13,23 ****
@EXPORT = qw(&getorders &bookseller &breakdown &basket &newbasket &bookfunds
&ordersearch &newbiblio &newbiblioitem &newsubject &newsubtitle &neworder
! &newordernum &modbiblio &modorder &getsingleorder &invoice &receiveorder
! &bookfundbreakdown &curconvert &updatesup &insertsup &makeitems &modbibitem
&getcurrencies &modsubtitle &modsubject &modaddauthor &moditem &countitems
&findall &needsmod &delitem &delbibitem &delbiblio &delorder &branches
&getallorders &getrecorders &updatecurrencies &getorder &getcurrency
&updaterecorder
! &updatecost &checkitems &modnote &getitemtypes &getbiblio);
!
%EXPORT_TAGS = ( ); # eg: TAG => [ qw!name1 name2! ],
--- 13,24 ----
@EXPORT = qw(&getorders &bookseller &breakdown &basket &newbasket &bookfunds
&ordersearch &newbiblio &newbiblioitem &newsubject &newsubtitle &neworder
! &newordernum &modbiblio &modorder &getsingleorder &invoice &receiveorder
! &bookfundbreakdown &curconvert &updatesup &insertsup &newitems &modbibitem
&getcurrencies &modsubtitle &modsubject &modaddauthor &moditem &countitems
&findall &needsmod &delitem &delbibitem &delbiblio &delorder &branches
&getallorders &getrecorders &updatecurrencies &getorder &getcurrency
&updaterecorder
! &updatecost &checkitems &modnote &getitemtypes &getbiblio
! &getbiblioitem &getitemsbybiblioitem &isbnsearch &keywordsearch
! &websitesearch);
%EXPORT_TAGS = ( ); # eg: TAG => [ qw!name1 name2! ],
***************
*** 194,209 ****
sub ordersearch {
! my ($search,$biblio,$catview)address@hidden;
! 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 =
! '000-00-00')
! and ((";
! my @data=split(' ',$search);
! my address@hidden;
! for (my $i=0;$i<$count;$i++){
! $query.= "(biblio.title like '$data[$i]%' or biblio.title like '%
$data[$i]%') and ";
}
$query=~ s/ and $//;
--- 195,210 ----
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 $//;
***************
*** 397,400 ****
--- 398,402 ----
$biblio->{'seriestitle'} = $dbh->quote($biblio->{'seriestitle'});
$biblio->{'notes'} = $dbh->quote($biblio->{'notes'});
+ $biblio->{'abstract'} = $dbh->quote($biblio->{'abstract'});
if ($biblio->{'seriestitle'}) { $series = 1 };
***************
*** 407,411 ****
series = $series;
seriestitle = $biblio->{'seriestitle'},
! notes = $biblio->{'notes'}";
$sth = $dbh->prepare($query);
--- 409,414 ----
series = $series;
seriestitle = $biblio->{'seriestitle'},
! notes = $biblio->{'notes'},
! abstract = $biblio->{'abstract'}";
$sth = $dbh->prepare($query);
***************
*** 419,434 ****
sub modbiblio {
! my
($bibnum,$title,$author,$copyright,$seriestitle,$serial,$unititle,$notes)address@hidden;
! 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;
$sth->finish;
$dbh->disconnect;
! return($bibnum);
}
--- 422,443 ----
sub modbiblio {
! my ($bibnum, $title, $author, $copyright, $seriestitle, $serial, $unititle,
$notes)address@hidden;
! 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;
+
$sth->finish;
$dbh->disconnect;
! return($bibnum);
}
***************
*** 444,461 ****
sub modaddauthor {
! my ($bibnum,$author)address@hidden;
! my $dbh=C4Connect;
! my $query="Delete from additionalauthors where biblionumber=$bibnum";
! my $sth=$dbh->prepare($query);
! $sth->execute;
! $sth->finish;
! if ($author ne ''){
! $query="insert into additionalauthors (author,biblionumber) values
('$author','$bibnum')";
! $sth=$dbh->prepare($query);
$sth->execute;
$sth->finish;
! }
$dbh->disconnect;
! }
sub modsubject {
--- 453,478 ----
sub modaddauthor {
! my ($bibnum, $author) = @_;
! my $dbh = C4Connect;
! my $query = "Delete from additionalauthors where biblionumber = $bibnum";
! my $sth = $dbh->prepare($query);
!
$sth->execute;
$sth->finish;
!
! if ($author ne '') {
! $query = "Insert into additionalauthors set
! author = '$author',
! biblionumber = '$bibnum'";
! $sth = $dbh->prepare($query);
!
! $sth->execute;
!
! $sth->finish;
! } # if
!
$dbh->disconnect;
! } # sub modaddauthor
!
sub modsubject {
***************
*** 558,561 ****
--- 575,579 ----
$biblioitem->{'classification'} =
$dbh->quote($biblioitem->{'classification'});
$biblioitem->{'itemtype'} = $dbh->quote($biblioitem->{'itemtype'});
+ $biblioitem->{'url'} = $dbh->quote($biblioitem->{'url'});
$biblioitem->{'isbn'} = $dbh->quote($biblioitem->{'isbn'});
$biblioitem->{'issn'} = $dbh->quote($biblioitem->{'issn'});
***************
*** 584,587 ****
--- 602,606 ----
classification = $biblioitem->{'classification'},
itemtype = $biblioitem->{'itemtype'},
+ url = $biblioitem->{'url'},
isbn = $biblioitem->{'isbn'},
issn = $biblioitem->{'issn'},
***************
*** 864,892 ****
}
! sub makeitems {
! my
!
($count,$bibitemno,$biblio,$replacement,$price,$booksellerid,$branch,$loan,@barcodes)address@hidden;
! my $dbh=C4Connect;
! my $sth=$dbh->prepare("Select max(itemnumber) from items");
$sth->execute;
! my $data=$sth->fetchrow_hashref;
! my $item=$data->{'max(itemnumber)'};
$sth->finish;
! $item++;
! my $error;
! for (my $i=0;$i<$count;$i++){
! $barcodes[$i]=uc $barcodes[$i];
! my $query="Insert into items
(biblionumber,biblioitemnumber,itemnumber,barcode,
!
booksellerid,dateaccessioned,homebranch,holdingbranch,price,replacementprice,
! replacementpricedate,notforloan) values
! ($biblio,$bibitemno,$item,'$barcodes[$i]','$booksellerid',now(),'$branch',
! '$branch','$price','$replacement',now(),$loan)";
! my $sth=$dbh->prepare($query);
$sth->execute;
! $error.=$sth->errstr;
$sth->finish;
! $item++;
! # print $query;
! }
$dbh->disconnect;
return($error);
--- 883,933 ----
}
!
! sub newitems {
! my ($item, @barcodes) = @_;
! my $dbh = C4Connect;
! my $query = "Select max(itemnumber) from items";
! my $sth = $dbh->prepare($query);
! my $data;
! my $itemnumber;
! my $error;
!
$sth->execute;
! $data = $sth->fetchrow_hashref;
! $itemnumber = $data->{'max(itemnumber)'} + 1;
$sth->finish;
!
! $item->{'booksellerid'} = $dbh->quote($item->{'bookselletid'});
! $item->{'homebranch'} = $dbh->quote($item->{'homebranch'});
! $item->{'price'} = $dbh->quote($item->{'price'});
! $item->{'replacementprice'} = $dbh->quote($item->{'replacementprice'});
! $item->{'itemnotes'} = $dbh->quote($item->{'itemnotes'});
!
! foreach my $barcode (@barcodes) {
! $barcode = uc($barcode);
! $query = "Insert into items set
! itemnumber = $itemnumber,
! biblionumber = $item->{'biblionumber'},
! biblioitemnumber = $item->{'biblioitemnumber'},
! barcode = $barcode,
! booksellerid = $item->{'booksellerid'},
! dateaccessioned = NOW(),
! homebranch = $item->{'branch'},
! holdingbranch = $item->{'branch'},
! price = $item->{'price'},
! replacementprice = $item->{'replacementprice'},
! replacementpricedate = NOW(),
! notforloan = $item->{'loan'},
! itemnotes = $item->{'itemnotes'}";
!
! $sth = $dbh->prepare($query);
$sth->execute;
!
! $error .= $sth->errstr;
!
$sth->finish;
! $itemnumber++;
! } # for
!
$dbh->disconnect;
return($error);
***************
*** 1099,1108 ****
my $query = "Select * from biblio where biblionumber = $biblionumber";
my $sth = $dbh->prepare($query);
! # || die "Cannot prepare $query" . $dbh->errstr;
my $count = 0;
my @results;
$sth->execute;
! # || die "Cannot execute $query" . $sth->errstr;
while (my $data = $sth->fetchrow_hashref) {
$results[$count] = $data;
--- 1140,1149 ----
my $query = "Select * from biblio where biblionumber = $biblionumber";
my $sth = $dbh->prepare($query);
! # || die "Cannot prepare $query\n" . $dbh->errstr;
my $count = 0;
my @results;
$sth->execute;
! # || die "Cannot execute $query\n" . $sth->errstr;
while (my $data = $sth->fetchrow_hashref) {
$results[$count] = $data;
***************
*** 1114,1117 ****
--- 1155,1312 ----
return($count, @results);
} # sub getbiblio
+
+
+ sub getbiblioitem {
+ my ($biblioitemnum) = @_;
+ my $dbh = C4Connect;
+ my $query = "Select * from biblioitems where
+ biblioitemnumber = $biblioitemnum";
+ 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 getbiblioitem
+
+
+ sub getitemsbybiblioitem {
+ my ($biblioitemnum) = @_;
+ my $dbh = C4Connect;
+ my $query = "Select * from items, biblio where
+ biblio.biblionumber = items.biblionumber and biblioitemnumber
+ = $biblioitemnum";
+ my $sth = $dbh->prepare($query);
+ # || die "Cannot prepare $query\n" . $dbh->errstr;
+ my $count = 0;
+ my @results;
+
+ $sth->execute;
+ # || die "Cannot execute $query\n" . $sth->errstr;
+ while (my $data = $sth->fetchrow_hashref) {
+ $results[$count] = $data;
+ $count++;
+ } # while
+
+ $sth->finish;
+ $dbh->disconnect;
+ return($count, @results);
+ } # sub getitemsbybiblioitem
+
+
+ sub isbnsearch {
+ my ($isbn) = @_;
+ my $dbh = C4Connect;
+ my $count = 0;
+ my $query;
+ my $sth;
+ my @results;
+
+ $isbn = $dbh->quote($isbn);
+ $query = "Select * from biblioitems where isbn = $isbn";
+ $sth = $dbh->prepare($query);
+
+ $sth->execute;
+ while (my $data = $sth->fetchrow_hashref) {
+ $results[$count] = $data;
+ $count++;
+ } # while
+
+ $sth->finish;
+ $dbh->disconnect;
+ return($count, @results);
+ } # sub isbnsearch
+
+
+ sub keywordsearch {
+ my ($keywordlist) = @_;
+ my $dbh = C4Connect;
+ my $query = "Select * from biblio where";
+ my $count = 0;
+ my $sth;
+ my @results;
+ my @keywords = split(/ +/, $keywordlist);
+ my $keyword = shift(@keywords);
+
+ $keyword =~ s/%/\\%/g;
+ $keyword =~ s/_/\\_/;
+ $keyword = "%" . $keyword . "%";
+ $keyword = $dbh->quote($keyword);
+ $query .= " (author like $keyword) or
+ (title like $keyword) or (unititle like $keyword) or
+ (notes like $keyword) or (seriestitle like $keyword) or
+ (abstract like $keyword)";
+
+ foreach $keyword (@keywords) {
+ $keyword =~ s/%/\\%/;
+ $keyword =~ s/_/\\_/;
+ $keyword = "%" . $keyword . "%";
+ $keyword = $dbh->quote($keyword);
+ $query .= " or (author like $keyword) or
+ (title like $keyword) or (unititle like $keyword) or
+ (notes like $keyword) or (seriestitle like $keyword) or
+ (abstract like $keyword)";
+ } # foreach
+
+ $sth = $dbh->prepare($query);
+ $sth->execute;
+
+ while (my $data = $sth->fetchrow_hashref) {
+ $results[$count] = $data;
+ $count++;
+ } # while
+
+ $sth->finish;
+ $dbh->disconnect;
+ return($count, @results);
+ } # sub keywordsearch
+
+
+ sub websitesearch {
+ my ($keywordlist) = @_;
+ my $dbh = C4Connect;
+ my $query = "Select distinct biblio.* from biblio, biblioitems where
+ biblio.biblionumber = biblioitems.biblionumber and (";
+ my $count = 0;
+ my $sth;
+ my @results;
+ my @keywords = split(/ +/, $keywordlist);
+ my $keyword = shift(@keywords);
+
+ $keyword =~ s/%/\\%/g;
+ $keyword =~ s/_/\\_/;
+ $keyword = "%" . $keyword . "%";
+ $keyword = $dbh->quote($keyword);
+ $query .= " (url like $keyword)";
+
+ foreach $keyword (@keywords) {
+ $keyword =~ s/%/\\%/;
+ $keyword =~ s/_/\\_/;
+ $keyword = "%" . $keyword . "%";
+ $keyword = $dbh->quote($keyword);
+ $query .= " or (url like $keyword)";
+ } # foreach
+
+ $query .= ")";
+ $sth = $dbh->prepare($query);
+ $sth->execute;
+
+ while (my $data = $sth->fetchrow_hashref) {
+ $results[$count] = $data;
+ $count++;
+ } # while
+
+ $sth->finish;
+ $dbh->disconnect;
+ return($count, @results);
+ } # sub websitesearch
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Koha-devel] CVS: koha/C4 Acquisitions.pm,1.5,1.6,
Gynn Lomax <=
- Prev by Date:
[Koha-devel] CVS: koha database.mysql,1.2,1.3
- Next by Date:
[Koha-devel] CVS: koha/acqui.simple addbiblio.pl,NONE,1.1 addbiblioitem.pl,NONE,1.1 additem.pl,NONE,1.1 isbnsearch.pl,NONE,1.1 keywordsearch.pl,NONE,1.1 savebiblio.pl,NONE,1.1 savebiblioitem.pl,NONE,1.1 saveitem.pl,NONE,1.1 websitesearch.pl,NONE,1.1
- Previous by thread:
[Koha-devel] CVS: koha database.mysql,1.2,1.3
- Next by thread:
[Koha-devel] CVS: koha/acqui.simple addbiblio.pl,NONE,1.1 addbiblioitem.pl,NONE,1.1 additem.pl,NONE,1.1 isbnsearch.pl,NONE,1.1 keywordsearch.pl,NONE,1.1 savebiblio.pl,NONE,1.1 savebiblioitem.pl,NONE,1.1 saveitem.pl,NONE,1.1 websitesearch.pl,NONE,1.1
- Index(es):