From f93ec3dcbf91e7853c9727a6a18b8b9cd2ca2da0 Mon Sep 17 00:00:00 2001 From: Demian Katz Date: Mon, 5 Aug 2024 14:01:21 -0400 Subject: [PATCH] Fix Harry E. Wolff loading issue. --- .../src/GeebyDeebyLocal/Ingest/ModsExtractor.php | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/module/GeebyDeebyLocal/src/GeebyDeebyLocal/Ingest/ModsExtractor.php b/module/GeebyDeebyLocal/src/GeebyDeebyLocal/Ingest/ModsExtractor.php index 13c8cbcd..c347d7fb 100644 --- a/module/GeebyDeebyLocal/src/GeebyDeebyLocal/Ingest/ModsExtractor.php +++ b/module/GeebyDeebyLocal/src/GeebyDeebyLocal/Ingest/ModsExtractor.php @@ -161,6 +161,20 @@ protected function extractSeries($series) return empty($seriesInfo) ? false : $seriesInfo; } + /** + * Is a "First Last" name equivalent to a "Last, Name" name? + * + * @param string $name First Last name + * @param string $invertedName Last, First name + * + * @return bool + */ + protected function nameIsInvertedName(string $name, string $invertedName): bool + { + $parts = explode(', ', $invertedName, 2); + return $name === $parts[1] . ' ' . $parts[0]; + } + /** * Extract publisher information. * @@ -192,7 +206,7 @@ protected function extractPublisher($mods, $authMods = []) $authModsStr = (string)($authMods[0] ?? ''); if ( preg_match('/\(\d{4}/', $authModsStr) - || strlen($authModsStr) > strlen($parts[0]) + || (strlen($authModsStr) > strlen($parts[0]) && !$this->nameIsInvertedName($parts[0], $authModsStr)) ) { $newParts = explode(',', $authModsStr); foreach ($newParts as $i => $part) {