From 097fef712a0ff640c85e3d1c3168b778eda23e88 Mon Sep 17 00:00:00 2001 From: hdl Date: Fri, 27 Apr 2007 14:00:48 +0000 Subject: [PATCH] Removing $dbh from GetMarcFromKohaField (dbh is not used in this function.) --- C4/Biblio.pm | 29 ++++++++++--------- C4/Letters.pm | 2 +- C4/Serials.pm | 16 +++++----- barcodes/label-item-search.pl | 2 +- cataloguing/addbiblio.pl | 6 ++-- cataloguing/additem.pl | 8 ++--- circ/branchoverdues.pl | 2 +- members/borrowers_details.pl | 7 ++--- misc/cronjobs/update_items.pl | 4 +-- misc/exportauth.pl | 1 - misc/marcimport_to_biblioitems.pl | 2 +- .../22_to_30/missing090field.pl | 4 +-- misc/missing090field.pl | 4 +-- misc/rebuildnonmarc.pl | 2 +- opac/opac-MARCdetail.pl | 2 +- serials/serials-edit.pl | 2 +- tools/export.pl | 2 +- 17 files changed, 47 insertions(+), 48 deletions(-) diff --git a/C4/Biblio.pm b/C4/Biblio.pm index 912410a707..1c777bac64 100644 --- a/C4/Biblio.pm +++ b/C4/Biblio.pm @@ -215,8 +215,8 @@ sub AddBiblio { # we build the new field with biblionumber and biblioitemnumber # we drop the original field # we add the new builded field. - ( my $biblio_tag, my $biblio_subfield ) = GetMarcFromKohaField($dbh,"biblio.biblionumber",$frameworkcode); - ( my $biblioitem_tag, my $biblioitem_subfield ) = GetMarcFromKohaField($dbh,"biblioitems.biblioitemnumber",$frameworkcode); + ( my $biblio_tag, my $biblio_subfield ) = GetMarcFromKohaField("biblio.biblionumber",$frameworkcode); + ( my $biblioitem_tag, my $biblioitem_subfield ) = GetMarcFromKohaField("biblioitems.biblioitemnumber",$frameworkcode); my $newfield; @@ -502,7 +502,7 @@ sub ModItemInMarconefield { } my $record = GetMarcItem( $biblionumber, $itemnumber ); - my ($tagfield, $tagsubfield) = GetMarcFromKohaField($dbh, $itemfield,''); + my ($tagfield, $tagsubfield) = GetMarcFromKohaField( $itemfield,''); if ($tagfield && $tagsubfield) { my $tag = $record->field($tagfield); if ($tag) { @@ -531,7 +531,7 @@ sub ModItemInMarc { # get complete MARC record & replace the item field by the new one my $completeRecord = GetMarcBiblio($biblionumber); - my ($itemtag,$itemsubfield) = GetMarcFromKohaField($dbh,"items.itemnumber",$frameworkcode); + my ($itemtag,$itemsubfield) = GetMarcFromKohaField("items.itemnumber",$frameworkcode); my $itemField = $ItemRecord->field($itemtag); my @items = $completeRecord->field($itemtag); foreach (@items) { @@ -664,7 +664,7 @@ sub DelItem { $copy2deleted->execute( $record->as_usmarc(), $itemnumber ); #search item field code - my ( $itemtag, $itemsubfield ) = GetMarcFromKohaField($dbh,"items.itemnumber",$frameworkcode); + my ( $itemtag, $itemsubfield ) = GetMarcFromKohaField("items.itemnumber",$frameworkcode); my @fields = $record->field($itemtag); # delete the item specified foreach my $field (@fields) { @@ -921,7 +921,7 @@ sub GetItemStatus { my $sth; $fwk = '' unless ($fwk); my ( $tag, $subfield ) = - GetMarcFromKohaField( $dbh, "items.notforloan", $fwk ); + GetMarcFromKohaField( "items.notforloan", $fwk ); if ( $tag and $subfield ) { my $sth = $dbh->prepare( @@ -1000,7 +1000,7 @@ sub GetItemLocation { my $sth; $fwk = '' unless ($fwk); my ( $tag, $subfield ) = - GetMarcFromKohaField( $dbh, "items.location", $fwk ); + GetMarcFromKohaField( "items.location", $fwk ); if ( $tag and $subfield ) { my $sth = $dbh->prepare( @@ -1502,7 +1502,7 @@ sub GetMarcStructure { =over 4 -($MARCfield,$MARCsubfield)=GetMarcFromKohaField($dbh,$kohafield,$frameworkcode); +($MARCfield,$MARCsubfield)=GetMarcFromKohaField($kohafield,$frameworkcode); Returns the MARC fields & subfields mapped to the koha field for the given frameworkcode @@ -1511,7 +1511,7 @@ for the given frameworkcode =cut sub GetMarcFromKohaField { - my ( $dbh, $kohafield, $frameworkcode ) = @_; + my ( $kohafield, $frameworkcode ) = @_; return 0, 0 unless $kohafield; my $relations = C4::Context->marcfromkohafield; return ( @@ -1636,7 +1636,7 @@ sub GetMarcItem { $record = MARC::Record::new_from_xml( $marcxml, "utf8", $marcflavour ); # now, find where the itemnumber is stored & extract only the item my ( $itemnumberfield, $itemnumbersubfield ) = - GetMarcFromKohaField( $dbh, 'items.itemnumber', '' ); + GetMarcFromKohaField( 'items.itemnumber', '' ); my @fields = $record->field($itemnumberfield); foreach my $field (@fields) { if ( $field->subfield($itemnumbersubfield) eq $itemnumber ) { @@ -2228,7 +2228,7 @@ sub TransformMarcToKohaOneField { my $res = ""; my ( $tagfield, $subfield ) = - GetMarcFromKohaField( "", $kohatable . "." . $kohafield, + GetMarcFromKohaField( $kohatable . "." . $kohafield, $frameworkcode ); foreach my $field ( $record->field($tagfield) ) { if ( $field->tag() < 10 ) { @@ -2477,7 +2477,7 @@ sub PrepareItemrecordDisplay { my $dbh = C4::Context->dbh; my $frameworkcode = &GetFrameworkCode( $bibnum ); my ( $itemtagfield, $itemtagsubfield ) = - &GetMarcFromKohaField( $dbh, "items.itemnumber", $frameworkcode ); + &GetMarcFromKohaField( "items.itemnumber", $frameworkcode ); my $tagslib = &GetMarcStructure( $dbh, 1, $frameworkcode ); my $itemrecord = GetMarcItem( $bibnum, $itemnum) if ($itemnum); my @loop_data; @@ -2816,7 +2816,7 @@ sub MARCitemchange { my $dbh = C4::Context->dbh; my ( $tagfield, $tagsubfield ) = - GetMarcFromKohaField( $dbh, $itemfield, "" ); + GetMarcFromKohaField( $itemfield, "" ); if ( ($tagfield) && ($tagsubfield) ) { my $tag = $record->field($tagfield); if ($tag) { @@ -3691,6 +3691,9 @@ Joshua Ferraro jmf@liblime.com # $Id$ # $Log$ +# Revision 1.201 2007/04/27 14:00:49 hdl +# Removing $dbh from GetMarcFromKohaField (dbh is not used in this function.) +# # Revision 1.200 2007/04/25 16:26:42 tipaul # Koha 3.0 nozebra 1st commit : the script misc/migration_tools/rebuild_nozebra.pl build the nozebra table, and, if you set NoZebra to Yes, queries will be done through zebra. TODO : # - add nozebra table management on biblio editing diff --git a/C4/Letters.pm b/C4/Letters.pm index 7374dcbba6..924f79dfb6 100644 --- a/C4/Letters.pm +++ b/C4/Letters.pm @@ -252,7 +252,7 @@ sub SendAlerts { foreach (@$alerts) { # and parse borrower ... my $innerletter = $letter; - my $borinfo = GetMember('',$_->{'borrowernumber'}); + my $borinfo = GetMember($_->{'borrowernumber'},'borrowernumber'); parseletter($innerletter,'borrowers',$_->{'borrowernumber'}); # ... then send mail if ($borinfo->{emailaddress}) { diff --git a/C4/Serials.pm b/C4/Serials.pm index b7785b7b2d..5ec3a74ece 100644 --- a/C4/Serials.pm +++ b/C4/Serials.pm @@ -1601,14 +1601,14 @@ sub ItemizeSerials { unless ($exists) { my $marcrecord = MARC::Record->new(); my ( $tag, $subfield ) = - GetMarcFromKohaField( $dbh, "items.barcode", $fwk ); + GetMarcFromKohaField( "items.barcode", $fwk ); my $newField = MARC::Field->new( "$tag", '', '', "$subfield" => $info->{barcode} ); $marcrecord->insert_fields_ordered($newField); if ( $info->{branch} ) { my ( $tag, $subfield ) = - GetMarcFromKohaField( $dbh, "items.homebranch", + GetMarcFromKohaField( "items.homebranch", $fwk ); #warn "items.homebranch : $tag , $subfield"; @@ -1623,7 +1623,7 @@ sub ItemizeSerials { $marcrecord->insert_fields_ordered($newField); } ( $tag, $subfield ) = - GetMarcFromKohaField( $dbh, "items.holdingbranch", + GetMarcFromKohaField( "items.holdingbranch", $fwk ); #warn "items.holdingbranch : $tag , $subfield"; @@ -1640,7 +1640,7 @@ sub ItemizeSerials { } if ( $info->{itemcallnumber} ) { my ( $tag, $subfield ) = - GetMarcFromKohaField( $dbh, "items.itemcallnumber", + GetMarcFromKohaField( "items.itemcallnumber", $fwk ); #warn "items.itemcallnumber : $tag , $subfield"; @@ -1657,7 +1657,7 @@ sub ItemizeSerials { } if ( $info->{notes} ) { my ( $tag, $subfield ) = - GetMarcFromKohaField( $dbh, "items.itemnotes", $fwk ); + GetMarcFromKohaField( "items.itemnotes", $fwk ); # warn "items.itemnotes : $tag , $subfield"; if ( $marcrecord->field($tag) ) { @@ -1673,7 +1673,7 @@ sub ItemizeSerials { } if ( $info->{location} ) { my ( $tag, $subfield ) = - GetMarcFromKohaField( $dbh, "items.location", $fwk ); + GetMarcFromKohaField( "items.location", $fwk ); # warn "items.location : $tag , $subfield"; if ( $marcrecord->field($tag) ) { @@ -1689,7 +1689,7 @@ sub ItemizeSerials { } if ( $info->{status} ) { my ( $tag, $subfield ) = - GetMarcFromKohaField( $dbh, "items.notforloan", + GetMarcFromKohaField( "items.notforloan", $fwk ); # warn "items.notforloan : $tag , $subfield"; @@ -1706,7 +1706,7 @@ sub ItemizeSerials { } if ( C4::Context->preference("RoutingSerials") ) { my ( $tag, $subfield ) = - GetMarcFromKohaField( $dbh, "items.dateaccessioned", + GetMarcFromKohaField( "items.dateaccessioned", $fwk ); if ( $marcrecord->field($tag) ) { $marcrecord->field($tag) diff --git a/barcodes/label-item-search.pl b/barcodes/label-item-search.pl index a54578b613..6f3176b780 100755 --- a/barcodes/label-item-search.pl +++ b/barcodes/label-item-search.pl @@ -62,7 +62,7 @@ if ( $op eq "do_search" ) { foreach my $marc (@marclist) { if ($marc) { my ( $tag, $subfield ) = - GetMarcFromKohaField( $dbh, $marc ); + GetMarcFromKohaField( $marc ); if ($tag) { push @tags, $dbh->quote("$tag$subfield"); } diff --git a/cataloguing/addbiblio.pl b/cataloguing/addbiblio.pl index dc5fa501fc..4d43487fa6 100755 --- a/cataloguing/addbiblio.pl +++ b/cataloguing/addbiblio.pl @@ -127,7 +127,7 @@ sub MARCfindbreeding { return -1; } else { if (C4::Context->preference("z3950NormalizeAuthor") and C4::Context->preference("z3950AuthorAuthFields")){ - my ($tag,$subfield) = GetMarcFromKohaField($dbh,"biblio.author"); + my ($tag,$subfield) = GetMarcFromKohaField("biblio.author"); # my $summary = C4::Context->preference("z3950authortemplate"); my $auth_fields = C4::Context->preference("z3950AuthorAuthFields"); my @auth_fields= split /,/,$auth_fields; @@ -518,8 +518,8 @@ my ($biblioitemnumtagfield,$biblioitemnumtagsubfield,$bibitem,$biblioitemnumber) if ($biblionumber) { $is_a_modif=1; # if it's a modif, retrieve bibli and biblioitem numbers for the future modification of old-DB. - ($biblionumtagfield,$biblionumtagsubfield) = &GetMarcFromKohaField($dbh,"biblio.biblionumber",$frameworkcode); - ($biblioitemnumtagfield,$biblioitemnumtagsubfield) = &GetMarcFromKohaField($dbh,"biblioitems.biblioitemnumber",$frameworkcode); + ($biblionumtagfield,$biblionumtagsubfield) = &GetMarcFromKohaField("biblio.biblionumber",$frameworkcode); + ($biblioitemnumtagfield,$biblioitemnumtagsubfield) = &GetMarcFromKohaField("biblioitems.biblioitemnumber",$frameworkcode); # search biblioitems value my $sth=$dbh->prepare("select biblioitemnumber from biblioitems where biblionumber=?"); $sth->execute($biblionumber); diff --git a/cataloguing/additem.pl b/cataloguing/additem.pl index eca945ab36..606e67c517 100755 --- a/cataloguing/additem.pl +++ b/cataloguing/additem.pl @@ -87,7 +87,7 @@ if ($op eq "additem") { my $record=MARC::Record::new_from_xml($xml, 'UTF-8'); # if autoBarcode is ON, calculate barcode... if (C4::Context->preference('autoBarcode')) { - my ($tagfield,$tagsubfield) = &GetMarcFromKohaField($dbh,"items.barcode"); + my ($tagfield,$tagsubfield) = &GetMarcFromKohaField("items.barcode",$frameworkcode); unless ($record->field($tagfield)->subfield($tagsubfield)) { my $sth_barcode = $dbh->prepare("select max(abs(barcode)) from items"); $sth_barcode->execute; @@ -175,8 +175,8 @@ my @fields = $temp->fields(); my %witness; #---- stores the list of subfields used at least once, with the "meaning" of the code my @big_array; #---- finds where items.itemnumber is stored -my ($itemtagfield,$itemtagsubfield) = &GetMarcFromKohaField($dbh,"items.itemnumber",$frameworkcode); -my ($branchtagfield,$branchtagsubfield) = &GetMarcFromKohaField($dbh,"items.homebranch",$frameworkcode); +my ($itemtagfield,$itemtagsubfield) = &GetMarcFromKohaField("items.itemnumber",$frameworkcode); +my ($branchtagfield,$branchtagsubfield) = &GetMarcFromKohaField("items.homebranch",$frameworkcode); foreach my $field (@fields) { next if ($field->tag()<10); @@ -206,7 +206,7 @@ foreach my $subfield_code (keys(%witness)) { $big_array[$i]{$subfield_code}=" " unless ($big_array[$i]{$subfield_code}); } } -my ($holdingbrtagf,$holdingbrtagsubf) = &GetMarcFromKohaField($dbh,"items.holdingbranch",$frameworkcode); +my ($holdingbrtagf,$holdingbrtagsubf) = &GetMarcFromKohaField("items.holdingbranch",$frameworkcode); @big_array = sort {$a->{$holdingbrtagsubf} cmp $b->{$holdingbrtagsubf}} @big_array; # now, construct template ! diff --git a/circ/branchoverdues.pl b/circ/branchoverdues.pl index 8d4cf9ce74..7fd09edfae 100755 --- a/circ/branchoverdues.pl +++ b/circ/branchoverdues.pl @@ -106,7 +106,7 @@ my $counter = 0; my @getoverdues = GetOverduesForBranch( $default, $location ); # search for location authorised value -my ($tag,$subfield) = GetMarcFromKohaField($dbh,'items.location',''); +my ($tag,$subfield) = GetMarcFromKohaField('items.location',''); my $tagslib = &GetMarcStructure($dbh,1,''); if ($tagslib->{$tag}->{$subfield}->{authorised_value}) { my $values= GetAuthorisedValues($tagslib->{$tag}->{$subfield}->{authorised_value}); diff --git a/members/borrowers_details.pl b/members/borrowers_details.pl index 0e4a2e857d..0aa987acc0 100644 --- a/members/borrowers_details.pl +++ b/members/borrowers_details.pl @@ -26,14 +26,13 @@ # Suite 330, Boston, MA 02111-1307 USA use strict; +use Date::Manip; +use CGI; use C4::Auth; use C4::Context; use C4::Output; -use CGI; use C4::Members; use C4::Koha; - -use Date::Manip; use C4::Date; use C4::Input; use C4::Log; @@ -70,11 +69,9 @@ $template->param( borrowernumber => $borrowernumber,#register number categorycode => $data{'categorycode'}, title => $data{'title'}, category_type => $borrowercategory ->{'category_type'}, - # # "title_".$data{'title'} => " SELECTED ", dateofbirth => format_date($data{'dateofbirth'}), description => $borrowercategory->{'description'} -# ); $template->param(Institution => 1) if ($category_type eq "I"); output_html_with_http_headers $input, $cookie, $template->output; diff --git a/misc/cronjobs/update_items.pl b/misc/cronjobs/update_items.pl index 803a256cbf..97afefcbcd 100644 --- a/misc/cronjobs/update_items.pl +++ b/misc/cronjobs/update_items.pl @@ -103,8 +103,8 @@ print "fetching marc and items data, updating\n"; # # 1st : find where some informations are hidden : itemnumber, date_due, popularity # -my ($itemnumberTag,$itemnumberSubfield) = GetMarcFromKohaField($dbh,"items.itemnumber",""); -my ($date_dueTag,$date_dueSubfield) = GetMarcFromKohaField($dbh,"items.issues",""); +my ($itemnumberTag,$itemnumberSubfield) = GetMarcFromKohaField("items.itemnumber",""); +my ($date_dueTag,$date_dueSubfield) = GetMarcFromKohaField("items.issues",""); my ( while (my $biblionumber=$biblionumber_sth->fetchrow) { $count++; diff --git a/misc/exportauth.pl b/misc/exportauth.pl index acbc1cf990..b1dad03a71 100644 --- a/misc/exportauth.pl +++ b/misc/exportauth.pl @@ -7,7 +7,6 @@ use strict; require Exporter; use C4::Auth; -use C4::Interface::CGI::Output; use C4::Output; # contains gettemplate use C4::Biblio; use CGI; diff --git a/misc/marcimport_to_biblioitems.pl b/misc/marcimport_to_biblioitems.pl index 8dda84fe56..cc80d5e902 100644 --- a/misc/marcimport_to_biblioitems.pl +++ b/misc/marcimport_to_biblioitems.pl @@ -44,7 +44,7 @@ my $batch = MARC::Batch->new( 'USMARC', $input_marc_file ); $batch->warnings_off(); $batch->strict_off(); my $i=0; -my ($tagfield,$biblionumtagsubfield) = &GetMarcFromKohaField($dbh,"biblio.biblionumber",""); +my ($tagfield,$biblionumtagsubfield) = &GetMarcFromKohaField("biblio.biblionumber",""); while ( my $record = $batch->next() ) { my $biblionumber=$record->field($tagfield)->subfield($biblionumtagsubfield); diff --git a/misc/migration_tools/22_to_30/missing090field.pl b/misc/migration_tools/22_to_30/missing090field.pl index 9e95f8a200..79174467db 100755 --- a/misc/migration_tools/22_to_30/missing090field.pl +++ b/misc/migration_tools/22_to_30/missing090field.pl @@ -28,8 +28,8 @@ while (my ($biblionumber,$biblioitemnumber)=$sth->fetchrow ){ sub MARCmodbiblionumber{ my ($biblionumber,$biblioitemnumber,$record)=@_; - my ($tagfield,$biblionumtagsubfield) = &GetMarcFromKohaField($dbh,"biblio.biblionumber",""); - my ($tagfield2,$biblioitemtagsubfield) = &GetMarcFromKohaField($dbh,"biblio.biblioitemnumber",""); + my ($tagfield,$biblionumtagsubfield) = &GetMarcFromKohaField("biblio.biblionumber",""); + my ($tagfield2,$biblioitemtagsubfield) = &GetMarcFromKohaField("biblio.biblioitemnumber",""); my $update=0; my @tags = $record->field($tagfield); diff --git a/misc/missing090field.pl b/misc/missing090field.pl index feb2a3ec26..e0552e3e0b 100755 --- a/misc/missing090field.pl +++ b/misc/missing090field.pl @@ -27,8 +27,8 @@ while (my ($biblionumber,$biblioitemnumber)=$sth->fetchrow ){ sub MARCmodbiblionumber{ my ($biblionumber,$biblioitemnumber,$record)=@_; -my ($tagfield,$biblionumtagsubfield) = &GetMarcFromKohaField($dbh,"biblio.biblionumber",""); -my ($tagfield2,$biblioitemtagsubfield) = &GetMarcFromKohaField($dbh,"biblio.biblioitemnumber",""); +my ($tagfield,$biblionumtagsubfield) = &GetMarcFromKohaField("biblio.biblionumber",""); +my ($tagfield2,$biblioitemtagsubfield) = &GetMarcFromKohaField("biblio.biblioitemnumber",""); my $update=0; my @tags = $record->field($tagfield); diff --git a/misc/rebuildnonmarc.pl b/misc/rebuildnonmarc.pl index 05115a9aa3..576af5d55c 100755 --- a/misc/rebuildnonmarc.pl +++ b/misc/rebuildnonmarc.pl @@ -43,7 +43,7 @@ $|=1; # flushes output my $starttime = gettimeofday; #1st of all, find item MARC tag. -my ($tagfield,$tagsubfield) = &GetMarcFromKohaField($dbh,"items.itemnumber",''); +my ($tagfield,$tagsubfield) = &GetMarcFromKohaField("items.itemnumber",''); # $dbh->do("lock tables biblio write, biblioitems write, items write, marc_biblio write, marc_subfield_table write, marc_blob_subfield write, marc_word write, marc_subfield_structure write, stopwords write"); my $sth = $dbh->prepare("select bibid from marc_biblio"); $sth->execute; diff --git a/opac/opac-MARCdetail.pl b/opac/opac-MARCdetail.pl index 1d156917a4..f945d4ffb1 100755 --- a/opac/opac-MARCdetail.pl +++ b/opac/opac-MARCdetail.pl @@ -235,7 +235,7 @@ foreach my $field (@fields) { } } my ( $holdingbrtagf, $holdingbrtagsubf ) = - &GetMarcFromKohaField( $dbh, "items.holdingbranch", $itemtype ); + &GetMarcFromKohaField( "items.holdingbranch", $itemtype ); @big_array = sort { $a->{$holdingbrtagsubf} cmp $b->{$holdingbrtagsubf} } @big_array; diff --git a/serials/serials-edit.pl b/serials/serials-edit.pl index b6f0e943d1..e664457c36 100755 --- a/serials/serials-edit.pl +++ b/serials/serials-edit.pl @@ -211,7 +211,7 @@ if ($op eq 'serialchangestatus') { if ($item=~/^N/){ #New Item # if autoBarcode is ON, calculate barcode... - my ($tagfield,$tagsubfield) = &GetMarcFromKohaField($dbh,"items.barcode"); + my ($tagfield,$tagsubfield) = &GetMarcFromKohaField("items.barcode"); if (C4::Context->preference('autoBarcode')) { unless ($record->field($tagfield)->subfield($tagsubfield)) { my $sth_barcode = $dbh->prepare("select max(abs(barcode)) from items"); diff --git a/tools/export.pl b/tools/export.pl index 540f6e8771..0d1a7b52f8 100755 --- a/tools/export.pl +++ b/tools/export.pl @@ -88,7 +88,7 @@ if ($op eq "export") { if ( $dont_export_items ) { # now, find where the itemnumber is stored & extract only the item my ( $itemnumberfield, $itemnumbersubfield ) = - GetMarcFromKohaField( $dbh, 'items.itemnumber', '' ); + GetMarcFromKohaField( 'items.itemnumber', '' ); # and delete it. foreach ($record->field($itemnumberfield)){ -- 2.20.1