# 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;
}
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) {
# 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) {
$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) {
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(
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(
=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
=cut
sub GetMarcFromKohaField {
- my ( $dbh, $kohafield, $frameworkcode ) = @_;
+ my ( $kohafield, $frameworkcode ) = @_;
return 0, 0 unless $kohafield;
my $relations = C4::Context->marcfromkohafield;
return (
$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 ) {
my $res = "";
my ( $tagfield, $subfield ) =
- GetMarcFromKohaField( "", $kohatable . "." . $kohafield,
+ GetMarcFromKohaField( $kohatable . "." . $kohafield,
$frameworkcode );
foreach my $field ( $record->field($tagfield) ) {
if ( $field->tag() < 10 ) {
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;
my $dbh = C4::Context->dbh;
my ( $tagfield, $tagsubfield ) =
- GetMarcFromKohaField( $dbh, $itemfield, "" );
+ GetMarcFromKohaField( $itemfield, "" );
if ( ($tagfield) && ($tagsubfield) ) {
my $tag = $record->field($tagfield);
if ($tag) {
# $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
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}) {
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";
$marcrecord->insert_fields_ordered($newField);
}
( $tag, $subfield ) =
- GetMarcFromKohaField( $dbh, "items.holdingbranch",
+ GetMarcFromKohaField( "items.holdingbranch",
$fwk );
#warn "items.holdingbranch : $tag , $subfield";
}
if ( $info->{itemcallnumber} ) {
my ( $tag, $subfield ) =
- GetMarcFromKohaField( $dbh, "items.itemcallnumber",
+ GetMarcFromKohaField( "items.itemcallnumber",
$fwk );
#warn "items.itemcallnumber : $tag , $subfield";
}
if ( $info->{notes} ) {
my ( $tag, $subfield ) =
- GetMarcFromKohaField( $dbh, "items.itemnotes", $fwk );
+ GetMarcFromKohaField( "items.itemnotes", $fwk );
# warn "items.itemnotes : $tag , $subfield";
if ( $marcrecord->field($tag) ) {
}
if ( $info->{location} ) {
my ( $tag, $subfield ) =
- GetMarcFromKohaField( $dbh, "items.location", $fwk );
+ GetMarcFromKohaField( "items.location", $fwk );
# warn "items.location : $tag , $subfield";
if ( $marcrecord->field($tag) ) {
}
if ( $info->{status} ) {
my ( $tag, $subfield ) =
- GetMarcFromKohaField( $dbh, "items.notforloan",
+ GetMarcFromKohaField( "items.notforloan",
$fwk );
# warn "items.notforloan : $tag , $subfield";
}
if ( C4::Context->preference("RoutingSerials") ) {
my ( $tag, $subfield ) =
- GetMarcFromKohaField( $dbh, "items.dateaccessioned",
+ GetMarcFromKohaField( "items.dateaccessioned",
$fwk );
if ( $marcrecord->field($tag) ) {
$marcrecord->field($tag)
foreach my $marc (@marclist) {
if ($marc) {
my ( $tag, $subfield ) =
- GetMarcFromKohaField( $dbh, $marc );
+ GetMarcFromKohaField( $marc );
if ($tag) {
push @tags, $dbh->quote("$tag$subfield");
}
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;
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);
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;
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);
$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 !
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});
# 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;
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;
#
# 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++;
require Exporter;
use C4::Auth;
-use C4::Interface::CGI::Output;
use C4::Output; # contains gettemplate
use C4::Biblio;
use CGI;
$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);
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);
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);
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;
}
}
my ( $holdingbrtagf, $holdingbrtagsubf ) =
- &GetMarcFromKohaField( $dbh, "items.holdingbranch", $itemtype );
+ &GetMarcFromKohaField( "items.holdingbranch", $itemtype );
@big_array =
sort { $a->{$holdingbrtagsubf} cmp $b->{$holdingbrtagsubf} } @big_array;
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");
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)){