Code cleaning :
authortipaul <tipaul>
Thu, 29 Mar 2007 13:30:31 +0000 (13:30 +0000)
committertipaul <tipaul>
Thu, 29 Mar 2007 13:30:31 +0000 (13:30 +0000)
== Biblio.pm cleaning (useless) ==
* some sub declaration dropped
* removed modbiblio sub
* removed moditem sub
* removed newitems. It was used only in finishrecieve. Replaced by a Koha2Marc+AddItem, that is better.
* removed MARCkoha2marcItem
* removed MARCdelsubfield declaration
* removed MARCkoha2marcBiblio

== Biblio.pm cleaning (naming conventions) ==
* MARCgettagslib renamed to GetMarcStructure
* MARCgetitems renamed to GetMarcItem
* MARCfind_frameworkcode renamed to GetFrameworkCode
* MARCmarc2koha renamed to TransformMarcToKoha
* MARChtml2marc renamed to TransformHtmlToMarc
* MARChtml2xml renamed to TranformeHtmlToXml
* zebraop renamed to ModZebra

== MARC=OFF ==
* removing MARC=OFF related scripts (in cataloguing directory)
* removed checkitems (function related to MARC=off feature, that is completly broken in head. If someone want to reintroduce it, hard work coming...)
* removed getitemsbybiblioitem (used only by MARC=OFF scripts, that is removed as well)

33 files changed:
C4/AuthoritiesMarc.pm
C4/Biblio.pm
C4/Breeding.pm
C4/Context.pm
C4/Search.pm
C4/Serials.pm
acqui/finishreceive.pl
acqui/neworderbiblio.pl
authorities/authorities.pl
barcodes/label-item-search.pl
catalogue/ISBDdetail.pl
catalogue/MARCdetail.pl
cataloguing/addbiblio.pl
cataloguing/addbooks.pl
cataloguing/additem.pl
cataloguing/value_builder/unimarc_field_4XX.pl
cataloguing/z3950_search.pl
koha-tmpl/intranet-tmpl/prog/en/cataloguing/addbooks.tmpl
misc/cleanmarcdb.pl
misc/cronjobs/update_items.pl
misc/marcimport_to_biblioitems.pl
misc/migration_tools/22_to_30/missing090field.pl
misc/migration_tools/22_to_30/move_marc_to_biblioitems.pl
misc/migration_tools/bulkmarcimport.pl
misc/migration_tools/rebuild_zebra.pl
misc/missing090field.pl
misc/rebuildnonmarc.pl
opac/opac-ISBDdetail.pl
opac/opac-MARCdetail.pl
serials/serials-edit.pl
serials/serials-recieve.pl
serials/subscription-bib-search.pl
tools/export.pl

index 49ddb53..5a4021b 100644 (file)
@@ -414,7 +414,7 @@ sub AUTHaddauthority {
       $sth->finish;
     }
     $dbh->do("unlock tables");
-    zebraop($authid,'specialUpdate',"authorityserver");
+    ModZebra($authid,'specialUpdate',"authorityserver");
 
 # if ($record->field($linkidfield)){
 # my @fields=$record->field($linkidfield);
@@ -442,7 +442,7 @@ sub AUTHaddlink{
   $sth->execute($record->as_usmarc,$linkid);
   $sth->finish;
   $dbh->do("unlock tables");
-  zebraop($linkid,'specialUpdate',"authorityserver");
+  ModZebra($linkid,'specialUpdate',"authorityserver");
 }
 
 sub AUTH2marcOnefieldlink {
@@ -535,7 +535,7 @@ my    $linkid=$field->subfield($linkidsubfield) ;
             if ($linkfield->subfield($linkidsubfield2) eq $authid){
                 $linkrecord->delete_field($linkfield);
                 $sth->execute($linkrecord->as_usmarc,$linkid);
-                zebraop($linkid,'specialUpdate',"authorityserver");
+                ModZebra($linkid,'specialUpdate',"authorityserver");
             }
             }#foreach linkfield
     }
@@ -571,7 +571,7 @@ sub AUTHdelauthority {
     my $dbh=C4::Context->dbh;
 # if the keep_biblio is set to 1, then authority entries in biblio are preserved.
 
-zebraop($authid,"recordDelete","authorityserver");
+ModZebra($authid,"recordDelete","authorityserver");
     $dbh->do("delete from auth_header where authid=$authid") ;
 
 # FIXME : delete or not in biblio tables (depending on $keep_biblio flag)
@@ -931,10 +931,10 @@ my $update;
         $update=1;
         }#for each tag
     }#foreach tagfield
-        my $oldbiblio = MARCmarc2koha($dbh,$marcrecord,"") ;
+        my $oldbiblio = TransformMarcToKoha($dbh,$marcrecord,"") ;
         if ($update==1){
         # FIXME : this NEWmodbiblio does not exist anymore...
-        &ModBiblio($marcrecord,$oldbiblio->{'biblionumber'},MARCfind_frameworkcode($oldbiblio->{'biblionumber'})) ;
+        &ModBiblio($marcrecord,$oldbiblio->{'biblionumber'},GetFrameworkCode($oldbiblio->{'biblionumber'})) ;
         }
     
 }#foreach $marc
@@ -953,6 +953,31 @@ Paul POULAIN paul.poulain@free.fr
 
 # $Id$
 # $Log$
+# Revision 1.41  2007/03/29 13:30:31  tipaul
+# Code cleaning :
+# == Biblio.pm cleaning (useless) ==
+# * some sub declaration dropped
+# * removed modbiblio sub
+# * removed moditem sub
+# * removed newitems. It was used only in finishrecieve. Replaced by a Koha2Marc+AddItem, that is better.
+# * removed MARCkoha2marcItem
+# * removed MARCdelsubfield declaration
+# * removed MARCkoha2marcBiblio
+#
+# == Biblio.pm cleaning (naming conventions) ==
+# * MARCgettagslib renamed to GetMarcStructure
+# * MARCgetitems renamed to GetMarcItem
+# * MARCfind_frameworkcode renamed to GetFrameworkCode
+# * MARCmarc2koha renamed to TransformMarcToKoha
+# * MARChtml2marc renamed to TransformHtmlToMarc
+# * MARChtml2xml renamed to TranformeHtmlToXml
+# * zebraop renamed to ModZebra
+#
+# == MARC=OFF ==
+# * removing MARC=OFF related scripts (in cataloguing directory)
+# * removed checkitems (function related to MARC=off feature, that is completly broken in head. If someone want to reintroduce it, hard work coming...)
+# * removed getitemsbybiblioitem (used only by MARC=OFF scripts, that is removed as well)
+#
 # Revision 1.40  2007/03/28 10:39:16  hdl
 # removing $dbh as a parameter in AuthoritiesMarc functions
 # And reporting all differences into the scripts taht relies on those functions.
index 202fdcb..270d663 100644 (file)
@@ -51,16 +51,27 @@ push @EXPORT, qw(
   &GetBiblioItemByBiblioNumber
   &GetBiblioFromItemNumber
   
+  &GetMarcItem
   &GetItemInfosOf
   &GetItemStatus
   &GetItemLocation
 
+  &GetMarcNotes
+  &GetMarcSubjects
+  &GetMarcBiblio
+  &GetMarcAuthors
+  &GetMarcSeries
+
   &GetItemsInfo
   &GetItemFromBarcode
-  &getitemsbybiblioitem
   &get_itemnumbers_of
-  &GetAuthorisedValueDesc
   &GetXmlBiblio
+
+  &GetAuthorisedValueDesc
+  &GetMarcStructure
+  &GetMarcFromKohaField
+  &GetFrameworkCode
+  &Koha2Marc
 );
 
 # To modify something
@@ -68,6 +79,7 @@ push @EXPORT, qw(
   &ModBiblio
   &ModItem
   &ModBiblioframework
+  &ModZebra
 );
 
 # To delete something
@@ -78,49 +90,24 @@ push @EXPORT, qw(
 
 # Marc related functions
 push @EXPORT, qw(
-  &MARCfind_marc_from_kohafield
-  &MARCfind_frameworkcode
-  &MARCgettagslib
   &MARCmoditemonefield
   &MARCaddbiblio
   &MARCadditem
   &MARCmodbiblio
   &MARCmoditem
-  &MARCkoha2marcBiblio
-  &MARCmarc2koha
-  &MARCkoha2marcItem
-  &MARChtml2marc
-  &MARChtml2xml
-  &MARCgetitem
-  &MARCaddword
-  &MARCdelword
-  &MARCdelsubfield
-  &GetMarcNotes
-  &GetMarcSubjects
-  &GetMarcBiblio
-  &GetMarcAuthors
-  &GetMarcSeries
-  &Koha2Marc
 );
 
 # Others functions
 push @EXPORT, qw(
+  &TransformMarcToKoha
+  &TransformHtmlToMarc
+  &TransformHtmlToXml
   &PrepareItemrecordDisplay
-  &zebraop
   &char_decode
   &itemcalculator
   &calculatelc
 );
 
-# OLD functions,
-push @EXPORT, qw(
-  &newitems
-  &modbiblio
-  &modbibitem
-  &moditem
-  &checkitems
-);
-
 =head1 NAME
 
 C4::Biblio - acquisitions and cataloging management functions
@@ -165,7 +152,7 @@ Because of this design choice, the process of managing storage and editing is a
 
 =item 5. internal helper functions such as char_decode, checkitems, etc. Some of these probably belong in Koha.pm
 
-=item 6. other functions that don't belong in Biblio.pm that will be cleaned out in time. (like MARCfind_marc_from_kohafield which belongs in Search.pm)
+=item 6. other functions that don't belong in Biblio.pm that will be cleaned out in time. (like GetMarcFromKohaField which belongs in Search.pm)
 
 In time, as we solidify the new API these older functions will be weeded out.
 
@@ -187,7 +174,7 @@ sub AddBiblio {
     my $oldbibitemnum;
     my $dbh = C4::Context->dbh;
     # transform the data into koha-table style data
-    my $olddata = MARCmarc2koha( $dbh, $record, $frameworkcode );
+    my $olddata = TransformMarcToKoha( $dbh, $record, $frameworkcode );
     $oldbibnum = _koha_add_biblio( $dbh, $olddata, $frameworkcode );
     $olddata->{'biblionumber'} = $oldbibnum;
     $oldbibitemnum = _koha_add_biblioitem( $dbh, $olddata );
@@ -294,8 +281,8 @@ sub AddItem {
     my $dbh = C4::Context->dbh;
     
     # add item in old-DB
-    my $frameworkcode = MARCfind_frameworkcode( $biblionumber );
-    my $item = &MARCmarc2koha( $dbh, $record, $frameworkcode );
+    my $frameworkcode = GetFrameworkCode( $biblionumber );
+    my $item = &TransformMarcToKoha( $dbh, $record, $frameworkcode );
 
     # needs old biblionumber and biblioitemnumber
     $item->{'biblionumber'} = $biblionumber;
@@ -385,7 +372,7 @@ sub ModBiblio {
     &MARCmodbiblio( $dbh, $biblionumber, $record, $frameworkcode, 1 );
 
     # load the koha-table data object
-    my $oldbiblio = MARCmarc2koha( $dbh, $record, $frameworkcode );
+    my $oldbiblio = TransformMarcToKoha( $dbh, $record, $frameworkcode );
 
     # modify the other koha tables
     my $oldbiblionumber = _koha_modify_biblio( $dbh, $oldbiblio );
@@ -414,9 +401,9 @@ sub ModItem {
     # we do the whole routine: update the MARC and zebra, then update the koha
     # tables
     if ($record) {
-        my $frameworkcode = MARCfind_frameworkcode( $biblionumber );
+        my $frameworkcode = GetFrameworkCode( $biblionumber );
         MARCmoditem( $record, $biblionumber, $itemnumber, $frameworkcode, $delete );
-        my $olditem       = MARCmarc2koha( $dbh, $record, $frameworkcode );
+        my $olditem       = TransformMarcToKoha( $dbh, $record, $frameworkcode );
         _koha_modify_item( $dbh, $olditem );
         return $biblionumber;
     }
@@ -492,7 +479,7 @@ sub DelBiblio {
     return $error if $error;
 
     # Delete in Zebra
-    zebraop($biblionumber,"delete_record","biblioserver");
+    ModZebra($biblionumber,"delete_record","biblioserver");
 
     # delete biblio from Koha tables and save in deletedbiblio
     $error = &_koha_delete_biblio( $dbh, $biblionumber );
@@ -536,7 +523,7 @@ sub DelItem {
     my $dbh = C4::Context->dbh;
     &_koha_delete_item( $dbh, $itemnumber );
     my $newrec = &MARCdelitem( $biblionumber, $itemnumber );
-    &MARCaddbiblio( $newrec, $biblionumber, MARCfind_frameworkcode($biblionumber) );
+    &MARCaddbiblio( $newrec, $biblionumber, GetFrameworkCode($biblionumber) );
     &logaction(C4::Context->userenv->{'number'},"CATALOGUING","DELETE",$itemnumber,"item") 
         if C4::Context->preference("CataloguingLog");
 }
@@ -782,7 +769,7 @@ sub GetItemStatus {
     my $sth;
     $fwk = '' unless ($fwk);
     my ( $tag, $subfield ) =
-      MARCfind_marc_from_kohafield( $dbh, "items.notforloan", $fwk );
+      GetMarcFromKohaField( $dbh, "items.notforloan", $fwk );
     if ( $tag and $subfield ) {
         my $sth =
           $dbh->prepare(
@@ -856,7 +843,7 @@ sub GetItemLocation {
     my $sth;
     $fwk = '' unless ($fwk);
     my ( $tag, $subfield ) =
-      MARCfind_marc_from_kohafield( $dbh, "items.location", $fwk );
+      GetMarcFromKohaField( $dbh, "items.location", $fwk );
     if ( $tag and $subfield ) {
         my $sth =
           $dbh->prepare(
@@ -1010,37 +997,6 @@ sub GetBiblio {
     return ( $count, @results );
 }    # sub GetBiblio
 
-=head2 getitemsbybiblioitem
-
-( $count, @results ) = &getitemsbybiblioitem($biblioitemnum);
-
-=cut
-
-sub getitemsbybiblioitem {
-    my ($biblioitemnum) = @_;
-    my $dbh             = C4::Context->dbh;
-    my $sth             = $dbh->prepare(
-        "Select * from items, biblio where
-biblio.biblionumber = items.biblionumber and biblioitemnumber
-= ?"
-    );
-
-    # || die "Cannot prepare $query\n" . $dbh->errstr;
-    my $count = 0;
-    my @results;
-
-    $sth->execute($biblioitemnum);
-
-    # || die "Cannot execute $query\n" . $sth->errstr;
-    while ( my $data = $sth->fetchrow_hashref ) {
-        $results[$count] = $data;
-        $count++;
-    }    # while
-
-    $sth->finish;
-    return ( $count, @results );
-}    # sub getitemsbybiblioitem
-
 =head2 get_itemnumbers_of
 
   my @itemnumbers_of = get_itemnumbers_of(@biblionumbers);
@@ -1242,11 +1198,11 @@ sub set_service_options {
 
 =head1 FUNCTIONS FOR HANDLING MARC MANAGEMENT
 
-=head2 MARCgettagslib
+=head2 GetMarcStructure
 
 =cut
 
-sub MARCgettagslib {
+sub GetMarcStructure {
     my ( $dbh, $forlibrarian, $frameworkcode ) = @_;
     $frameworkcode = "" unless $frameworkcode;
     my $sth;
@@ -1323,11 +1279,11 @@ sub MARCgettagslib {
     return $res;
 }
 
-=head2 MARCfind_marc_from_kohafield
+=head2 GetMarcFromKohaField
 
 =cut
 
-sub MARCfind_marc_from_kohafield {
+sub GetMarcFromKohaField {
     my ( $dbh, $kohafield, $frameworkcode ) = @_;
     return 0, 0 unless $kohafield;
     my $relations = C4::Context->marcfromkohafield;
@@ -1387,7 +1343,7 @@ sub MARCaddbiblio {
         $biblionumber );
 #     warn $record->as_xml_record();
     $sth->finish;
-    zebraop($biblionumber,"specialUpdate","biblioserver");
+    ModZebra($biblionumber,"specialUpdate","biblioserver");
     return $biblionumber;
 }
 
@@ -1496,13 +1452,13 @@ sub GetAuthorisedValueDesc {
     }
 }
 
-=head2 MARCgetitem
+=head2 GetMarcItem
 
 Returns MARC::Record of the item passed in parameter.
 
 =cut
 
-sub MARCgetitem {
+sub GetMarcItem {
     my ( $biblionumber, $itemnumber ) = @_;
     my $dbh = C4::Context->dbh;
     my $newrecord = MARC::Record->new();
@@ -1515,7 +1471,7 @@ sub MARCgetitem {
 #     warn "record :".$record->as_formatted;
     # now, find where the itemnumber is stored & extract only the item
     my ( $itemnumberfield, $itemnumbersubfield ) =
-      MARCfind_marc_from_kohafield( $dbh, 'items.itemnumber', '' );
+      GetMarcFromKohaField( $dbh, 'items.itemnumber', '' );
     my @fields = $record->field($itemnumberfield);
     foreach my $field (@fields) {
         if ( $field->subfield($itemnumbersubfield) eq $itemnumber ) {
@@ -1855,7 +1811,7 @@ sub MARCmoditemonefield {
         $newvalue = "";
     }
 
-    my $record = MARCgetitem( $biblionumber, $itemnumber );
+    my $record = GetMarcItem( $biblionumber, $itemnumber );
 
     my $sth =
       $dbh->prepare(
@@ -1905,13 +1861,13 @@ sub MARCmoditem {
     &MARCaddbiblio( $newrec, $biblionumber, $frameworkcode );
 }
 
-=head2 MARCfind_frameworkcode
+=head2 GetFrameworkCode
 
-$frameworkcode = MARCfind_frameworkcode( $biblionumber )
+$frameworkcode = GetFrameworkCode( $biblionumber )
 
 =cut
 
-sub MARCfind_frameworkcode {
+sub GetFrameworkCode {
     my ( $biblionumber ) = @_;
     my $dbh = C4::Context->dbh;
     my $sth =
@@ -1948,107 +1904,6 @@ sub Koha2Marc {
         }
     return $record;
 }
-        
-=head2 MARCkoha2marcBiblio
-
-$record = MARCkoha2marcBiblio( $biblionumber, $biblioitemnumber )
-
-this function builds partial MARC::Record from the old koha-DB fields
-
-=cut
-
-sub MARCkoha2marcBiblio {
-
-    my ( $biblionumber, $biblioitemnumber ) = @_;
-    my $dbh = C4::Context->dbh;
-    my $sth =
-      $dbh->prepare(
-"select tagfield,tagsubfield from marc_subfield_structure where frameworkcode=? and kohafield=?"
-      );
-    my $record = MARC::Record->new();
-
-    #--- if biblionumber, then retrieve old-style koha data
-    if ( $biblionumber > 0 ) {
-        my $sth2 = $dbh->prepare(
-"select biblionumber,author,title,unititle,notes,abstract,serial,seriestitle,copyrightdate,timestamp
-        from biblio where biblionumber=?"
-        );
-        $sth2->execute($biblionumber);
-        my $row = $sth2->fetchrow_hashref;
-        my $code;
-        foreach $code ( keys %$row ) {
-            if ( $row->{$code} ) {
-                &MARCkoha2marcOnefield( $sth, $record, "biblio." . $code,
-                    $row->{$code}, '' );
-            }
-        }
-    }
-
-    #--- if biblioitem, then retrieve old-style koha data
-    if ( $biblioitemnumber > 0 ) {
-        my $sth2 = $dbh->prepare(
-            " SELECT biblioitemnumber,biblionumber,volume,number,classification,
-                        itemtype,url,isbn,issn,dewey,subclass,publicationyear,publishercode,
-                        volumedate,volumeddesc,timestamp,illus,pages,notes AS bnotes,size,place
-                    FROM biblioitems
-                    WHERE biblioitemnumber=?
-                    "
-        );
-        $sth2->execute($biblioitemnumber);
-        my $row = $sth2->fetchrow_hashref;
-        my $code;
-        foreach $code ( keys %$row ) {
-            if ( $row->{$code} ) {
-                &MARCkoha2marcOnefield( $sth, $record, "biblioitems." . $code,
-                    $row->{$code}, '' );
-            }
-        }
-    }
-    return $record;
-}
-
-=head2 MARCkoha2marcItem
-
-$record = MARCkoha2marcItem( $dbh, $biblionumber, $itemnumber );
-
-=cut
-
-sub MARCkoha2marcItem {
-
-    # this function builds partial MARC::Record from the old koha-DB fields
-    my ( $dbh, $biblionumber, $itemnumber ) = @_;
-
-    #    my $dbh=&C4Connect;
-    my $sth =
-      $dbh->prepare(
-"select tagfield,tagsubfield from marc_subfield_structure where frameworkcode=? and kohafield=?"
-      );
-    my $record = MARC::Record->new();
-
-    #--- if item, then retrieve old-style koha data
-    if ( $itemnumber > 0 ) {
-
-        #    print STDERR "prepare $biblionumber,$itemnumber\n";
-        my $sth2 = $dbh->prepare(
-"SELECT itemnumber,biblionumber,multivolumepart,biblioitemnumber,barcode,dateaccessioned,
-                        booksellerid,homebranch,price,replacementprice,replacementpricedate,datelastborrowed,
-                        datelastseen,multivolume,stack,notforloan,itemlost,wthdrawn,itemcallnumber,issues,renewals,
-                    reserves,restricted,binding,itemnotes,holdingbranch,timestamp,onloan,Cutterextra
-                    FROM items
-                    WHERE itemnumber=?"
-        );
-        $sth2->execute($itemnumber);
-        my $row = $sth2->fetchrow_hashref;
-        my $code;
-        foreach $code ( keys %$row ) {
-            if ( $row->{$code} ) {
-                &MARCkoha2marcOnefield( $sth, $record, "items." . $code,
-                    $row->{$code}, '' );
-            }
-        }
-    }
-    return $record;
-}
 
 =head2 MARCkoha2marcOnefield
 
@@ -2084,13 +1939,13 @@ sub MARCkoha2marcOnefield {
     return $record;
 }
 
-=head2 MARChtml2xml
+=head2 TransformHtmlToXml
 
-$xml = MARChtml2xml( $tags, $subfields, $values, $indicator, $ind_tag )
+$xml = TransformHtmlToXml( $tags, $subfields, $values, $indicator, $ind_tag )
 
 =cut
 
-sub MARChtml2xml {
+sub TransformHtmlToXml {
     my ( $tags, $subfields, $values, $indicator, $ind_tag ) = @_;
     my $xml = MARC::File::XML::header('UTF-8');
     if ( C4::Context->preference('marcflavour') eq 'UNIMARC' ) {
@@ -2191,13 +2046,13 @@ sub MARChtml2xml {
     return $xml;
 }
 
-=head2 MARChtml2marc
+=head2 TransformHtmlToMarc
 
-$record = MARChtml2marc( $dbh, $rtags, $rsubfields, $rvalues, %indicators )
+$record = TransformHtmlToMarc( $dbh, $rtags, $rsubfields, $rvalues, %indicators )
 
 =cut
 
-sub MARChtml2marc {
+sub TransformHtmlToMarc {
     my ( $dbh, $rtags, $rsubfields, $rvalues, %indicators ) = @_;
     my $prevtag = -1;
     my $record  = MARC::Record->new();
@@ -2269,13 +2124,13 @@ sub MARChtml2marc {
     return $record;
 }
 
-=head2 MARCmarc2koha
+=head2 TransformMarcToKoha
 
-$result = MARCmarc2koha( $dbh, $record, $frameworkcode )
+$result = TransformMarcToKoha( $dbh, $record, $frameworkcode )
 
 =cut
 
-sub MARCmarc2koha {
+sub TransformMarcToKoha {
     my ( $dbh, $record, $frameworkcode ) = @_;
     my $sth =
       $dbh->prepare(
@@ -2287,7 +2142,7 @@ sub MARCmarc2koha {
     my $field;
     while ( ($field) = $sth2->fetchrow ) {
         $result =
-          &MARCmarc2kohaOneField( "biblio", $field, $record, $result,
+          &TransformMarcToKohaOneField( "biblio", $field, $record, $result,
             $frameworkcode );
     }
     $sth2 = $dbh->prepare("SHOW COLUMNS from biblioitems");
@@ -2295,14 +2150,14 @@ sub MARCmarc2koha {
     while ( ($field) = $sth2->fetchrow ) {
         if ( $field eq 'notes' ) { $field = 'bnotes'; }
         $result =
-          &MARCmarc2kohaOneField( "biblioitems", $field, $record, $result,
+          &TransformMarcToKohaOneField( "biblioitems", $field, $record, $result,
             $frameworkcode );
     }
     $sth2 = $dbh->prepare("SHOW COLUMNS from items");
     $sth2->execute;
     while ( ($field) = $sth2->fetchrow ) {
         $result =
-          &MARCmarc2kohaOneField( "items", $field, $record, $result,
+          &TransformMarcToKohaOneField( "items", $field, $record, $result,
             $frameworkcode );
     }
 
@@ -2331,20 +2186,20 @@ sub MARCmarc2koha {
     return $result;
 }
 
-=head2 MARCmarc2kohaOneField
+=head2 TransformMarcToKohaOneField
 
-$result = MARCmarc2kohaOneField( $kohatable, $kohafield, $record, $result, $frameworkcode )
+$result = TransformMarcToKohaOneField( $kohatable, $kohafield, $record, $result, $frameworkcode )
 
 =cut
 
-sub MARCmarc2kohaOneField {
+sub TransformMarcToKohaOneField {
 
 # FIXME ? if a field has a repeatable subfield that is used in old-db, only the 1st will be retrieved...
     my ( $kohatable, $kohafield, $record, $result, $frameworkcode ) = @_;
 
     my $res = "";
     my ( $tagfield, $subfield ) =
-      MARCfind_marc_from_kohafield( "", $kohatable . "." . $kohafield,
+      GetMarcFromKohaField( "", $kohatable . "." . $kohafield,
         $frameworkcode );
     foreach my $field ( $record->field($tagfield) ) {
         if ( $field->tag() < 10 ) {
@@ -2387,7 +2242,7 @@ sub MARCitemchange {
     my $dbh = C4::Context->dbh;
     
     my ( $tagfield, $tagsubfield ) =
-      MARCfind_marc_from_kohafield( $dbh, $itemfield, "" );
+      GetMarcFromKohaField( $dbh, $itemfield, "" );
     if ( ($tagfield) && ($tagsubfield) ) {
         my $tag = $record->field($tagfield);
         if ($tag) {
@@ -2981,113 +2836,6 @@ sub _koha_delete_items {
     return undef;
 }
 
-
-
-=head2 modbiblio
-
-  $biblionumber = &modbiblio($biblio);
-
-Update a biblio record.
-
-C<$biblio> is a reference-to-hash whose keys are the fields in the
-biblio table in the Koha database. All fields must be present, not
-just the ones you wish to change.
-
-C<&modbiblio> updates the record defined by
-C<$biblio-E<gt>{biblionumber}> with the values in C<$biblio>.
-
-C<&modbiblio> returns C<$biblio-E<gt>{biblionumber}> whether it was
-successful or not.
-
-=cut
-
-sub modbiblio {
-    my ($biblio) = @_;
-    my $dbh = C4::Context->dbh;
-    my $biblionumber = _koha_modify_biblio( $dbh, $biblio );
-    my $record = MARCkoha2marcBiblio( $biblionumber, $biblionumber );
-    MARCmodbiblio( $dbh, $biblionumber, $record, "", 0 );
-    return ($biblionumber);
-}    # sub modbiblio
-
-=head2 modbibitem
-
-&modbibitem($biblioitem)
-
-=cut
-
-sub modbibitem {
-    my ($biblioitem) = @_;
-    my $dbh = C4::Context->dbh;
-    &_koha_modify_biblio( $dbh, $biblioitem );
-}    # sub modbibitem
-
-
-=head2 newitems
-
-$errors = &newitems( $item, @barcodes );
-
-=cut
-
-sub newitems {
-    my ( $item, @barcodes ) = @_;
-    my $dbh = C4::Context->dbh;
-    my $errors;
-    my $itemnumber;
-    my $error;
-    foreach my $barcode (@barcodes) {
-        ( $itemnumber, $error ) = &_koha_new_items( $dbh, $item, uc($barcode) );
-        $errors .= $error;
-        my $MARCitem =
-          &MARCkoha2marcItem( $dbh, $item->{biblionumber}, $itemnumber );
-        &MARCadditem( $MARCitem, $item->{biblionumber} );
-    }
-    return ($errors);
-}
-
-=head2 moditem
-
-$errors = &moditem( $item, $op );
-
-=cut
-
-sub moditem {
-    my ( $item, $op ) = @_;
-    my $dbh = C4::Context->dbh;
-    &_koha_modify_item( $dbh, $item, $op );
-
-    # if we're just setting statuses, just update items table
-    # it's faster and zebra and marc will be synched anyway by the cron job
-    unless ( $op eq "setstatus" ) {
-        my $MARCitem = &MARCkoha2marcItem( $dbh, $item->{'biblionumber'},
-            $item->{'itemnum'} );
-        &MARCmoditem( $MARCitem, $item->{biblionumber}, $item->{itemnum},
-                      MARCfind_frameworkcode( $item->{biblionumber} ), 0 );
-    }
-}
-
-=head2 checkitems
-
-$errors = &checkitems( $count, @barcodes );
-
-=cut
-
-sub checkitems {
-    my ( $count, @barcodes ) = @_;
-    my $dbh = C4::Context->dbh;
-    my $error;
-    my $sth = $dbh->prepare("Select * from items where barcode=?");
-    for ( my $i = 0 ; $i < $count ; $i++ ) {
-        $barcodes[$i] = uc $barcodes[$i];
-        $sth->execute( $barcodes[$i] );
-        if ( my $data = $sth->fetchrow_hashref ) {
-            $error .= " Duplicate Barcode: $barcodes[$i]";
-        }
-    }
-    $sth->finish;
-    return ($error);
-}
-
 =head1  OTHER FUNCTIONS
 
 =head2 char_decode
@@ -3274,11 +3022,11 @@ sub PrepareItemrecordDisplay {
     my ( $bibnum, $itemnum ) = @_;
 
     my $dbh = C4::Context->dbh;
-    my $frameworkcode = &MARCfind_frameworkcode( $bibnum );
+    my $frameworkcode = &GetFrameworkCode( $bibnum );
     my ( $itemtagfield, $itemtagsubfield ) =
-      &MARCfind_marc_from_kohafield( $dbh, "items.itemnumber", $frameworkcode );
-    my $tagslib = &MARCgettagslib( $dbh, 1, $frameworkcode );
-    my $itemrecord = MARCgetitem( $bibnum, $itemnum) if ($itemnum);
+      &GetMarcFromKohaField( $dbh, "items.itemnumber", $frameworkcode );
+    my $tagslib = &GetMarcStructure( $dbh, 1, $frameworkcode );
+    my $itemrecord = GetMarcItem( $bibnum, $itemnum) if ($itemnum);
     my @loop_data;
     my $authorised_values_sth =
       $dbh->prepare(
@@ -3468,13 +3216,13 @@ sub nsb_clean {
     return ($string);
 }
 
-=head2 zebraopfiles
+=head2 ModZebrafiles
 
-&zebraopfiles( $dbh, $biblionumber, $record, $folder, $server );
+&ModZebrafiles( $dbh, $biblionumber, $record, $folder, $server );
 
 =cut
 
-sub zebraopfiles {
+sub ModZebrafiles {
 
     my ( $dbh, $biblionumber, $record, $folder, $server ) = @_;
 
@@ -3495,21 +3243,21 @@ sub zebraopfiles {
     }
 }
 
-=head2 zebraop
+=head2 ModZebra
 
-zebraop( $dbh, $biblionumber, $op, $server );
+ModZebra( $dbh, $biblionumber, $op, $server );
 
 =cut
 
-sub zebraop {
+sub ModZebra {
 ###Accepts a $server variable thus we can use it for biblios authorities or other zebra dbs
     my ( $biblionumber, $op, $server ) = @_;
     my $dbh=C4::Context->dbh;
     #warn "SERVER:".$server;
 #
-# true zebraop commented until indexdata fixes zebraDB crashes (it seems they occur on multiple updates
+# true ModZebra commented until indexdata fixes zebraDB crashes (it seems they occur on multiple updates
 # at the same time
-# replaced by a zebraqueue table, that is filled with zebraop to run.
+# replaced by a zebraqueue table, that is filled with ModZebra to run.
 # the table is emptied by misc/cronjobs/zebraqueue_start.pl script
 
 my $sth=$dbh->prepare("insert into zebraqueue  (biblio_auth_number ,server,operation) values(?,?,?)");
@@ -3588,7 +3336,7 @@ $sth->finish;
 # "Error-$server   $op $biblionumber /errcode:, $error, /MSG:,$errmsg,$addinfo \n";
 #         $Zpackage->destroy();
 #         $Zconnbiblio[0]->destroy();
-#         zebraopfiles( $dbh, $biblionumber, $record, $op, $server );
+#         ModZebrafiles( $dbh, $biblionumber, $record, $op, $server );
 #         return;
 #     }
 #     if ( C4::Context->$shadow ) {
@@ -3697,6 +3445,31 @@ Joshua Ferraro jmf@liblime.com
 
 # $Id$
 # $Log$
+# Revision 1.192  2007/03/29 13:30:31  tipaul
+# Code cleaning :
+# == Biblio.pm cleaning (useless) ==
+# * some sub declaration dropped
+# * removed modbiblio sub
+# * removed moditem sub
+# * removed newitems. It was used only in finishrecieve. Replaced by a Koha2Marc+AddItem, that is better.
+# * removed MARCkoha2marcItem
+# * removed MARCdelsubfield declaration
+# * removed MARCkoha2marcBiblio
+#
+# == Biblio.pm cleaning (naming conventions) ==
+# * MARCgettagslib renamed to GetMarcStructure
+# * MARCgetitems renamed to GetMarcItem
+# * MARCfind_frameworkcode renamed to GetFrameworkCode
+# * MARCmarc2koha renamed to TransformMarcToKoha
+# * MARChtml2marc renamed to TransformHtmlToMarc
+# * MARChtml2xml renamed to TranformeHtmlToXml
+# * zebraop renamed to ModZebra
+#
+# == MARC=OFF ==
+# * removing MARC=OFF related scripts (in cataloguing directory)
+# * removed checkitems (function related to MARC=off feature, that is completly broken in head. If someone want to reintroduce it, hard work coming...)
+# * removed getitemsbybiblioitem (used only by MARC=OFF scripts, that is removed as well)
+#
 # Revision 1.191  2007/03/29 09:42:13  tipaul
 # adding default value new feature into cataloguing. The system (definition) part has already been added by toins
 #
@@ -3753,7 +3526,7 @@ Joshua Ferraro jmf@liblime.com
 # *** empty log message ***
 #
 # Revision 1.178.2.51  2007/01/15 15:16:44  hdl
-# Uncommenting zebraop.
+# Uncommenting ModZebra.
 #
 # Revision 1.178.2.50  2007/01/15 14:59:09  hdl
 # Adding creation of an unexpected serial any time.
@@ -3820,10 +3593,10 @@ Joshua Ferraro jmf@liblime.com
 # BUT for bulkmarcimport & mod_perl, the zebra conn must be persistant.
 #
 # Revision 1.178.2.36  2006/12/06 16:54:21  alaurin
-# restore function zebraop for delete biblios :
+# restore function ModZebra for delete biblios :
 #
 # 1) restore C4::Circulation::Circ2::itemissues, (was missing)
-# 2) restore zebraop value : delete_record
+# 2) restore ModZebra value : delete_record
 #
 # Revision 1.178.2.35  2006/12/06 10:02:12  alaurin
 # bugfixing for delete a biblio :
@@ -3844,7 +3617,7 @@ Joshua Ferraro jmf@liblime.com
 # Revision 1.178.2.32  2006/12/04 17:39:57  alaurin
 # bugfix :
 #
-# restore zebraop for update zebra
+# restore ModZebra for update zebra
 #
 # Revision 1.178.2.31  2006/12/01 17:00:19  tipaul
 # additem needs $frameworkcode
@@ -3923,7 +3696,7 @@ Joshua Ferraro jmf@liblime.com
 # handling of UNIMARC :
 # - better management of field 100 = automatic creation of the field if needed & filling encoding to unicode.
 # - better management of encoding (MARC::File::XML new_from_xml()). This fix works only on my own version of M:F:XML, i think the actual one is buggy & have reported the problem to perl4lib mailing list
-# - fixing a bug on MARCgetitem, that uses biblioitems.marc and not biblioitems.marcxml
+# - fixing a bug on GetMarcItem, that uses biblioitems.marc and not biblioitems.marcxml
 #
 # Revision 1.178.2.14  2006/10/11 07:59:36  tipaul
 # removing hardcoded ccode fiels in biblioitems
index abea5de..3e96686 100644 (file)
@@ -81,7 +81,7 @@ where isbn=? and title=?");
         if (scalar($marcrecord->fields()) == 0) {
             $notmarcrecord++;
         } else {
-            my $oldbiblio = MARCmarc2koha($dbh,$marcrecord,'');
+            my $oldbiblio = TransformMarcToKoha($dbh,$marcrecord,'');
             my $isbnlength=10;
             if($oldbiblio->{isbn}){
                 $isbnlength = length($oldbiblio->{isbn});
index 303c689..8046272 100644 (file)
@@ -338,7 +338,7 @@ sub zebraconfig
     # Return the value of the requested config variable
     return $context->{"server"}->{$var};
 }
-sub zebraoptions
+sub ModZebrations
 {
     my $self = shift;
     my $var = shift;        # The config variable to return
@@ -874,6 +874,31 @@ Joshua Ferraro <jmf at liblime dot com>
 =cut
 
 # $Log$
+# Revision 1.53  2007/03/29 13:30:31  tipaul
+# Code cleaning :
+# == Biblio.pm cleaning (useless) ==
+# * some sub declaration dropped
+# * removed modbiblio sub
+# * removed moditem sub
+# * removed newitems. It was used only in finishrecieve. Replaced by a Koha2Marc+AddItem, that is better.
+# * removed MARCkoha2marcItem
+# * removed MARCdelsubfield declaration
+# * removed MARCkoha2marcBiblio
+#
+# == Biblio.pm cleaning (naming conventions) ==
+# * MARCgettagslib renamed to GetMarcStructure
+# * MARCgetitems renamed to GetMarcItem
+# * MARCfind_frameworkcode renamed to GetFrameworkCode
+# * MARCmarc2koha renamed to TransformMarcToKoha
+# * MARChtml2marc renamed to TransformHtmlToMarc
+# * MARChtml2xml renamed to TranformeHtmlToXml
+# * zebraop renamed to ModZebra
+#
+# == MARC=OFF ==
+# * removing MARC=OFF related scripts (in cataloguing directory)
+# * removed checkitems (function related to MARC=off feature, that is completly broken in head. If someone want to reintroduce it, hard work coming...)
+# * removed getitemsbybiblioitem (used only by MARC=OFF scripts, that is removed as well)
+#
 # Revision 1.52  2007/03/16 01:25:08  kados
 # Using my precrash CVS copy I did the following:
 #
@@ -906,7 +931,7 @@ Joshua Ferraro <jmf at liblime dot com>
 # reident programs, and adding branchcode value in reserves2
 #
 # Revision 1.43.2.7  2006/12/06 21:55:38  hdl
-# Adding zebraoptions for servers to get serverinfos in Context.pm
+# Adding ModZebrations for servers to get serverinfos in Context.pm
 # Using this function in rebuild_zebra.pl
 #
 # Revision 1.43.2.6  2006/11/24 21:18:31  kados
index 7d93c55..3b1fda3 100755 (executable)
@@ -18,7 +18,7 @@ package C4::Search;
 use strict;
 require Exporter;
 use C4::Context;
-use C4::Biblio;    # MARCfind_marc_from_kohafield
+use C4::Biblio;    # GetMarcFromKohaField
 use C4::Koha;      # getFacets
 use Lingua::Stem;
 
@@ -72,7 +72,7 @@ This function modify the @$fields array and add related fields to search on.
 
 sub findseealso {
     my ( $dbh, $fields ) = @_;
-    my $tagslib = MARCgettagslib( $dbh, 1 );
+    my $tagslib = GetMarcStructure( $dbh, 1 );
     for ( my $i = 0 ; $i <= $#{$fields} ; $i++ ) {
         my ($tag)      = substr( @$fields[$i], 1, 3 );
         my ($subfield) = substr( @$fields[$i], 4, 1 );
@@ -91,7 +91,7 @@ sub FindDuplicate {
     my ($record) = @_;
     return;
     my $dbh = C4::Context->dbh;
-    my $result = MARCmarc2koha( $dbh, $record, '' );
+    my $result = TransformMarcToKoha( $dbh, $record, '' );
     my $sth;
     my $query;
     my $search;
@@ -115,7 +115,7 @@ sub FindDuplicate {
     if ($possible_duplicate_record) {
         my $marcrecord =
           MARC::Record->new_from_usmarc($possible_duplicate_record);
-        my $result = MARCmarc2koha( $dbh, $marcrecord, '' );
+        my $result = TransformMarcToKoha( $dbh, $marcrecord, '' );
         
         # FIXME :: why 2 $biblionumber ?
         return $result->{'biblionumber'}, $result->{'biblionumber'},
@@ -160,7 +160,7 @@ my @results;
 for(my $i=0;$i<$hits;$i++) {
     my %resultsloop;
     my $marcrecord = MARC::File::USMARC::decode($marcresults->[$i]);
-    my $biblio = MARCmarc2koha(C4::Context->dbh,$marcrecord,'');
+    my $biblio = TransformMarcToKoha(C4::Context->dbh,$marcrecord,'');
 
     #build the hash for the template.
     $resultsloop{highlight}       = ($i % 2)?(1):(0);
@@ -823,7 +823,7 @@ sub searchResults {
     my %subfieldstosearch;
     while ( ( my $column ) = $sth2->fetchrow ) {
         my ( $tagfield, $tagsubfield ) =
-          &MARCfind_marc_from_kohafield( $dbh, "items." . $column, "" );
+          &GetMarcFromKohaField( $dbh, "items." . $column, "" );
         $subfieldstosearch{$column} = $tagsubfield;
     }
     my $times;
@@ -839,7 +839,7 @@ sub searchResults {
         my $marcrecord;
         $marcrecord = MARC::File::USMARC::decode( $marcresults[$i] );
 
-        my $oldbiblio = MARCmarc2koha( $dbh, $marcrecord, '' );
+        my $oldbiblio = TransformMarcToKoha( $dbh, $marcrecord, '' );
 
         # add image url if there is one
         if ( $itemtypes{ $oldbiblio->{itemtype} }->{imageurl} =~ /^http:/ ) {
index 3480a91..b7785b7 100644 (file)
@@ -256,8 +256,8 @@ sub GetSerialInformation {
             my @itemnumbers = split /,/, $data->{'itemnumber'};
             foreach my $itemnum (@itemnumbers) {
 
-                #It is ASSUMED that MARCgetitem ALWAYS WORK...
-                #Maybe MARCgetitem should return values on failure
+                #It is ASSUMED that GetMarcItem ALWAYS WORK...
+                #Maybe GetMarcItem should return values on failure
 #                 warn "itemnumber :$itemnum, bibnum :".$data->{'biblionumber'};
                 my $itemprocessed =
                   PrepareItemrecordDisplay( $data->{'biblionumber'}, $itemnum );
@@ -1507,7 +1507,7 @@ sub NewIssue {
 
     if ( $status eq 2 ) {
       ### TODO Add a feature that improves recognition and description.
-      ### As such count (serialseq) i.e. : N°18,2(N°19),N°20
+      ### As such count (serialseq) i.e. : N18,2(N19),N20
       ### Would use substr and index But be careful to previous presence of ()
         $recievedlist .= ",$serialseq" unless (index($recievedlist,$serialseq)>0);
     }
@@ -1593,7 +1593,7 @@ sub ItemizeSerials {
         }
     }
 
-    my $fwk = MARCfind_frameworkcode( $data->{'biblionumber'} );
+    my $fwk = GetFrameworkCode( $data->{'biblionumber'} );
     if ( $info->{barcode} ) {
         my @errors;
         my $exists = itemdata( $info->{'barcode'} );
@@ -1601,14 +1601,14 @@ sub ItemizeSerials {
         unless ($exists) {
             my $marcrecord = MARC::Record->new();
             my ( $tag, $subfield ) =
-              MARCfind_marc_from_kohafield( $dbh, "items.barcode", $fwk );
+              GetMarcFromKohaField( $dbh, "items.barcode", $fwk );
             my $newField =
               MARC::Field->new( "$tag", '', '',
                 "$subfield" => $info->{barcode} );
             $marcrecord->insert_fields_ordered($newField);
             if ( $info->{branch} ) {
                 my ( $tag, $subfield ) =
-                  MARCfind_marc_from_kohafield( $dbh, "items.homebranch",
+                  GetMarcFromKohaField( $dbh, "items.homebranch",
                     $fwk );
 
                 #warn "items.homebranch : $tag , $subfield";
@@ -1623,7 +1623,7 @@ sub ItemizeSerials {
                     $marcrecord->insert_fields_ordered($newField);
                 }
                 ( $tag, $subfield ) =
-                  MARCfind_marc_from_kohafield( $dbh, "items.holdingbranch",
+                  GetMarcFromKohaField( $dbh, "items.holdingbranch",
                     $fwk );
 
                 #warn "items.holdingbranch : $tag , $subfield";
@@ -1640,7 +1640,7 @@ sub ItemizeSerials {
             }
             if ( $info->{itemcallnumber} ) {
                 my ( $tag, $subfield ) =
-                  MARCfind_marc_from_kohafield( $dbh, "items.itemcallnumber",
+                  GetMarcFromKohaField( $dbh, "items.itemcallnumber",
                     $fwk );
 
                 #warn "items.itemcallnumber : $tag , $subfield";
@@ -1657,7 +1657,7 @@ sub ItemizeSerials {
             }
             if ( $info->{notes} ) {
                 my ( $tag, $subfield ) =
-                  MARCfind_marc_from_kohafield( $dbh, "items.itemnotes", $fwk );
+                  GetMarcFromKohaField( $dbh, "items.itemnotes", $fwk );
 
                 # warn "items.itemnotes : $tag , $subfield";
                 if ( $marcrecord->field($tag) ) {
@@ -1673,7 +1673,7 @@ sub ItemizeSerials {
             }
             if ( $info->{location} ) {
                 my ( $tag, $subfield ) =
-                  MARCfind_marc_from_kohafield( $dbh, "items.location", $fwk );
+                  GetMarcFromKohaField( $dbh, "items.location", $fwk );
 
                 # warn "items.location : $tag , $subfield";
                 if ( $marcrecord->field($tag) ) {
@@ -1689,7 +1689,7 @@ sub ItemizeSerials {
             }
             if ( $info->{status} ) {
                 my ( $tag, $subfield ) =
-                  MARCfind_marc_from_kohafield( $dbh, "items.notforloan",
+                  GetMarcFromKohaField( $dbh, "items.notforloan",
                     $fwk );
 
                 # warn "items.notforloan : $tag , $subfield";
@@ -1706,7 +1706,7 @@ sub ItemizeSerials {
             }
             if ( C4::Context->preference("RoutingSerials") ) {
                 my ( $tag, $subfield ) =
-                  MARCfind_marc_from_kohafield( $dbh, "items.dateaccessioned",
+                  GetMarcFromKohaField( $dbh, "items.dateaccessioned",
                     $fwk );
                 if ( $marcrecord->field($tag) ) {
                     $marcrecord->field($tag)
index 476fd99..dbe84c8 100755 (executable)
@@ -55,14 +55,18 @@ if ($quantity != 0) {
     # create items if the user has entered barcodes
     my $barcode=$input->param('barcode');
     my @barcodes=split(/\,| |\|/,$barcode);
-    my ($error) = newitems({ biblioitemnumber => $biblioitemnumber,
-                    biblionumber     => $biblionumber,
-                    replacementprice => $replacement,
-                    price            => $cost,
-                    booksellerid     => $supplierid,
-                    homebranch       => $branch,
-                    loan             => 0 },
-                @barcodes);
+    # foreach barcode provided, build the item MARC::Record and create the item
+    foreach my $bc (@barcodes) {
+        my $itemRecord = Koha2Marc({
+                    "items.replacementprice" => $replacement,
+                    "items.price"            => $cost,
+                    "items.booksellerid"     => $supplierid,
+                    "items.homebranch"       => $branch,
+                    "items.holdingbranch"    => $branch,
+                    "items.barcode"          => $bc,
+                    "items.loan"             => 0, });
+        AddItem($itemRecord,$biblionumber);
+    }
     print $input->redirect("/cgi-bin/koha/acqui/parcel.pl?invoice=$invoiceno&supplierid=$supplierid&freight=$freight&gst=$gst&datereceived=$datereceived");
 } else {
     print $input->header;
index f491f5a..0e56c7c 100755 (executable)
@@ -106,7 +106,7 @@ my @results;
 for(my $i=0;$i<$hits;$i++) {
     my %resultsloop;
     my $marcrecord = MARC::File::USMARC::decode($marcresults->[$i]);
-    my $biblio = MARCmarc2koha(C4::Context->dbh,$marcrecord,'');
+    my $biblio = TransformMarcToKoha(C4::Context->dbh,$marcrecord,'');
 
     #build the hash for the template.
     %resultsloop=%$biblio;
index 6509502..085a964 100755 (executable)
@@ -385,7 +385,7 @@ if ($op eq "add") {
        # build indicator hash.
        my @ind_tag = $input->param('ind_tag');
        my @indicator = $input->param('indicator');
-       my $xml = MARChtml2xml(\@tags,\@subfields,\@values,\@indicator,\@ind_tag);
+       my $xml = TransformHtmlToXml(\@tags,\@subfields,\@values,\@indicator,\@ind_tag);
 #     warn $record->as_formatted;
        warn $xml;
        my $record=MARC::Record->new_from_xml($xml,'UTF-8',(C4::Context->preference("marcflavour") eq "UNIMARC"?"UNIMARCAUTH":C4::Context->preference("marcflavour")));
@@ -432,7 +432,7 @@ warn "duplicate:$duplicateauthid,$duplicateauthvalue";
        # build indicator hash.
        my @ind_tag = $input->param('ind_tag');
        my @indicator = $input->param('indicator');
-       my $xml = MARChtml2xml(\@tags,\@subfields,\@values,\@indicator,\@ind_tag);
+       my $xml = TransformHtmlToXml(\@tags,\@subfields,\@values,\@indicator,\@ind_tag);
        my $record=MARC::Record->new_from_xml($xml,'UTF-8');
        $record->encoding('UTF-8');
        # adding an empty field
index 9ca689e..b46c8fd 100755 (executable)
@@ -63,7 +63,7 @@ if ( $op eq "do_search" ) {
     foreach my $marc (@marclist) {
         if ($marc) {
             my ( $tag, $subfield ) =
-              MARCfind_marc_from_kohafield( $dbh, $marc );
+              GetMarcFromKohaField( $dbh, $marc );
             if ($tag) {
                 push @tags, $dbh->quote("$tag$subfield");
             }
index 487105b..d8e8d9d 100755 (executable)
@@ -86,8 +86,8 @@ my $query = new CGI;
 my $dbh = C4::Context->dbh;
 
 my $biblionumber = $query->param('biblionumber');
-my $itemtype     = &MARCfind_frameworkcode($biblionumber);
-my $tagslib      = &MARCgettagslib( $dbh, 1, $itemtype );
+my $itemtype     = &GetFrameworkCode($biblionumber);
+my $tagslib      = &GetMarcStructure( $dbh, 1, $itemtype );
 
 my $record = GetMarcBiblio($biblionumber);
 
index 2397ab3..cb296dd 100755 (executable)
@@ -95,13 +95,13 @@ sub get_authorised_value_desc ($$$$$$) {
 my $query        = new CGI;
 my $dbh          = C4::Context->dbh;
 my $biblionumber = $query->param('biblionumber');
-my $frameworkcode = MARCfind_frameworkcode( $biblionumber );
+my $frameworkcode = GetFrameworkCode( $biblionumber );
 my $popup        =
   $query->param('popup')
   ;    # if set to 1, then don't insert links, it's just to show the biblio
 my $subscriptionid = $query->param('subscriptionid');
 
-my $tagslib = &MARCgettagslib($dbh,1,$frameworkcode);
+my $tagslib = &GetMarcStructure($dbh,1,$frameworkcode);
 
 my $record = GetMarcBiblio($biblionumber);
 
@@ -292,7 +292,7 @@ foreach my $field (@fields) {
         push( @big_array, \%this_row );
     }
 }
-my ($holdingbrtagf,$holdingbrtagsubf) = &MARCfind_marc_from_kohafield($dbh,"items.holdingbranch",$frameworkcode);
+my ($holdingbrtagf,$holdingbrtagsubf) = &GetMarcFromKohaField($dbh,"items.holdingbranch",$frameworkcode);
 @big_array = sort {$a->{$holdingbrtagsubf} cmp $b->{$holdingbrtagsubf}} @big_array;
 
 #fill big_row with missing datas
index e8c86b1..184b5f2 100755 (executable)
@@ -128,7 +128,7 @@ sub MARCfindbreeding {
             return -1;
         } else {
             if (C4::Context->preference("z3950NormalizeAuthor") and C4::Context->preference("z3950AuthorAuthFields")){
-                my ($tag,$subfield) = MARCfind_marc_from_kohafield($dbh,"biblio.author");
+                my ($tag,$subfield) = GetMarcFromKohaField($dbh,"biblio.author");
 #                 my $summary = C4::Context->preference("z3950authortemplate");
                 my $auth_fields = C4::Context->preference("z3950AuthorAuthFields");
                 my @auth_fields= split /,/,$auth_fields;
@@ -470,7 +470,7 @@ my $op = $input->param('op');
 my $frameworkcode = $input->param('frameworkcode');
 my $dbh = C4::Context->dbh;
 
-$frameworkcode = &MARCfind_frameworkcode($biblionumber) if ($biblionumber and not ($frameworkcode));
+$frameworkcode = &GetFrameworkCode($biblionumber) if ($biblionumber and not ($frameworkcode));
 
 $frameworkcode='' if ($frameworkcode eq 'Default');
 my ($template, $loggedinuser, $cookie)
@@ -506,7 +506,7 @@ my $framework=CGI::scrolling_list(
             -multiple => 0 );
 $template->param( framework => $framework, breedingid => $breedingid);
 
-$tagslib = &MARCgettagslib($dbh,1,$frameworkcode);
+$tagslib = &GetMarcStructure($dbh,1,$frameworkcode);
 my $record=-1;
 my $encoding="";
 $record = GetMarcBiblio( $biblionumber ) if ($biblionumber);
@@ -519,8 +519,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) = &MARCfind_marc_from_kohafield($dbh,"biblio.biblionumber",$frameworkcode);
-    ($biblioitemnumtagfield,$biblioitemnumtagsubfield) = &MARCfind_marc_from_kohafield($dbh,"biblioitems.biblioitemnumber",$frameworkcode);
+    ($biblionumtagfield,$biblionumtagsubfield) = &GetMarcFromKohaField($dbh,"biblio.biblionumber",$frameworkcode);
+    ($biblioitemnumtagfield,$biblioitemnumtagsubfield) = &GetMarcFromKohaField($dbh,"biblioitems.biblioitemnumber",$frameworkcode);
     # search biblioitems value
     my $sth=$dbh->prepare("select biblioitemnumber from biblioitems where biblionumber=?");
     $sth->execute($biblionumber);
@@ -537,9 +537,9 @@ if ($op eq "addbiblio") {
     my @ind_tag = $input->param('ind_tag');
     my @indicator = $input->param('indicator');
     if (C4::Context->preference('TemplateEncoding') eq "iso-8859-1") {
-        $record = MARChtml2marc($dbh,\@tags,\@subfields,\@values,\@indicator,\@ind_tag);
+        $record = TransformHtmlToMarc($dbh,\@tags,\@subfields,\@values,\@indicator,\@ind_tag);
     } else {
-        my $xml = MARChtml2xml(\@tags,\@subfields,\@values,\@indicator,\@ind_tag);
+        my $xml = TransformHtmlToXml(\@tags,\@subfields,\@values,\@indicator,\@ind_tag);
         $record=MARC::Record->new_from_xml($xml,C4::Context->preference('TemplateEncoding'),C4::Context->preference('marcflavour'));
 #         warn "MARC :".$record->as_formatted;
 #         die;
@@ -591,16 +591,16 @@ if ($op eq "addbiblio") {
     # build indicator hash.
     my @ind_tag = $input->param('ind_tag');
     my @indicator = $input->param('indicator');
-    my $xml = MARChtml2xml(\@tags,\@subfields,\@values,\@indicator,\@ind_tag);
+    my $xml = TransformHtmlToXml(\@tags,\@subfields,\@values,\@indicator,\@ind_tag);
     my $record;
     if (C4::Context->preference('TemplateEncoding') eq "iso-8859-1") {
         my %indicators;
         for (my $i=0;$i<=$#ind_tag;$i++) {
             $indicators{$ind_tag[$i]} = $indicator[$i];
         }
-        $record = MARChtml2marc($dbh,\@tags,\@subfields,\@values,%indicators);
+        $record = TransformHtmlToMarc($dbh,\@tags,\@subfields,\@values,%indicators);
     } else {
-        my $xml = MARChtml2xml(\@tags,\@subfields,\@values,\@indicator,\@ind_tag);
+        my $xml = TransformHtmlToXml(\@tags,\@subfields,\@values,\@indicator,\@ind_tag);
         $record=MARC::Record->new_from_xml($xml,C4::Context->preference('TemplateEncoding'),C4::Context->preference('marcflavour'));
     }
     for (my $i=1;$i<=$cntrepeatfield;$i++){
index 6a80060..01b9873 100755 (executable)
@@ -87,7 +87,7 @@ if($query) {
     for(my $i=0;$i<$total;$i++) {
         my %resultsloop;
         my $marcrecord = MARC::File::USMARC::decode($marcresults->[$i]);
-        my $biblio = MARCmarc2koha(C4::Context->dbh,$marcrecord,'');
+        my $biblio = TransformMarcToKoha(C4::Context->dbh,$marcrecord,'');
     
         #hilight the result
         $biblio->{'title'} =~ s/$query/<span class=term>$&<\/span>/gi;
index ed7c313..f84dbf1 100755 (executable)
@@ -65,12 +65,12 @@ my $itemnumber = $input->param('itemnumber');
 my $op = $input->param('op');
 
 # find itemtype
-my $frameworkcode = &MARCfind_frameworkcode($biblionumber);
+my $frameworkcode = &GetFrameworkCode($biblionumber);
 
-my $tagslib = &MARCgettagslib($dbh,1,$frameworkcode);
+my $tagslib = &GetMarcStructure($dbh,1,$frameworkcode);
 my $record = GetMarcBiblio($biblionumber);
 # warn "==>".$record->as_formatted;
-my $oldrecord = MARCmarc2koha($dbh,$record);
+my $oldrecord = TransformMarcToKoha($dbh,$record);
 my $itemrecord;
 my $nextop="additem";
 my @errors; # store errors found while checking data BEFORE saving item.
@@ -84,11 +84,11 @@ if ($op eq "additem") {
     # build indicator hash.
     my @ind_tag = $input->param('ind_tag');
     my @indicator = $input->param('indicator');
-    my $xml = MARChtml2xml(\@tags,\@subfields,\@values,\@indicator,\@ind_tag);
+    my $xml = TransformHtmlToXml(\@tags,\@subfields,\@values,\@indicator,\@ind_tag);
         my $record=MARC::Record::new_from_xml($xml, 'UTF-8');
     # if autoBarcode is ON, calculate barcode...
     if (C4::Context->preference('autoBarcode')) {
-        my ($tagfield,$tagsubfield) = &MARCfind_marc_from_kohafield($dbh,"items.barcode");
+        my ($tagfield,$tagsubfield) = &GetMarcFromKohaField($dbh,"items.barcode");
         unless ($record->field($tagfield)->subfield($tagsubfield)) {
             my $sth_barcode = $dbh->prepare("select max(abs(barcode)) from items");
             $sth_barcode->execute;
@@ -102,7 +102,7 @@ if ($op eq "additem") {
         }
     }
 # check for item barcode # being unique
-    my $addedolditem = MARCmarc2koha($dbh,$record);
+    my $addedolditem = TransformMarcToKoha($dbh,$record);
     my $exists = get_item_from_barcode($addedolditem->{'barcode'});
     push @errors,"barcode_not_unique" if($exists);
     # if barcode exists, don't create, but report The problem.
@@ -117,7 +117,7 @@ if ($op eq "additem") {
 } elsif ($op eq "edititem") {
 #-------------------------------------------------------------------------------
 # retrieve item if exist => then, it's a modif
-    $itemrecord = MARCgetitem($biblionumber,$itemnumber);
+    $itemrecord = GetMarcItem($biblionumber,$itemnumber);
     $nextop="saveitem";
 #-------------------------------------------------------------------------------
 } elsif ($op eq "delitem") {
@@ -145,7 +145,7 @@ if ($op eq "additem") {
     my @ind_tag = $input->param('ind_tag');
     my @indicator = $input->param('indicator');
 #    my $itemnumber = $input->param('itemnumber');
-    my $xml = MARChtml2xml(\@tags,\@subfields,\@values,\@indicator,\@ind_tag);
+    my $xml = TransformHtmlToXml(\@tags,\@subfields,\@values,\@indicator,\@ind_tag);
         my $itemrecord=MARC::Record::new_from_xml($xml, 'UTF-8');
 # MARC::Record builded => now, record in DB
 # warn "R: ".$record->as_formatted;
@@ -176,8 +176,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) = &MARCfind_marc_from_kohafield($dbh,"items.itemnumber",$frameworkcode);
-my ($branchtagfield,$branchtagsubfield) = &MARCfind_marc_from_kohafield($dbh,"items.homebranch",$frameworkcode);
+my ($itemtagfield,$itemtagsubfield) = &GetMarcFromKohaField($dbh,"items.itemnumber",$frameworkcode);
+my ($branchtagfield,$branchtagsubfield) = &GetMarcFromKohaField($dbh,"items.homebranch",$frameworkcode);
 
 foreach my $field (@fields) {
     next if ($field->tag()<10);
@@ -207,7 +207,7 @@ foreach my $subfield_code  (keys(%witness)) {
         $big_array[$i]{$subfield_code}="&nbsp;" unless ($big_array[$i]{$subfield_code});
     }
 }
-my ($holdingbrtagf,$holdingbrtagsubf) = &MARCfind_marc_from_kohafield($dbh,"items.holdingbranch",$frameworkcode);
+my ($holdingbrtagf,$holdingbrtagsubf) = &GetMarcFromKohaField($dbh,"items.holdingbranch",$frameworkcode);
 @big_array = sort {$a->{$holdingbrtagsubf} cmp $b->{$holdingbrtagsubf}} @big_array;
 
 # now, construct template !
index 37f95f2..2699db7 100755 (executable)
@@ -233,7 +233,7 @@ sub plugin {
         my @field_data = ($search);
         for (my $i=$startfrom; $i<=(($startfrom+$resultsperpage)<scalar(@$results)?($startfrom+$resultsperpage):scalar(@$results));$i++){
             my $record=MARC::Record::new_from_usmarc( $results->[$i] );
-            my $rechash=MARCmarc2koha($dbh,$record);
+            my $rechash=TransformMarcToKoha($dbh,$record);
             my $pos;
             my $countitems=1 if ($rechash->{itemnumber});
             while (index($rechash->{itemnumber},'|',$pos)>0){
index a2837b7..b923605 100755 (executable)
@@ -108,12 +108,12 @@ if ($op ne "do_search"){
        } elsif ($title) {
                $attr='1=4 ';
         utf8::decode($title);
-        $title=~tr/àâäéèêëîïôöùû/aaaeeeeiioouu/;
+        $title=~tr/������/aaaeeeeiioouu/;
                $term=$title;
        } elsif ($author) {
                $attr='1=1003';
         utf8::decode($author);
-        $author=~tr/àâäéèêëîïôöùû/aaaeeeeiioouu/;
+        $author=~tr/������/aaaeeeeiioouu/;
                $term=$author;
        }
 
@@ -178,7 +178,7 @@ AGAIN:
   ## In HEAD i change everything to UTF-8
   # In rel2_2 i am not sure what encoding is so no character conversion is done here
   ##Add necessary encoding changes to here -TG
-                  my $oldbiblio = MARCmarc2koha($dbh,$marcrecord,"");
+                  my $oldbiblio = TransformMarcToKoha($dbh,$marcrecord,"");
                   $oldbiblio->{isbn} =~ s/ |-|\.//g,
                   $oldbiblio->{issn} =~ s/ |-|\.//g,
                   my ($notmarcrecord,$alreadyindb,$alreadyinfarm,$imported,$breedingid)=ImportBreeding($marcdata,1,$serverhost[$k],$encoding[$k],$random);
index 4952c7d..5b2d8fb 100644 (file)
@@ -51,9 +51,6 @@
     <table>
     <tr>
        <th>Title</th>
-       <th>Author</th>
-       <th>publisher</th>
-       <th>Publication year</th>
     </tr>
     <!-- TMPL_LOOP NAME="resultsloop" -->
         <tr>
                 <a href="/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->">
                     <!-- TMPL_VAR NAME="title" -->
                 </a>
-                <br />
-                <small><!-- TMPL_VAR NAME="subtitle" --></small>
-            </td>
-            <td>
-                <!-- TMPL_VAR NAME="author" -->
-            </td>
-            <td>
-                <!-- TMPL_VAR NAME="publishercode" -->
-            </td>
-            <td>
-                <!-- TMPL_VAR NAME="publicationyear" -->
-            </td>
-        </tr>
+                <!-- TMPL_IF name="summary" -->
+                    <p><!-- TMPL_VAR name="summary" --></p>
+                <!-- TMPL_ELSE -->
+                    <p>
+                        <!-- TMPL_IF NAME="author" -->
+                            <!-- TMPL_VAR NAME="author" -->
+                        <!-- TMPL_ELSE -->
+                            &nbsp;
+                        <!-- /TMPL_IF -->
+                        <!-- TMPL_IF name="publicationyear" --> - <!-- TMPL_VAR name="publicationyear" --><!-- /TMPL_IF -->
+                        <!-- TMPL_IF name="publishercode" -->- <!-- TMPL_VAR name="publishercode" --><!-- /TMPL_IF -->
+                        <!-- TMPL_IF name="place" --> ; <!-- TMPL_VAR name="place" --><!-- /TMPL_IF -->
+                        <!-- TMPL_IF name="pages" --> - <!-- TMPL_VAR name="pages" --><!-- /TMPL_IF -->
+                        <!-- TMPL_IF name="notes" --> : <!-- TMPL_VAR name="notes" --><!-- /TMPL_IF -->
+                        <!-- TMPL_IF name="size" --> ; <!-- TMPL_VAR name="size" --><!-- /TMPL_IF -->
+                        <!-- TMPL_IF name="timestamp" --> <i>(modified on <!-- TMPL_VAR name="timestamp" -->)</i><!-- /TMPL_IF -->
+                    </p>
+                <!-- /TMPL_IF -->
+</tr>
     <!-- /TMPL_LOOP -->
     </table>
 </div>
@@ -90,7 +93,6 @@
         <table>
             <tr>
                 <th>Title</th>
-                <th>Author</th>
                 <th>ISBN</th>
                 <th>coming from</th>
                 <th>&nbsp;</th>
             </tr>
             <!-- TMPL_LOOP NAME="breeding_loop" -->
             <!-- TMPL_IF NAME="toggle" --><tr><!-- TMPL_ELSE --><tr class="hilighted"><!-- /TMPL_IF -->
-                <td><!-- TMPL_VAR NAME="title" --></a>
-                <td><!-- TMPL_VAR NAME="author" --></td>
+                <td><!-- TMPL_VAR NAME="title" -->
+                <!-- TMPL_VAR NAME="author" --></td>
                 <td><!-- TMPL_VAR NAME="isbn" --></td>
                 <td><!-- TMPL_VAR NAME="file" --></td>
                 <!-- TMPL_IF NAME="NOTMARC" -->
index 6f5c059..b703af7 100755 (executable)
@@ -42,7 +42,7 @@ my $cleansubfield = $dbh->prepare("delete from marc_subfield_table where tag=? a
 my $cleanword = $dbh->prepare("delete from marc_word where tag=? and subfieldid=?");
 
 # get tags structure
-my $tags = MARCgettagslib($dbh,1);
+my $tags = GetMarcStructure($dbh,1);
 foreach my $tag (sort keys(%{$tags})) {
        foreach my $subfield (sort keys(%{$tags->{$tag}})) {
                next if $subfield eq "lib";
index 4712bf5..803a256 100644 (file)
@@ -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) = MARCfind_marc_from_kohafield($dbh,"items.itemnumber","");
-my ($date_dueTag,$date_dueSubfield) = MARCfind_marc_from_kohafield($dbh,"items.issues","");
+my ($itemnumberTag,$itemnumberSubfield) = GetMarcFromKohaField($dbh,"items.itemnumber","");
+my ($date_dueTag,$date_dueSubfield) = GetMarcFromKohaField($dbh,"items.issues","");
 my (
 while (my $biblionumber=$biblionumber_sth->fetchrow) {
        $count++;
index 9d893c3..8dda84f 100644 (file)
@@ -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) = &MARCfind_marc_from_kohafield($dbh,"biblio.biblionumber","");
+my ($tagfield,$biblionumtagsubfield) = &GetMarcFromKohaField($dbh,"biblio.biblionumber","");
 
 while ( my $record = $batch->next() ) {
 my $biblionumber=$record->field($tagfield)->subfield($biblionumtagsubfield);
index d9cf481..27ad735 100755 (executable)
@@ -28,8 +28,8 @@ while (my ($biblionumber,$biblioitemnumber)=$sth->fetchrow ){
 sub MARCmodbiblionumber{
     my ($biblionumber,$biblioitemnumber,$record)=@_;
     
-    my ($tagfield,$biblionumtagsubfield) = &MARCfind_marc_from_kohafield($dbh,"biblio.biblionumber","");
-    my ($tagfield2,$biblioitemtagsubfield) = &MARCfind_marc_from_kohafield($dbh,"biblio.biblioitemnumber","");
+    my ($tagfield,$biblionumtagsubfield) = &GetMarcFromKohaField($dbh,"biblio.biblionumber","");
+    my ($tagfield2,$biblioitemtagsubfield) = &GetMarcFromKohaField($dbh,"biblio.biblioitemnumber","");
         
     my $update=0;
         my @tags = $record->field($tagfield);
index 49a40bc..db1665f 100755 (executable)
@@ -29,7 +29,7 @@ my $totaldone=0;
 $|=1;
 
 while (my ($bibid,$biblionumber) = $sth->fetchrow) {
-    my $record = MARCgetbiblio($dbh,$bibid);
+    my $record = LocalMARCgetbiblio($dbh,$bibid);
     #Force UTF-8 in record leader
     $record->encoding('UTF-8');
     $sth_update->execute($record->as_usmarc(),$record->as_xml_record(),$biblionumber);
@@ -41,14 +41,14 @@ print "\rdone\n";
 
 
 #
-# those 2 subs are a copy of Biblio.pm, version 2.2.4
-# they are useful only once, for moving from 2.2 to 3.0
-# the MARCgetbiblio & MARCgetitem subs in Biblio.pm
-# are still here, but uses other tables
+# this sub is a copy of Biblio.pm, version 2.2.4
+# It is useful only once, for moving from 2.2 to 3.0
+# the MARCgetbiblio in Biblio.pm
+# is still here, but uses other tables
 # (the ones that are filled by updatedatabase !)
 #
 
-sub MARCgetbiblio {
+sub LocalMARCgetbiblio {
 
     # Returns MARC::Record of the biblio passed in parameter.
     my ( $dbh, $bibid ) = @_;
@@ -137,68 +137,4 @@ sub MARCgetbiblio {
         }
     }
     return $record;
-}
-
-sub MARCgetitem {
-
-    # Returns MARC::Record of the biblio passed in parameter.
-    my ( $dbh, $bibid, $itemnumber ) = @_;
-    my $record = MARC::Record->new();
-
-    # search MARC tagorder
-    my $sth2 =
-      $dbh->prepare(
-"select tagorder from marc_subfield_table,marc_subfield_structure where marc_subfield_table.tag=marc_subfield_structure.tagfield and marc_subfield_table.subfieldcode=marc_subfield_structure.tagsubfield and bibid=? and kohafield='items.itemnumber' and subfieldvalue=?"
-    );
-    $sth2->execute( $bibid, $itemnumber );
-    my ($tagorder) = $sth2->fetchrow_array();
-
-    #---- TODO : the leader is missing
-    my $sth =
-      $dbh->prepare(
-"select bibid,subfieldid,tag,tagorder,tag_indicator,subfieldcode,subfieldorder,subfieldvalue,valuebloblink
-                  from marc_subfield_table
-                  where bibid=? and tagorder=? order by subfieldcode,subfieldorder
-              "
-    );
-    $sth2 =
-      $dbh->prepare(
-        "select subfieldvalue from marc_blob_subfield where blobidlink=?");
-    $sth->execute( $bibid, $tagorder );
-    while ( my $row = $sth->fetchrow_hashref ) {
-        if ( $row->{'valuebloblink'} ) {    #---- search blob if there is one
-            $sth2->execute( $row->{'valuebloblink'} );
-            my $row2 = $sth2->fetchrow_hashref;
-            $sth2->finish;
-            $row->{'subfieldvalue'} = $row2->{'subfieldvalue'};
-        }
-        if ( $record->field( $row->{'tag'} ) ) {
-            my $field;
-
-#--- this test must stay as this, because of strange behaviour of mySQL/Perl DBI with char var containing a number...
-            #--- sometimes, eliminates 0 at beginning, sometimes no ;-\\\
-            if ( length( $row->{'tag'} ) < 3 ) {
-                $row->{'tag'} = "0" . $row->{'tag'};
-            }
-            $field = $record->field( $row->{'tag'} );
-            if ($field) {
-                my $x =
-                  $field->add_subfields( $row->{'subfieldcode'},
-                    $row->{'subfieldvalue'} );
-                $record->delete_field($field);
-                $record->add_fields($field);
-            }
-        }
-        else {
-            if ( length( $row->{'tag'} ) < 3 ) {
-                $row->{'tag'} = "0" . $row->{'tag'};
-            }
-            my $temp =
-              MARC::Field->new( $row->{'tag'}, " ", " ",
-                $row->{'subfieldcode'} => $row->{'subfieldvalue'} );
-            $record->add_fields($temp);
-        }
-
-    }
-    return $record;
-}
+}
\ No newline at end of file
index a42bd72..513291e 100644 (file)
@@ -208,7 +208,7 @@ $commitnum = $commit;
 }
 
 #1st of all, find item MARC tag.
-my ($tagfield,$tagsubfield) = &MARCfind_marc_from_kohafield($dbh,"items.itemnumber",'');
+my ($tagfield,$tagsubfield) = &GetMarcFromKohaField($dbh,"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");
 while ( my $record = $batch->next() ) {
 # warn "=>".$record->as_formatted;
index f5d503e..ac063ac 100755 (executable)
@@ -38,8 +38,8 @@ my $authorityserverdir = C4::Context->zebraconfig('authorityserver')->{directory
 
 my $kohadir = C4::Context->config('intranetdir');
 my $dbh = C4::Context->dbh;
-my ($biblionumbertagfield,$biblionumbertagsubfield) = &MARCfind_marc_from_kohafield($dbh,"biblio.biblionumber","");
-my ($biblioitemnumbertagfield,$biblioitemnumbertagsubfield) = &MARCfind_marc_from_kohafield($dbh,"biblioitems.biblioitemnumber","");
+my ($biblionumbertagfield,$biblionumbertagsubfield) = &GetMarcFromKohaField($dbh,"biblio.biblionumber","");
+my ($biblioitemnumbertagfield,$biblioitemnumbertagsubfield) = &GetMarcFromKohaField($dbh,"biblioitems.biblioitemnumber","");
 
 print "some informations\n";
 print "=================\n";
@@ -204,8 +204,8 @@ if ($authorities) {
         $created_dir_or_file++;
     }
     
-    unless (-f C4::Context->zebraoptions('authorityserver')->{ccl2rpn}) {
-        system("cp -f $kohadir/misc/zebra/ccl.properties ".C4::Context->zebraoptions('authorityserver')->{ccl2rpn});
+    unless (-f C4::Context->ModZebrations('authorityserver')->{ccl2rpn}) {
+        system("cp -f $kohadir/misc/zebra/ccl.properties ".C4::Context->ModZebrations('authorityserver')->{ccl2rpn});
     #    system("cp -f $kohadir/misc/zebra/ccl.properties $authorityserverdir/etc/ccl.properties");
         print "Info: copied ccl.properties\n";
         $created_dir_or_file++;
@@ -391,8 +391,8 @@ if ($biblios) {
         print "Info: copied default.idx\n";
         $created_dir_or_file++;
     }
-    unless (-f C4::Context->zebraoptions('biblioserver')->{ccl2rpn}) {
-        system("cp -f $kohadir/misc/zebra/ccl.properties ".C4::Context->zebraoptions('biblioserver')->{ccl2rpn});
+    unless (-f C4::Context->ModZebrations('biblioserver')->{ccl2rpn}) {
+        system("cp -f $kohadir/misc/zebra/ccl.properties ".C4::Context->ModZebrations('biblioserver')->{ccl2rpn});
     #    system("cp -f $kohadir/misc/zebra/ccl.properties $biblioserverdir/etc/ccl.properties");
         print "Info: copied ccl.properties\n";
         $created_dir_or_file++;
index 6c27624..72f476c 100755 (executable)
@@ -27,8 +27,8 @@ while (my ($biblionumber,$biblioitemnumber)=$sth->fetchrow ){
 sub MARCmodbiblionumber{
 my ($biblionumber,$biblioitemnumber,$record)=@_;
 
-my ($tagfield,$biblionumtagsubfield) = &MARCfind_marc_from_kohafield($dbh,"biblio.biblionumber","");
-my ($tagfield2,$biblioitemtagsubfield) = &MARCfind_marc_from_kohafield($dbh,"biblio.biblioitemnumber","");
+my ($tagfield,$biblionumtagsubfield) = &GetMarcFromKohaField($dbh,"biblio.biblionumber","");
+my ($tagfield2,$biblioitemtagsubfield) = &GetMarcFromKohaField($dbh,"biblio.biblioitemnumber","");
     
 my $update=0;
       my @tags = $record->field($tagfield);
index d9eb5c0..1ca7f3d 100755 (executable)
@@ -43,7 +43,7 @@ $|=1; # flushes output
 my $starttime = gettimeofday;
 
 #1st of all, find item MARC tag.
-my ($tagfield,$tagsubfield) = &MARCfind_marc_from_kohafield($dbh,"items.itemnumber",'');
+my ($tagfield,$tagsubfield) = &GetMarcFromKohaField($dbh,"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;
@@ -68,12 +68,12 @@ while (my ($bibid)= $sth->fetchrow) {
     }
 #     print "$bibid\n";
     # now, create biblio and items with NEWnewXX call.
-    my $frameworkcode = MARCfind_frameworkcode($bibid);
+    my $frameworkcode = GetFrameworkCode($bibid);
     localNEWmodbiblio($dbh,$record,$bibid,$frameworkcode) unless $test_parameter;
 #     warn 'B=>'.$record->as_formatted;
 #     print "biblio done\n";
     for (my $i=0;$i<=$#items;$i++) {
-        my $tmp = MARCmarc2koha($dbh,$items[$i],$frameworkcode) unless $test_parameter; # finds the itemnumber
+        my $tmp = TransformMarcToKoha($dbh,$items[$i],$frameworkcode) unless $test_parameter; # finds the itemnumber
 #         warn "    I=> ".$items[$i]->as_formatted;
         localNEWmoditem($dbh,$items[$i],$bibid,$tmp->{itemnumber},0) unless $test_parameter;
 #         print "1 item done\n";
@@ -89,7 +89,7 @@ sub localNEWmodbiblio {
     my ($dbh,$record,$bibid,$frameworkcode) =@_;
     $frameworkcode="" unless $frameworkcode;
 #     &MARCmodbiblio($dbh,$bibid,$record,$frameworkcode,0);
-    my $oldbiblio = MARCmarc2koha($dbh,$record,$frameworkcode);
+    my $oldbiblio = TransformMarcToKoha($dbh,$record,$frameworkcode);
 
     return 1;
 }
@@ -97,7 +97,7 @@ sub localNEWmodbiblio {
 sub localNEWmoditem {
     my ( $dbh, $record, $bibid, $itemnumber, $delete ) = @_;
 #     warn "NEWmoditem $bibid / $itemnumber / $delete ".$record->as_formatted;
-    my $frameworkcode=MARCfind_frameworkcode($bibid);
-    my $olditem = MARCmarc2koha( $dbh, $record,$frameworkcode );
+    my $frameworkcode=GetFrameworkCode($bibid);
+    my $olditem = TransformMarcToKoha( $dbh, $record,$frameworkcode );
     C4::Biblio::_koha_modify_item( $dbh, $olditem );
 }
index 77094fb..df7f45d 100755 (executable)
@@ -62,14 +62,14 @@ my $query = new CGI;
 my $dbh = C4::Context->dbh;
 
 my $biblionumber = $query->param('biblionumber');
-my $itemtype     = &MARCfind_frameworkcode($biblionumber);
-my $tagslib      = &MARCgettagslib( $dbh, 1, $itemtype );
+my $itemtype     = &GetFrameworkCode($biblionumber);
+my $tagslib      = &GetMarcStructure( $dbh, 1, $itemtype );
 
 my $record = GetMarcBiblio($biblionumber);
 
 #coping with subscriptions
 my $subscriptionsnumber = CountSubscriptionFromBiblionumber($biblionumber);
-my $dat                 = MARCmarc2koha( $dbh, $record );
+my $dat                 = TransformMarcToKoha( $dbh, $record );
 my @subscriptions       =
   GetSubscriptions( $dat->{title}, $dat->{issn}, $biblionumber );
 my @subs;
index 7ab3579..d8edefa 100755 (executable)
@@ -56,8 +56,8 @@ my $query = new CGI;
 my $dbh = C4::Context->dbh;
 
 my $biblionumber = $query->param('biblionumber');
-my $itemtype     = &MARCfind_frameworkcode($biblionumber);
-my $tagslib      = &MARCgettagslib( $dbh, 0, $itemtype );
+my $itemtype     = &GetFrameworkCode($biblionumber);
+my $tagslib      = &GetMarcStructure( $dbh, 0, $itemtype );
 
 my $record = GetMarcBiblio($biblionumber);
 
@@ -236,7 +236,7 @@ foreach my $field (@fields) {
     }
 }
 my ( $holdingbrtagf, $holdingbrtagsubf ) =
-  &MARCfind_marc_from_kohafield( $dbh, "items.holdingbranch", $itemtype );
+  &GetMarcFromKohaField( $dbh, "items.holdingbranch", $itemtype );
 @big_array =
   sort { $a->{$holdingbrtagsubf} cmp $b->{$holdingbrtagsubf} } @big_array;
 
index 2277174..4da3c76 100755 (executable)
@@ -202,7 +202,7 @@ if ($op eq 'serialchangestatus') {
           $index = $i if ($itemhash{$item}->{'serial'} eq $serialids[$i]);
         }
         if ($status[$index]==2){
-          my $xml = MARChtml2xml( $itemhash{$item}->{'tags'},
+          my $xml = TransformHtmlToXml( $itemhash{$item}->{'tags'},
                                   $itemhash{$item}->{'subfields'},
                                   $itemhash{$item}->{'field_values'},
                                   $itemhash{$item}->{'ind_tag'},
@@ -212,7 +212,7 @@ if ($op eq 'serialchangestatus') {
           if ($item=~/^N/){
             #New Item
             # if autoBarcode is ON, calculate barcode...
-            my ($tagfield,$tagsubfield) = &MARCfind_marc_from_kohafield($dbh,"items.barcode");
+            my ($tagfield,$tagsubfield) = &GetMarcFromKohaField($dbh,"items.barcode");
             if (C4::Context->preference('autoBarcode')) {
               unless ($record->field($tagfield)->subfield($tagsubfield)) {
                 my $sth_barcode = $dbh->prepare("select max(abs(barcode)) from items");
index 8342122..bb7e560 100755 (executable)
@@ -201,7 +201,7 @@ my $subs = &GetSubscription($subscriptionid);
 my ($totalissues,@serialslist) = GetSerials($subscriptionid);
 
 if (C4::Context->preference("serialsadditems")){
-    my $fwk=MARCfind_frameworkcode($subscription->{biblionumber});
+    my $fwk=GetFrameworkCode($subscription->{biblionumber});
 
     my $branches = GetBranches;
     my @branchloop;
index 4f2e2bf..c379346 100755 (executable)
@@ -89,7 +89,7 @@ if ($op eq "do_search") {
     for(my $i=0;$i<$total;$i++) {
         my %resultsloop;
         my $marcrecord = MARC::File::USMARC::decode($marcrecords->[$i]);
-        my $biblio = MARCmarc2koha(C4::Context->dbh,$marcrecord,'');
+        my $biblio = TransformMarcToKoha(C4::Context->dbh,$marcrecord,'');
 
         #build the hash for the template.
         $resultsloop{highlight}       = ($i % 2)?(1):(0);
index a012514..c540c64 100755 (executable)
@@ -89,7 +89,7 @@ if ($op eq "export") {
         if ( $dont_export_items ) {
             # now, find where the itemnumber is stored & extract only the item
             my ( $itemnumberfield, $itemnumbersubfield ) =
-                MARCfind_marc_from_kohafield( $dbh, 'items.itemnumber', '' );
+                GetMarcFromKohaField( $dbh, 'items.itemnumber', '' );
 
             # and delete it.
             foreach ($record->field($itemnumberfield)){