diff --git a/module/fid/src/Service/Client.php b/module/fid/src/Service/Client.php index 10cf3a2e32918ac475fd70cf6d73cbee4e37efdf..111ceb8f9fda5bad7c6fe4fbcea4ec2b3d5aa4a2 100644 --- a/module/fid/src/Service/Client.php +++ b/module/fid/src/Service/Client.php @@ -24,6 +24,7 @@ namespace fid\Service; use fid\Service\DataTransferObject\Library; use fid\Service\DataTransferObject\Logon; use fid\Service\DataTransferObject\Order; +use fid\Service\DataTransferObject\Record; use fid\Service\DataTransferObject\User; use InvalidArgumentException; use Psr\Http\Client\ClientExceptionInterface as HttpClientExceptionInterface; @@ -231,6 +232,21 @@ class Client return $result; } + public function requestRecord(string $recordid) : Record + { + $request = $this->buildRequest('get', "records/$recordid"); + $response = $this->sendAuthenticatedRequest($request); + + if ($response->getStatusCode() !== 200) { + $this->throwException($response); + } + /** @var Record $record */ + $record = $this->serializer->deserialize((string)$response->getBody(), + Record::class, 'json'); + + return $record; + } + /** * @return array|Order[] * @throws ClientException diff --git a/module/fid/src/Service/DataTransferObject/Record.php b/module/fid/src/Service/DataTransferObject/Record.php new file mode 100644 index 0000000000000000000000000000000000000000..0d0a8f9e3a19f85f8cf5e8ce80125177f1a777b2 --- /dev/null +++ b/module/fid/src/Service/DataTransferObject/Record.php @@ -0,0 +1,67 @@ +<?php +/** + * Copyright (C) 2019 Leipzig University Library + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + * @author Sebastian Kehr <kehr@ub.uni-leipzig.de> + * @license https://opensource.org/licenses/GPL-3.0 GNU GPLv3 + */ + +namespace fid\Service\DataTransferObject; + +class Record +{ + /** + * @var string + */ + protected $id; + + /** + * @var bool + */ + protected $ordered = ''; + + /** + * @return string + */ + public function getId(): string + { + return $this->id; + } + + /** + * @param string $id + */ + public function setId(string $id): void + { + $this->id = $id; + } + + /** + * @return bool + */ + public function getOrdered(): bool + { + return $this->ordered; + } + + /** + * @param bool $ordered + */ + public function setOrdered(bool $ordered): void + { + $this->ordered = $ordered; + } +} \ No newline at end of file diff --git a/module/fid/src/View/Helper/Root/GetIt.php b/module/fid/src/View/Helper/Root/GetIt.php index a47a8c51c4058522b364ffed800f3118219b1b06..70ac4be9a4ecaff426f57736ddc82a868048d82b 100644 --- a/module/fid/src/View/Helper/Root/GetIt.php +++ b/module/fid/src/View/Helper/Root/GetIt.php @@ -735,4 +735,18 @@ class GetIt extends AbstractHelper { $notice = $this->translate('getit_text_7'); } + + /** + * @return bool + */ + public function isRecordOrdered() + { + if ($this->fidClient->isLoggedOn()) { + $id = $this->driver->tryMethod('getUniqueID'); + $record = $this->fidClient->requestRecord($id); + + return $record->getOrdered(); + } + return false; + } } diff --git a/themes/fid/languages/fid/de.ini b/themes/fid/languages/fid/de.ini index 64f3766f63e11efc3cef5cf7746f2374e25ce9a4..7fc87751f06987da8ea63406160e53c26537b24d 100644 --- a/themes/fid/languages/fid/de.ini +++ b/themes/fid/languages/fid/de.ini @@ -133,7 +133,7 @@ admin_section = "Nutzerverwaltung" ;Acquisition acquisition_pda = "Printbestellung" -acquisition_pda_info = "Dies ist ein neu erschienenes Buch, welches wir Ihnen gerne zur Leihe kostenlos zur Verfügung stellen. Die Anschaffungskosten übernimmt %%fidname%% für Sie, die Preisangabe dient nur zu Ihrer Information. Das Medium wird Ihnen direkt vom Buchhändler an Ihre hier angezeigte Lieferadresse zugeschickt. Zum Ablauf der Leihfrist sind Sie verpflichtet, das Medium auf Ihre Kosten an die %%library%% zurückzusenden. Sie erhalten mit der Lieferung hierzu genaue Informationen." +acquisition_pda_info = "Dies ist ein neu erschienenes Buch, welches wir Ihnen gerne zur Leihe für 30 Tage kostenlos zur Verfügung stellen. Die Anschaffungskosten übernimmt %%fidname%% für Sie, die Preisangabe dient nur zu Ihrer Information. Das Medium wird Ihnen direkt vom Buchhändler an Ihre hier angezeigte Lieferadresse zugeschickt. Zum Ablauf der Leihfrist sind Sie verpflichtet, das Medium auf Ihre Kosten an die %%library%% zurückzusenden. Sie erhalten mit der Lieferung hierzu genaue Informationen." acquisition_subito_article = "Artikelbestellung" acquisition_subito_article_info = "Auf Kosten von %%fidname%% können Sie sich Teile eines erschienenen Werkes sowie Beiträge aus Fachzeitschriften oder wissenschaftlichen Zeitschriften als Kopie bestellen. Wir können Ihnen aus urheberrechtlichen Gründen max. 10 Prozent des Umfangs eines Buches bzw. nur einzelne Zeitschriftenbeiträge vervielfältigen. Bitte überprüfen Sie daher bei Büchern ggf. die Anzahl der bestellten Seiten. Mit der Absendung der Bestellung bestätigen Sie, die Vervielfältigung ausschließlich zu nicht kommerziellen Zwecken zu verwenden." acquisition_subito_partial_copy = "Teilkopiebestellung" @@ -150,4 +150,5 @@ acquisition_error_pages_pattern = "Fehlerhaftes oder falsches Format" acquisition_subito_article_confirmation = "Möchten Sie den Artikel bestellen?" acquisition_subito_partial_copy_confirmation = "Möchten Sie die Teilkopie bestellen?" acquisition_pda_confirmation = "Möchten Sie das Buch bestellen?" +acquisition_pda_ordered = "Dieser Titel wurde bereits auf Nutzerwunsch durch adlr.link erworben und wird in Kürze verfügbar sein." acquisition_success = "Ihre Bestellung wurde entgegengenommen und wird nun von uns bearbeitet." \ No newline at end of file diff --git a/themes/fid/languages/fid/en.ini b/themes/fid/languages/fid/en.ini index 82ebbb769268e5140b08c0a2d3f730b78bad69a1..1bd992ba68fd4b2b06fc07f610c854bc607f5628 100644 --- a/themes/fid/languages/fid/en.ini +++ b/themes/fid/languages/fid/en.ini @@ -131,7 +131,7 @@ admin_section = "User Administration" ;Acquisition acquisition_pda = "Print order" -acquisition_pda_info = "This is a recently published book, which we are pleased to make available to you for loan at no charge. The purchase costs will be paid by %%fidname%%, the price is for your information only. The medium will be sent directly by the bookseller to the delivery address shown here. At the end of the loan period you are obliged to return the book at your own expense to the %%library%%. You will receive detailed information with the delivery." +acquisition_pda_info = "This is a new published book, which we are pleased to lend you for 30 days free of charge. %%fidname%% will pay the acquisition costs for you, the price is for your information only. The medium will be sent directly by the bookseller to the delivery address shown here. At the end of the loan period, you are obliged to return the book to %%library%% at your own expense. You will receive detailed information with the delivery." acquisition_subito_article = "Article Order" acquisition_subito_article_info = "You may order copies of parts of a published work as well as articles from professional or scientific journals at the expense of %%fidname%%. For copyright reasons we can only copy a maximum of 10 percent of a book or only individual journal articles. For books, please check the total number of pages ordered if necessary. By sending the order, you confirm that you will use the copy only for non-commercial purposes." acquisition_subito_partial_copy = "Partial copy order" @@ -148,4 +148,5 @@ acquisition_error_pages_pattern = "Inaccurate or wrong format" acquisition_subito_article_confirmation = "Do you like to order the article?" acquisition_subito_partial_copy_confirmation = "Do you like to order the partial copy?" acquisition_pda_confirmation = "Do you like to order the book?" +acquisition_pda_ordered = "This item has been acquired by adlr.link by request of a patron and will be available in a short time." acquisition_success = "Your order is received and will be processed now."