From 528f1b2b8006061a4b2d10a53f367d84b7b6e50b Mon Sep 17 00:00:00 2001 From: tipaul Date: Thu, 4 Jul 2002 15:53:02 +0000 Subject: [PATCH] Long is the road to MARC.. Not related to MARC : * removed HLT- empty link when no basket for a supplier (should be useful to copy this into rel-1-2 i think) * fixed some "use of uninitialized value" related to MARC * changed use Acquisition to use Catalogue, new package for MARC management For instance, nothing is done to MARC DB, but structure is modified (see Biblio.pm for details), and everything seems to work : it's still possible to use acqui, and it fills old-DB pretty good. WARNING : if you work on main trunk, please note Acquisition.pm is NO MORE USED in /acqui/ system. Every sub in Acquisition.pm has been moved to Biblio.pm or Catalogue.pm. --- C4/Biblio.pm | 21 ++++++----- C4/Catalogue.pm | 2 +- acqui/acquire.pl | 2 +- acqui/addorder.pl | 3 +- acqui/basket.pl | 2 +- acqui/finishreceive.pl | 3 +- acqui/modorders.pl | 2 +- acqui/newbasket.pl | 2 +- acqui/newbasket2.pl | 5 ++- acqui/newbiblio.pl | 2 +- acqui/order.pl | 83 +++++++++++++++++++++++++++-------------- acqui/receive.pl | 2 +- acqui/recieveorder.pl | 2 +- acqui/supplier.pl | 2 +- acqui/updatesupplier.pl | 2 +- 15 files changed, 83 insertions(+), 52 deletions(-) diff --git a/C4/Biblio.pm b/C4/Biblio.pm index 51aed82fc8..460dffa338 100644 --- a/C4/Biblio.pm +++ b/C4/Biblio.pm @@ -52,7 +52,7 @@ $VERSION = 0.01; &updateBiblio &updateBiblioItem &updateItem &itemcount &newbiblio &newbiblioitem &modnote &newsubject &newsubtitle - &newordernum &modbiblio &checkitems + &modbiblio &checkitems &newitems &modbibitem &modsubtitle &modsubject &modaddauthor &moditem &countitems &delitem &deletebiblioitem &delbiblio @@ -200,7 +200,7 @@ sub MARCaddsubfield { $sth=$dbh->prepare("select max(blobidlink)from marc_blob_subfield"); $sth->execute; my ($res)=$sth->fetchrow; - my $sth=$dbh->prepare("insert into marc_subfield_table (bibid,tag,tagorder,subfieldcode,subfieldorder,valuebloblink) values (?,?,?,?,?,?)"); + $sth=$dbh->prepare("insert into marc_subfield_table (bibid,tag,tagorder,subfieldcode,subfieldorder,valuebloblink) values (?,?,?,?,?,?)"); $sth->execute($bibid,$tagid,$tagorder,$subfieldcode,$subfieldorder,$res); $dbh->do("unlock tables"); } else { @@ -363,7 +363,8 @@ sub MARCmodsubfield { $sth->finish; $sth=$dbh->prepare("select bibid,tag,tagorder,subfieldcode,subfieldid,subfieldorder from marc_subfield_table where subfieldid=?"); $sth->execute($subfieldid); - my ($bibid,$tagid,$tagorder,$subfieldcode,$subfieldid,$subfieldorder) = $sth->fetchrow; + my ($bibid,$tagid,$tagorder,$subfieldcode,$x,$subfieldorder) = $sth->fetchrow; + $subfieldid=$x; &MARCdelword($dbh,$bibid,$tagid,$tagorder,$subfieldcode,$subfieldorder); &MARCaddword($dbh,$bibid,$tagid,$tagorder,$subfieldcode,$subfieldorder,$subfieldvalue); return($subfieldid, $subfieldvalue); @@ -458,9 +459,9 @@ sub MARCdelsubfield { # delete a subfield for $bibid / tag / tagorder / subfield / subfieldorder my ($dbh,$bibid,$tag,$tagorder,$subfield,$subfieldorder) = @_; # my $dbh=&C4Connect; - my $dbh->do("delete from marc_subfield_table where bibid='$bibid' and + $dbh->do("delete from marc_subfield_table where bibid='$bibid' and tag='$tag' and tagorder='$tagorder' - and subfieldcode='$subfield'and subfieldorder='$subfieldorder + and subfieldcode='$subfield' and subfieldorder='$subfieldorder "); } @@ -971,7 +972,7 @@ sub OLDnewitems { my $sth = $dbh->prepare($query); my $data; my $itemnumber; - my $error; + my $error = ""; $sth->execute; $data = $sth->fetchrow_hashref; @@ -1006,9 +1007,9 @@ sub OLDnewitems { $sth = $dbh->prepare($query); $sth->execute; - - $error .= $sth->errstr; - + if (defined $sth->errstr) { + $error .= $sth->errstr; + } $sth->finish; $itemnumber++; } # for @@ -1345,7 +1346,7 @@ sub getitemtypes { $sth->execute; # || die "Cannot execute $query\n" . $sth->errstr; while (my $data = $sth->fetchrow_hashref) { - @results[$count] = $data; + $results[$count] = $data; $count++; } # while diff --git a/C4/Catalogue.pm b/C4/Catalogue.pm index 94049e94ca..0ec0cbf3a4 100644 --- a/C4/Catalogue.pm +++ b/C4/Catalogue.pm @@ -28,7 +28,7 @@ $VERSION = 0.01; &getorder &neworder &delorder &ordersearch &modorder &getsingleorder &invoice &receiveorder - &updaterecorder + &updaterecorder &newordernum &bookfunds &bookfundbreakdown &updatecost &curconvert &getcurrencies &updatecurrencies &getcurrency diff --git a/acqui/acquire.pl b/acqui/acquire.pl index 309f768648..5de97b49cd 100755 --- a/acqui/acquire.pl +++ b/acqui/acquire.pl @@ -3,7 +3,7 @@ #script to recieve orders #written by chris@katipo.co.nz 24/2/2000 -use C4::Acquisitions; +use C4::Catalogue; use C4::Biblio; use C4::Output; use C4::Database; diff --git a/acqui/addorder.pl b/acqui/addorder.pl index 920a516186..0d56449b1f 100755 --- a/acqui/addorder.pl +++ b/acqui/addorder.pl @@ -6,7 +6,8 @@ use strict; use CGI; use C4::Output; -use C4::Acquisitions; +use C4::Catalogue; +use C4::Biblio; #use Date::Manip; my $input = new CGI; diff --git a/acqui/basket.pl b/acqui/basket.pl index ea6db1b580..f7b1c2a0ca 100755 --- a/acqui/basket.pl +++ b/acqui/basket.pl @@ -3,7 +3,7 @@ #script to show display basket of orders #written by chris@katipo.co.nz 24/2/2000 -use C4::Acquisitions; +use C4::Catalogue; use C4::Biblio; use C4::Output; use CGI; diff --git a/acqui/finishreceive.pl b/acqui/finishreceive.pl index 0fd4d13f11..34ac9f4db1 100755 --- a/acqui/finishreceive.pl +++ b/acqui/finishreceive.pl @@ -4,7 +4,8 @@ #written 1/3/00 by chris@katipo.co.nz use C4::Output; -use C4::Acquisitions; +use C4::Catalogue; +use C4::Biblio; use CGI; use C4::Search; diff --git a/acqui/modorders.pl b/acqui/modorders.pl index 6bd657c28e..884509c155 100755 --- a/acqui/modorders.pl +++ b/acqui/modorders.pl @@ -6,7 +6,7 @@ use strict; use CGI; use C4::Output; -use C4::Acquisitions; +use C4::Catalogue; use C4::Biblio; #use Date::Manip; diff --git a/acqui/newbasket.pl b/acqui/newbasket.pl index 726e79b540..3e61e31091 100755 --- a/acqui/newbasket.pl +++ b/acqui/newbasket.pl @@ -3,7 +3,7 @@ #script to show display basket of orders #written by chris@katipo.co.nz 24/2/2000 -use C4::Acquisitions; +use C4::Catalogue; use C4::Biblio; use C4::Output; use CGI; diff --git a/acqui/newbasket2.pl b/acqui/newbasket2.pl index 4d79d9642d..e02340b22d 100755 --- a/acqui/newbasket2.pl +++ b/acqui/newbasket2.pl @@ -6,7 +6,8 @@ use strict; use C4::Search; use CGI; use C4::Output; -use C4::Acquisitions; +use C4::Catalogue; +use C4::Biblio; my $env; my $input = new CGI; @@ -142,7 +143,7 @@ while ($i < $count2){ $word=~ s/\n//g; my $url="/cgi-bin/koha/search.pl?author=$word&type=$type"; $result->{'author'}=mklink($url,$result->{'author'}); - my ($count,$lcount,$nacount,$fcount,$scount,$lostcount,$mending,$transit)=itemcount($env,$result->{'biblionumber'},$type); + my ($count,$lcount,$nacount,$fcount,$scount,$lostcount,$mending,$transit)=C4::Search::itemcount($env,$result->{'biblionumber'},$type); $itemcount=$count; if ($nacount > 0){ $location=$location."On Loan"; diff --git a/acqui/newbiblio.pl b/acqui/newbiblio.pl index 2cffbad33b..3e6db4b7ff 100755 --- a/acqui/newbiblio.pl +++ b/acqui/newbiblio.pl @@ -3,7 +3,7 @@ #script to show display basket of orders #written by chris@katipo.co.nz 24/2/2000 -use C4::Acquisitions; +use C4::Catalogue; use C4::Biblio; use C4::Output; use C4::Search; diff --git a/acqui/order.pl b/acqui/order.pl index 4c3f5113f6..090305b579 100755 --- a/acqui/order.pl +++ b/acqui/order.pl @@ -3,7 +3,7 @@ #script to show suppliers and orders #written by chris@katipo.co.nz 23/2/2000 -use C4::Acquisitions; +use C4::Catalogue; use C4::Biblio; use C4::Output; use CGI; @@ -34,38 +34,65 @@ printend my $colour='#ffffcc'; my $toggle=0; for (my $i=0; $i<$count; $i++) { - if ($toggle==0){ - $colour='#ffffcc'; - $toggle=1; - } else { - $colour='white'; - $toggle=0; - } - my ($ordcount,$orders)=getorders($suppliers[$i]->{'id'}); + if ($toggle==0){ + $colour='#ffffcc'; + $toggle=1; + } else { + $colour='white'; + $toggle=0; + } + my ($ordcount,$orders)=getorders($suppliers[$i]->{'id'}); # print $ordcount; - print < - New Basket - Receive Order - $suppliers[$i]->{'name'} - HLT-$orders->[0]->{'basketno'} - $orders->[0]->{'count(*)'} - $orders->[0]->{'authorisedby'} - $orders->[0]->{'entrydate'} + if ($orders->[0]->{'basketno'}>0) { + print < + New Basket + Receive Order + $suppliers[$i]->{'name'} + HLT-$orders->[0]->{'basketno'} + $orders->[0]->{'count(*)'} + $orders->[0]->{'authorisedby'} + $orders->[0]->{'entrydate'} printend ; - for (my $i2=1;$i2<$ordcount;$i2++){ - print < -   -   - HLT-$orders->[$i2]->{'basketno'} - $orders->[$i2]->{'count(*)'}$orders->[$i2]->{'authorisedby'}   - $orders->[$i2]->{'entrydate'} - + } else { + print < + New Basket + Receive Order + $suppliers[$i]->{'name'} +   + $orders->[0]->{'count(*)'} + $orders->[0]->{'authorisedby'} + $orders->[0]->{'entrydate'} printend ; - } + } + for (my $i2=1;$i2<$ordcount;$i2++){ + if ($orders->[$i2]->{'basketno'}>=1) { + print < +   +   + HLT-$orders->[$i2]->{'basketno'} + $orders->[$i2]->{'count(*)'}$orders->[$i2]->{'authorisedby'}   + $orders->[$i2]->{'entrydate'} + +printend +; + } else { + print < +   +   +   + $orders->[$i2]->{'count(*)'}$orders->[$i2]->{'authorisedby'}   + $orders->[$i2]->{'entrydate'} + +printend +; + } + } } print <