Browse Source

Removing $dbh from GetMarcFromKohaField (dbh is not used in this function.)

3.0.x
hdl 15 years ago
parent
commit
097fef712a
  1. 29
      C4/Biblio.pm
  2. 2
      C4/Letters.pm
  3. 16
      C4/Serials.pm
  4. 2
      barcodes/label-item-search.pl
  5. 6
      cataloguing/addbiblio.pl
  6. 8
      cataloguing/additem.pl
  7. 2
      circ/branchoverdues.pl
  8. 7
      members/borrowers_details.pl
  9. 4
      misc/cronjobs/update_items.pl
  10. 1
      misc/exportauth.pl
  11. 2
      misc/marcimport_to_biblioitems.pl
  12. 4
      misc/migration_tools/22_to_30/missing090field.pl
  13. 4
      misc/missing090field.pl
  14. 2
      misc/rebuildnonmarc.pl
  15. 2
      opac/opac-MARCdetail.pl
  16. 2
      serials/serials-edit.pl
  17. 2
      tools/export.pl

29
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

2
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}) {

16
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)

2
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");
}

6
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);

8
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}="&nbsp;" 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 !

2
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});

7
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;

4
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++;

1
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;

2
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);

4
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);

4
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);

2
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;

2
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;

2
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");

2
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)){

Loading…
Cancel
Save