koha-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Koha-cvs] koha/C4 Biblio.pm


From: Antoine Farnault
Subject: [Koha-cvs] koha/C4 Biblio.pm
Date: Tue, 31 Jul 2007 16:01:11 +0000

CVSROOT:        /sources/koha
Module name:    koha
Changes by:     Antoine Farnault <toins>        07/07/31 16:01:11

Modified files:
        C4             : Biblio.pm 

Log message:
        Some new functions.
        TransformHTMLtoMarc rewrited.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/C4/Biblio.pm?cvsroot=koha&r1=1.220&r2=1.221

Patches:
Index: Biblio.pm
===================================================================
RCS file: /sources/koha/koha/C4/Biblio.pm,v
retrieving revision 1.220
retrieving revision 1.221
diff -u -b -r1.220 -r1.221
--- Biblio.pm   20 Jul 2007 15:43:16 -0000      1.220
+++ Biblio.pm   31 Jul 2007 16:01:11 -0000      1.221
@@ -33,7 +33,7 @@
 use vars qw($VERSION @ISA @EXPORT);
 
 # set the version for version checking
-$VERSION = do { my @v = '$Revision: 1.220 $' =~ /\d+/g; shift(@v).".".join( 
"_", map { sprintf "%03d", $_ } @v ); };
+$VERSION = do { my @v = '$Revision: 1.221 $' =~ /\d+/g; shift(@v).".".join( 
"_", map { sprintf "%03d", $_ } @v ); };
 
 @ISA = qw( Exporter );
 
@@ -65,6 +65,7 @@
   &GetMarcBiblio
   &GetMarcAuthors
   &GetMarcSeries
+  &GetUsedMarcStructure
 
   &GetItemsInfo
   &GetItemnumberFromBarcode
@@ -75,6 +76,7 @@
   &GetMarcStructure
   &GetMarcFromKohaField
   &GetFrameworkCode
+  &GetPublisherNameFromIsbn
   &TransformKohaToMarc
 );
 
@@ -110,6 +112,7 @@
 # Others functions
 push @EXPORT, qw(
   &TransformMarcToKoha
+  &TransformHtmlToMarc2
   &TransformHtmlToMarc
   &TransformHtmlToXml
   &PrepareItemrecordDisplay
@@ -280,10 +283,10 @@
 
 =head2 AddItem
 
-=over
+=over 2
 
-$biblionumber = AddItem( $record, $biblionumber)
-Exported function (core API) for adding a new item to Koha
+    $biblionumber = AddItem( $record, $biblionumber)
+    Exported function (core API) for adding a new item to Koha
 
 =back
 
@@ -332,8 +335,7 @@
       &_koha_new_items( $dbh, $item, $item->{barcode} );
 
     # add itemnumber to MARC::Record before adding the item.
-    $sth =
-      $dbh->prepare(
+    $sth = $dbh->prepare(
 "select tagfield,tagsubfield from marc_subfield_structure where 
frameworkcode=? and kohafield=?"
       );
     &TransformKohaToMarcOneField( $sth, $record, "items.itemnumber", 
$itemnumber,
@@ -350,21 +352,16 @@
 
 =head2 ModBiblio
 
-=over
-
-ModBiblio( $record,$biblionumber,$frameworkcode);
-Exported function (core API) to modify a biblio
-
-=back
+    ModBiblio( $record,$biblionumber,$frameworkcode);
+    Exported function (core API) to modify a biblio
 
 =cut
 
 sub ModBiblio {
     my ( $record, $biblionumber, $frameworkcode ) = @_;
-    
     if (C4::Context->preference("CataloguingLog")) {    
         my $newrecord = GetMarcBiblio($biblionumber);
-        
&logaction(C4::Context->userenv->{'number'},"CATALOGUING","MODIFY",$biblionumber,$newrecord->as_formatted)
 
+        
&logaction(C4::Context->userenv->{'number'},"CATALOGUING","MODIFY",$biblionumber,"BEFORE=>".$newrecord->as_formatted);
     }
     
     my $dbh = C4::Context->dbh;
@@ -373,26 +370,40 @@
 
     # get the items before and append them to the biblio before updating the 
record, atm we just have the biblio
     my ( $itemtag, $itemsubfield ) = 
GetMarcFromKohaField("items.itemnumber",$frameworkcode);
-    my $oldRecord = GetMarcBiblio($biblionumber);
-    my @fields = $oldRecord->field($itemtag);
-    $record->append_fields(@fields);
+    my $oldRecord = GetMarcBiblio( $biblionumber );
+    #$oldRecord->encoding('UTF-8');
+    
+    my @fields = $oldRecord->field( $itemtag );
+    foreach (@fields){
+        if ( !utf8::is_utf8( $_ ) ) {
+            utf8::decode( $_ );
+        }
+    }
+    $record->append_fields( @fields ); # FIXME : encoding error...
+    
+    # adding biblionumber
+    my ($tag_biblionumber, $subfield_biblionumber) = 
GetMarcFromKohaField('biblio.biblionumber',$frameworkcode);
+    $record->append_fields(
+       MARC::Field->new(
+               $tag_biblionumber,'','',$subfield_biblionumber => $biblionumber
+       )
+    );
 
     # update the MARC record (that now contains biblio and items) with the new 
record data
-    &ModBiblioMarc($record, $biblionumber, $frameworkcode );
+    &ModBiblioMarc( $record, $biblionumber, $frameworkcode );
 
     # load the koha-table data object
     my $oldbiblio = TransformMarcToKoha( $dbh, $record, $frameworkcode );
 
     # modify the other koha tables
-    $biblionumber = _koha_modify_biblio( $dbh, $oldbiblio );
+    _koha_modify_biblio( $dbh, $oldbiblio );
     _koha_modify_biblioitem( $dbh, $oldbiblio );
-
     return 1;
 }
 
 =head2 ModItem
 
-=over
+=over 2
 
 Exported function (core API) for modifying an item in Koha.
 
@@ -469,23 +480,20 @@
 #     }
 #     return;
 # }
-=head2 ModBiblioframework
-
-=over
 
-ModBiblioframework($biblionumber,$frameworkcode);
-Exported function to modify a biblio framework
+=head2 ModBiblioframework
 
-=back
+    ModBiblioframework($biblionumber,$frameworkcode);
+    Exported function to modify a biblio framework
 
 =cut
 
 sub ModBiblioframework {
     my ( $biblionumber, $frameworkcode ) = @_;
     my $dbh = C4::Context->dbh;
-    my $sth =
-      $dbh->prepare(
-        "UPDATE biblio SET frameworkcode=? WHERE biblionumber=$biblionumber");
+    my $sth = $dbh->prepare(
+        "UPDATE biblio SET frameworkcode=? WHERE biblionumber=$biblionumber"
+    );
     $sth->execute($frameworkcode);
     return 1;
 }
@@ -1465,6 +1473,7 @@
       $dbh->prepare(
 "select tagfield,tagsubfield,liblibrarian,libopac,tab, mandatory, 
repeatable,authorised_value,authtypecode,value_builder,kohafield,seealso,hidden,isurl,link,defaultvalue
 from marc_subfield_structure where frameworkcode=? order by 
tagfield,tagsubfield"
       );
+    
     $sth->execute($frameworkcode);
 
     my $subfield;
@@ -1508,6 +1517,38 @@
     return $res;
 }
 
+=head2 GetUsedMarcStructure
+
+    the same function as GetMarcStructure expcet it just take field
+    in tab 0-9. (used field)
+    
+    my $results = GetUsedMarcStructure($frameworkcode);
+    
+    L<$results> is a ref to an array which each case containts a ref
+    to a hash which each keys is the columns from marc_subfield_structure
+    
+    L<$frameworkcode> is the framework code. 
+    
+=cut
+
+sub GetUsedMarcStructure($){
+    my $frameworkcode = shift || '';
+    my $dbh           = C4::Context->dbh;
+    my $query         = qq/
+        SELECT *
+        FROM   marc_subfield_structure
+        WHERE   tab > -1 
+            AND frameworkcode = ?
+    /;
+    my @results;
+    my $sth = $dbh->prepare($query);
+    $sth->execute($frameworkcode);
+    while (my $row = $sth->fetchrow_hashref){
+        push @results,$row;
+    }
+    return address@hidden;
+}
+
 =head2 GetMarcFromKohaField
 
 =over 4
@@ -1901,7 +1942,7 @@
 
 =over 4
 
-$frameworkcode = GetFrameworkCode( $biblionumber )
+    $frameworkcode = GetFrameworkCode( $biblionumber )
 
 =back
 
@@ -1910,21 +1951,50 @@
 sub GetFrameworkCode {
     my ( $biblionumber ) = @_;
     my $dbh = C4::Context->dbh;
-    my $sth =
-      $dbh->prepare("select frameworkcode from biblio where biblionumber=?");
+    my $sth = $dbh->prepare("select frameworkcode from biblio where 
biblionumber=?");
     $sth->execute($biblionumber);
     my ($frameworkcode) = $sth->fetchrow;
     return $frameworkcode;
 }
 
+=head2 GetPublisherNameFromIsbn
+
+    $name = GetPublishercodeFromIsbn($isbn);
+    if(defined $name){
+        ...
+    }
+
+=cut
+
+sub GetPublisherNameFromIsbn($){
+    my $isbn = shift;
+    $isbn =~ s/[- _]//g;
+    $isbn =~ s/^0*//;
+    my @codes = (split '-', DisplayISBN($isbn));
+    my $code = $codes[0].$codes[1].$codes[2];
+    my $dbh  = C4::Context->dbh;
+    my $query = qq{
+        SELECT distinct publishercode
+        FROM   biblioitems
+        WHERE  isbn LIKE ?
+        AND    publishercode IS NOT NULL
+        LIMIT 1
+    };
+    my $sth = $dbh->prepare($query);
+    $sth->execute("$code%");
+    my $name = $sth->fetchrow;
+    return $name if length $name;
+    return undef;
+}
+
 =head2 TransformKohaToMarc
 
 =over 4
 
-$record = TransformKohaToMarc( $hash )
-This function builds partial MARC::Record from a hash
-Hash entries can be from biblio or biblioitems.
-This function is called in acquisition module, to create a basic catalogue 
entry from user entry
+    $record = TransformKohaToMarc( $hash )
+    This function builds partial MARC::Record from a hash
+    Hash entries can be from biblio or biblioitems.
+    This function is called in acquisition module, to create a basic catalogue 
entry from user entry
 
 =back
 
@@ -1950,7 +2020,7 @@
 
 =over 4
 
-$record = TransformKohaToMarcOneField( $sth, $record, $kohafieldname, $value, 
$frameworkcode );
+    $record = TransformKohaToMarcOneField( $sth, $record, $kohafieldname, 
$value, $frameworkcode );
 
 =back
 
@@ -1964,9 +2034,8 @@
 
     if ( !defined $sth ) {
         my $dbh = C4::Context->dbh;
-        $sth =
-          $dbh->prepare(
-"select tagfield,tagsubfield from marc_subfield_structure where 
frameworkcode=? and kohafield=?"
+        $sth = $dbh->prepare(
+            "select tagfield,tagsubfield from marc_subfield_structure where 
frameworkcode=? and kohafield=?"
           );
     }
     $sth->execute( $frameworkcode, $kohafieldname );
@@ -1994,6 +2063,7 @@
 - nothing : rebuild a biblio, un UNIMARC the encoding is in 100$a pos 26/27
 - UNIMARCAUTH : rebuild an authority. In UNIMARC, the encoding is in 100$a pos 
13/14
 - ITEM : rebuild an item : in UNIMARC, 100$a, it's in the biblio ! (otherwise, 
we would get 2 100 fields !)
+
 =back
 
 =cut
@@ -2120,82 +2190,82 @@
 
 =head2 TransformHtmlToMarc
 
-=over 4
-
-$record = TransformHtmlToMarc( $dbh, $rtags, $rsubfields, $rvalues, 
%indicators )
-
-=back
+    L<$record> = TransformHtmlToMarc(L<$params>,L<$cgi>)
+    L<$params> is a ref to an array as below:
+    {
+        'tag_010_indicator_531951' ,
+        'tag_010_code_a_531951_145735' ,
+        'tag_010_subfield_a_531951_145735' ,
+        'tag_200_indicator_873510' ,
+        'tag_200_code_a_873510_673465' ,
+        'tag_200_subfield_a_873510_673465' ,
+        'tag_200_code_b_873510_704318' ,
+        'tag_200_subfield_b_873510_704318' ,
+        'tag_200_code_e_873510_280822' ,
+        'tag_200_subfield_e_873510_280822' ,
+        'tag_200_code_f_873510_110730' ,
+        'tag_200_subfield_f_873510_110730' ,
+    }
+    L<$cgi> is the CGI object which containts the value.
+    L<$record> is the MARC::Record object.
 
 =cut
 
 sub TransformHtmlToMarc {
-    my ( $dbh, $rtags, $rsubfields, $rvalues, %indicators ) = @_;
-    my $prevtag = -1;
-    my $record  = MARC::Record->new();
+    my $params = shift;
+    my $cgi    = shift;
 
-    #     my %subfieldlist=();
-    my $prevvalue;    # if tag <10
-    my $field;        # if tag >=10
-    for ( my $i = 0 ; $i < @$rtags ; $i++ ) {
-        next unless @$rvalues[$i];
-
- # rebuild MARC::Record
- #             warn "0=>"address@hidden@$rsubfields[$i]." = "address@hidden": 
";
-        if ( @$rtags[$i] ne $prevtag ) {
-            if ( $prevtag < 10 ) {
-                if ($prevvalue) {
+    # creating a new record
+    my $record  = MARC::Record->new();
+    my $i=0;
+    my @fields;
 
-                    if ( $prevtag ne '000' ) {
-                        $record->insert_fields_ordered(
-                            ( sprintf "%03s", $prevtag ), $prevvalue );
-                    }
-                    else {
+    while ($params->[$i]){ # browse all CGI params
+        my $param = $params->[$i];
 
-                        $record->leader($prevvalue);
+        if($param =~ /^tag_(\d*)_indicator_/){ # new field start when having 
'input name="..._indicator_..."
+            my $tag  = $1;
 
-                    }
-                }
-            }
-            else {
-                if ($field) {
-                    $record->insert_fields_ordered($field);
-                }
-            }
-            $indicators{ @$rtags[$i] } .= '  ';
-            if ( @$rtags[$i] < 10 ) {
-                $prevvalue = @$rvalues[$i];
-                undef $field;
-            }
-            else {
-                undef $prevvalue;
-                $field = MARC::Field->new(
-                    ( sprintf "%03s", @$rtags[$i] ),
-                    substr( $indicators{ @$rtags[$i] }, 0, 1 ),
-                    substr( $indicators{ @$rtags[$i] }, 1, 1 ),
-                    @$rsubfields[$i] => @$rvalues[$i]
+            my $ind1 = substr($cgi->param($param),0,1);
+            my $ind2 = substr($cgi->param($param),1,1);
+            
+            my $newfield=0;
+            my $j=$i+1;
+            
+            if($tag < 10){ # no code for theses fields
+                my $inner_param = $params->[$j];
+                $newfield = MARC::Field->new(
+                    $tag,
+                    $cgi->param($params->[$j+1]),
+                );
+            } else {
+                while($params->[$j] =~ /_code_/){ # browse all it's subfield
+                    my $inner_param = $params->[$j];
+                    if ($newfield){
+                        if($cgi->param($params->[$j+1])){  # only if there is 
a value (code => value)
+                            $newfield->add_subfields(
+                                $cgi->param($inner_param) => 
$cgi->param($params->[$j+1])
                 );
             }
-            $prevtag = @$rtags[$i];
+                    } else {
+                        if ( $cgi->param($params->[$j+1]) ) { # creating only 
if there is a value (code => value)
+                            $newfield = MARC::Field->new(
+                                $tag,
+                                ''.$ind1,
+                                ''.$ind2,
+                                $cgi->param($inner_param) => 
$cgi->param($params->[$j+1]),
+                            );
         }
-        else {
-            if ( @$rtags[$i] < 10 ) {
-                $prevvalue = @$rvalues[$i];
             }
-            else {
-                if ( length( @$rvalues[$i] ) > 0 ) {
-                    $field->add_subfields( @$rsubfields[$i] => @$rvalues[$i] );
+                    $j+=2;
                 }
             }
-            $prevtag = @$rtags[$i];
+            push @fields,$newfield if($newfield);
         }
+        $i++;
     }
 
-    # the last has not been included inside the loop... do it now !
-    $record->insert_fields_ordered($field) if $field;
-
-    $record->encoding('UTF-8');
-
-    #    $record->MARC::File::USMARC::update_leader();
+    $record->append_fields(@fields);
     return $record;
 }
 
@@ -2203,7 +2273,7 @@
 
 =over 4
 
-$result = TransformMarcToKoha( $dbh, $record, $frameworkcode )
+       $result = TransformMarcToKoha( $dbh, $record, $frameworkcode )
 
 =back
 
@@ -2211,10 +2281,13 @@
 
 sub TransformMarcToKoha {
     my ( $dbh, $record, $frameworkcode ) = @_;
-    my $sth =
-      $dbh->prepare(
-"select tagfield,tagsubfield from marc_subfield_structure where 
frameworkcode=? and kohafield=?"
-      );
+    
+    #  FIXME :: This query is unused..
+    #    my $sth =
+    #      $dbh->prepare(
+    #"select tagfield,tagsubfield from marc_subfield_structure where 
frameworkcode=? and kohafield=?"
+    #      );
+    
     my $result;
     my $sth2 = $dbh->prepare("SHOW COLUMNS from biblio");
     $sth2->execute;
@@ -2224,7 +2297,6 @@
           &TransformMarcToKohaOneField( "biblio", $field, $record, $result,
             $frameworkcode );
     }
-    $sth2 = $dbh->prepare("SHOW COLUMNS from biblioitems");
     $sth2->execute;
     while ( ($field) = $sth2->fetchrow ) {
         if ( $field eq 'notes' ) { $field = 'bnotes'; }
@@ -2277,9 +2349,9 @@
 
 sub TransformMarcToKohaOneField {
 
-# FIXME ? if a field has a repeatable subfield that is used in old-db, only 
the 1st will be retrieved...
+    # 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 ) =
       GetMarcFromKohaField( $kohatable . "." . $kohafield,
@@ -2313,6 +2385,7 @@
     }
     return $result;
 }
+
 =head1  OTHER FUNCTIONS
 
 =head2 char_decode
@@ -2748,6 +2821,7 @@
     $op is specialUpdate or delete, and is used to know what we want to do
     $server is the server that we want to update
     $newRecord is the MARC::Record containing the new record. It is usefull 
only when NoZebra=1, and is used to know what to add to the nozebra database. 
(the record in mySQL being, if it exist, the previous record, the one just 
before the modif. We need both : the previous and the new one.
+    
 =back
 
 =cut
@@ -2755,14 +2829,12 @@
 sub ModZebra {
 ###Accepts a $server variable thus we can use it for biblios authorities or 
other zebra dbs
     my ( $biblionumber, $op, $server, $newRecord ) = @_;
-#     warn "ModZebra with : ( $biblionumber, $op, $server, $newRecord )";
     my $dbh=C4::Context->dbh;
-    #warn "SERVER:".$server;
-#
-# 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 ModZebra to run.
-# the table is emptied by misc/cronjobs/zebraqueue_start.pl script
+
+    # 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 ModZebra to run.
+    # the table is emptied by misc/cronjobs/zebraqueue_start.pl script
 
     if (C4::Context->preference("NoZebra")) {
         # lock the nozebra table : we will read index lines, update them in 
Perl process
@@ -2784,14 +2856,13 @@
             %result=_AddBiblioNoZebra($biblionumber,$newRecord, $server, 
%result);
         } else {
             # it's a deletion, delete the record...
-#             warn "DELETE the record $biblionumber on 
$server".$record->as_formatted;
+            # warn "DELETE the record $biblionumber on 
$server".$record->as_formatted;
             %result=_DelBiblioNoZebra($biblionumber,$record,$server);
         }
         # ok, now update the database...
         my $sth = $dbh->prepare("UPDATE nozebra SET biblionumbers=? WHERE 
server=? AND indexname=? AND value=?");
         foreach my $key (keys %result) {
             foreach my $index (keys %{$result{$key}}) {
-#                 warn "UPDATING : $server $key , $index with 
:".$result{$key}->{$index};
                 $sth->execute($result{$key}->{$index}, $server, $key, $index);
             }
         }
@@ -2809,6 +2880,10 @@
 
 =head2 GetNoZebraIndexes
 
+    %indexes = GetNoZebraIndexes;
+    
+    return the data from NoZebraIndexes syspref.
+
 =cut
 
 sub GetNoZebraIndexes {
@@ -2929,13 +3004,12 @@
     return %result;
 }
 
-=head2 _DelBiblioNoZebra($biblionumber,$record);
+=head2 _AddBiblioNoZebra($biblionumber, $record, $server, %result);
 
-    function to delete a biblio in NoZebra indexes
+    function to add a biblio in NoZebra indexes
 
 =cut
 
-
 sub _AddBiblioNoZebra {
     my ($biblionumber, $record, $server, %result)address@hidden;
     my $dbh = C4::Context->dbh;
@@ -2948,12 +3022,12 @@
         my ($titletag,$titlesubfield) = GetMarcFromKohaField('biblio.title');
         $title = lc($record->subfield($titletag,$titlesubfield));
     } else {
-#     warn "server : $server";
+        # warn "server : $server";
         # for authorities, the "title" is the $a mainentry
         my $authref = 
C4::AuthoritiesMarc::GetAuthType($record->subfield(152,'b'));
         warn "ERROR : authtype undefined for ".$record->as_formatted unless 
$authref;
         $title = $record->subfield($authref->{auth_tag_to_report},'a');
-        $index{'mainmainentry'}=$authref->{auth_tag_to_report}.'a';
+        $index{'mainmainentry'} = $authref->{auth_tag_to_report}.'a';
         $index{'mainentry'}    = $authref->{auth_tag_to_report}.'*';
         $index{'auth_type'}    = '152b';
     }
@@ -3163,6 +3237,7 @@
 
 =over 4
 
+$biblionumber = _koha_modify_biblio($dbh,$biblio);
 Internal function for updating the biblio table
 
 =back
@@ -3171,20 +3246,36 @@
 
 sub _koha_modify_biblio {
     my ( $dbh, $biblio ) = @_;
+    # FIXME: this code could be made more portable by not hard-coding
+    #        the values that are supposed to be in biblio table
+    my $query = qq{
+        UPDATE biblio
+        SET    title = ?,
+               author = ?,
+               abstract = ?,
+               copyrightdate = ?,
+               seriestitle = ?,
+               serial = ?,
+               unititle = ?,
+               notes = ?
+        WHERE  biblionumber = ?
+    };
+    my $sth = $dbh->prepare($query);
 
-# FIXME: this code could be made more portable by not hard-coding the values 
that are supposed to be in biblio table
-    my $sth =
-      $dbh->prepare(
-"Update biblio set title = ?, author = ?, abstract = ?, copyrightdate = ?, 
seriestitle = ?, serial = ?, unititle = ?, notes = ? where biblionumber = ?"
-      );
     $sth->execute(
-        $biblio->{'title'},       $biblio->{'author'},
-        $biblio->{'abstract'},    $biblio->{'copyrightdate'},
-        $biblio->{'seriestitle'}, $biblio->{'serial'},
-        $biblio->{'unititle'},    $biblio->{'notes'},
+        $biblio->{'title'},
+        $biblio->{'author'},
+        $biblio->{'abstract'},
+        $biblio->{'copyrightdate'},
+        $biblio->{'seriestitle'},
+        $biblio->{'serial'},
+        $biblio->{'unititle'},
+        $biblio->{'notes'},
         $biblio->{'biblionumber'}
-    );
-    $sth->finish;
+    ) if $biblio->{'biblionumber'};
+    
+    warn $sth->err if $sth->err;
+    warn "BIG ERROR :: No biblionumber for $biblio->{title}" if 
$biblio->{biblionumber} !~ /\d+/; # if it is not a number
     return ( $biblio->{'biblionumber'} );
 }
 
@@ -3724,15 +3815,11 @@
 
 =head2 ModBiblioMarc
 
-=over 4
-
-&ModBiblioMarc($newrec,$biblionumber,$frameworkcode);
+    &ModBiblioMarc($newrec,$biblionumber,$frameworkcode);
 
-Add MARC data for a biblio to koha 
+    Add MARC data for a biblio to koha 
 
-Function exported, but should NOT be used, unless you really know what you're 
doing
-
-=back
+    Function exported, but should NOT be used, unless you really know what 
you're doing
 
 =cut
 
@@ -3751,7 +3838,7 @@
     $sth->finish;
     my $encoding = C4::Context->preference("marcflavour");
 
-# deal with UNIMARC field 100 (encoding) : create it if needed & set encoding 
to unicode
+    # deal with UNIMARC field 100 (encoding) : create it if needed & set 
encoding to unicode
     if ( $encoding eq "UNIMARC" ) {
         my $string;
         if ( length($record->subfield( 100, "a" )) == 35 ) {
@@ -3770,14 +3857,12 @@
                 MARC::Field->new( 100, "", "", "a" => $string ) );
         }
     }
-#     warn "biblionumber : ".$biblionumber;
     ModZebra($biblionumber,"specialUpdate","biblioserver",$record);
     $sth =
       $dbh->prepare(
         "update biblioitems set marc=?,marcxml=?  where biblionumber=?");
     $sth->execute( $record->as_usmarc(), $record->as_xml_record(),
         $biblionumber );
-#     warn $record->as_xml_record();
     $sth->finish;
     return $biblionumber;
 }
@@ -3798,7 +3883,7 @@
 
 sub AddItemInMarc {
 
-# pass the MARC::Record to this function, and it will create the records in 
the marc tables
+    # pass the MARC::Record to this function, and it will create the records 
in the marc tables
     my ( $record, $biblionumber, $frameworkcode ) = @_;
     my $newrec = &GetMarcBiblio($biblionumber);
 
@@ -3957,8 +4042,12 @@
 
 =cut
 
-# $Id: Biblio.pm,v 1.220 2007/07/20 15:43:16 hdl Exp $
+# $Id: Biblio.pm,v 1.221 2007/07/31 16:01:11 toins Exp $
 # $Log: Biblio.pm,v $
+# Revision 1.221  2007/07/31 16:01:11  toins
+# Some new functions.
+# TransformHTMLtoMarc rewrited.
+#
 # Revision 1.220  2007/07/20 15:43:16  hdl
 # Bug Fixing GetMarcSubjects.
 # Links parameters were mixed.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]