From c6ebed9d317fb0a8fb4822d89b732b27bdce47f1 Mon Sep 17 00:00:00 2001 From: Demian Katz <demian.katz@villanova.edu> Date: Thu, 10 Dec 2015 14:43:06 -0500 Subject: [PATCH] Added UPC support to ContentCafe. - Thanks to Ross Shanley-Roberts. --- .../src/VuFind/Content/Covers/ContentCafe.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/module/VuFind/src/VuFind/Content/Covers/ContentCafe.php b/module/VuFind/src/VuFind/Content/Covers/ContentCafe.php index f0631fd606a..981e5c5f5f3 100644 --- a/module/VuFind/src/VuFind/Content/Covers/ContentCafe.php +++ b/module/VuFind/src/VuFind/Content/Covers/ContentCafe.php @@ -62,7 +62,7 @@ class ContentCafe extends \VuFind\Content\AbstractCover $this->password = $config->pw; $this->baseURL = isset($config->url) ? $config->url : 'http://contentcafe2.btol.com'; - $this->supportsIsbn = $this->cacheAllowed = true; + $this->supportsUpc = $this->supportsIsbn = $this->cacheAllowed = true; } /** @@ -78,12 +78,17 @@ class ContentCafe extends \VuFind\Content\AbstractCover public function getUrl($key, $size, $ids) { $size = strtoupper(substr($size, 0, 1)); - if (!isset($ids['isbn'])) { + + if (isset($ids['isbn'])) { + $value = $ids['isbn']->get13(); + } elseif (isset($ids['upc'])) { + $value = urlencode($ids['upc']); + } else { return false; } - $isbn = $ids['isbn']->get13(); + return $this->baseURL . '/ContentCafe/Jacket.aspx' . "?UserID={$key}&Password={$this->password}&Return=1" . - "&Type={$size}&Value={$isbn}&erroroverride=1"; + "&Type={$size}&Value={$value}&erroroverride=1"; } } -- GitLab