You are here

public function ISBNtest::get_isbn10 in Biblio Advanced Import 6

Same name and namespace in other branches
  1. 7 lib/isbntest.class.php \ISBNtest::get_isbn10()
1 call to ISBNtest::get_isbn10()
ISBNtest::valid_isbn10 in lib/isbntest.class.php

File

lib/isbntest.class.php, line 278

Class

ISBNtest

Code

public function get_isbn10() {
  if ($this->isbn10 != FALSE) {
    return $this->isbn10;
  }
  elseif ($this
    ->valid_isbn13() != FALSE) {
    if (eregi("979", $this->isbn13)) {
      $this->error = "979 Bookland EAN values can't be converted to ISBN-10";
      return FALSE;

      // if it's a 979 prefix it can't be downgraded
    }
    else {
      $this
        ->set_isbn10(substr($this->isbn13, 3, 10));

      // invalid ISBN used as a temp value for next step
      $checkdigit = $this
        ->get_isbn10_checkdigit();
      $this
        ->set_isbn10(substr($this->isbn13, 3, 9) . $checkdigit);

      // true value (I hope)
      return $this->isbn10;
    }
  }
  else {
    $this->error = "No ISBN-10 value set or calculable";
    return FALSE;
  }
}