diff --git a/isbn/alma-sru.php b/isbn/alma-sru.php
index 06a77f4..9c53582 100644
--- a/isbn/alma-sru.php
+++ b/isbn/alma-sru.php
@@ -28,9 +28,9 @@
include 'conf.php';
include 'lib.php';
-if (isset($_GET['bibliothek'])) {
- $file = file_get_contents('./srulibraries.json');
- $json = json_decode($file, true);
+$file = file_get_contents('./srulibraries.json');
+$json = json_decode($file, true);
+if (isset($_GET['bibliothek']) and isset($json[$_GET['bibliothek']])) {
$urlBase = $json[$_GET['bibliothek']]['sru'];
} else {
echo "Bibliothek nicht gefunden in der Liste der bekannten Alma-SRU-Schnittstellen.\n";
@@ -118,9 +118,16 @@
// Delete check value at the end for ISBN10
$testString = substr($testString, 0, -1);
}
- }
- if (strpos($foundValue, $testString) !== false) {
- $foundMatch = true;
+ // for isbn, check that the test string is part of the found value
+ if (strpos($foundValue, $testString) !== false) {
+ $foundMatch = true;
+ }
+ } else {
+ // for ppn (or other ids), skip the possible prefix in paranthesis and then they need to be exactly the same
+ $foundValue = preg_replace('/^\(.*\)/', '', $foundValue);
+ if ($foundValue == $testString) {
+ $foundMatch = true;
+ }
}
}
}
@@ -187,9 +194,6 @@
$location = getValues($node->xpath('./subfield[@code="b"]')[0]);
$sublocation = getValues($node->xpath('./subfield[@code="c"]')[0]);
- /*if (strpos($sublocation, "Lehrbuchsammlung") !== false) {
- $location = "LBS";
- }*/
$node_f = $node->xpath('./subfield[@code="f"]');
$number = count($node_f) ? getValues($node_f[0]) : 0;
diff --git a/isbn/dnb.php b/isbn/dnb.php
index 0d6ce5e..57d1cf8 100644
--- a/isbn/dnb.php
+++ b/isbn/dnb.php
@@ -20,16 +20,8 @@
* Sucht übergebene ISBN bzw. PPN in der SRU-Schnittstelle der DNB
* und gibt maximal 10 Ergebnisse als MARCXML oder JSON zurück.
*/
-
-include 'conf.php';
-include 'lib.php';
-
-if (isset($_GET['ppn'])) {
- $ppn = trim($_GET['ppn']);
- $suchString = 'dnb.idn=' . $ppn;
-}
-
-/*
+
+ /*
Explain SRU
https://services.dnb.de/sru/dnb?version=1.1&operation=explain
@@ -40,12 +32,19 @@
*/
+include 'conf.php';
+include 'lib.php';
+
+if (isset($_GET['ppn'])) {
+ $ppn = trim($_GET['ppn']);
+ $suchString = 'dnb.idn=' . $ppn;
+}
+
$urlBase = 'https://services.dnb.de/sru/dnb?version=1.1&operation=searchRetrieve&recordSchema=MARC21-xml&query=';
if (isset($_GET['isbn'])) {
$n = trim($_GET['isbn']);
$nArray = preg_split("/\s*(or|,|;)\s*/i", $n, -1, PREG_SPLIT_NO_EMPTY);
$suchString = 'dnb.num=' . implode('+OR+dnb.num=', $nArray);
- $suchStringSWB = implode(' or ', $nArray);
}
$result = file_get_contents($urlBase . $suchString, false);
@@ -75,29 +74,8 @@
foreach ($records as $record) {
- // Filter out any other results which contain the ISBN but not in the 020 or 776 field
- $foundMatch = false;
- $foundIsbns = $xpath->query('.//datafield[@tag="020" or @tag="776"]/subfield', $record);
- foreach ($foundIsbns as $foundNode) {
- $foundValue = $foundNode->nodeValue;
- foreach ($nArray as $queryValue) {
- $testString = preg_replace('/[^0-9xX]/', '', $queryValue);
- if (strlen($testString) == 13) {
- // Delete the 978-prefix and the check value at the end for ISBN13
- $testString = substr($testString, 3, -1);
- } elseif (strlen($testString) == 10) {
- // Delete check value at the end for ISBN10
- $testString = substr($testString, 0, -1);
- }
- if (strpos(preg_replace('[^0-9xX]', '', $foundValue), $testString) !== false) {
- $foundMatch = true;
- }
- }
- }
- if ($foundMatch) {
- $outputString .= $doc->saveXML($record);
- array_push($outputArray, $doc->saveXML($record));
- }
+ $outputString .= $doc->saveXML($record);
+ array_push($outputArray, $doc->saveXML($record));
}
$outputString .= "";
diff --git a/isbn/suche.html b/isbn/suche.html
index 3f2b842..2ae1661 100644
--- a/isbn/suche.html
+++ b/isbn/suche.html
@@ -30,7 +30,7 @@
alert("jQuery wurde nicht gefunden");
}
-
+