[Koha-cvs] koha/C4 Biblio.pm [dev_week]
Joshua Ferraro
jmf at kados.org
Mon Sep 25 01:33:08 CEST 2006
CVSROOT: /sources/koha
Module name: koha
Branch: dev_week
Changes by: Joshua Ferraro <kados> 06/09/24 23:33:08
Modified files:
C4 : Biblio.pm
Log message:
renaming the remaining OLD subs to _koha_*
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/C4/Biblio.pm?cvsroot=koha&only_with_tag=dev_week&r1=1.115.2.51.2.27&r2=1.115.2.51.2.28
Patches:
Index: Biblio.pm
===================================================================
RCS file: /sources/koha/koha/C4/Biblio.pm,v
retrieving revision 1.115.2.51.2.27
retrieving revision 1.115.2.51.2.28
diff -u -b -r1.115.2.51.2.27 -r1.115.2.51.2.28
--- Biblio.pm 24 Sep 2006 23:10:01 -0000 1.115.2.51.2.27
+++ Biblio.pm 24 Sep 2006 23:33:07 -0000 1.115.2.51.2.28
@@ -155,7 +155,7 @@
foreach my $addiauthfield (@addiauthfields) {
my @addiauthsubfields = $addiauthfield->subfield($tagsubfield);
foreach my $subfieldcount ( 0 .. $#addiauthsubfields ) {
- OLDmodaddauthor( $dbh, $oldbibnum, $addiauthsubfields[$subfieldcount] );
+ _koha_modify_additionalauthor( $dbh, $oldbibnum, $addiauthsubfields[$subfieldcount] );
}
}
( $tagfield, $tagsubfield ) = MARCfind_marc_from_kohafield( $dbh, "bibliosubtitle.subtitle",$frameworkcode );
@@ -163,7 +163,7 @@
foreach my $subtitlefield (@subtitlefields) {
my @subtitlesubfields = $subtitlefield->subfield($tagsubfield);
foreach my $subfieldcount ( 0 .. $#subtitlesubfields ) {
- OLDnewsubtitle( $dbh, $oldbibnum, $subtitlesubfields[$subfieldcount] );
+ _koha_add_subtitle( $dbh, $oldbibnum, $subtitlesubfields[$subfieldcount] );
}
}
( $tagfield, $tagsubfield ) = MARCfind_marc_from_kohafield( $dbh, "bibliosubject.subject",$frameworkcode );
@@ -175,7 +175,7 @@
push @subjects, $subjsubfield[$subfieldcount];
}
}
- OLDmodsubject( $dbh, $oldbibnum, 1, @subjects );
+ _koha_modify_subject( $dbh, $oldbibnum, 1, @subjects );
# we must add bibnum and bibitemnum in MARC::Record...
# we build the new field with biblionumber and biblioitemnumber
@@ -347,19 +347,19 @@
foreach my $addiauthfield (@addiauthfields) {
my @addiauthsubfields = $addiauthfield->subfield($tagsubfield);
foreach my $subfieldcount (0..$#addiauthsubfields) {
- OLDmodaddauthor($dbh,$oldbiblionumber,$addiauthsubfields[$subfieldcount]);
+ _koha_modify_additionalauthor($dbh,$oldbiblionumber,$addiauthsubfields[$subfieldcount]);
}
}
($tagfield,$tagsubfield) = MARCfind_marc_from_kohafield($dbh,"bibliosubtitle.subtitle",$frameworkcode);
my @subtitlefields = $record->field($tagfield);
foreach my $subtitlefield (@subtitlefields) {
my @subtitlesubfields = $subtitlefield->subfield($tagsubfield);
- # delete & create subtitle again because OLDmodsubtitle can't handle new subtitles
+ # delete & create subtitle again because _koha_modify_subtitle can't handle new subtitles
# between 2 modifs
$dbh->do("delete from bibliosubtitle where biblionumber=$oldbiblionumber");
foreach my $subfieldcount (0..$#subtitlesubfields) {
foreach my $subtit(split /\||#/,$subtitlesubfields[$subfieldcount]) {
- OLDnewsubtitle($dbh,$oldbiblionumber,$subtit);
+ _koha_add_subtitle($dbh,$oldbiblionumber,$subtit);
}
}
}
@@ -372,7 +372,7 @@
push @subjects,$subjsubfield[$subfieldcount];
}
}
- OLDmodsubject($dbh,$oldbiblionumber,1, at subjects);
+ _koha_modify_subject($dbh,$oldbiblionumber,1, at subjects);
return 1;
}
@@ -606,6 +606,12 @@
return $serviceOptions;
}
+=head1 FUNCTIONS FOR HANDLING MARC MANAGEMENT
+
+=head2 MARCgettagslib
+
+=cut
+
sub MARCgettagslib {
my ( $dbh, $forlibrarian, $frameworkcode ) = @_;
$frameworkcode = "" unless $frameworkcode;
@@ -673,6 +679,10 @@
return $res;
}
+=head2 MARCfind_marc_from_kohafield
+
+=cut
+
sub MARCfind_marc_from_kohafield {
my ( $dbh, $kohafield,$frameworkcode ) = @_;
return 0, 0 unless $kohafield;
@@ -680,12 +690,16 @@
return ($relations->{$frameworkcode}->{$kohafield}->[0],$relations->{$frameworkcode}->{$kohafield}->[1]);
}
+=head2 MARCfind_MARCbibid_from_oldbiblionumber
+
+=cut
+
sub MARCfind_MARCbibid_from_oldbiblionumber {
my ( $dbh, $oldbiblionumber ) = @_;
return $oldbiblionumber;
}
-=item MARCaddbiblio
+=head2 MARCaddbiblio
&MARCaddbiblio($dbh,$newrec,$biblionumber,$frameworkcode);
@@ -712,6 +726,10 @@
return $biblionumber;
}
+=head2 MARCadditem
+
+=cut
+
sub MARCadditem {
# pass the MARC::Record to this function, and it will create the records in the marc tables
my ($dbh,$record,$biblionumber) = @_;
@@ -727,6 +745,10 @@
return $biblionumber;
}
+=head2 MARCgetbiblio
+
+=cut
+
sub MARCgetbiblio {
# Returns MARC::Record of the biblio passed in parameter.
my ( $dbh, $bibid ) = @_;
@@ -748,6 +770,11 @@
return $marcxml;
}
+
+=head2 MARCgetbiblio2
+
+=cut
+
sub MARCgetbiblio2 {
# Returns MARC::Record of the biblio passed in parameter.
@@ -769,6 +796,10 @@
}
}
+=head2 MARCgetitem_frombarcode
+
+=cut
+
sub MARCgetitem_frombarcode {
my ( $dbh, $biblionumber, $barcode ) = @_;
@@ -794,6 +825,10 @@
return $itemrecord;
}
+=head2 MARCgetitem
+
+=cut
+
sub MARCgetitem {
# Returns MARC::Record of the item passed in parameter.
my ( $dbh, $bibid, $itemnumber ) = @_;
@@ -821,7 +856,7 @@
return $newrecord;
}
-=item MARCmodbiblio
+=head2 MARCmodbiblio
MARCmodbibio($dbh,$bibid,$record,$frameworkcode,1);
@@ -849,6 +884,10 @@
&MARCaddbiblio($dbh,$newrec,$biblionumber,$frameworkcode);
}
+=head2 MARCdelbiblio
+
+=cut
+
sub MARCdelbiblio {
my ( $dbh, $bibid, $keep_items ) = @_;
@@ -884,6 +923,10 @@
return $record;
}
+=head2 MARCdelitem
+
+=cut
+
sub MARCdelitem {
# delete the item passed in parameter in MARC tables.
@@ -916,15 +959,19 @@
return $record;
}
+=head2 MARCmoditemonefield
+
+=cut
+
sub MARCmoditemonefield{
-my ($dbh,$biblionumber,$itemnumber,$itemfield,$newvalue)=@_;
-if (!defined $newvalue){
-$newvalue="";
-}
+ my ($dbh,$biblionumber,$itemnumber,$itemfield,$newvalue)=@_;
+ if (!defined $newvalue){
+ $newvalue="";
+ }
-my $record = MARCgetitem($dbh,$biblionumber,$itemnumber);
+ my $record = MARCgetitem($dbh,$biblionumber,$itemnumber);
-my $sth =
+ my $sth =
$dbh->prepare(
"select tagfield,tagsubfield from marc_subfield_structure where kohafield=?"
);
@@ -933,7 +980,6 @@
$sth->execute($itemfield);
if ( ( $tagfield, $tagsubfield ) = $sth->fetchrow ) {
my $tag = $record->field($tagfield);
-
if ( $tag) {
my $tagsubs=$record->field($tagfield)->subfield($tagsubfield);
@@ -948,6 +994,10 @@
}
+=head2 MARCmoditem
+
+=cut
+
sub MARCmoditem {
my ($dbh,$record,$bibid,$itemnumber,$delete)=@_;
my $biblionumber = $bibid;
@@ -970,6 +1020,10 @@
}
+=head2 MARCmodsubfield
+
+=cut
+
sub MARCmodsubfield {
# Subroutine changes a subfield value given a subfieldid.
@@ -1032,6 +1086,10 @@
return ( $subfieldid, $subfieldvalue );
}
+=head2 MARCfindsubfield
+
+=cut
+
sub MARCfindsubfield {
my ( $dbh, $bibid, $tag, $subfieldcode, $subfieldorder, $subfieldvalue ) =
@_;
@@ -1069,6 +1127,10 @@
}
}
+=head2 MARCfindsubfieldid
+
+=cut
+
sub MARCfindsubfieldid {
my ( $dbh, $bibid, $tag, $tagorder, $subfield, $subfieldorder ) = @_;
my $sth = $dbh->prepare( "select subfieldid from marc_subfield_table
@@ -1088,6 +1150,10 @@
return $res;
}
+=head2 MARCfind_frameworkcode
+
+=cut
+
sub MARCfind_frameworkcode {
my ( $dbh, $bibid ) = @_;
my $sth =
@@ -1097,6 +1163,10 @@
return $frameworkcode;
}
+=head2 MARCdelsubfield
+
+=cut
+
sub MARCdelsubfield {
# delete a subfield for $bibid / tag / tagorder / subfield / subfieldorder
@@ -1115,6 +1185,10 @@
}
}
+=head MARCkoha2marcBiblio
+
+=cut
+
sub MARCkoha2marcBiblio {
# this function builds partial MARC::Record from the old koha-DB fields
@@ -1192,6 +1266,10 @@
return $record;
}
+=head2 MARCkoha2marcItem
+
+=cut
+
sub MARCkoha2marcItem {
# this function builds partial MARC::Record from the old koha-DB fields
@@ -1227,6 +1305,9 @@
return $record;
}
+=head2 MARCkoha2marcSubtitle
+
+=cut
sub MARCkoha2marcSubtitle {
# this function builds partial MARC::Record from the old koha-DB fields
@@ -1241,6 +1322,10 @@
return $record;
}
+=head2 MARCkoha2marcOnefield
+
+=cut
+
sub MARCkoha2marcOnefield {
my ( $sth, $record, $kohafieldname, $value,$frameworkcode ) = @_;
my $tagfield;
@@ -1271,6 +1356,10 @@
return $record;
}
+=head MARChtml2xml
+
+=cut
+
sub MARChtml2xml {
my ($tags,$subfields,$values,$indicator,$ind_tag) = @_;
#use MARC::File::XML;
@@ -1340,6 +1429,10 @@
return $xml;
}
+=head2 MARChtml2marc
+
+=cut
+
sub MARChtml2marc {
my ($dbh,$rtags,$rsubfields,$rvalues,%indicators) = @_;
my $prevtag = -1;
@@ -1398,6 +1491,10 @@
return $record;
}
+=head MARCmarc2koha
+
+=cut
+
sub MARCmarc2koha {
my ($dbh,$record,$frameworkcode) = @_;
my $sth=$dbh->prepare("select tagfield,tagsubfield from marc_subfield_structure where frameworkcode=? and kohafield=?");
@@ -1445,6 +1542,10 @@
return $result;
}
+=head2 MARCmarc2kohaOneField
+
+=cut
+
sub MARCmarc2kohaOneField {
# FIXME ? if a field has a repeatable subfield that is used in old-db, only the 1st will be retrieved...
@@ -1481,6 +1582,10 @@
return $result;
}
+=head2 MARCaddword
+
+=cut
+
sub MARCaddword {
# split a subfield string and adds it into the word table.
@@ -1509,6 +1614,10 @@
}
}
+=head2 MARCdelword
+
+=cut
+
sub MARCdelword {
# delete words. this sub deletes all the words from a sentence. a subfield modif is done by a delete then a add
@@ -1520,7 +1629,24 @@
$sth->execute( $bibid, $tag, $subfield, $tagorder, $subfieldorder );
}
-=item ModBiblioframework
+=head2 MARCitemchange
+
+=cut
+
+sub MARCitemchange {
+ my ($dbh,$record,$itemfield,$newvalue)=@_;
+ my ($tagfield, $tagsubfield)=MARCfind_marc_from_kohafield($dbh,$itemfield,"");
+ if (($tagfield) && ($tagsubfield)) {
+ my $tag = $record->field($tagfield);
+ if ( $tag) {
+ $tag->update($tagsubfield => $newvalue);
+ $record->delete_field($tag);
+ $record->insert_fields_ordered($tag);
+ }
+ }
+}
+
+=head2 ModBiblioframework
=over 4
@@ -1539,22 +1665,9 @@
return 1;
}
-sub MARCitemchange {
- my ($dbh,$record,$itemfield,$newvalue)=@_;
- my ($tagfield, $tagsubfield)=MARCfind_marc_from_kohafield($dbh,$itemfield,"");
- if (($tagfield) && ($tagsubfield)) {
- my $tag = $record->field($tagfield);
- if ( $tag) {
- $tag->update($tagsubfield => $newvalue);
- $record->delete_field($tag);
- $record->insert_fields_ordered($tag);
- }
- }
-}
-
=head1 INTERNAL FUNCTIONS
-=item _koha_add_biblio
+=head2 _koha_add_biblio
=over 4
@@ -1596,7 +1709,7 @@
return ($bibnum);
}
-=item _koha_modify_biblio
+=head2 _koha_modify_biblio
over 4
@@ -1621,7 +1734,11 @@
return ( $biblio->{'biblionumber'} );
}
-sub OLDmodsubtitle {
+=head2 _koha_modify_subtitle
+
+=cut
+
+sub _koha_modify_subtitle {
my ( $dbh, $bibnum, $subtitle ) = @_;
my $sth =
$dbh->prepare(
@@ -1630,7 +1747,7 @@
$sth->finish;
} # sub modsubtitle
-sub OLDmodaddauthor {
+sub _koha_modify_additionalauthor {
my ( $dbh, $bibnum, @authors ) = @_;
# my $dbh = C4Connect;
@@ -1653,7 +1770,7 @@
}
} # sub modaddauthor
-sub OLDmodsubject {
+sub _koha_modify_subject {
my ( $dbh, $bibnum, $force, @subject ) = @_;
# my $dbh = C4Connect;
@@ -1772,7 +1889,7 @@
}
}
-sub OLDmodnote {
+sub _koha_modify_note {
my ( $dbh, $bibitemnum, $note ) = @_;
# my $dbh=C4Connect;
@@ -1845,7 +1962,7 @@
return ($bibitemnum);
}
-sub OLDnewsubject {
+sub _koha_add_subject {
my ( $dbh, $bibnum ) = @_;
my $sth =
$dbh->prepare("insert into bibliosubject (biblionumber) values (?)");
@@ -1853,7 +1970,7 @@
$sth->finish;
}
-sub OLDnewsubtitle {
+sub _koha_add_subtitle {
my ( $dbh, $bibnum, $subtitle ) = @_;
my $sth =
$dbh->prepare(
@@ -2038,7 +2155,7 @@
# $dbh->disconnect;
}
-sub OLDdeletebiblioitem {
+sub _koha_delete_biblioitem {
my ( $dbh, $biblioitemnumber ) = @_;
# my $dbh = C4Connect;
@@ -2278,7 +2395,7 @@
sub modsubtitle {
my ( $bibnum, $subtitle ) = @_;
my $dbh = C4::Context->dbh;
- &OLDmodsubtitle( $dbh, $bibnum, $subtitle );
+ &_koha_modify_subtitle( $dbh, $bibnum, $subtitle );
} # sub modsubtitle
=item modaddauthor
@@ -2294,7 +2411,7 @@
sub modaddauthor {
my ( $bibnum, @authors ) = @_;
my $dbh = C4::Context->dbh;
- &OLDmodaddauthor( $dbh, $bibnum, @authors );
+ &_koha_modify_additionalauthor( $dbh, $bibnum, @authors );
} # sub modaddauthor
=item modsubject
@@ -2310,7 +2427,7 @@
sub modsubject {
my ( $bibnum, $force, @subject ) = @_;
my $dbh = C4::Context->dbh;
- my $error = &OLDmodsubject( $dbh, $bibnum, $force, @subject );
+ my $error = &_koha_modify_subject( $dbh, $bibnum, $force, @subject );
if ($error eq ''){
# When MARC is off, ensures that the MARC biblio table gets updated with new
# subjects, of course, it deletes the biblio in marc, and then recreates.
@@ -2327,7 +2444,7 @@
sub modnote {
my ( $bibitemnum, $note ) = @_;
my $dbh = C4::Context->dbh;
- &OLDmodnote( $dbh, $bibitemnum, $note );
+ &_koha_modify_note( $dbh, $bibitemnum, $note );
}
sub newbiblioitem {
@@ -2346,13 +2463,13 @@
sub newsubject {
my ($bibnum) = @_;
my $dbh = C4::Context->dbh;
- &OLDnewsubject( $dbh, $bibnum );
+ &_koha_add_subject( $dbh, $bibnum );
}
sub newsubtitle {
my ( $bibnum, $subtitle ) = @_;
my $dbh = C4::Context->dbh;
- &OLDnewsubtitle( $dbh, $bibnum, $subtitle );
+ &_koha_add_subtitle( $dbh, $bibnum, $subtitle );
}
sub newitems {
@@ -3014,8 +3131,11 @@
=cut
-# $Id: Biblio.pm,v 1.115.2.51.2.27 2006/09/24 23:10:01 kados Exp $
+# $Id: Biblio.pm,v 1.115.2.51.2.28 2006/09/24 23:33:07 kados Exp $
# $Log: Biblio.pm,v $
+# Revision 1.115.2.51.2.28 2006/09/24 23:33:07 kados
+# renaming the remaining OLD subs to _koha_*
+#
# Revision 1.115.2.51.2.27 2006/09/24 23:10:01 kados
# improving POD
#
More information about the Koha-cvs
mailing list