From rangi at users.sourceforge.net Mon Sep 10 16:38:02 2001 From: rangi at users.sourceforge.net (Chris Cormack) Date: Mon Sep 10 16:38:02 2001 Subject: [Koha-devel] CVS: koha moredetail.pl,1.2,1.3 modbibitem.pl,1.1.1.1,1.2 Message-ID: Update of /cvsroot/koha/koha In directory usw-pr-cvs1:/tmp/cvs-serv3802 Modified Files: moredetail.pl modbibitem.pl Log Message: Fixing a glitch that was showing the biblio notes field where the biblioitems notes should have been displaying Index: moredetail.pl =================================================================== RCS file: /cvsroot/koha/koha/moredetail.pl,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** moredetail.pl 2001/03/15 10:17:33 1.2 --- moredetail.pl 2001/09/10 23:37:09 1.3 *************** *** 35,39 **** my (@items)=itemissues($bi); ! my ($order)=getorder($bi,$bib); #print @items; my $count=@items; --- 35,39 ---- my (@items)=itemissues($bi); ! my ($order,$ordernum)=getorder($bi,$bib); #print @items; my $count=@items; *************** *** 89,94 **** Illus: $data->{'illus'}
Size: $data->{'size'}
! Notes: $data->{'notes'}
No. of Items: $count printend ; --- 89,95 ---- Illus: $data->{'illus'}
Size: $data->{'size'}
! Notes: $data->{'bnotes'}
No. of Items: $count + printend ; *************** *** 98,101 **** --- 99,103 ---- } print < *************** *** 118,121 **** --- 120,124 ---- {'itemnumber'}> + *************** *** 154,161 **** Replacement Price: $items[$i]->{'replacementprice'}
Item lost: $items[$i]->{'itemlost'}
! paid by:
Notes: $items[$i]->{'itemnotes'}
Renewals: $items[$i]->{'renewals'}
! {'ordernumber'}&biblio=$bib&invoice=$order->{'booksellerinvoicenumber'}&catview=yes>Accession Date: $items[$i]->{'dateaccessioned'}
printend ; --- 157,164 ---- Replacement Price: $items[$i]->{'replacementprice'}
Item lost: $items[$i]->{'itemlost'}
! Paid for: $items[$i]->{'paidfor'}
Notes: $items[$i]->{'itemnotes'}
Renewals: $items[$i]->{'renewals'}
! {'booksellerinvoicenumber'}&catview=yes>Accession Date: $items[$i]->{'dateaccessioned'}
printend ; Index: modbibitem.pl =================================================================== RCS file: /cvsroot/koha/koha/modbibitem.pl,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -r1.1.1.1 -r1.2 *** modbibitem.pl 2000/12/19 23:45:52 1.1.1.1 --- modbibitem.pl 2001/09/10 23:37:09 1.2 *************** *** 113,117 **** Notes ! Size --- 113,117 ---- Notes ! Size From rangi at users.sourceforge.net Mon Sep 10 16:38:02 2001 From: rangi at users.sourceforge.net (Chris Cormack) Date: Mon Sep 10 16:38:02 2001 Subject: [Koha-devel] CVS: koha/C4 Search.pm,1.3,1.4 Message-ID: Update of /cvsroot/koha/koha/C4 In directory usw-pr-cvs1:/tmp/cvs-serv3802/C4 Modified Files: Search.pm Log Message: Fixing a glitch that was showing the biblio notes field where the biblioitems notes should have been displaying Index: Search.pm =================================================================== RCS file: /cvsroot/koha/koha/C4/Search.pm,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** Search.pm 2001/06/20 03:36:01 1.3 --- Search.pm 2001/09/10 23:37:09 1.4 *************** *** 20,24 **** &OpacSearch &borrdata2 &NewBorrowerNumber &bibitemdata &borrissues &getboracctrecord &ItemType &itemissues &FrontSearch &subject &subtitle ! &addauthor &bibitems &barcodes &findguarantees &allissues &systemprefs); %EXPORT_TAGS = ( ); # eg: TAG => [ qw!name1 name2! ], --- 20,25 ---- &OpacSearch &borrdata2 &NewBorrowerNumber &bibitemdata &borrissues &getboracctrecord &ItemType &itemissues &FrontSearch &subject &subtitle ! &addauthor &bibitems &barcodes &findguarantees &allissues &systemprefs ! &findguarantor); %EXPORT_TAGS = ( ); # eg: TAG => [ qw!name1 name2! ], *************** *** 73,76 **** --- 74,95 ---- } + sub findguarantor{ + my ($bornum)=@_; + my $dbh=C4Connect; + my $query="select guarantor from borrowers where + borrowernumber='$bornum'"; + my $sth=$dbh->prepare($query); + $sth->execute; + my $data=$sth->fetchrow_hashref; + $sth->finish; + $query="Select * from borrowers where borrowernumber='$data->{'guarantor'}'"; + $sth=$dbh->prepare($query); + $sth->execute; + $data=$sth->fetchrow_hashref; + $sth->finish; + $dbh->disconnect; + return($data); + } + sub NewBorrowerNumber { my $dbh=C4Connect; *************** *** 215,221 **** my $i=1; my @results; ! my $query ="Select * from biblio,bibliosubtitle,biblioitems where ! biblio.biblionumber=bibliosubtitle.biblionumber and ! biblioitems.biblionumber=biblio.biblionumber and (((title like '$key[0]%' or title like '% $key[0]%')"; while ($i < $count){ --- 234,243 ---- my $i=1; my @results; ! my $query ="Select * from biblio ! left join bibliosubtitle on ! bibliosubtitle.biblionumber=biblio.biblionumber ! left join biblioitems on ! biblioitems.biblionumber=biblio.biblionumber ! where (((title like '$key[0]%' or title like '% $key[0]%')"; while ($i < $count){ *************** *** 345,353 **** my $i=1; $query="select *,biblio.author,biblio.biblionumber from ! biblioitems,biblio left join additionalauthors on additionalauthors.biblionumber =biblio.biblionumber ! where biblioitems.biblionumber=biblio.biblionumber ! and ((biblio.author like '$key[0]%' or biblio.author like '% $key[0]%' or additionalauthors.author like '$key[0]%' or additionalauthors.author --- 367,375 ---- my $i=1; $query="select *,biblio.author,biblio.biblionumber from ! biblio left join additionalauthors on additionalauthors.biblionumber =biblio.biblionumber ! left join biblioitems on biblioitems.biblionumber=biblio.biblionumber ! where ((biblio.author like '$key[0]%' or biblio.author like '% $key[0]%' or additionalauthors.author like '$key[0]%' or additionalauthors.author *************** *** 397,404 **** my $count=@key; my $i=1; ! $query="select * from biblio,bibliosubtitle,biblioitems where - (biblio.biblionumber=bibliosubtitle.biblionumber and - biblioitems.biblionumber=biblio.biblionumber) and (((title like '$key[0]%' or title like '% $key[0]%' or title like '% $key[0]')"; while ($i<$count){ --- 419,427 ---- my $count=@key; my $i=1; ! $query="select * from biblio ! left join bibliosubtitle on ! bibliosubtitle.biblionumber=biblio.biblionumber ! left join biblioitems on biblioitems.biblionumber=biblio.biblionumber where (((title like '$key[0]%' or title like '% $key[0]%' or title like '% $key[0]')"; while ($i<$count){ *************** *** 714,718 **** my ($bibitem)=@_; my $dbh=C4Connect; ! my $query="Select * from biblio,biblioitems,itemtypes where biblio.biblionumber= biblioitems.biblionumber and biblioitemnumber=$bibitem and biblioitems.itemtype=itemtypes.itemtype"; --- 737,742 ---- 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"; *************** *** 1043,1048 **** biblionumber=$bibnum "; if ($type eq 'opac'){ ! $query.=" and (itemlost <>1 or itemlost is NULL) and ! (wthdrawn <> 1 or wthdrawn is NULL)"; } my $sth=$dbh->prepare($query); --- 1067,1072 ---- biblionumber=$bibnum "; if ($type eq 'opac'){ ! $query.=" and (itemlost =0 or itemlost is NULL) and ! (wthdrawn = 0 or wthdrawn is NULL)"; } my $sth=$dbh->prepare($query); *************** *** 1078,1082 **** $scount++; } ! if ($data->{'itemlost'} eq '1'){ $lostcount++; } --- 1102,1106 ---- $scount++; } ! if ($data->{'itemlost'} eq '1' || $data->{'itemlost'} eq '2'){ $lostcount++; } From rangi at users.sourceforge.net Mon Sep 10 19:04:02 2001 From: rangi at users.sourceforge.net (Chris Cormack) Date: Mon Sep 10 19:04:02 2001 Subject: [Koha-devel] CVS: koha deletemem.pl,1.1,1.2 Message-ID: Update of /cvsroot/koha/koha In directory usw-pr-cvs1:/tmp/cvs-serv27882 Modified Files: deletemem.pl Log Message: Fixing member deletion, so that it checks fines, issues and guarantees before deleting Index: deletemem.pl =================================================================== RCS file: /cvsroot/koha/koha/deletemem.pl,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** deletemem.pl 2001/07/05 21:37:59 1.1 --- deletemem.pl 2001/09/11 02:03:26 1.2 *************** *** 19,35 **** my %env; $env{'nottodayissues'}=1; ! my %member2; ! $member2{'borrowernumber'}=$member; ! my $issues=currentissues(\%env,\%member2); ! my $i=0; ! foreach (sort keys %$issues) { $i++; ! } ! if ($i > 0){ print $input->header; ! print "error borrower has items on issue"; } else { ! delmember($member); ! print $input->redirect("/members/"); } --- 19,56 ---- my %env; $env{'nottodayissues'}=1; ! my %member2; ! $member2{'borrowernumber'}=$member; ! my $issues=currentissues(\%env,\%member2); ! my $i=0; ! foreach (sort keys %$issues) { $i++; ! } ! my ($bor,$flags)=getpatroninformation(\%env, $member,''); ! my $dbh=C4Connect; ! my $query="Select * from borrowers where guarantor='$member'"; ! my $sth=$dbh->prepare($query); ! $sth->execute; ! my $data=$sth->fetchrow_hashref; ! $sth->finish; ! $dbh->disconnect; ! ! ! if ($i > 0 || $flags->{'CHARGES'} ne '' || $data ne ''){ print $input->header; ! print ""; ! if ($i > 0){ ! print ""; ! } ! if ($flags->{'CHARGES'} ne ''){ ! print ""; ! } ! if ($data ne ''){ ! print ""; ! } ! print "
Items on Issue$i
Charges$flags->{'CHARGES'}->{'message'}
Guarantees
"; ! } else { ! delmember($member); ! print $input->redirect("/members/"); } *************** *** 52,55 **** --- 73,80 ---- $sth->finish; $query = "Delete from borrowers where borrowernumber='$member'"; + $sth=$dbh->prepare($query); + $sth->execute; + $sth->finish; + $query="Delete from reserves where borrowernumber='$member'"; $sth=$dbh->prepare($query); $sth->execute; From nsr4n at tetra.mail.virginia.edu Fri Sep 21 21:16:01 2001 From: nsr4n at tetra.mail.virginia.edu (Nicholas Stephen Rosasco) Date: Fri Sep 21 21:16:01 2001 Subject: [Koha-devel] MARC, etc Message-ID: I know a LOT of work has happened since I suggested MARC support in Koha, but since the list has suddenly gone silent, I was wondering what the status was... particularly as I've got someone asking for an install of it soon, and they are specifically requesting info about OpenBook (still in beta I think) rather than Koha. I have no issue with the OpenBook app or development, but I'm of the opinion that Koha is a more mature product. Also, since my last email, I've had a chance to acquire at least some Perl skill and feel fairly confident that I could at least handle non-essential bits n' bobs, etc if need be (perhaps not quick turnaround for a little while -- the work backlog I've got is depressing indeed). NSR From tonnesen at users.sourceforge.net Thu Sep 27 12:25:03 2001 From: tonnesen at users.sourceforge.net (Steve Tonnesen) Date: Thu Sep 27 12:25:03 2001 Subject: [Koha-devel] CVS: koha/C4 Catalogue.pm,1.6,1.7 Message-ID: Update of /cvsroot/koha/koha/C4 In directory usw-pr-cvs1:/tmp/cvs-serv31420/koha/C4 Modified Files: Catalogue.pm Log Message: Started on updateItem subroutine. Index: Catalogue.pm =================================================================== RCS file: /cvsroot/koha/koha/C4/Catalogue.pm,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -r1.6 -r1.7 *** Catalogue.pm 2001/06/26 22:27:12 1.6 --- Catalogue.pm 2001/09/27 19:24:18 1.7 *************** *** 1,4 **** --- 1,8 ---- package C4::Catalogue; #asummes C4/Acquisitions.pm + # Continue working on updateItem!!!!!! + # + + use strict; require Exporter; *************** *** 55,58 **** --- 59,63 ---- # only created when new biblioitems are added. my ($env, $biblio) = @_; + my $dbh=&C4Connect; my $title=$biblio->{'title'}; my $q_title=$dbh->quote($title); *************** *** 106,109 **** --- 111,117 ---- # Might be nice to be able to pass a Subfield_ID directly to this routine to # remove ambiguity, if possible. + # + # Pass barcode to remove ambiguity for changes to individual items. Look up + # field link and sequence number based on barcode. my $Record_ID=shift; *************** *** 113,116 **** --- 121,126 ---- my $Subfield_OldValue=shift; my $Subfield_Value=shift; + my $barcode=shift; + my $Subfield_ID; my $dbh=&C4Connect; my $sth=$dbh->prepare("select S.Subfield_ID, S.Subfield_Value from Bib_Table B, $firstdigit\XX_Tag_Table T, $firstdigit\XX_Subfield_Table S where B.Record_ID=$Record_ID and B.Tag_$firstdigit\XX_ID=T.Tag_ID and T.Subfield_ID=S.Subfield_ID and S.Subfield_Mark='$Subfield_Mark'"); *************** *** 121,127 **** --- 131,139 ---- my $sti=$dbh->prepare("update $firstdigit\XX_Subfield_Table set Subfield_Value=$q_Subfield_Value where Subfield_ID=$ID"); $sti->execute; + $Subfield_ID=$ID; last; } } + return($Subfield_ID); } *************** *** 329,333 **** my ($biblioitemnumber) =$sth->fetchrow; $biblioitemnumber++; ! $sth=$dbh->prepare("insert into biblioitems (biblionumber,biblioitemnumber,volume,number,classification,itemtype,isbn,issn,dewey,subclass,publicationyear,publishercode,volumedate,illus,pages,notes,size,place,lccn) values ($biblionumber, $biblioitemnumber, $q_volume, $q_number, $q_classification, $q_itemtype, $q_isbn, $q_issn, $dewey, $q_subclass, $q_publicationyear, $q_publishercode, $q_volumedate, $q_illus, $q_pages,$q_notes, $q_size, $q_place, $q_lccn)"); $sth->execute; #my $sth=$dbh->prepare("unlock tables"); --- 341,345 ---- my ($biblioitemnumber) =$sth->fetchrow; $biblioitemnumber++; ! $sth=$dbh->prepare("insert into biblioitems (biblionumber,biblioitemnumber,volume,number,classification,itemtype,isbn,issn,dewey,subclass,publicationyear,publishercode,volumedate,illus,pages,notes,size,place,lccn) values ($biblionumber, $biblioitemnumber, $q_volume, $q_number, $q_classification, $q_itemtype, $q_isbn, $q_issn, $dewey, $q_subclass, $publicationyear, $q_publishercode, $q_volumedate, $q_illus, $q_pages,$q_notes, $q_size, $q_place, $q_lccn)"); $sth->execute; #my $sth=$dbh->prepare("unlock tables"); *************** *** 339,343 **** # same isbn/lccn/issn? ! $sth=$dbh->prepare("select title,unititle,seriestitle,copyrightdate,notes,author from biblio where biblionumber=$biblionumber"); $sth->execute; my ($title, $unititle,$seriestitle,$copyrightdate,$biblionotes,$author) = $sth->fetchrow; --- 351,355 ---- # same isbn/lccn/issn? ! my $sth=$dbh->prepare("select title,unititle,seriestitle,copyrightdate,notes,author from biblio where biblionumber=$biblionumber"); $sth->execute; my ($title, $unititle,$seriestitle,$copyrightdate,$biblionotes,$author) = $sth->fetchrow; *************** *** 403,407 **** $subfields->{2}->{'Subfield_Mark'}='3'; $subfields->{2}->{'Subfield_Value'}='biblio'; ! my $tag='440'; addTag($env, $Record_ID, $tag, ' ', ' ', $subfields); } --- 415,419 ---- $subfields->{2}->{'Subfield_Mark'}='3'; $subfields->{2}->{'Subfield_Value'}='biblio'; ! my $tag='500'; addTag($env, $Record_ID, $tag, ' ', ' ', $subfields); } *************** *** 540,544 **** sub updateBiblioItem { # Update the biblioitem with biblioitemnumber $biblioitem->{'biblioitemnumber'} - # This routine should also modify the corresponding MARC record data. # # This routine should also check to see which fields are actually being --- 552,555 ---- *************** *** 598,602 **** if ($biblioitem->{'dewey'} ne $obi->{'dewey'}) { logchange('kohadb', 'biblioitems', 'dewey', $obi->{'dewey'}, $biblioitem->{'dewey'}); ! my $sth=$dbh->prepare("update biblioitems set dewey=$dewey where biblioitemnumber=$biblioitemnumber"); logchange('marc', '082', 'a', $obi->{'dewey'}, $biblioitem->{'dewey'}); changeSubfield($Record_ID, '082', 'a', $obi->{'dewey'}, $biblioitem->{'dewey'}); --- 609,613 ---- if ($biblioitem->{'dewey'} ne $obi->{'dewey'}) { logchange('kohadb', 'biblioitems', 'dewey', $obi->{'dewey'}, $biblioitem->{'dewey'}); ! my $sth=$dbh->prepare("update biblioitems set dewey=$biblioitem->{'dewey'} where biblioitemnumber=$biblioitemnumber"); logchange('marc', '082', 'a', $obi->{'dewey'}, $biblioitem->{'dewey'}); changeSubfield($Record_ID, '082', 'a', $obi->{'dewey'}, $biblioitem->{'dewey'}); *************** *** 673,683 **** --- 684,700 ---- my $dbh=&C4Connect; my $barcode=$item->{'barcode'}; + my $q_barcode=$dbh->quote($barcode); + my $biblionumber=$item->{'biblionumber'}; + my $biblioitemnumber=$item->{'biblioitemnumber'}; my $dateaccessioned=$item->{'dateaccessioned'}; my $booksellerid=$item->{'booksellerid'}; + my $q_booksellerid=$dbh->quote($booksellerid); my $homebranch=$item->{'homebranch'}; + my $q_homebranch=$dbh->quote($homebranch); my $holdingbranch=$item->{'holdingbranch'}; my $price=$item->{'price'}; my $replacementprice=$item->{'replacementprice'}; my $replacementpricedate=$item->{'replacementpricedate'}; + my $q_replacementpricedate=$dbh->quote($replacementpricedate); my $notforloan=$item->{'notforloan'}; my $itemlost=$item->{'itemlost'}; *************** *** 685,688 **** --- 702,706 ---- my $restricted=$item->{'restricted'}; my $itemnotes=$item->{'itemnotes'}; + my $q_itemnotes=$dbh->quote($itemnotes); my $itemtype=$item->{'itemtype'}; my $subclass=$item->{'subclass'}; *************** *** 763,766 **** --- 781,858 ---- my ($env, $item) = @_; + my $dbh=&C4Connect; + my $itemnumber=$item->{'itemnumber'}; + my $biblionumber=$item->{'biblionumber'}; + my $biblioitemnumber=$item->{'biblioitemnumber'}; + my $barcode=$item->{'barcode'}; + my $dateaccessioned=$item->{'dateaccessioned'}; + my $booksellerid=$item->{'booksellerid'}; + my $homebranch=$item->{'homebranch'}; + my $price=$item->{'price'}; + my $replacementprice=$item->{'replacementprice'}; + my $replacementpricedate=$item->{'replacementpricedate'}; + my $multivolume=$item->{'multivolume'}; + my $stack=$item->{'stack'}; + my $notforloan=$item->{'notforloan'}; + my $itemlost=$item->{'itemlost'}; + my $wthdrawn=$item->{'wthdrawn'}; + my $bulk=$item->{'bulk'}; + my $restricted=$item->{'restricted'}; + my $binding=$item->{'binding'}; + my $itemnotes=$item->{'itemnotes'}; + my $holdingbranch=$item->{'holdingbranch'}; + my $interim=$item->{'interim'}; + my $sth=$dbh->prepare("select * from items where itemnumber=$itemnumber"); + $sth->execute; + my $olditem=$sth->fetchrow_hashref; + my $q_barcode=$dbh->quote($olditem->{'barcode'}); + $sth=$dbh->prepare("select Subfield_ID from 8XX_Subfield_Table where Subfield_Mark='p' and Subfield_Value=$q_barcode"); + $sth->execute; + my ($Subfield852_ID) = $sth->fetchrow; + $sth=$dbh->prepare("select Subfield_Value from 8XX_Subfield_Table where Subfield_Mark=8 and Subfield_ID=$Subfield852_ID"); + $sth->execute; + my ($link) = $sth->fetchrow; + $sth=$dbh->prepare("select Subfield_ID from 8XX_Subfield_Table where Subfield_Mark=8 and Subfield_Value=$link"); + $sth->execute; + my ($Subfield876_ID) = $sth->fetchrow; + + if ($item->{'barcode'} ne $olditem->{'barcode'}) { + logchange('kohadb', 'items', 'barcode', $olditem->{'barcode'}, $item->{'barcode'}); + my $q_barcode=$dbh->quote($item->{'barcode'}); + my $sth=$dbh->prepare("update items set barcode=$q_barcode where itemnumber=$itemnumber"); + logchange('marc', '876', 'p', $olditem->{'barcode'}, $item->{'barcode'}); + ($Subfield_ID) = changeSubfield($Record_ID, '876', 'p', $olditem->{'barcode'}, $item->{'barcode'}); + } + if ($item->{'booksellerid'} ne $olditem->{'booksellerid'}) { + logchange('kohadb', 'items', 'booksellerid', $olditem->{'booksellerid'}, $item->{'booksellerid'}); + my $q_booksellerid=$dbh->quote($item->{'booksellerid'}); + my $sth=$dbh->prepare("update items set booksellerid=$q_booksellerid where itemnumber=$itemnumber"); + logchange('marc', '876', 'e', $olditem->{'booksellerid'}, $item->{'booksellerid'}); + changeSubfield($Record_ID, '876', 'e', $olditem->{'booksellerid'}, $item->{'booksellerid'}); + } + if ($item->{'dateaccessioned'} ne $olditem->{'dateaccessioned'}) { + logchange('kohadb', 'items', 'dateaccessioned', $olditem->{'dateaccessioned'}, $item->{'dateaccessioned'}); + my $q_dateaccessioned=$dbh->quote($item->{'dateaccessioned'}); + my $sth=$dbh->prepare("update items set dateaccessioned=$q_dateaccessioned where itemnumber=$itemnumber"); + logchange('marc', '876', 'd', $olditem->{'dateaccessioned'}, $item->{'dateaccessioned'}); + changeSubfield($Record_ID, '876', 'd', $olditem->{'dateaccessioned'}, $item->{'dateaccessioned'}); + } + if ($item->{'homebranch'} ne $olditem->{'homebranch'}) { + # FIX ME!!!! This really needs to check the field link and sequence + # number entry to make sure the right item is being modified! + # Use 876 p (piece designation) to ensure. + logchange('kohadb', 'items', 'homebranch', $olditem->{'homebranch'}, $item->{'homebranch'}); + my $q_homebranch=$dbh->quote($item->{'homebranch'}); + my $sth=$dbh->prepare("update items set homebranch=$q_homebranch where itemnumber=$itemnumber"); + logchange('marc', '876', 'b', $olditem->{'homebranch'}, $item->{'homebranch'}); + changeSubfield($Record_ID, '876', 'b', $olditem->{'homebranch'}, $item->{'homebranch'}); + } + if ($item->{'holdingbranch'} ne $olditem->{'holdingbranch'}) { + logchange('kohadb', 'items', 'holdingbranch', $olditem->{'holdingbranch'}, $item->{'holdingbranch'}); + my $q_holdingbranch=$dbh->quote($item->{'holdingbranch'}); + my $sth=$dbh->prepare("update items set holdingbranch=$q_holdingbranch where itemnumber=$itemnumber"); + logchange('marc', '876', 'l', $olditem->{'holdingbranch'}, $item->{'holdingbranch'}); + changeSubfield($Record_ID, '876', 'l', $olditem->{'holdingbranch'}, $item->{'holdingbranch'}); + } } From tonnesen at users.sourceforge.net Thu Sep 27 12:25:03 2001 From: tonnesen at users.sourceforge.net (Steve Tonnesen) Date: Thu Sep 27 12:25:03 2001 Subject: [Koha-devel] CVS: koha/marc koha2marc,1.2,1.3 Message-ID: Update of /cvsroot/koha/koha/marc In directory usw-pr-cvs1:/tmp/cvs-serv31420/koha/marc Modified Files: koha2marc Log Message: Started on updateItem subroutine. Index: koha2marc =================================================================== RCS file: /cvsroot/koha/koha/marc/koha2marc,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** koha2marc 2001/06/25 19:07:20 1.2 --- koha2marc 2001/09/27 19:24:18 1.3 *************** *** 7,11 **** # MySQL tables!!! It is only in here during development!!!! ! system("mysql Koha -ptestpass < deletemarc"); use C4::Database; --- 7,11 ---- # MySQL tables!!! It is only in here during development!!!! ! system("mysql Koha -pkohapass < deletemarc"); use C4::Database; *************** *** 26,29 **** --- 26,30 ---- $sth->execute; my $env; + $env->{'marconly'}=1; while (my $biblioitem=$sth->fetchrow_hashref) { From tonnesen at users.sourceforge.net Thu Sep 27 13:41:01 2001 From: tonnesen at users.sourceforge.net (Steve Tonnesen) Date: Thu Sep 27 13:41:01 2001 Subject: [Koha-devel] CVS: koha/C4 Catalogue.pm,1.7,1.8 Message-ID: Update of /cvsroot/koha/koha/C4 In directory usw-pr-cvs1:/tmp/cvs-serv22278/koha/C4 Modified Files: Catalogue.pm Log Message: Tested updateItem subroutine, made some better checks for Subfield_IDs and Subfield_Keys when modifying MARC data based on changes to Koha data. Index: Catalogue.pm =================================================================== RCS file: /cvsroot/koha/koha/C4/Catalogue.pm,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -r1.7 -r1.8 *** Catalogue.pm 2001/09/27 19:24:18 1.7 --- Catalogue.pm 2001/09/27 20:39:59 1.8 *************** *** 109,114 **** # Subfield_Mark, and Subfield_OldValue, only the first one will be modified. # ! # Might be nice to be able to pass a Subfield_ID directly to this routine to ! # remove ambiguity, if possible. # # Pass barcode to remove ambiguity for changes to individual items. Look up --- 109,114 ---- # Subfield_Mark, and Subfield_OldValue, only the first one will be modified. # ! # Might be nice to be able to pass a Subfield_ID or Subfield_Key directly to ! # this routine to remove ambiguity, if possible. # # Pass barcode to remove ambiguity for changes to individual items. Look up *************** *** 121,139 **** my $Subfield_OldValue=shift; my $Subfield_Value=shift; ! my $barcode=shift; ! my $Subfield_ID; my $dbh=&C4Connect; ! my $sth=$dbh->prepare("select S.Subfield_ID, S.Subfield_Value from Bib_Table B, $firstdigit\XX_Tag_Table T, $firstdigit\XX_Subfield_Table S where B.Record_ID=$Record_ID and B.Tag_$firstdigit\XX_ID=T.Tag_ID and T.Subfield_ID=S.Subfield_ID and S.Subfield_Mark='$Subfield_Mark'"); ! $sth->execute; ! while (my ($ID, $Value) = $sth->fetchrow) { ! if ($Value eq $Subfield_OldValue) { ! my $q_Subfield_Value=$dbh->quote($Subfield_Value); ! my $sti=$dbh->prepare("update $firstdigit\XX_Subfield_Table set Subfield_Value=$q_Subfield_Value where Subfield_ID=$ID"); ! $sti->execute; ! $Subfield_ID=$ID; ! last; } } ! return($Subfield_ID); } --- 121,159 ---- my $Subfield_OldValue=shift; my $Subfield_Value=shift; ! my $Subfield_ID=shift; ! my $Subfield_Key=shift; my $dbh=&C4Connect; ! my $q_Subfield_Value=$dbh->quote($Subfield_Value); ! if ($Subfield_Key) { ! # Great. Subfield_Key makes the record absolutely unique. Just make ! # the change ! my $sth=$dbh->prepare("update $firstdigit\XX_Subfield_Table set Subfield_Value=$q_Subfield_Value where Subfield_Key=$Subfield_Key"); ! $sth->execute; ! } elsif ($Subfield_ID) { ! # Subfield_ID does not make the record unique. Could be multiple ! # records with the same mark. This is a bad situatoin. ! my $sth=$dbh->prepare("select Subfield_Key, Subfield_Value from $firstdigit\XX_Subfield_Table where Subfield_Mark='$Subfield_Mark' and Subfield_ID=$Subfield_ID"); ! $sth->execute; ! while (my ($key, $Value) = $sth->fetchrow) { ! if ($Value eq $Subfield_OldValue) { ! my $sti=$dbh->prepare("update $firstdigit\XX_Subfield_Table set Subfield_Value=$q_Subfield_Value where Subfield_Key=$key"); ! $sti->execute; ! $Subfield_Key=$key; ! last; ! } } + } else { + my $sth=$dbh->prepare("select S.Subfield_Key, S.Subfield_ID, S.Subfield_Value from Bib_Table B, $firstdigit\XX_Tag_Table T, $firstdigit\XX_Subfield_Table S where B.Record_ID=$Record_ID and B.Tag_$firstdigit\XX_ID=T.Tag_ID and T.Subfield_ID=S.Subfield_ID and S.Subfield_Mark='$Subfield_Mark'"); + $sth->execute; + while (my ($key, $ID, $Value) = $sth->fetchrow) { + if ($Value eq $Subfield_OldValue) { + my $sti=$dbh->prepare("update $firstdigit\XX_Subfield_Table set Subfield_Value=$q_Subfield_Value where Subfield_Key=$key"); + $sti->execute; + $Subfield_Key=$key; + last; + } + } } ! return($Subfield_ID, $Subfield_Key); } *************** *** 235,242 **** # Subroutine to log changes to databases my $database=shift; ! my $section=shift; ! my $item=shift; ! my $original=shift; ! my $new=shift; } --- 255,272 ---- # Subroutine to log changes to databases my $database=shift; ! if ($database eq 'kohadb') { ! my $section=shift; ! my $item=shift; ! my $original=shift; ! my $new=shift; ! print "KOHA: $section $item $original $new\n"; ! } elsif ($database eq 'marc') { ! my $tag=shift; ! my $mark=shift; ! my $subfield_ID=shift; ! my $original=shift; ! my $new=shift; ! print "MARC: $tag $mark $subfield_ID $original $new\n"; ! } } *************** *** 807,819 **** my $olditem=$sth->fetchrow_hashref; my $q_barcode=$dbh->quote($olditem->{'barcode'}); ! $sth=$dbh->prepare("select Subfield_ID from 8XX_Subfield_Table where Subfield_Mark='p' and Subfield_Value=$q_barcode"); $sth->execute; ! my ($Subfield852_ID) = $sth->fetchrow; ! $sth=$dbh->prepare("select Subfield_Value from 8XX_Subfield_Table where Subfield_Mark=8 and Subfield_ID=$Subfield852_ID"); $sth->execute; my ($link) = $sth->fetchrow; ! $sth=$dbh->prepare("select Subfield_ID from 8XX_Subfield_Table where Subfield_Mark=8 and Subfield_Value=$link"); $sth->execute; ! my ($Subfield876_ID) = $sth->fetchrow; if ($item->{'barcode'} ne $olditem->{'barcode'}) { --- 837,849 ---- my $olditem=$sth->fetchrow_hashref; my $q_barcode=$dbh->quote($olditem->{'barcode'}); ! $sth=$dbh->prepare("select S.Subfield_ID, B.Record_ID from 8XX_Subfield_Table S, 8XX_Tag_Table T, Bib_Table B where B.Tag_8XX_ID=T.Tag_ID and T.Subfield_ID=S.Subfield_ID and Subfield_Mark='p' and Subfield_Value=$q_barcode"); $sth->execute; ! my ($Subfield876_ID, $Record_ID) = $sth->fetchrow; ! $sth=$dbh->prepare("select Subfield_Value from 8XX_Subfield_Table where Subfield_Mark=8 and Subfield_ID=$Subfield876_ID"); $sth->execute; my ($link) = $sth->fetchrow; ! $sth=$dbh->prepare("select Subfield_ID from 8XX_Subfield_Table where Subfield_Mark=8 and Subfield_Value=$link and !(Subfield_ID=$Subfield876_ID)"); $sth->execute; ! my ($Subfield852_ID) = $sth->fetchrow; if ($item->{'barcode'} ne $olditem->{'barcode'}) { *************** *** 821,826 **** my $q_barcode=$dbh->quote($item->{'barcode'}); my $sth=$dbh->prepare("update items set barcode=$q_barcode where itemnumber=$itemnumber"); ! logchange('marc', '876', 'p', $olditem->{'barcode'}, $item->{'barcode'}); ! ($Subfield_ID) = changeSubfield($Record_ID, '876', 'p', $olditem->{'barcode'}, $item->{'barcode'}); } if ($item->{'booksellerid'} ne $olditem->{'booksellerid'}) { --- 851,857 ---- my $q_barcode=$dbh->quote($item->{'barcode'}); my $sth=$dbh->prepare("update items set barcode=$q_barcode where itemnumber=$itemnumber"); ! $sth->execute; ! my ($Subfield_ID, $Subfield_Key) = changeSubfield($Record_ID, '876', 'p', $olditem->{'barcode'}, $item->{'barcode'}, $Subfield876_ID); ! logchange('marc', '876', 'p', $Subfield_Key, $olditem->{'barcode'}, $item->{'barcode'}); } if ($item->{'booksellerid'} ne $olditem->{'booksellerid'}) { *************** *** 828,833 **** my $q_booksellerid=$dbh->quote($item->{'booksellerid'}); my $sth=$dbh->prepare("update items set booksellerid=$q_booksellerid where itemnumber=$itemnumber"); ! logchange('marc', '876', 'e', $olditem->{'booksellerid'}, $item->{'booksellerid'}); ! changeSubfield($Record_ID, '876', 'e', $olditem->{'booksellerid'}, $item->{'booksellerid'}); } if ($item->{'dateaccessioned'} ne $olditem->{'dateaccessioned'}) { --- 859,865 ---- my $q_booksellerid=$dbh->quote($item->{'booksellerid'}); my $sth=$dbh->prepare("update items set booksellerid=$q_booksellerid where itemnumber=$itemnumber"); ! $sth->execute; ! my ($Subfield_ID, $Subfield_Key) = changeSubfield($Record_ID, '876', 'e', $olditem->{'booksellerid'}, $item->{'booksellerid'}, $Subfield876_ID); ! logchange('marc', '876', 'e', $Subfield_Key, $olditem->{'booksellerid'}, $item->{'booksellerid'}); } if ($item->{'dateaccessioned'} ne $olditem->{'dateaccessioned'}) { *************** *** 835,850 **** my $q_dateaccessioned=$dbh->quote($item->{'dateaccessioned'}); my $sth=$dbh->prepare("update items set dateaccessioned=$q_dateaccessioned where itemnumber=$itemnumber"); ! logchange('marc', '876', 'd', $olditem->{'dateaccessioned'}, $item->{'dateaccessioned'}); ! changeSubfield($Record_ID, '876', 'd', $olditem->{'dateaccessioned'}, $item->{'dateaccessioned'}); } if ($item->{'homebranch'} ne $olditem->{'homebranch'}) { - # FIX ME!!!! This really needs to check the field link and sequence - # number entry to make sure the right item is being modified! - # Use 876 p (piece designation) to ensure. logchange('kohadb', 'items', 'homebranch', $olditem->{'homebranch'}, $item->{'homebranch'}); my $q_homebranch=$dbh->quote($item->{'homebranch'}); my $sth=$dbh->prepare("update items set homebranch=$q_homebranch where itemnumber=$itemnumber"); ! logchange('marc', '876', 'b', $olditem->{'homebranch'}, $item->{'homebranch'}); ! changeSubfield($Record_ID, '876', 'b', $olditem->{'homebranch'}, $item->{'homebranch'}); } if ($item->{'holdingbranch'} ne $olditem->{'holdingbranch'}) { --- 867,881 ---- my $q_dateaccessioned=$dbh->quote($item->{'dateaccessioned'}); my $sth=$dbh->prepare("update items set dateaccessioned=$q_dateaccessioned where itemnumber=$itemnumber"); ! $sth->execute; ! my ($Subfield_ID, $Subfield_Key) = changeSubfield($Record_ID, '876', 'd', $olditem->{'dateaccessioned'}, $item->{'dateaccessioned'}, $Subfield876_ID); ! logchange('marc', '876', 'd', $Subfield_Key, $olditem->{'dateaccessioned'}, $item->{'dateaccessioned'}); } if ($item->{'homebranch'} ne $olditem->{'homebranch'}) { logchange('kohadb', 'items', 'homebranch', $olditem->{'homebranch'}, $item->{'homebranch'}); my $q_homebranch=$dbh->quote($item->{'homebranch'}); my $sth=$dbh->prepare("update items set homebranch=$q_homebranch where itemnumber=$itemnumber"); ! $sth->execute; ! my ($Subfield_ID, $Subfield_Key) = changeSubfield($Record_ID, '876', 'b', $olditem->{'homebranch'}, $item->{'homebranch'}, $Subfield876_ID); ! logchange('marc', '876', 'b', $Subfield_Key, $olditem->{'homebranch'}, $item->{'homebranch'}); } if ($item->{'holdingbranch'} ne $olditem->{'holdingbranch'}) { *************** *** 852,857 **** my $q_holdingbranch=$dbh->quote($item->{'holdingbranch'}); my $sth=$dbh->prepare("update items set holdingbranch=$q_holdingbranch where itemnumber=$itemnumber"); ! logchange('marc', '876', 'l', $olditem->{'holdingbranch'}, $item->{'holdingbranch'}); ! changeSubfield($Record_ID, '876', 'l', $olditem->{'holdingbranch'}, $item->{'holdingbranch'}); } } --- 883,889 ---- my $q_holdingbranch=$dbh->quote($item->{'holdingbranch'}); my $sth=$dbh->prepare("update items set holdingbranch=$q_holdingbranch where itemnumber=$itemnumber"); ! $sth->execute; ! my ($Subfield_ID, $Subfield_Key) = changeSubfield($Record_ID, '876', 'l', $olditem->{'holdingbranch'}, $item->{'holdingbranch'}, $Subfield876_ID); ! logchange('marc', '876', 'l', $Subfield_Key, $olditem->{'holdingbranch'}, $item->{'holdingbranch'}); } } From rangi at users.sourceforge.net Mon Sep 10 16:38:02 2001 From: rangi at users.sourceforge.net (Chris Cormack) Date: Mon Sep 10 16:38:02 2001 Subject: [Koha-devel] CVS: koha moredetail.pl,1.2,1.3 modbibitem.pl,1.1.1.1,1.2 Message-ID: Update of /cvsroot/koha/koha In directory usw-pr-cvs1:/tmp/cvs-serv3802 Modified Files: moredetail.pl modbibitem.pl Log Message: Fixing a glitch that was showing the biblio notes field where the biblioitems notes should have been displaying Index: moredetail.pl =================================================================== RCS file: /cvsroot/koha/koha/moredetail.pl,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** moredetail.pl 2001/03/15 10:17:33 1.2 --- moredetail.pl 2001/09/10 23:37:09 1.3 *************** *** 35,39 **** my (@items)=itemissues($bi); ! my ($order)=getorder($bi,$bib); #print @items; my $count=@items; --- 35,39 ---- my (@items)=itemissues($bi); ! my ($order,$ordernum)=getorder($bi,$bib); #print @items; my $count=@items; *************** *** 89,94 **** Illus: $data->{'illus'}
Size: $data->{'size'}
! Notes: $data->{'notes'}
No. of Items: $count printend ; --- 89,95 ---- Illus: $data->{'illus'}
Size: $data->{'size'}
! Notes: $data->{'bnotes'}
No. of Items: $count + printend ; *************** *** 98,101 **** --- 99,103 ---- } print < *************** *** 118,121 **** --- 120,124 ---- {'itemnumber'}> + *************** *** 154,161 **** Replacement Price: $items[$i]->{'replacementprice'}
Item lost: $items[$i]->{'itemlost'}
! paid by:
Notes: $items[$i]->{'itemnotes'}
Renewals: $items[$i]->{'renewals'}
! {'ordernumber'}&biblio=$bib&invoice=$order->{'booksellerinvoicenumber'}&catview=yes>Accession Date: $items[$i]->{'dateaccessioned'}
printend ; --- 157,164 ---- Replacement Price: $items[$i]->{'replacementprice'}
Item lost: $items[$i]->{'itemlost'}
! Paid for: $items[$i]->{'paidfor'}
Notes: $items[$i]->{'itemnotes'}
Renewals: $items[$i]->{'renewals'}
! {'booksellerinvoicenumber'}&catview=yes>Accession Date: $items[$i]->{'dateaccessioned'}
printend ; Index: modbibitem.pl =================================================================== RCS file: /cvsroot/koha/koha/modbibitem.pl,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -r1.1.1.1 -r1.2 *** modbibitem.pl 2000/12/19 23:45:52 1.1.1.1 --- modbibitem.pl 2001/09/10 23:37:09 1.2 *************** *** 113,117 **** Notes ! Size --- 113,117 ---- Notes ! Size From rangi at users.sourceforge.net Mon Sep 10 16:38:02 2001 From: rangi at users.sourceforge.net (Chris Cormack) Date: Mon Sep 10 16:38:02 2001 Subject: [Koha-devel] CVS: koha/C4 Search.pm,1.3,1.4 Message-ID: Update of /cvsroot/koha/koha/C4 In directory usw-pr-cvs1:/tmp/cvs-serv3802/C4 Modified Files: Search.pm Log Message: Fixing a glitch that was showing the biblio notes field where the biblioitems notes should have been displaying Index: Search.pm =================================================================== RCS file: /cvsroot/koha/koha/C4/Search.pm,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** Search.pm 2001/06/20 03:36:01 1.3 --- Search.pm 2001/09/10 23:37:09 1.4 *************** *** 20,24 **** &OpacSearch &borrdata2 &NewBorrowerNumber &bibitemdata &borrissues &getboracctrecord &ItemType &itemissues &FrontSearch &subject &subtitle ! &addauthor &bibitems &barcodes &findguarantees &allissues &systemprefs); %EXPORT_TAGS = ( ); # eg: TAG => [ qw!name1 name2! ], --- 20,25 ---- &OpacSearch &borrdata2 &NewBorrowerNumber &bibitemdata &borrissues &getboracctrecord &ItemType &itemissues &FrontSearch &subject &subtitle ! &addauthor &bibitems &barcodes &findguarantees &allissues &systemprefs ! &findguarantor); %EXPORT_TAGS = ( ); # eg: TAG => [ qw!name1 name2! ], *************** *** 73,76 **** --- 74,95 ---- } + sub findguarantor{ + my ($bornum)=@_; + my $dbh=C4Connect; + my $query="select guarantor from borrowers where + borrowernumber='$bornum'"; + my $sth=$dbh->prepare($query); + $sth->execute; + my $data=$sth->fetchrow_hashref; + $sth->finish; + $query="Select * from borrowers where borrowernumber='$data->{'guarantor'}'"; + $sth=$dbh->prepare($query); + $sth->execute; + $data=$sth->fetchrow_hashref; + $sth->finish; + $dbh->disconnect; + return($data); + } + sub NewBorrowerNumber { my $dbh=C4Connect; *************** *** 215,221 **** my $i=1; my @results; ! my $query ="Select * from biblio,bibliosubtitle,biblioitems where ! biblio.biblionumber=bibliosubtitle.biblionumber and ! biblioitems.biblionumber=biblio.biblionumber and (((title like '$key[0]%' or title like '% $key[0]%')"; while ($i < $count){ --- 234,243 ---- my $i=1; my @results; ! my $query ="Select * from biblio ! left join bibliosubtitle on ! bibliosubtitle.biblionumber=biblio.biblionumber ! left join biblioitems on ! biblioitems.biblionumber=biblio.biblionumber ! where (((title like '$key[0]%' or title like '% $key[0]%')"; while ($i < $count){ *************** *** 345,353 **** my $i=1; $query="select *,biblio.author,biblio.biblionumber from ! biblioitems,biblio left join additionalauthors on additionalauthors.biblionumber =biblio.biblionumber ! where biblioitems.biblionumber=biblio.biblionumber ! and ((biblio.author like '$key[0]%' or biblio.author like '% $key[0]%' or additionalauthors.author like '$key[0]%' or additionalauthors.author --- 367,375 ---- my $i=1; $query="select *,biblio.author,biblio.biblionumber from ! biblio left join additionalauthors on additionalauthors.biblionumber =biblio.biblionumber ! left join biblioitems on biblioitems.biblionumber=biblio.biblionumber ! where ((biblio.author like '$key[0]%' or biblio.author like '% $key[0]%' or additionalauthors.author like '$key[0]%' or additionalauthors.author *************** *** 397,404 **** my $count=@key; my $i=1; ! $query="select * from biblio,bibliosubtitle,biblioitems where - (biblio.biblionumber=bibliosubtitle.biblionumber and - biblioitems.biblionumber=biblio.biblionumber) and (((title like '$key[0]%' or title like '% $key[0]%' or title like '% $key[0]')"; while ($i<$count){ --- 419,427 ---- my $count=@key; my $i=1; ! $query="select * from biblio ! left join bibliosubtitle on ! bibliosubtitle.biblionumber=biblio.biblionumber ! left join biblioitems on biblioitems.biblionumber=biblio.biblionumber where (((title like '$key[0]%' or title like '% $key[0]%' or title like '% $key[0]')"; while ($i<$count){ *************** *** 714,718 **** my ($bibitem)=@_; my $dbh=C4Connect; ! my $query="Select * from biblio,biblioitems,itemtypes where biblio.biblionumber= biblioitems.biblionumber and biblioitemnumber=$bibitem and biblioitems.itemtype=itemtypes.itemtype"; --- 737,742 ---- 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"; *************** *** 1043,1048 **** biblionumber=$bibnum "; if ($type eq 'opac'){ ! $query.=" and (itemlost <>1 or itemlost is NULL) and ! (wthdrawn <> 1 or wthdrawn is NULL)"; } my $sth=$dbh->prepare($query); --- 1067,1072 ---- biblionumber=$bibnum "; if ($type eq 'opac'){ ! $query.=" and (itemlost =0 or itemlost is NULL) and ! (wthdrawn = 0 or wthdrawn is NULL)"; } my $sth=$dbh->prepare($query); *************** *** 1078,1082 **** $scount++; } ! if ($data->{'itemlost'} eq '1'){ $lostcount++; } --- 1102,1106 ---- $scount++; } ! if ($data->{'itemlost'} eq '1' || $data->{'itemlost'} eq '2'){ $lostcount++; } From rangi at users.sourceforge.net Mon Sep 10 19:04:02 2001 From: rangi at users.sourceforge.net (Chris Cormack) Date: Mon Sep 10 19:04:02 2001 Subject: [Koha-devel] CVS: koha deletemem.pl,1.1,1.2 Message-ID: Update of /cvsroot/koha/koha In directory usw-pr-cvs1:/tmp/cvs-serv27882 Modified Files: deletemem.pl Log Message: Fixing member deletion, so that it checks fines, issues and guarantees before deleting Index: deletemem.pl =================================================================== RCS file: /cvsroot/koha/koha/deletemem.pl,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** deletemem.pl 2001/07/05 21:37:59 1.1 --- deletemem.pl 2001/09/11 02:03:26 1.2 *************** *** 19,35 **** my %env; $env{'nottodayissues'}=1; ! my %member2; ! $member2{'borrowernumber'}=$member; ! my $issues=currentissues(\%env,\%member2); ! my $i=0; ! foreach (sort keys %$issues) { $i++; ! } ! if ($i > 0){ print $input->header; ! print "error borrower has items on issue"; } else { ! delmember($member); ! print $input->redirect("/members/"); } --- 19,56 ---- my %env; $env{'nottodayissues'}=1; ! my %member2; ! $member2{'borrowernumber'}=$member; ! my $issues=currentissues(\%env,\%member2); ! my $i=0; ! foreach (sort keys %$issues) { $i++; ! } ! my ($bor,$flags)=getpatroninformation(\%env, $member,''); ! my $dbh=C4Connect; ! my $query="Select * from borrowers where guarantor='$member'"; ! my $sth=$dbh->prepare($query); ! $sth->execute; ! my $data=$sth->fetchrow_hashref; ! $sth->finish; ! $dbh->disconnect; ! ! ! if ($i > 0 || $flags->{'CHARGES'} ne '' || $data ne ''){ print $input->header; ! print ""; ! if ($i > 0){ ! print ""; ! } ! if ($flags->{'CHARGES'} ne ''){ ! print ""; ! } ! if ($data ne ''){ ! print ""; ! } ! print "
Items on Issue$i
Charges$flags->{'CHARGES'}->{'message'}
Guarantees
"; ! } else { ! delmember($member); ! print $input->redirect("/members/"); } *************** *** 52,55 **** --- 73,80 ---- $sth->finish; $query = "Delete from borrowers where borrowernumber='$member'"; + $sth=$dbh->prepare($query); + $sth->execute; + $sth->finish; + $query="Delete from reserves where borrowernumber='$member'"; $sth=$dbh->prepare($query); $sth->execute; From nsr4n at tetra.mail.virginia.edu Fri Sep 21 21:16:01 2001 From: nsr4n at tetra.mail.virginia.edu (Nicholas Stephen Rosasco) Date: Fri Sep 21 21:16:01 2001 Subject: [Koha-devel] MARC, etc Message-ID: I know a LOT of work has happened since I suggested MARC support in Koha, but since the list has suddenly gone silent, I was wondering what the status was... particularly as I've got someone asking for an install of it soon, and they are specifically requesting info about OpenBook (still in beta I think) rather than Koha. I have no issue with the OpenBook app or development, but I'm of the opinion that Koha is a more mature product. Also, since my last email, I've had a chance to acquire at least some Perl skill and feel fairly confident that I could at least handle non-essential bits n' bobs, etc if need be (perhaps not quick turnaround for a little while -- the work backlog I've got is depressing indeed). NSR From tonnesen at users.sourceforge.net Thu Sep 27 12:25:03 2001 From: tonnesen at users.sourceforge.net (Steve Tonnesen) Date: Thu Sep 27 12:25:03 2001 Subject: [Koha-devel] CVS: koha/C4 Catalogue.pm,1.6,1.7 Message-ID: Update of /cvsroot/koha/koha/C4 In directory usw-pr-cvs1:/tmp/cvs-serv31420/koha/C4 Modified Files: Catalogue.pm Log Message: Started on updateItem subroutine. Index: Catalogue.pm =================================================================== RCS file: /cvsroot/koha/koha/C4/Catalogue.pm,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -r1.6 -r1.7 *** Catalogue.pm 2001/06/26 22:27:12 1.6 --- Catalogue.pm 2001/09/27 19:24:18 1.7 *************** *** 1,4 **** --- 1,8 ---- package C4::Catalogue; #asummes C4/Acquisitions.pm + # Continue working on updateItem!!!!!! + # + + use strict; require Exporter; *************** *** 55,58 **** --- 59,63 ---- # only created when new biblioitems are added. my ($env, $biblio) = @_; + my $dbh=&C4Connect; my $title=$biblio->{'title'}; my $q_title=$dbh->quote($title); *************** *** 106,109 **** --- 111,117 ---- # Might be nice to be able to pass a Subfield_ID directly to this routine to # remove ambiguity, if possible. + # + # Pass barcode to remove ambiguity for changes to individual items. Look up + # field link and sequence number based on barcode. my $Record_ID=shift; *************** *** 113,116 **** --- 121,126 ---- my $Subfield_OldValue=shift; my $Subfield_Value=shift; + my $barcode=shift; + my $Subfield_ID; my $dbh=&C4Connect; my $sth=$dbh->prepare("select S.Subfield_ID, S.Subfield_Value from Bib_Table B, $firstdigit\XX_Tag_Table T, $firstdigit\XX_Subfield_Table S where B.Record_ID=$Record_ID and B.Tag_$firstdigit\XX_ID=T.Tag_ID and T.Subfield_ID=S.Subfield_ID and S.Subfield_Mark='$Subfield_Mark'"); *************** *** 121,127 **** --- 131,139 ---- my $sti=$dbh->prepare("update $firstdigit\XX_Subfield_Table set Subfield_Value=$q_Subfield_Value where Subfield_ID=$ID"); $sti->execute; + $Subfield_ID=$ID; last; } } + return($Subfield_ID); } *************** *** 329,333 **** my ($biblioitemnumber) =$sth->fetchrow; $biblioitemnumber++; ! $sth=$dbh->prepare("insert into biblioitems (biblionumber,biblioitemnumber,volume,number,classification,itemtype,isbn,issn,dewey,subclass,publicationyear,publishercode,volumedate,illus,pages,notes,size,place,lccn) values ($biblionumber, $biblioitemnumber, $q_volume, $q_number, $q_classification, $q_itemtype, $q_isbn, $q_issn, $dewey, $q_subclass, $q_publicationyear, $q_publishercode, $q_volumedate, $q_illus, $q_pages,$q_notes, $q_size, $q_place, $q_lccn)"); $sth->execute; #my $sth=$dbh->prepare("unlock tables"); --- 341,345 ---- my ($biblioitemnumber) =$sth->fetchrow; $biblioitemnumber++; ! $sth=$dbh->prepare("insert into biblioitems (biblionumber,biblioitemnumber,volume,number,classification,itemtype,isbn,issn,dewey,subclass,publicationyear,publishercode,volumedate,illus,pages,notes,size,place,lccn) values ($biblionumber, $biblioitemnumber, $q_volume, $q_number, $q_classification, $q_itemtype, $q_isbn, $q_issn, $dewey, $q_subclass, $publicationyear, $q_publishercode, $q_volumedate, $q_illus, $q_pages,$q_notes, $q_size, $q_place, $q_lccn)"); $sth->execute; #my $sth=$dbh->prepare("unlock tables"); *************** *** 339,343 **** # same isbn/lccn/issn? ! $sth=$dbh->prepare("select title,unititle,seriestitle,copyrightdate,notes,author from biblio where biblionumber=$biblionumber"); $sth->execute; my ($title, $unititle,$seriestitle,$copyrightdate,$biblionotes,$author) = $sth->fetchrow; --- 351,355 ---- # same isbn/lccn/issn? ! my $sth=$dbh->prepare("select title,unititle,seriestitle,copyrightdate,notes,author from biblio where biblionumber=$biblionumber"); $sth->execute; my ($title, $unititle,$seriestitle,$copyrightdate,$biblionotes,$author) = $sth->fetchrow; *************** *** 403,407 **** $subfields->{2}->{'Subfield_Mark'}='3'; $subfields->{2}->{'Subfield_Value'}='biblio'; ! my $tag='440'; addTag($env, $Record_ID, $tag, ' ', ' ', $subfields); } --- 415,419 ---- $subfields->{2}->{'Subfield_Mark'}='3'; $subfields->{2}->{'Subfield_Value'}='biblio'; ! my $tag='500'; addTag($env, $Record_ID, $tag, ' ', ' ', $subfields); } *************** *** 540,544 **** sub updateBiblioItem { # Update the biblioitem with biblioitemnumber $biblioitem->{'biblioitemnumber'} - # This routine should also modify the corresponding MARC record data. # # This routine should also check to see which fields are actually being --- 552,555 ---- *************** *** 598,602 **** if ($biblioitem->{'dewey'} ne $obi->{'dewey'}) { logchange('kohadb', 'biblioitems', 'dewey', $obi->{'dewey'}, $biblioitem->{'dewey'}); ! my $sth=$dbh->prepare("update biblioitems set dewey=$dewey where biblioitemnumber=$biblioitemnumber"); logchange('marc', '082', 'a', $obi->{'dewey'}, $biblioitem->{'dewey'}); changeSubfield($Record_ID, '082', 'a', $obi->{'dewey'}, $biblioitem->{'dewey'}); --- 609,613 ---- if ($biblioitem->{'dewey'} ne $obi->{'dewey'}) { logchange('kohadb', 'biblioitems', 'dewey', $obi->{'dewey'}, $biblioitem->{'dewey'}); ! my $sth=$dbh->prepare("update biblioitems set dewey=$biblioitem->{'dewey'} where biblioitemnumber=$biblioitemnumber"); logchange('marc', '082', 'a', $obi->{'dewey'}, $biblioitem->{'dewey'}); changeSubfield($Record_ID, '082', 'a', $obi->{'dewey'}, $biblioitem->{'dewey'}); *************** *** 673,683 **** --- 684,700 ---- my $dbh=&C4Connect; my $barcode=$item->{'barcode'}; + my $q_barcode=$dbh->quote($barcode); + my $biblionumber=$item->{'biblionumber'}; + my $biblioitemnumber=$item->{'biblioitemnumber'}; my $dateaccessioned=$item->{'dateaccessioned'}; my $booksellerid=$item->{'booksellerid'}; + my $q_booksellerid=$dbh->quote($booksellerid); my $homebranch=$item->{'homebranch'}; + my $q_homebranch=$dbh->quote($homebranch); my $holdingbranch=$item->{'holdingbranch'}; my $price=$item->{'price'}; my $replacementprice=$item->{'replacementprice'}; my $replacementpricedate=$item->{'replacementpricedate'}; + my $q_replacementpricedate=$dbh->quote($replacementpricedate); my $notforloan=$item->{'notforloan'}; my $itemlost=$item->{'itemlost'}; *************** *** 685,688 **** --- 702,706 ---- my $restricted=$item->{'restricted'}; my $itemnotes=$item->{'itemnotes'}; + my $q_itemnotes=$dbh->quote($itemnotes); my $itemtype=$item->{'itemtype'}; my $subclass=$item->{'subclass'}; *************** *** 763,766 **** --- 781,858 ---- my ($env, $item) = @_; + my $dbh=&C4Connect; + my $itemnumber=$item->{'itemnumber'}; + my $biblionumber=$item->{'biblionumber'}; + my $biblioitemnumber=$item->{'biblioitemnumber'}; + my $barcode=$item->{'barcode'}; + my $dateaccessioned=$item->{'dateaccessioned'}; + my $booksellerid=$item->{'booksellerid'}; + my $homebranch=$item->{'homebranch'}; + my $price=$item->{'price'}; + my $replacementprice=$item->{'replacementprice'}; + my $replacementpricedate=$item->{'replacementpricedate'}; + my $multivolume=$item->{'multivolume'}; + my $stack=$item->{'stack'}; + my $notforloan=$item->{'notforloan'}; + my $itemlost=$item->{'itemlost'}; + my $wthdrawn=$item->{'wthdrawn'}; + my $bulk=$item->{'bulk'}; + my $restricted=$item->{'restricted'}; + my $binding=$item->{'binding'}; + my $itemnotes=$item->{'itemnotes'}; + my $holdingbranch=$item->{'holdingbranch'}; + my $interim=$item->{'interim'}; + my $sth=$dbh->prepare("select * from items where itemnumber=$itemnumber"); + $sth->execute; + my $olditem=$sth->fetchrow_hashref; + my $q_barcode=$dbh->quote($olditem->{'barcode'}); + $sth=$dbh->prepare("select Subfield_ID from 8XX_Subfield_Table where Subfield_Mark='p' and Subfield_Value=$q_barcode"); + $sth->execute; + my ($Subfield852_ID) = $sth->fetchrow; + $sth=$dbh->prepare("select Subfield_Value from 8XX_Subfield_Table where Subfield_Mark=8 and Subfield_ID=$Subfield852_ID"); + $sth->execute; + my ($link) = $sth->fetchrow; + $sth=$dbh->prepare("select Subfield_ID from 8XX_Subfield_Table where Subfield_Mark=8 and Subfield_Value=$link"); + $sth->execute; + my ($Subfield876_ID) = $sth->fetchrow; + + if ($item->{'barcode'} ne $olditem->{'barcode'}) { + logchange('kohadb', 'items', 'barcode', $olditem->{'barcode'}, $item->{'barcode'}); + my $q_barcode=$dbh->quote($item->{'barcode'}); + my $sth=$dbh->prepare("update items set barcode=$q_barcode where itemnumber=$itemnumber"); + logchange('marc', '876', 'p', $olditem->{'barcode'}, $item->{'barcode'}); + ($Subfield_ID) = changeSubfield($Record_ID, '876', 'p', $olditem->{'barcode'}, $item->{'barcode'}); + } + if ($item->{'booksellerid'} ne $olditem->{'booksellerid'}) { + logchange('kohadb', 'items', 'booksellerid', $olditem->{'booksellerid'}, $item->{'booksellerid'}); + my $q_booksellerid=$dbh->quote($item->{'booksellerid'}); + my $sth=$dbh->prepare("update items set booksellerid=$q_booksellerid where itemnumber=$itemnumber"); + logchange('marc', '876', 'e', $olditem->{'booksellerid'}, $item->{'booksellerid'}); + changeSubfield($Record_ID, '876', 'e', $olditem->{'booksellerid'}, $item->{'booksellerid'}); + } + if ($item->{'dateaccessioned'} ne $olditem->{'dateaccessioned'}) { + logchange('kohadb', 'items', 'dateaccessioned', $olditem->{'dateaccessioned'}, $item->{'dateaccessioned'}); + my $q_dateaccessioned=$dbh->quote($item->{'dateaccessioned'}); + my $sth=$dbh->prepare("update items set dateaccessioned=$q_dateaccessioned where itemnumber=$itemnumber"); + logchange('marc', '876', 'd', $olditem->{'dateaccessioned'}, $item->{'dateaccessioned'}); + changeSubfield($Record_ID, '876', 'd', $olditem->{'dateaccessioned'}, $item->{'dateaccessioned'}); + } + if ($item->{'homebranch'} ne $olditem->{'homebranch'}) { + # FIX ME!!!! This really needs to check the field link and sequence + # number entry to make sure the right item is being modified! + # Use 876 p (piece designation) to ensure. + logchange('kohadb', 'items', 'homebranch', $olditem->{'homebranch'}, $item->{'homebranch'}); + my $q_homebranch=$dbh->quote($item->{'homebranch'}); + my $sth=$dbh->prepare("update items set homebranch=$q_homebranch where itemnumber=$itemnumber"); + logchange('marc', '876', 'b', $olditem->{'homebranch'}, $item->{'homebranch'}); + changeSubfield($Record_ID, '876', 'b', $olditem->{'homebranch'}, $item->{'homebranch'}); + } + if ($item->{'holdingbranch'} ne $olditem->{'holdingbranch'}) { + logchange('kohadb', 'items', 'holdingbranch', $olditem->{'holdingbranch'}, $item->{'holdingbranch'}); + my $q_holdingbranch=$dbh->quote($item->{'holdingbranch'}); + my $sth=$dbh->prepare("update items set holdingbranch=$q_holdingbranch where itemnumber=$itemnumber"); + logchange('marc', '876', 'l', $olditem->{'holdingbranch'}, $item->{'holdingbranch'}); + changeSubfield($Record_ID, '876', 'l', $olditem->{'holdingbranch'}, $item->{'holdingbranch'}); + } } From tonnesen at users.sourceforge.net Thu Sep 27 12:25:03 2001 From: tonnesen at users.sourceforge.net (Steve Tonnesen) Date: Thu Sep 27 12:25:03 2001 Subject: [Koha-devel] CVS: koha/marc koha2marc,1.2,1.3 Message-ID: Update of /cvsroot/koha/koha/marc In directory usw-pr-cvs1:/tmp/cvs-serv31420/koha/marc Modified Files: koha2marc Log Message: Started on updateItem subroutine. Index: koha2marc =================================================================== RCS file: /cvsroot/koha/koha/marc/koha2marc,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** koha2marc 2001/06/25 19:07:20 1.2 --- koha2marc 2001/09/27 19:24:18 1.3 *************** *** 7,11 **** # MySQL tables!!! It is only in here during development!!!! ! system("mysql Koha -ptestpass < deletemarc"); use C4::Database; --- 7,11 ---- # MySQL tables!!! It is only in here during development!!!! ! system("mysql Koha -pkohapass < deletemarc"); use C4::Database; *************** *** 26,29 **** --- 26,30 ---- $sth->execute; my $env; + $env->{'marconly'}=1; while (my $biblioitem=$sth->fetchrow_hashref) { From tonnesen at users.sourceforge.net Thu Sep 27 13:41:01 2001 From: tonnesen at users.sourceforge.net (Steve Tonnesen) Date: Thu Sep 27 13:41:01 2001 Subject: [Koha-devel] CVS: koha/C4 Catalogue.pm,1.7,1.8 Message-ID: Update of /cvsroot/koha/koha/C4 In directory usw-pr-cvs1:/tmp/cvs-serv22278/koha/C4 Modified Files: Catalogue.pm Log Message: Tested updateItem subroutine, made some better checks for Subfield_IDs and Subfield_Keys when modifying MARC data based on changes to Koha data. Index: Catalogue.pm =================================================================== RCS file: /cvsroot/koha/koha/C4/Catalogue.pm,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -r1.7 -r1.8 *** Catalogue.pm 2001/09/27 19:24:18 1.7 --- Catalogue.pm 2001/09/27 20:39:59 1.8 *************** *** 109,114 **** # Subfield_Mark, and Subfield_OldValue, only the first one will be modified. # ! # Might be nice to be able to pass a Subfield_ID directly to this routine to ! # remove ambiguity, if possible. # # Pass barcode to remove ambiguity for changes to individual items. Look up --- 109,114 ---- # Subfield_Mark, and Subfield_OldValue, only the first one will be modified. # ! # Might be nice to be able to pass a Subfield_ID or Subfield_Key directly to ! # this routine to remove ambiguity, if possible. # # Pass barcode to remove ambiguity for changes to individual items. Look up *************** *** 121,139 **** my $Subfield_OldValue=shift; my $Subfield_Value=shift; ! my $barcode=shift; ! my $Subfield_ID; my $dbh=&C4Connect; ! my $sth=$dbh->prepare("select S.Subfield_ID, S.Subfield_Value from Bib_Table B, $firstdigit\XX_Tag_Table T, $firstdigit\XX_Subfield_Table S where B.Record_ID=$Record_ID and B.Tag_$firstdigit\XX_ID=T.Tag_ID and T.Subfield_ID=S.Subfield_ID and S.Subfield_Mark='$Subfield_Mark'"); ! $sth->execute; ! while (my ($ID, $Value) = $sth->fetchrow) { ! if ($Value eq $Subfield_OldValue) { ! my $q_Subfield_Value=$dbh->quote($Subfield_Value); ! my $sti=$dbh->prepare("update $firstdigit\XX_Subfield_Table set Subfield_Value=$q_Subfield_Value where Subfield_ID=$ID"); ! $sti->execute; ! $Subfield_ID=$ID; ! last; } } ! return($Subfield_ID); } --- 121,159 ---- my $Subfield_OldValue=shift; my $Subfield_Value=shift; ! my $Subfield_ID=shift; ! my $Subfield_Key=shift; my $dbh=&C4Connect; ! my $q_Subfield_Value=$dbh->quote($Subfield_Value); ! if ($Subfield_Key) { ! # Great. Subfield_Key makes the record absolutely unique. Just make ! # the change ! my $sth=$dbh->prepare("update $firstdigit\XX_Subfield_Table set Subfield_Value=$q_Subfield_Value where Subfield_Key=$Subfield_Key"); ! $sth->execute; ! } elsif ($Subfield_ID) { ! # Subfield_ID does not make the record unique. Could be multiple ! # records with the same mark. This is a bad situatoin. ! my $sth=$dbh->prepare("select Subfield_Key, Subfield_Value from $firstdigit\XX_Subfield_Table where Subfield_Mark='$Subfield_Mark' and Subfield_ID=$Subfield_ID"); ! $sth->execute; ! while (my ($key, $Value) = $sth->fetchrow) { ! if ($Value eq $Subfield_OldValue) { ! my $sti=$dbh->prepare("update $firstdigit\XX_Subfield_Table set Subfield_Value=$q_Subfield_Value where Subfield_Key=$key"); ! $sti->execute; ! $Subfield_Key=$key; ! last; ! } } + } else { + my $sth=$dbh->prepare("select S.Subfield_Key, S.Subfield_ID, S.Subfield_Value from Bib_Table B, $firstdigit\XX_Tag_Table T, $firstdigit\XX_Subfield_Table S where B.Record_ID=$Record_ID and B.Tag_$firstdigit\XX_ID=T.Tag_ID and T.Subfield_ID=S.Subfield_ID and S.Subfield_Mark='$Subfield_Mark'"); + $sth->execute; + while (my ($key, $ID, $Value) = $sth->fetchrow) { + if ($Value eq $Subfield_OldValue) { + my $sti=$dbh->prepare("update $firstdigit\XX_Subfield_Table set Subfield_Value=$q_Subfield_Value where Subfield_Key=$key"); + $sti->execute; + $Subfield_Key=$key; + last; + } + } } ! return($Subfield_ID, $Subfield_Key); } *************** *** 235,242 **** # Subroutine to log changes to databases my $database=shift; ! my $section=shift; ! my $item=shift; ! my $original=shift; ! my $new=shift; } --- 255,272 ---- # Subroutine to log changes to databases my $database=shift; ! if ($database eq 'kohadb') { ! my $section=shift; ! my $item=shift; ! my $original=shift; ! my $new=shift; ! print "KOHA: $section $item $original $new\n"; ! } elsif ($database eq 'marc') { ! my $tag=shift; ! my $mark=shift; ! my $subfield_ID=shift; ! my $original=shift; ! my $new=shift; ! print "MARC: $tag $mark $subfield_ID $original $new\n"; ! } } *************** *** 807,819 **** my $olditem=$sth->fetchrow_hashref; my $q_barcode=$dbh->quote($olditem->{'barcode'}); ! $sth=$dbh->prepare("select Subfield_ID from 8XX_Subfield_Table where Subfield_Mark='p' and Subfield_Value=$q_barcode"); $sth->execute; ! my ($Subfield852_ID) = $sth->fetchrow; ! $sth=$dbh->prepare("select Subfield_Value from 8XX_Subfield_Table where Subfield_Mark=8 and Subfield_ID=$Subfield852_ID"); $sth->execute; my ($link) = $sth->fetchrow; ! $sth=$dbh->prepare("select Subfield_ID from 8XX_Subfield_Table where Subfield_Mark=8 and Subfield_Value=$link"); $sth->execute; ! my ($Subfield876_ID) = $sth->fetchrow; if ($item->{'barcode'} ne $olditem->{'barcode'}) { --- 837,849 ---- my $olditem=$sth->fetchrow_hashref; my $q_barcode=$dbh->quote($olditem->{'barcode'}); ! $sth=$dbh->prepare("select S.Subfield_ID, B.Record_ID from 8XX_Subfield_Table S, 8XX_Tag_Table T, Bib_Table B where B.Tag_8XX_ID=T.Tag_ID and T.Subfield_ID=S.Subfield_ID and Subfield_Mark='p' and Subfield_Value=$q_barcode"); $sth->execute; ! my ($Subfield876_ID, $Record_ID) = $sth->fetchrow; ! $sth=$dbh->prepare("select Subfield_Value from 8XX_Subfield_Table where Subfield_Mark=8 and Subfield_ID=$Subfield876_ID"); $sth->execute; my ($link) = $sth->fetchrow; ! $sth=$dbh->prepare("select Subfield_ID from 8XX_Subfield_Table where Subfield_Mark=8 and Subfield_Value=$link and !(Subfield_ID=$Subfield876_ID)"); $sth->execute; ! my ($Subfield852_ID) = $sth->fetchrow; if ($item->{'barcode'} ne $olditem->{'barcode'}) { *************** *** 821,826 **** my $q_barcode=$dbh->quote($item->{'barcode'}); my $sth=$dbh->prepare("update items set barcode=$q_barcode where itemnumber=$itemnumber"); ! logchange('marc', '876', 'p', $olditem->{'barcode'}, $item->{'barcode'}); ! ($Subfield_ID) = changeSubfield($Record_ID, '876', 'p', $olditem->{'barcode'}, $item->{'barcode'}); } if ($item->{'booksellerid'} ne $olditem->{'booksellerid'}) { --- 851,857 ---- my $q_barcode=$dbh->quote($item->{'barcode'}); my $sth=$dbh->prepare("update items set barcode=$q_barcode where itemnumber=$itemnumber"); ! $sth->execute; ! my ($Subfield_ID, $Subfield_Key) = changeSubfield($Record_ID, '876', 'p', $olditem->{'barcode'}, $item->{'barcode'}, $Subfield876_ID); ! logchange('marc', '876', 'p', $Subfield_Key, $olditem->{'barcode'}, $item->{'barcode'}); } if ($item->{'booksellerid'} ne $olditem->{'booksellerid'}) { *************** *** 828,833 **** my $q_booksellerid=$dbh->quote($item->{'booksellerid'}); my $sth=$dbh->prepare("update items set booksellerid=$q_booksellerid where itemnumber=$itemnumber"); ! logchange('marc', '876', 'e', $olditem->{'booksellerid'}, $item->{'booksellerid'}); ! changeSubfield($Record_ID, '876', 'e', $olditem->{'booksellerid'}, $item->{'booksellerid'}); } if ($item->{'dateaccessioned'} ne $olditem->{'dateaccessioned'}) { --- 859,865 ---- my $q_booksellerid=$dbh->quote($item->{'booksellerid'}); my $sth=$dbh->prepare("update items set booksellerid=$q_booksellerid where itemnumber=$itemnumber"); ! $sth->execute; ! my ($Subfield_ID, $Subfield_Key) = changeSubfield($Record_ID, '876', 'e', $olditem->{'booksellerid'}, $item->{'booksellerid'}, $Subfield876_ID); ! logchange('marc', '876', 'e', $Subfield_Key, $olditem->{'booksellerid'}, $item->{'booksellerid'}); } if ($item->{'dateaccessioned'} ne $olditem->{'dateaccessioned'}) { *************** *** 835,850 **** my $q_dateaccessioned=$dbh->quote($item->{'dateaccessioned'}); my $sth=$dbh->prepare("update items set dateaccessioned=$q_dateaccessioned where itemnumber=$itemnumber"); ! logchange('marc', '876', 'd', $olditem->{'dateaccessioned'}, $item->{'dateaccessioned'}); ! changeSubfield($Record_ID, '876', 'd', $olditem->{'dateaccessioned'}, $item->{'dateaccessioned'}); } if ($item->{'homebranch'} ne $olditem->{'homebranch'}) { - # FIX ME!!!! This really needs to check the field link and sequence - # number entry to make sure the right item is being modified! - # Use 876 p (piece designation) to ensure. logchange('kohadb', 'items', 'homebranch', $olditem->{'homebranch'}, $item->{'homebranch'}); my $q_homebranch=$dbh->quote($item->{'homebranch'}); my $sth=$dbh->prepare("update items set homebranch=$q_homebranch where itemnumber=$itemnumber"); ! logchange('marc', '876', 'b', $olditem->{'homebranch'}, $item->{'homebranch'}); ! changeSubfield($Record_ID, '876', 'b', $olditem->{'homebranch'}, $item->{'homebranch'}); } if ($item->{'holdingbranch'} ne $olditem->{'holdingbranch'}) { --- 867,881 ---- my $q_dateaccessioned=$dbh->quote($item->{'dateaccessioned'}); my $sth=$dbh->prepare("update items set dateaccessioned=$q_dateaccessioned where itemnumber=$itemnumber"); ! $sth->execute; ! my ($Subfield_ID, $Subfield_Key) = changeSubfield($Record_ID, '876', 'd', $olditem->{'dateaccessioned'}, $item->{'dateaccessioned'}, $Subfield876_ID); ! logchange('marc', '876', 'd', $Subfield_Key, $olditem->{'dateaccessioned'}, $item->{'dateaccessioned'}); } if ($item->{'homebranch'} ne $olditem->{'homebranch'}) { logchange('kohadb', 'items', 'homebranch', $olditem->{'homebranch'}, $item->{'homebranch'}); my $q_homebranch=$dbh->quote($item->{'homebranch'}); my $sth=$dbh->prepare("update items set homebranch=$q_homebranch where itemnumber=$itemnumber"); ! $sth->execute; ! my ($Subfield_ID, $Subfield_Key) = changeSubfield($Record_ID, '876', 'b', $olditem->{'homebranch'}, $item->{'homebranch'}, $Subfield876_ID); ! logchange('marc', '876', 'b', $Subfield_Key, $olditem->{'homebranch'}, $item->{'homebranch'}); } if ($item->{'holdingbranch'} ne $olditem->{'holdingbranch'}) { *************** *** 852,857 **** my $q_holdingbranch=$dbh->quote($item->{'holdingbranch'}); my $sth=$dbh->prepare("update items set holdingbranch=$q_holdingbranch where itemnumber=$itemnumber"); ! logchange('marc', '876', 'l', $olditem->{'holdingbranch'}, $item->{'holdingbranch'}); ! changeSubfield($Record_ID, '876', 'l', $olditem->{'holdingbranch'}, $item->{'holdingbranch'}); } } --- 883,889 ---- my $q_holdingbranch=$dbh->quote($item->{'holdingbranch'}); my $sth=$dbh->prepare("update items set holdingbranch=$q_holdingbranch where itemnumber=$itemnumber"); ! $sth->execute; ! my ($Subfield_ID, $Subfield_Key) = changeSubfield($Record_ID, '876', 'l', $olditem->{'holdingbranch'}, $item->{'holdingbranch'}, $Subfield876_ID); ! logchange('marc', '876', 'l', $Subfield_Key, $olditem->{'holdingbranch'}, $item->{'holdingbranch'}); } } From rangi at users.sourceforge.net Mon Sep 10 16:38:02 2001 From: rangi at users.sourceforge.net (Chris Cormack) Date: Mon Sep 10 16:38:02 2001 Subject: [Koha-devel] CVS: koha moredetail.pl,1.2,1.3 modbibitem.pl,1.1.1.1,1.2 Message-ID: Update of /cvsroot/koha/koha In directory usw-pr-cvs1:/tmp/cvs-serv3802 Modified Files: moredetail.pl modbibitem.pl Log Message: Fixing a glitch that was showing the biblio notes field where the biblioitems notes should have been displaying Index: moredetail.pl =================================================================== RCS file: /cvsroot/koha/koha/moredetail.pl,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** moredetail.pl 2001/03/15 10:17:33 1.2 --- moredetail.pl 2001/09/10 23:37:09 1.3 *************** *** 35,39 **** my (@items)=itemissues($bi); ! my ($order)=getorder($bi,$bib); #print @items; my $count=@items; --- 35,39 ---- my (@items)=itemissues($bi); ! my ($order,$ordernum)=getorder($bi,$bib); #print @items; my $count=@items; *************** *** 89,94 **** Illus: $data->{'illus'}
Size: $data->{'size'}
! Notes: $data->{'notes'}
No. of Items: $count printend ; --- 89,95 ---- Illus: $data->{'illus'}
Size: $data->{'size'}
! Notes: $data->{'bnotes'}
No. of Items: $count + printend ; *************** *** 98,101 **** --- 99,103 ---- } print < *************** *** 118,121 **** --- 120,124 ---- {'itemnumber'}> + *************** *** 154,161 **** Replacement Price: $items[$i]->{'replacementprice'}
Item lost: $items[$i]->{'itemlost'}
! paid by:
Notes: $items[$i]->{'itemnotes'}
Renewals: $items[$i]->{'renewals'}
! {'ordernumber'}&biblio=$bib&invoice=$order->{'booksellerinvoicenumber'}&catview=yes>Accession Date: $items[$i]->{'dateaccessioned'}
printend ; --- 157,164 ---- Replacement Price: $items[$i]->{'replacementprice'}
Item lost: $items[$i]->{'itemlost'}
! Paid for: $items[$i]->{'paidfor'}
Notes: $items[$i]->{'itemnotes'}
Renewals: $items[$i]->{'renewals'}
! {'booksellerinvoicenumber'}&catview=yes>Accession Date: $items[$i]->{'dateaccessioned'}
printend ; Index: modbibitem.pl =================================================================== RCS file: /cvsroot/koha/koha/modbibitem.pl,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -r1.1.1.1 -r1.2 *** modbibitem.pl 2000/12/19 23:45:52 1.1.1.1 --- modbibitem.pl 2001/09/10 23:37:09 1.2 *************** *** 113,117 **** Notes ! Size --- 113,117 ---- Notes ! Size From rangi at users.sourceforge.net Mon Sep 10 16:38:02 2001 From: rangi at users.sourceforge.net (Chris Cormack) Date: Mon Sep 10 16:38:02 2001 Subject: [Koha-devel] CVS: koha/C4 Search.pm,1.3,1.4 Message-ID: Update of /cvsroot/koha/koha/C4 In directory usw-pr-cvs1:/tmp/cvs-serv3802/C4 Modified Files: Search.pm Log Message: Fixing a glitch that was showing the biblio notes field where the biblioitems notes should have been displaying Index: Search.pm =================================================================== RCS file: /cvsroot/koha/koha/C4/Search.pm,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** Search.pm 2001/06/20 03:36:01 1.3 --- Search.pm 2001/09/10 23:37:09 1.4 *************** *** 20,24 **** &OpacSearch &borrdata2 &NewBorrowerNumber &bibitemdata &borrissues &getboracctrecord &ItemType &itemissues &FrontSearch &subject &subtitle ! &addauthor &bibitems &barcodes &findguarantees &allissues &systemprefs); %EXPORT_TAGS = ( ); # eg: TAG => [ qw!name1 name2! ], --- 20,25 ---- &OpacSearch &borrdata2 &NewBorrowerNumber &bibitemdata &borrissues &getboracctrecord &ItemType &itemissues &FrontSearch &subject &subtitle ! &addauthor &bibitems &barcodes &findguarantees &allissues &systemprefs ! &findguarantor); %EXPORT_TAGS = ( ); # eg: TAG => [ qw!name1 name2! ], *************** *** 73,76 **** --- 74,95 ---- } + sub findguarantor{ + my ($bornum)=@_; + my $dbh=C4Connect; + my $query="select guarantor from borrowers where + borrowernumber='$bornum'"; + my $sth=$dbh->prepare($query); + $sth->execute; + my $data=$sth->fetchrow_hashref; + $sth->finish; + $query="Select * from borrowers where borrowernumber='$data->{'guarantor'}'"; + $sth=$dbh->prepare($query); + $sth->execute; + $data=$sth->fetchrow_hashref; + $sth->finish; + $dbh->disconnect; + return($data); + } + sub NewBorrowerNumber { my $dbh=C4Connect; *************** *** 215,221 **** my $i=1; my @results; ! my $query ="Select * from biblio,bibliosubtitle,biblioitems where ! biblio.biblionumber=bibliosubtitle.biblionumber and ! biblioitems.biblionumber=biblio.biblionumber and (((title like '$key[0]%' or title like '% $key[0]%')"; while ($i < $count){ --- 234,243 ---- my $i=1; my @results; ! my $query ="Select * from biblio ! left join bibliosubtitle on ! bibliosubtitle.biblionumber=biblio.biblionumber ! left join biblioitems on ! biblioitems.biblionumber=biblio.biblionumber ! where (((title like '$key[0]%' or title like '% $key[0]%')"; while ($i < $count){ *************** *** 345,353 **** my $i=1; $query="select *,biblio.author,biblio.biblionumber from ! biblioitems,biblio left join additionalauthors on additionalauthors.biblionumber =biblio.biblionumber ! where biblioitems.biblionumber=biblio.biblionumber ! and ((biblio.author like '$key[0]%' or biblio.author like '% $key[0]%' or additionalauthors.author like '$key[0]%' or additionalauthors.author --- 367,375 ---- my $i=1; $query="select *,biblio.author,biblio.biblionumber from ! biblio left join additionalauthors on additionalauthors.biblionumber =biblio.biblionumber ! left join biblioitems on biblioitems.biblionumber=biblio.biblionumber ! where ((biblio.author like '$key[0]%' or biblio.author like '% $key[0]%' or additionalauthors.author like '$key[0]%' or additionalauthors.author *************** *** 397,404 **** my $count=@key; my $i=1; ! $query="select * from biblio,bibliosubtitle,biblioitems where - (biblio.biblionumber=bibliosubtitle.biblionumber and - biblioitems.biblionumber=biblio.biblionumber) and (((title like '$key[0]%' or title like '% $key[0]%' or title like '% $key[0]')"; while ($i<$count){ --- 419,427 ---- my $count=@key; my $i=1; ! $query="select * from biblio ! left join bibliosubtitle on ! bibliosubtitle.biblionumber=biblio.biblionumber ! left join biblioitems on biblioitems.biblionumber=biblio.biblionumber where (((title like '$key[0]%' or title like '% $key[0]%' or title like '% $key[0]')"; while ($i<$count){ *************** *** 714,718 **** my ($bibitem)=@_; my $dbh=C4Connect; ! my $query="Select * from biblio,biblioitems,itemtypes where biblio.biblionumber= biblioitems.biblionumber and biblioitemnumber=$bibitem and biblioitems.itemtype=itemtypes.itemtype"; --- 737,742 ---- 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"; *************** *** 1043,1048 **** biblionumber=$bibnum "; if ($type eq 'opac'){ ! $query.=" and (itemlost <>1 or itemlost is NULL) and ! (wthdrawn <> 1 or wthdrawn is NULL)"; } my $sth=$dbh->prepare($query); --- 1067,1072 ---- biblionumber=$bibnum "; if ($type eq 'opac'){ ! $query.=" and (itemlost =0 or itemlost is NULL) and ! (wthdrawn = 0 or wthdrawn is NULL)"; } my $sth=$dbh->prepare($query); *************** *** 1078,1082 **** $scount++; } ! if ($data->{'itemlost'} eq '1'){ $lostcount++; } --- 1102,1106 ---- $scount++; } ! if ($data->{'itemlost'} eq '1' || $data->{'itemlost'} eq '2'){ $lostcount++; } From rangi at users.sourceforge.net Mon Sep 10 19:04:02 2001 From: rangi at users.sourceforge.net (Chris Cormack) Date: Mon Sep 10 19:04:02 2001 Subject: [Koha-devel] CVS: koha deletemem.pl,1.1,1.2 Message-ID: Update of /cvsroot/koha/koha In directory usw-pr-cvs1:/tmp/cvs-serv27882 Modified Files: deletemem.pl Log Message: Fixing member deletion, so that it checks fines, issues and guarantees before deleting Index: deletemem.pl =================================================================== RCS file: /cvsroot/koha/koha/deletemem.pl,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** deletemem.pl 2001/07/05 21:37:59 1.1 --- deletemem.pl 2001/09/11 02:03:26 1.2 *************** *** 19,35 **** my %env; $env{'nottodayissues'}=1; ! my %member2; ! $member2{'borrowernumber'}=$member; ! my $issues=currentissues(\%env,\%member2); ! my $i=0; ! foreach (sort keys %$issues) { $i++; ! } ! if ($i > 0){ print $input->header; ! print "error borrower has items on issue"; } else { ! delmember($member); ! print $input->redirect("/members/"); } --- 19,56 ---- my %env; $env{'nottodayissues'}=1; ! my %member2; ! $member2{'borrowernumber'}=$member; ! my $issues=currentissues(\%env,\%member2); ! my $i=0; ! foreach (sort keys %$issues) { $i++; ! } ! my ($bor,$flags)=getpatroninformation(\%env, $member,''); ! my $dbh=C4Connect; ! my $query="Select * from borrowers where guarantor='$member'"; ! my $sth=$dbh->prepare($query); ! $sth->execute; ! my $data=$sth->fetchrow_hashref; ! $sth->finish; ! $dbh->disconnect; ! ! ! if ($i > 0 || $flags->{'CHARGES'} ne '' || $data ne ''){ print $input->header; ! print ""; ! if ($i > 0){ ! print ""; ! } ! if ($flags->{'CHARGES'} ne ''){ ! print ""; ! } ! if ($data ne ''){ ! print ""; ! } ! print "
Items on Issue$i
Charges$flags->{'CHARGES'}->{'message'}
Guarantees
"; ! } else { ! delmember($member); ! print $input->redirect("/members/"); } *************** *** 52,55 **** --- 73,80 ---- $sth->finish; $query = "Delete from borrowers where borrowernumber='$member'"; + $sth=$dbh->prepare($query); + $sth->execute; + $sth->finish; + $query="Delete from reserves where borrowernumber='$member'"; $sth=$dbh->prepare($query); $sth->execute; From nsr4n at tetra.mail.virginia.edu Fri Sep 21 21:16:01 2001 From: nsr4n at tetra.mail.virginia.edu (Nicholas Stephen Rosasco) Date: Fri Sep 21 21:16:01 2001 Subject: [Koha-devel] MARC, etc Message-ID: I know a LOT of work has happened since I suggested MARC support in Koha, but since the list has suddenly gone silent, I was wondering what the status was... particularly as I've got someone asking for an install of it soon, and they are specifically requesting info about OpenBook (still in beta I think) rather than Koha. I have no issue with the OpenBook app or development, but I'm of the opinion that Koha is a more mature product. Also, since my last email, I've had a chance to acquire at least some Perl skill and feel fairly confident that I could at least handle non-essential bits n' bobs, etc if need be (perhaps not quick turnaround for a little while -- the work backlog I've got is depressing indeed). NSR From tonnesen at users.sourceforge.net Thu Sep 27 12:25:03 2001 From: tonnesen at users.sourceforge.net (Steve Tonnesen) Date: Thu Sep 27 12:25:03 2001 Subject: [Koha-devel] CVS: koha/C4 Catalogue.pm,1.6,1.7 Message-ID: Update of /cvsroot/koha/koha/C4 In directory usw-pr-cvs1:/tmp/cvs-serv31420/koha/C4 Modified Files: Catalogue.pm Log Message: Started on updateItem subroutine. Index: Catalogue.pm =================================================================== RCS file: /cvsroot/koha/koha/C4/Catalogue.pm,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -r1.6 -r1.7 *** Catalogue.pm 2001/06/26 22:27:12 1.6 --- Catalogue.pm 2001/09/27 19:24:18 1.7 *************** *** 1,4 **** --- 1,8 ---- package C4::Catalogue; #asummes C4/Acquisitions.pm + # Continue working on updateItem!!!!!! + # + + use strict; require Exporter; *************** *** 55,58 **** --- 59,63 ---- # only created when new biblioitems are added. my ($env, $biblio) = @_; + my $dbh=&C4Connect; my $title=$biblio->{'title'}; my $q_title=$dbh->quote($title); *************** *** 106,109 **** --- 111,117 ---- # Might be nice to be able to pass a Subfield_ID directly to this routine to # remove ambiguity, if possible. + # + # Pass barcode to remove ambiguity for changes to individual items. Look up + # field link and sequence number based on barcode. my $Record_ID=shift; *************** *** 113,116 **** --- 121,126 ---- my $Subfield_OldValue=shift; my $Subfield_Value=shift; + my $barcode=shift; + my $Subfield_ID; my $dbh=&C4Connect; my $sth=$dbh->prepare("select S.Subfield_ID, S.Subfield_Value from Bib_Table B, $firstdigit\XX_Tag_Table T, $firstdigit\XX_Subfield_Table S where B.Record_ID=$Record_ID and B.Tag_$firstdigit\XX_ID=T.Tag_ID and T.Subfield_ID=S.Subfield_ID and S.Subfield_Mark='$Subfield_Mark'"); *************** *** 121,127 **** --- 131,139 ---- my $sti=$dbh->prepare("update $firstdigit\XX_Subfield_Table set Subfield_Value=$q_Subfield_Value where Subfield_ID=$ID"); $sti->execute; + $Subfield_ID=$ID; last; } } + return($Subfield_ID); } *************** *** 329,333 **** my ($biblioitemnumber) =$sth->fetchrow; $biblioitemnumber++; ! $sth=$dbh->prepare("insert into biblioitems (biblionumber,biblioitemnumber,volume,number,classification,itemtype,isbn,issn,dewey,subclass,publicationyear,publishercode,volumedate,illus,pages,notes,size,place,lccn) values ($biblionumber, $biblioitemnumber, $q_volume, $q_number, $q_classification, $q_itemtype, $q_isbn, $q_issn, $dewey, $q_subclass, $q_publicationyear, $q_publishercode, $q_volumedate, $q_illus, $q_pages,$q_notes, $q_size, $q_place, $q_lccn)"); $sth->execute; #my $sth=$dbh->prepare("unlock tables"); --- 341,345 ---- my ($biblioitemnumber) =$sth->fetchrow; $biblioitemnumber++; ! $sth=$dbh->prepare("insert into biblioitems (biblionumber,biblioitemnumber,volume,number,classification,itemtype,isbn,issn,dewey,subclass,publicationyear,publishercode,volumedate,illus,pages,notes,size,place,lccn) values ($biblionumber, $biblioitemnumber, $q_volume, $q_number, $q_classification, $q_itemtype, $q_isbn, $q_issn, $dewey, $q_subclass, $publicationyear, $q_publishercode, $q_volumedate, $q_illus, $q_pages,$q_notes, $q_size, $q_place, $q_lccn)"); $sth->execute; #my $sth=$dbh->prepare("unlock tables"); *************** *** 339,343 **** # same isbn/lccn/issn? ! $sth=$dbh->prepare("select title,unititle,seriestitle,copyrightdate,notes,author from biblio where biblionumber=$biblionumber"); $sth->execute; my ($title, $unititle,$seriestitle,$copyrightdate,$biblionotes,$author) = $sth->fetchrow; --- 351,355 ---- # same isbn/lccn/issn? ! my $sth=$dbh->prepare("select title,unititle,seriestitle,copyrightdate,notes,author from biblio where biblionumber=$biblionumber"); $sth->execute; my ($title, $unititle,$seriestitle,$copyrightdate,$biblionotes,$author) = $sth->fetchrow; *************** *** 403,407 **** $subfields->{2}->{'Subfield_Mark'}='3'; $subfields->{2}->{'Subfield_Value'}='biblio'; ! my $tag='440'; addTag($env, $Record_ID, $tag, ' ', ' ', $subfields); } --- 415,419 ---- $subfields->{2}->{'Subfield_Mark'}='3'; $subfields->{2}->{'Subfield_Value'}='biblio'; ! my $tag='500'; addTag($env, $Record_ID, $tag, ' ', ' ', $subfields); } *************** *** 540,544 **** sub updateBiblioItem { # Update the biblioitem with biblioitemnumber $biblioitem->{'biblioitemnumber'} - # This routine should also modify the corresponding MARC record data. # # This routine should also check to see which fields are actually being --- 552,555 ---- *************** *** 598,602 **** if ($biblioitem->{'dewey'} ne $obi->{'dewey'}) { logchange('kohadb', 'biblioitems', 'dewey', $obi->{'dewey'}, $biblioitem->{'dewey'}); ! my $sth=$dbh->prepare("update biblioitems set dewey=$dewey where biblioitemnumber=$biblioitemnumber"); logchange('marc', '082', 'a', $obi->{'dewey'}, $biblioitem->{'dewey'}); changeSubfield($Record_ID, '082', 'a', $obi->{'dewey'}, $biblioitem->{'dewey'}); --- 609,613 ---- if ($biblioitem->{'dewey'} ne $obi->{'dewey'}) { logchange('kohadb', 'biblioitems', 'dewey', $obi->{'dewey'}, $biblioitem->{'dewey'}); ! my $sth=$dbh->prepare("update biblioitems set dewey=$biblioitem->{'dewey'} where biblioitemnumber=$biblioitemnumber"); logchange('marc', '082', 'a', $obi->{'dewey'}, $biblioitem->{'dewey'}); changeSubfield($Record_ID, '082', 'a', $obi->{'dewey'}, $biblioitem->{'dewey'}); *************** *** 673,683 **** --- 684,700 ---- my $dbh=&C4Connect; my $barcode=$item->{'barcode'}; + my $q_barcode=$dbh->quote($barcode); + my $biblionumber=$item->{'biblionumber'}; + my $biblioitemnumber=$item->{'biblioitemnumber'}; my $dateaccessioned=$item->{'dateaccessioned'}; my $booksellerid=$item->{'booksellerid'}; + my $q_booksellerid=$dbh->quote($booksellerid); my $homebranch=$item->{'homebranch'}; + my $q_homebranch=$dbh->quote($homebranch); my $holdingbranch=$item->{'holdingbranch'}; my $price=$item->{'price'}; my $replacementprice=$item->{'replacementprice'}; my $replacementpricedate=$item->{'replacementpricedate'}; + my $q_replacementpricedate=$dbh->quote($replacementpricedate); my $notforloan=$item->{'notforloan'}; my $itemlost=$item->{'itemlost'}; *************** *** 685,688 **** --- 702,706 ---- my $restricted=$item->{'restricted'}; my $itemnotes=$item->{'itemnotes'}; + my $q_itemnotes=$dbh->quote($itemnotes); my $itemtype=$item->{'itemtype'}; my $subclass=$item->{'subclass'}; *************** *** 763,766 **** --- 781,858 ---- my ($env, $item) = @_; + my $dbh=&C4Connect; + my $itemnumber=$item->{'itemnumber'}; + my $biblionumber=$item->{'biblionumber'}; + my $biblioitemnumber=$item->{'biblioitemnumber'}; + my $barcode=$item->{'barcode'}; + my $dateaccessioned=$item->{'dateaccessioned'}; + my $booksellerid=$item->{'booksellerid'}; + my $homebranch=$item->{'homebranch'}; + my $price=$item->{'price'}; + my $replacementprice=$item->{'replacementprice'}; + my $replacementpricedate=$item->{'replacementpricedate'}; + my $multivolume=$item->{'multivolume'}; + my $stack=$item->{'stack'}; + my $notforloan=$item->{'notforloan'}; + my $itemlost=$item->{'itemlost'}; + my $wthdrawn=$item->{'wthdrawn'}; + my $bulk=$item->{'bulk'}; + my $restricted=$item->{'restricted'}; + my $binding=$item->{'binding'}; + my $itemnotes=$item->{'itemnotes'}; + my $holdingbranch=$item->{'holdingbranch'}; + my $interim=$item->{'interim'}; + my $sth=$dbh->prepare("select * from items where itemnumber=$itemnumber"); + $sth->execute; + my $olditem=$sth->fetchrow_hashref; + my $q_barcode=$dbh->quote($olditem->{'barcode'}); + $sth=$dbh->prepare("select Subfield_ID from 8XX_Subfield_Table where Subfield_Mark='p' and Subfield_Value=$q_barcode"); + $sth->execute; + my ($Subfield852_ID) = $sth->fetchrow; + $sth=$dbh->prepare("select Subfield_Value from 8XX_Subfield_Table where Subfield_Mark=8 and Subfield_ID=$Subfield852_ID"); + $sth->execute; + my ($link) = $sth->fetchrow; + $sth=$dbh->prepare("select Subfield_ID from 8XX_Subfield_Table where Subfield_Mark=8 and Subfield_Value=$link"); + $sth->execute; + my ($Subfield876_ID) = $sth->fetchrow; + + if ($item->{'barcode'} ne $olditem->{'barcode'}) { + logchange('kohadb', 'items', 'barcode', $olditem->{'barcode'}, $item->{'barcode'}); + my $q_barcode=$dbh->quote($item->{'barcode'}); + my $sth=$dbh->prepare("update items set barcode=$q_barcode where itemnumber=$itemnumber"); + logchange('marc', '876', 'p', $olditem->{'barcode'}, $item->{'barcode'}); + ($Subfield_ID) = changeSubfield($Record_ID, '876', 'p', $olditem->{'barcode'}, $item->{'barcode'}); + } + if ($item->{'booksellerid'} ne $olditem->{'booksellerid'}) { + logchange('kohadb', 'items', 'booksellerid', $olditem->{'booksellerid'}, $item->{'booksellerid'}); + my $q_booksellerid=$dbh->quote($item->{'booksellerid'}); + my $sth=$dbh->prepare("update items set booksellerid=$q_booksellerid where itemnumber=$itemnumber"); + logchange('marc', '876', 'e', $olditem->{'booksellerid'}, $item->{'booksellerid'}); + changeSubfield($Record_ID, '876', 'e', $olditem->{'booksellerid'}, $item->{'booksellerid'}); + } + if ($item->{'dateaccessioned'} ne $olditem->{'dateaccessioned'}) { + logchange('kohadb', 'items', 'dateaccessioned', $olditem->{'dateaccessioned'}, $item->{'dateaccessioned'}); + my $q_dateaccessioned=$dbh->quote($item->{'dateaccessioned'}); + my $sth=$dbh->prepare("update items set dateaccessioned=$q_dateaccessioned where itemnumber=$itemnumber"); + logchange('marc', '876', 'd', $olditem->{'dateaccessioned'}, $item->{'dateaccessioned'}); + changeSubfield($Record_ID, '876', 'd', $olditem->{'dateaccessioned'}, $item->{'dateaccessioned'}); + } + if ($item->{'homebranch'} ne $olditem->{'homebranch'}) { + # FIX ME!!!! This really needs to check the field link and sequence + # number entry to make sure the right item is being modified! + # Use 876 p (piece designation) to ensure. + logchange('kohadb', 'items', 'homebranch', $olditem->{'homebranch'}, $item->{'homebranch'}); + my $q_homebranch=$dbh->quote($item->{'homebranch'}); + my $sth=$dbh->prepare("update items set homebranch=$q_homebranch where itemnumber=$itemnumber"); + logchange('marc', '876', 'b', $olditem->{'homebranch'}, $item->{'homebranch'}); + changeSubfield($Record_ID, '876', 'b', $olditem->{'homebranch'}, $item->{'homebranch'}); + } + if ($item->{'holdingbranch'} ne $olditem->{'holdingbranch'}) { + logchange('kohadb', 'items', 'holdingbranch', $olditem->{'holdingbranch'}, $item->{'holdingbranch'}); + my $q_holdingbranch=$dbh->quote($item->{'holdingbranch'}); + my $sth=$dbh->prepare("update items set holdingbranch=$q_holdingbranch where itemnumber=$itemnumber"); + logchange('marc', '876', 'l', $olditem->{'holdingbranch'}, $item->{'holdingbranch'}); + changeSubfield($Record_ID, '876', 'l', $olditem->{'holdingbranch'}, $item->{'holdingbranch'}); + } } From tonnesen at users.sourceforge.net Thu Sep 27 12:25:03 2001 From: tonnesen at users.sourceforge.net (Steve Tonnesen) Date: Thu Sep 27 12:25:03 2001 Subject: [Koha-devel] CVS: koha/marc koha2marc,1.2,1.3 Message-ID: Update of /cvsroot/koha/koha/marc In directory usw-pr-cvs1:/tmp/cvs-serv31420/koha/marc Modified Files: koha2marc Log Message: Started on updateItem subroutine. Index: koha2marc =================================================================== RCS file: /cvsroot/koha/koha/marc/koha2marc,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** koha2marc 2001/06/25 19:07:20 1.2 --- koha2marc 2001/09/27 19:24:18 1.3 *************** *** 7,11 **** # MySQL tables!!! It is only in here during development!!!! ! system("mysql Koha -ptestpass < deletemarc"); use C4::Database; --- 7,11 ---- # MySQL tables!!! It is only in here during development!!!! ! system("mysql Koha -pkohapass < deletemarc"); use C4::Database; *************** *** 26,29 **** --- 26,30 ---- $sth->execute; my $env; + $env->{'marconly'}=1; while (my $biblioitem=$sth->fetchrow_hashref) { From tonnesen at users.sourceforge.net Thu Sep 27 13:41:01 2001 From: tonnesen at users.sourceforge.net (Steve Tonnesen) Date: Thu Sep 27 13:41:01 2001 Subject: [Koha-devel] CVS: koha/C4 Catalogue.pm,1.7,1.8 Message-ID: Update of /cvsroot/koha/koha/C4 In directory usw-pr-cvs1:/tmp/cvs-serv22278/koha/C4 Modified Files: Catalogue.pm Log Message: Tested updateItem subroutine, made some better checks for Subfield_IDs and Subfield_Keys when modifying MARC data based on changes to Koha data. Index: Catalogue.pm =================================================================== RCS file: /cvsroot/koha/koha/C4/Catalogue.pm,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -r1.7 -r1.8 *** Catalogue.pm 2001/09/27 19:24:18 1.7 --- Catalogue.pm 2001/09/27 20:39:59 1.8 *************** *** 109,114 **** # Subfield_Mark, and Subfield_OldValue, only the first one will be modified. # ! # Might be nice to be able to pass a Subfield_ID directly to this routine to ! # remove ambiguity, if possible. # # Pass barcode to remove ambiguity for changes to individual items. Look up --- 109,114 ---- # Subfield_Mark, and Subfield_OldValue, only the first one will be modified. # ! # Might be nice to be able to pass a Subfield_ID or Subfield_Key directly to ! # this routine to remove ambiguity, if possible. # # Pass barcode to remove ambiguity for changes to individual items. Look up *************** *** 121,139 **** my $Subfield_OldValue=shift; my $Subfield_Value=shift; ! my $barcode=shift; ! my $Subfield_ID; my $dbh=&C4Connect; ! my $sth=$dbh->prepare("select S.Subfield_ID, S.Subfield_Value from Bib_Table B, $firstdigit\XX_Tag_Table T, $firstdigit\XX_Subfield_Table S where B.Record_ID=$Record_ID and B.Tag_$firstdigit\XX_ID=T.Tag_ID and T.Subfield_ID=S.Subfield_ID and S.Subfield_Mark='$Subfield_Mark'"); ! $sth->execute; ! while (my ($ID, $Value) = $sth->fetchrow) { ! if ($Value eq $Subfield_OldValue) { ! my $q_Subfield_Value=$dbh->quote($Subfield_Value); ! my $sti=$dbh->prepare("update $firstdigit\XX_Subfield_Table set Subfield_Value=$q_Subfield_Value where Subfield_ID=$ID"); ! $sti->execute; ! $Subfield_ID=$ID; ! last; } } ! return($Subfield_ID); } --- 121,159 ---- my $Subfield_OldValue=shift; my $Subfield_Value=shift; ! my $Subfield_ID=shift; ! my $Subfield_Key=shift; my $dbh=&C4Connect; ! my $q_Subfield_Value=$dbh->quote($Subfield_Value); ! if ($Subfield_Key) { ! # Great. Subfield_Key makes the record absolutely unique. Just make ! # the change ! my $sth=$dbh->prepare("update $firstdigit\XX_Subfield_Table set Subfield_Value=$q_Subfield_Value where Subfield_Key=$Subfield_Key"); ! $sth->execute; ! } elsif ($Subfield_ID) { ! # Subfield_ID does not make the record unique. Could be multiple ! # records with the same mark. This is a bad situatoin. ! my $sth=$dbh->prepare("select Subfield_Key, Subfield_Value from $firstdigit\XX_Subfield_Table where Subfield_Mark='$Subfield_Mark' and Subfield_ID=$Subfield_ID"); ! $sth->execute; ! while (my ($key, $Value) = $sth->fetchrow) { ! if ($Value eq $Subfield_OldValue) { ! my $sti=$dbh->prepare("update $firstdigit\XX_Subfield_Table set Subfield_Value=$q_Subfield_Value where Subfield_Key=$key"); ! $sti->execute; ! $Subfield_Key=$key; ! last; ! } } + } else { + my $sth=$dbh->prepare("select S.Subfield_Key, S.Subfield_ID, S.Subfield_Value from Bib_Table B, $firstdigit\XX_Tag_Table T, $firstdigit\XX_Subfield_Table S where B.Record_ID=$Record_ID and B.Tag_$firstdigit\XX_ID=T.Tag_ID and T.Subfield_ID=S.Subfield_ID and S.Subfield_Mark='$Subfield_Mark'"); + $sth->execute; + while (my ($key, $ID, $Value) = $sth->fetchrow) { + if ($Value eq $Subfield_OldValue) { + my $sti=$dbh->prepare("update $firstdigit\XX_Subfield_Table set Subfield_Value=$q_Subfield_Value where Subfield_Key=$key"); + $sti->execute; + $Subfield_Key=$key; + last; + } + } } ! return($Subfield_ID, $Subfield_Key); } *************** *** 235,242 **** # Subroutine to log changes to databases my $database=shift; ! my $section=shift; ! my $item=shift; ! my $original=shift; ! my $new=shift; } --- 255,272 ---- # Subroutine to log changes to databases my $database=shift; ! if ($database eq 'kohadb') { ! my $section=shift; ! my $item=shift; ! my $original=shift; ! my $new=shift; ! print "KOHA: $section $item $original $new\n"; ! } elsif ($database eq 'marc') { ! my $tag=shift; ! my $mark=shift; ! my $subfield_ID=shift; ! my $original=shift; ! my $new=shift; ! print "MARC: $tag $mark $subfield_ID $original $new\n"; ! } } *************** *** 807,819 **** my $olditem=$sth->fetchrow_hashref; my $q_barcode=$dbh->quote($olditem->{'barcode'}); ! $sth=$dbh->prepare("select Subfield_ID from 8XX_Subfield_Table where Subfield_Mark='p' and Subfield_Value=$q_barcode"); $sth->execute; ! my ($Subfield852_ID) = $sth->fetchrow; ! $sth=$dbh->prepare("select Subfield_Value from 8XX_Subfield_Table where Subfield_Mark=8 and Subfield_ID=$Subfield852_ID"); $sth->execute; my ($link) = $sth->fetchrow; ! $sth=$dbh->prepare("select Subfield_ID from 8XX_Subfield_Table where Subfield_Mark=8 and Subfield_Value=$link"); $sth->execute; ! my ($Subfield876_ID) = $sth->fetchrow; if ($item->{'barcode'} ne $olditem->{'barcode'}) { --- 837,849 ---- my $olditem=$sth->fetchrow_hashref; my $q_barcode=$dbh->quote($olditem->{'barcode'}); ! $sth=$dbh->prepare("select S.Subfield_ID, B.Record_ID from 8XX_Subfield_Table S, 8XX_Tag_Table T, Bib_Table B where B.Tag_8XX_ID=T.Tag_ID and T.Subfield_ID=S.Subfield_ID and Subfield_Mark='p' and Subfield_Value=$q_barcode"); $sth->execute; ! my ($Subfield876_ID, $Record_ID) = $sth->fetchrow; ! $sth=$dbh->prepare("select Subfield_Value from 8XX_Subfield_Table where Subfield_Mark=8 and Subfield_ID=$Subfield876_ID"); $sth->execute; my ($link) = $sth->fetchrow; ! $sth=$dbh->prepare("select Subfield_ID from 8XX_Subfield_Table where Subfield_Mark=8 and Subfield_Value=$link and !(Subfield_ID=$Subfield876_ID)"); $sth->execute; ! my ($Subfield852_ID) = $sth->fetchrow; if ($item->{'barcode'} ne $olditem->{'barcode'}) { *************** *** 821,826 **** my $q_barcode=$dbh->quote($item->{'barcode'}); my $sth=$dbh->prepare("update items set barcode=$q_barcode where itemnumber=$itemnumber"); ! logchange('marc', '876', 'p', $olditem->{'barcode'}, $item->{'barcode'}); ! ($Subfield_ID) = changeSubfield($Record_ID, '876', 'p', $olditem->{'barcode'}, $item->{'barcode'}); } if ($item->{'booksellerid'} ne $olditem->{'booksellerid'}) { --- 851,857 ---- my $q_barcode=$dbh->quote($item->{'barcode'}); my $sth=$dbh->prepare("update items set barcode=$q_barcode where itemnumber=$itemnumber"); ! $sth->execute; ! my ($Subfield_ID, $Subfield_Key) = changeSubfield($Record_ID, '876', 'p', $olditem->{'barcode'}, $item->{'barcode'}, $Subfield876_ID); ! logchange('marc', '876', 'p', $Subfield_Key, $olditem->{'barcode'}, $item->{'barcode'}); } if ($item->{'booksellerid'} ne $olditem->{'booksellerid'}) { *************** *** 828,833 **** my $q_booksellerid=$dbh->quote($item->{'booksellerid'}); my $sth=$dbh->prepare("update items set booksellerid=$q_booksellerid where itemnumber=$itemnumber"); ! logchange('marc', '876', 'e', $olditem->{'booksellerid'}, $item->{'booksellerid'}); ! changeSubfield($Record_ID, '876', 'e', $olditem->{'booksellerid'}, $item->{'booksellerid'}); } if ($item->{'dateaccessioned'} ne $olditem->{'dateaccessioned'}) { --- 859,865 ---- my $q_booksellerid=$dbh->quote($item->{'booksellerid'}); my $sth=$dbh->prepare("update items set booksellerid=$q_booksellerid where itemnumber=$itemnumber"); ! $sth->execute; ! my ($Subfield_ID, $Subfield_Key) = changeSubfield($Record_ID, '876', 'e', $olditem->{'booksellerid'}, $item->{'booksellerid'}, $Subfield876_ID); ! logchange('marc', '876', 'e', $Subfield_Key, $olditem->{'booksellerid'}, $item->{'booksellerid'}); } if ($item->{'dateaccessioned'} ne $olditem->{'dateaccessioned'}) { *************** *** 835,850 **** my $q_dateaccessioned=$dbh->quote($item->{'dateaccessioned'}); my $sth=$dbh->prepare("update items set dateaccessioned=$q_dateaccessioned where itemnumber=$itemnumber"); ! logchange('marc', '876', 'd', $olditem->{'dateaccessioned'}, $item->{'dateaccessioned'}); ! changeSubfield($Record_ID, '876', 'd', $olditem->{'dateaccessioned'}, $item->{'dateaccessioned'}); } if ($item->{'homebranch'} ne $olditem->{'homebranch'}) { - # FIX ME!!!! This really needs to check the field link and sequence - # number entry to make sure the right item is being modified! - # Use 876 p (piece designation) to ensure. logchange('kohadb', 'items', 'homebranch', $olditem->{'homebranch'}, $item->{'homebranch'}); my $q_homebranch=$dbh->quote($item->{'homebranch'}); my $sth=$dbh->prepare("update items set homebranch=$q_homebranch where itemnumber=$itemnumber"); ! logchange('marc', '876', 'b', $olditem->{'homebranch'}, $item->{'homebranch'}); ! changeSubfield($Record_ID, '876', 'b', $olditem->{'homebranch'}, $item->{'homebranch'}); } if ($item->{'holdingbranch'} ne $olditem->{'holdingbranch'}) { --- 867,881 ---- my $q_dateaccessioned=$dbh->quote($item->{'dateaccessioned'}); my $sth=$dbh->prepare("update items set dateaccessioned=$q_dateaccessioned where itemnumber=$itemnumber"); ! $sth->execute; ! my ($Subfield_ID, $Subfield_Key) = changeSubfield($Record_ID, '876', 'd', $olditem->{'dateaccessioned'}, $item->{'dateaccessioned'}, $Subfield876_ID); ! logchange('marc', '876', 'd', $Subfield_Key, $olditem->{'dateaccessioned'}, $item->{'dateaccessioned'}); } if ($item->{'homebranch'} ne $olditem->{'homebranch'}) { logchange('kohadb', 'items', 'homebranch', $olditem->{'homebranch'}, $item->{'homebranch'}); my $q_homebranch=$dbh->quote($item->{'homebranch'}); my $sth=$dbh->prepare("update items set homebranch=$q_homebranch where itemnumber=$itemnumber"); ! $sth->execute; ! my ($Subfield_ID, $Subfield_Key) = changeSubfield($Record_ID, '876', 'b', $olditem->{'homebranch'}, $item->{'homebranch'}, $Subfield876_ID); ! logchange('marc', '876', 'b', $Subfield_Key, $olditem->{'homebranch'}, $item->{'homebranch'}); } if ($item->{'holdingbranch'} ne $olditem->{'holdingbranch'}) { *************** *** 852,857 **** my $q_holdingbranch=$dbh->quote($item->{'holdingbranch'}); my $sth=$dbh->prepare("update items set holdingbranch=$q_holdingbranch where itemnumber=$itemnumber"); ! logchange('marc', '876', 'l', $olditem->{'holdingbranch'}, $item->{'holdingbranch'}); ! changeSubfield($Record_ID, '876', 'l', $olditem->{'holdingbranch'}, $item->{'holdingbranch'}); } } --- 883,889 ---- my $q_holdingbranch=$dbh->quote($item->{'holdingbranch'}); my $sth=$dbh->prepare("update items set holdingbranch=$q_holdingbranch where itemnumber=$itemnumber"); ! $sth->execute; ! my ($Subfield_ID, $Subfield_Key) = changeSubfield($Record_ID, '876', 'l', $olditem->{'holdingbranch'}, $item->{'holdingbranch'}, $Subfield876_ID); ! logchange('marc', '876', 'l', $Subfield_Key, $olditem->{'holdingbranch'}, $item->{'holdingbranch'}); } }