[Koha-patches] [PATCH] Bug 5403 Remove DisplayISBN and GetPublisherNameFromIsbn
Colin Campbell
colin.campbell at ptfs-europe.com
Tue Dec 14 10:28:53 CET 2010
These two subroutines were no longer being used by any other code
removed them from their respective modules
If we need any ISBN in future we should use Business::ISBN directly
---
C4/Biblio.pm | 31 ------------------
C4/Koha.pm | 101 ----------------------------------------------------------
2 files changed, 0 insertions(+), 132 deletions(-)
diff --git a/C4/Biblio.pm b/C4/Biblio.pm
index c3a3094..5033203 100644
--- a/C4/Biblio.pm
+++ b/C4/Biblio.pm
@@ -82,7 +82,6 @@ BEGIN {
&GetMarcStructure
&GetMarcFromKohaField
&GetFrameworkCode
- &GetPublisherNameFromIsbn
&TransformKohaToMarc
&CountItemsIssued
@@ -1592,36 +1591,6 @@ sub GetFrameworkCode {
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
$record = TransformKohaToMarc( $hash )
diff --git a/C4/Koha.pm b/C4/Koha.pm
index d10c52e..4f7b50f 100644
--- a/C4/Koha.pm
+++ b/C4/Koha.pm
@@ -35,7 +35,6 @@ BEGIN {
@ISA = qw(Exporter);
@EXPORT = qw(
&slashifyDate
- &DisplayISBN
&subfield_is_koha_internal_p
&GetPrinters &GetPrinter
&GetItemTypes &getitemtypeinfo
@@ -106,106 +105,6 @@ sub slashifyDate {
return ("$dateOut[2]/$dateOut[1]/$dateOut[0]");
}
-
-=head2 DisplayISBN
-
- my $string = DisplayISBN( $isbn );
-
-=cut
-
-sub DisplayISBN {
- my ($isbn) = @_;
- if (length ($isbn)<13){
- my $seg1;
- if ( substr( $isbn, 0, 1 ) <= 7 ) {
- $seg1 = substr( $isbn, 0, 1 );
- }
- elsif ( substr( $isbn, 0, 2 ) <= 94 ) {
- $seg1 = substr( $isbn, 0, 2 );
- }
- elsif ( substr( $isbn, 0, 3 ) <= 995 ) {
- $seg1 = substr( $isbn, 0, 3 );
- }
- elsif ( substr( $isbn, 0, 4 ) <= 9989 ) {
- $seg1 = substr( $isbn, 0, 4 );
- }
- else {
- $seg1 = substr( $isbn, 0, 5 );
- }
- my $x = substr( $isbn, length($seg1) );
- my $seg2;
- if ( substr( $x, 0, 2 ) <= 19 ) {
-
- # if(sTmp2 < 10) sTmp2 = "0" sTmp2;
- $seg2 = substr( $x, 0, 2 );
- }
- elsif ( substr( $x, 0, 3 ) <= 699 ) {
- $seg2 = substr( $x, 0, 3 );
- }
- elsif ( substr( $x, 0, 4 ) <= 8399 ) {
- $seg2 = substr( $x, 0, 4 );
- }
- elsif ( substr( $x, 0, 5 ) <= 89999 ) {
- $seg2 = substr( $x, 0, 5 );
- }
- elsif ( substr( $x, 0, 6 ) <= 9499999 ) {
- $seg2 = substr( $x, 0, 6 );
- }
- else {
- $seg2 = substr( $x, 0, 7 );
- }
- my $seg3 = substr( $x, length($seg2) );
- $seg3 = substr( $seg3, 0, length($seg3) - 1 );
- my $seg4 = substr( $x, -1, 1 );
- return "$seg1-$seg2-$seg3-$seg4";
- } else {
- my $seg1;
- $seg1 = substr( $isbn, 0, 3 );
- my $seg2;
- if ( substr( $isbn, 3, 1 ) <= 7 ) {
- $seg2 = substr( $isbn, 3, 1 );
- }
- elsif ( substr( $isbn, 3, 2 ) <= 94 ) {
- $seg2 = substr( $isbn, 3, 2 );
- }
- elsif ( substr( $isbn, 3, 3 ) <= 995 ) {
- $seg2 = substr( $isbn, 3, 3 );
- }
- elsif ( substr( $isbn, 3, 4 ) <= 9989 ) {
- $seg2 = substr( $isbn, 3, 4 );
- }
- else {
- $seg2 = substr( $isbn, 3, 5 );
- }
- my $x = substr( $isbn, length($seg2) +3);
- my $seg3;
- if ( substr( $x, 0, 2 ) <= 19 ) {
-
- # if(sTmp2 < 10) sTmp2 = "0" sTmp2;
- $seg3 = substr( $x, 0, 2 );
- }
- elsif ( substr( $x, 0, 3 ) <= 699 ) {
- $seg3 = substr( $x, 0, 3 );
- }
- elsif ( substr( $x, 0, 4 ) <= 8399 ) {
- $seg3 = substr( $x, 0, 4 );
- }
- elsif ( substr( $x, 0, 5 ) <= 89999 ) {
- $seg3 = substr( $x, 0, 5 );
- }
- elsif ( substr( $x, 0, 6 ) <= 9499999 ) {
- $seg3 = substr( $x, 0, 6 );
- }
- else {
- $seg3 = substr( $x, 0, 7 );
- }
- my $seg4 = substr( $x, length($seg3) );
- $seg4 = substr( $seg4, 0, length($seg4) - 1 );
- my $seg5 = substr( $x, -1, 1 );
- return "$seg1-$seg2-$seg3-$seg4-$seg5";
- }
-}
-
# FIXME.. this should be moved to a MARC-specific module
sub subfield_is_koha_internal_p ($) {
my ($subfield) = @_;
--
1.7.3.3
More information about the Koha-patches
mailing list