You are here

public function ISBNtest::valid_gtin14 in Biblio Advanced Import 7

Same name and namespace in other branches
  1. 6 lib/isbntest.class.php \ISBNtest::valid_gtin14()
1 call to ISBNtest::valid_gtin14()
ISBNtest::valid_isbn in lib/isbntest.class.php

File

lib/isbntest.class.php, line 235

Class

ISBNtest

Code

public function valid_gtin14($isbn = "") {
  if ($isbn != "") {

    // if we've been given an ISBN here, use it
    $this
      ->set_gtin14($isbn);
  }
  if (FALSE === $this->gtin14 || strlen($this->gtin14) != 14) {
    $this->error = "GTIN-14 is not set";
    return FALSE;
  }
  if (substr($this->gtin14, 13, 1) === $this
    ->get_gtin14_checkdigit()) {
    return TRUE;
  }
  else {
    $this->error = "Checkdigit failure";
    return FALSE;
  }
}