X-Git-Url: http://koha-dev.rot13.org:8081/gitweb/?a=blobdiff_plain;f=C4%2FBiblio.pm;h=7be1b3e22ea185bb8c6756ba560fd8e5f137a378;hb=7e1077b51bbdd13e4a8032f73b286b1ea61bb288;hp=135dd9163048e9c2c8eaa5ccba47645752872b4b;hpb=36efd0d4d0cfe5bbdcd9a4b48e0e417a59aaa63a;p=koha_gimpoz diff --git a/C4/Biblio.pm b/C4/Biblio.pm old mode 100644 new mode 100755 index 135dd91630..7be1b3e22e --- a/C4/Biblio.pm +++ b/C4/Biblio.pm @@ -79,6 +79,8 @@ BEGIN { &GetUsedMarcStructure &GetXmlBiblio &GetCOinSBiblio + &GetMarcPrice + &GetMarcQuantity &GetAuthorisedValueDesc &GetMarcStructure @@ -1243,6 +1245,72 @@ sub GetCOinSBiblio { return $coins_value; } + +=head2 GetMarcPrice + +return the prices in accordance with the Marc format. +=cut + +sub GetMarcPrice { + my ( $record, $marcflavour ) = @_; + my @listtags; + my $subfield; + + if ( $marcflavour eq "MARC21" ) { + @listtags = ('345', '020'); + $subfield="c"; + } elsif ( $marcflavour eq "UNIMARC" ) { + @listtags = ('345', '010'); + $subfield="d"; + } else { + return; + } + + for my $field ( $record->field(@listtags) ) { + for my $subfield_value ($field->subfield($subfield)){ + #check value + return $subfield_value if ($subfield_value); + } + } + return 0; # no price found +} + +=head2 GetMarcQuantity + +return the quantity of a book. Used in acquisition only, when importing a file an iso2709 from a bookseller +Warning : this is not really in the marc standard. In Unimarc, Electre (the most widely used bookseller) use the 969$a + +=cut + +sub GetMarcQuantity { + my ( $record, $marcflavour ) = @_; + my @listtags; + my $subfield; + + if ( $marcflavour eq "MARC21" ) { + return 0 + } elsif ( $marcflavour eq "UNIMARC" ) { + @listtags = ('969'); + $subfield="a"; + } else { + return; + } + + for my $field ( $record->field(@listtags) ) { + for my $subfield_value ($field->subfield($subfield)){ + #check value + if ($subfield_value) { + # in France, the cents separator is the , but sometimes, ppl use a . + # in this case, the price will be x100 when unformatted ! Replace the . by a , to get a proper price calculation + $subfield_value =~ s/\./,/ if C4::Context->preference("CurrencyFormat") eq "FR"; + return $subfield_value; + } + } + } + return 0; # no price found +} + + =head2 GetAuthorisedValueDesc my $subfieldvalue =get_authorised_value_desc( @@ -1326,10 +1394,10 @@ ISBNs stored in differents places depending on MARC flavour sub GetMarcISBN { my ( $record, $marcflavour ) = @_; my $scope; - if ( $marcflavour eq "MARC21" ) { - $scope = '020'; - } else { # assume unimarc if not marc21 + if ( $marcflavour eq "UNIMARC" ) { $scope = '010'; + } else { # assume marc21 if not unimarc + $scope = '020'; } my @marcisbns; my $isbn = ""; @@ -1366,10 +1434,10 @@ The note are stored in differents places depending on MARC flavour sub GetMarcNotes { my ( $record, $marcflavour ) = @_; my $scope; - if ( $marcflavour eq "MARC21" ) { - $scope = '5..'; - } else { # assume unimarc if not marc21 + if ( $marcflavour eq "UNIMARC" ) { $scope = '3..'; + } else { # assume marc21 if not unimarc + $scope = '5..'; } my @marcnotes; my $note = ""; @@ -1406,12 +1474,12 @@ The subjects are stored in differents places depending on MARC flavour sub GetMarcSubjects { my ( $record, $marcflavour ) = @_; my ( $mintag, $maxtag ); - if ( $marcflavour eq "MARC21" ) { - $mintag = "600"; - $maxtag = "699"; - } else { # assume unimarc if not marc21 + if ( $marcflavour eq "UNIMARC" ) { $mintag = "600"; $maxtag = "611"; + } else { # assume marc21 if not unimarc + $mintag = "600"; + $maxtag = "699"; } my @marcsubjects; @@ -1479,12 +1547,12 @@ sub GetMarcAuthors { # tagslib useful for UNIMARC author reponsabilities my $tagslib = &GetMarcStructure( 1, '' ); # FIXME : we don't have the framework available, we take the default framework. May be buggy on some setups, will be usually correct. - if ( $marcflavour eq "MARC21" ) { - $mintag = "700"; - $maxtag = "720"; - } elsif ( $marcflavour eq "UNIMARC" ) { # assume unimarc if not marc21 + if ( $marcflavour eq "UNIMARC" ) { $mintag = "700"; $maxtag = "712"; + } elsif ( $marcflavour eq "MARC21" || $marcflavour eq "NORMARC" ) { # assume marc21 or normarc if not unimarc + $mintag = "700"; + $maxtag = "720"; } else { return; } @@ -1599,12 +1667,12 @@ The series are stored in differents places depending on MARC flavour sub GetMarcSeries { my ( $record, $marcflavour ) = @_; my ( $mintag, $maxtag ); - if ( $marcflavour eq "MARC21" ) { - $mintag = "440"; - $maxtag = "490"; - } else { # assume unimarc if not marc21 + if ( $marcflavour eq "UNIMARC" ) { $mintag = "600"; $maxtag = "619"; + } else { # assume marc21 if not unimarc + $mintag = "440"; + $maxtag = "490"; } my @marcseries;