diff --git a/res/theme/languages/de.ini b/res/theme/languages/de.ini new file mode 100644 index 0000000000000000000000000000000000000000..e19305556be99e2378ab7dbd4e16344a631f831b --- /dev/null +++ b/res/theme/languages/de.ini @@ -0,0 +1,7 @@ +boss_default = "Bitte geben Sie in Ihrem Profil eine Heimatbibliothek an, um Informationen zur Verfügbarkeit dieses Titels vor Ort zu erhalten." +boss_true = "Exemplar in Ihrer Heimatbibliothek vorhanden." +boss_false = "Nicht in Ihrer Heimatbibliothek vorhanden.<br/><br/>Ob der Titel per Fernleihe bestellbar ist, kann Ihnen Ihre Heimatbibliothek mitteilen." +boss_noISXNZBD = "Für diesen Titel können wir derzeit leider keine weitere Informationen zur Verfügbarkeit bereitstellen.<br/><br/>Ob der Titel per Fernleihe bestellbar ist, kann Ihnen Ihre Heimatbibliothek mitteilen." +boss_note = "Wichtiger Hinweis" +boss_holding = "Exemplar in meiner Bibiothek vorhanden?" +boss_callnumber = "Signatur" diff --git a/res/theme/languages/en.ini b/res/theme/languages/en.ini new file mode 100644 index 0000000000000000000000000000000000000000..2f68ead33bed17db17228a01d78b8f1435800bf3 --- /dev/null +++ b/res/theme/languages/en.ini @@ -0,0 +1,7 @@ +boss_default = "Please add a home library in your profile to obtain information about the availability of this title on site." +boss_true = "Copy available in your home library." +boss_false = "Not available in your home library.<br/><br/>Your home library can tell you whether the title can be ordered by interlibrary loan." +boss_noISXNZBD = "Unfortunately, we cannot provide any further information on availability for this title at the moment.<br/><br/>Your home library can tell you whether the title can be ordered by interlibrary loan." +boss_note = "Important note" +boss_holding = "Copy available in my library?" +boss_callnumber = "Call number" diff --git a/res/theme/templates/ajax/boss.phtml b/res/theme/templates/ajax/boss.phtml index 4e563cc757ed0fa84e592d523df90363124f8149..60ad3353ea6ed001721d54ac82a073ed99591adf 100644 --- a/res/theme/templates/ajax/boss.phtml +++ b/res/theme/templates/ajax/boss.phtml @@ -1,13 +1,26 @@ <!-- boss-module: ajax - boss --> <div> - <? if ($this->isISIL): ?> - <?=$this->transEsc('boss_true')?> - <?php if (!empty($this->callnumber)): ?> - <?=$this->transEsc('Callnumber')?>: <?=implode(', ', $this->callnumber)?> + <?php if ($this->homeLibrary): ?> + <?=$this->translate('boss_default')?> + <?php else: ?> + <?php if ($this->isISXNZBD): ?> + <?php if ($this->isISIL): ?> + <?=$this->translate('boss_true')?> + <?php if (!empty($this->callnumber)): ?> + <br/><?=$this->transEsc('boss_callnumber')?>: <?=implode(', ', $this->callnumber)?> + <?php endif; ?> + <?php elseif (!$this->isAddNetwork): ?> + <?=$this->translate('boss_false')?> + <?php endif; ?> + <?php if ($this->isAddNetwork): ?> + <a href="<?=$this->url?>" target="_blank"><?=$this->translate('boss_holding')?></a><br/> + <a href="<?=$this->url('fid/user/terms')?>" data-lightbox><?=$this->translate('boss_note')?></a> + <?php else: ?> + <br/><a href="<?=$this->url?>" target="_blank"><?=$this->translate('More Information')?></a> + <?php endif; ?> + <?php else: ?> + <?=$this->translate('boss_noISXNZBD')?> + <?php endif; ?> <?php endif; ?> - <? else: ?> - <?=$this->transEsc('boss_false')?> - <? endif; ?><br /> - <a href="<?=$this->url?>" target="_blank"><?=$this->transEsc('More Information')?></a> </div> <!-- boss-module: ajax - boss - END --> \ No newline at end of file diff --git a/src/AjaxHandler/GetBoss.php b/src/AjaxHandler/GetBoss.php index 63656ae62928f2752f91a34df1ed328584cbc680..4e87fd087448abb0449c5c20f70cc99ec1b0a8d1 100644 --- a/src/AjaxHandler/GetBoss.php +++ b/src/AjaxHandler/GetBoss.php @@ -160,14 +160,22 @@ class GetBoss extends \VuFind\AjaxHandler\AbstractBase $isilCallNumber = $this->getISILCallNumber($results['data']); $networks = isset($this->config->General->networks) ? $this->config->General->networks->toArray() : []; + $addNetworks = isset($this->config->General->addNetworks) ? + $this->config->General->addNetworks->toArray() : []; $inArray = in_array($network, $networks); + $zdbId = $driver->tryMethod('getZdbId'); $isbns = $driver->tryMethod('getISBNs'); $isbns = count($isbns) > 0 ? $isbns[0] : ''; - $callnumber = $this->getCallnumbers($boss, $results['data']); + $tmp = $isilCallNumber; + unset($tmp['isils']); + $callnumber = $this->getCallnumbers($boss, $tmp); $view = [ + 'homeLibrary' => ($homeLibrary == "AAAAA") ? true : false, + 'isISXNZBD' => (!empty($isbns) || !empty($zdbId)) ? true : false, 'isISIL' => ($inArray ? $this->isISIL($isilCallNumber['isils'], $boss) : false), + 'isAddNetwork' => in_array($network, $addNetworks) ? true : false, 'url' => sprintf($this->config->SearchUrls->$network, ($inArray ? $results['param'] : $isbns)), 'callnumber' => $callnumber @@ -181,10 +189,10 @@ class GetBoss extends \VuFind\AjaxHandler\AbstractBase private function getCallnumbers($namespace, $data) { - if ($this->isISIL($this->getISILCallNumber($data), $namespace)) { + if ($this->isISIL(array_keys($data), $namespace)) { $cnValue = []; foreach ($data as $key => $value) { - if (preg_match('/' . $namespace . '/', $key)) { + if (preg_match('/' . $namespace . '/', $key) && !empty($value)) { $cnValue[] = $value; } } diff --git a/src/Client/BossClient.php b/src/Client/BossClient.php index 24a022ecb67eb906f37c3cf06e59f69fccdc5f49..9744b09bc05339ecbe2e72c76351635f4eb2aaee 100644 --- a/src/Client/BossClient.php +++ b/src/Client/BossClient.php @@ -155,34 +155,5 @@ class BossClient JsonEncoder::class => true, ]); return $root; -// try { -// $jsonEncoder = new JsonEncoder(); -// // TODO: caching data -// // symfony/serializer suggests installing doctrine/cache (For using the default cached annotation reader and metadata cache.) -// $objectNormalizers = new ObjectNormalizer( -//// null,//new ClassMetadataFactory(new AnnotationLoader(new AnnotationReader(null))), -//// new CamelCaseToSnakeCaseNameConverter(), -//// null, -//// new ReflectionExtractor() -// ); -// $serializer = new Serializer( -// [ -// $objectNormalizers//, -//// $attributesDenormalizer = new AttributesDenormalizer(), -//// new ArrayDenormalizer(), -// ], -// [ -// $jsonEncoder -// ] -// ); -//// $attributesDenormalizer->setDenormalizer($serializer); -// return $serializer->deserialize( -// (string)$response->getBody(), -// Root::class, -// 'json' -// ); -// } catch (HttpClientException $ex) { -// throw new ClientException($ex->getMessage(), $ex->getCode(), $ex); -// } } }