Skip to content
Snippets Groups Projects
Commit 48eb756a authored by Alexander Purr's avatar Alexander Purr Committed by Dorian Merz
Browse files

refs #20243 [fid_bbi] enable fid pda ordering for direct delivery service

* add translation
* override pda template
* display address for direct delivery service
* display contact details only for Digitization-On-Demand
* own pda template
** add link for address editing
** adding comment field in form config
* improve feedback on missing address
** show complete form except submit button
** add translation
parent eec8c20d
No related merge requests found
<?php
/**
* Copyright (C) 2021 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 version 2 as
* published by the Free Software Foundation.
*
* 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, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* @author Alexander Purr <purr@ub.uni-leipzig.de>
* @license http://opensource.org/licenses/gpl-2.0.php GNU GPLv2
*/
use Zend\Filter\StringTrim;
use Zend\Form\Element\Textarea;
use Zend\Validator\StringLength;
return [
'elements' => [
'comment' => [
'spec' => [
'name' => 'comment',
'type' => Textarea::class,
'options' => [
'label' => 'acquisition_label_comment',
],
'attributes' => [
'required' => false,
],
],
],
],
'input_filter' => [
'comment' => [
'name' => 'comment',
'required' => false,
'filters' => [
StringTrim::class => [
'name' => StringTrim::class,
],
],
'validators' => [
StringLength::class => [
'name' => StringLength::class,
'options' => [
'max' => 5000
]
],
],
],
],
];
......@@ -35,6 +35,7 @@ $config = [
'user-init-form' => require 'user-init-form.php',
'user-create-form' => require 'user-create-form.php',
'user-update-form' => require 'user-update-form.php',
'fid-acquisition-form' => require 'fid-acquisition-form.php',
],
'controllers' => [
'factories' => [
......
......@@ -30,3 +30,7 @@ acquisition_digitization_kvk_name = "Karlsruher Virtuellen Katalogs"
acquisition_digitization_usage = "Die besitzende Bibliothek informiert meist mithilfe von %%link%%, über die für das Digitalisat geltenden Nutzungsbedingungen. Nutzungsbedingungen, über die uns die besitzende Bibliothek bei Lieferung der Digitalisate informiert, werden in gleicher Form an Sie weitergegeben. Bitte beachten Sie, dass die <strong>kommerzielle Nutzung</strong> von Digitalisaten (etwa als Reproduktionsvorlage für Print-Publikationen) in den meisten Bibliotheken genehmigungs- und gebührenpflichtig ist. Bei Interesse an einer kommerziellen Nutzung wenden Sie sich daher unbedingt an die Bibliothek, die das Digitalisat erstellt hat, und informieren sich über die geltenden Bestimmungen."
acquisition_digitization_cc_name = "Creative Commons Lizenzen"
acquisition_digitization_cc_url = "https://creativecommons.org/licenses/?lang=de"
acquisition_pda = "Direktlieferungsservice"
acquisition_pda_info = "Dies ist ein neu erschienenes Buch, welches wir Ihnen zur Leihe für 30 Tage kostenlos zur Verfügung stellen. Die Anschaffungskosten übernimmt der FID BBI für Sie. 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 Herzog August Bibliothek zurückzusenden. Sie erhalten mit der Lieferung hierzu genaue Informationen."
acquisition_address_missing = "Bevor Sie die Bestellung aufgeben können, benötigen wir Ihre vollständige Postadresse. Klicken Sie bitte auf „Profildaten ändern“, um diese in Ihr Konto einzutragen."
......@@ -21,3 +21,7 @@ acquisition_digitization_kvk_name = "Karlsruhe Virtual Catalog"
acquisition_digitization_usage = "Generally, the owning library informs via %%link%% about the terms of use that apply to the digitized material. Any terms of use that the owning library notifies us of upon delivery of the digitized copy will be passed on to you in the same form. Please note that a commercial use of digitized materials (for example, as a template for print publications) is subject to permission and fees in most libraries. Therefore, if you are interested in <strong>commercial use</strong>, be sure to contact the library that created the digitized copy and find out about the terms and conditions that apply. "
acquisition_digitization_cc_name = "Creative Commons Licenses"
acquisition_digitization_cc_url = "https://creativecommons.org/about/cclicenses/"
acquisition_pda = "Direct Delivery Service"
acquisition_pda_info = "This is a new published book, which we offer you for loan for 30 days free of charge. The FID BBI takes over the acquisition costs for you. The medium will be sent to you directly from the bookseller to your delivery address. At the end of the loan period, you are obliged to return the medium to the Herzog August Bibliothek at your own expense. You will receive detailed information on this with the delivery."
acquisition_address_missing = "Before you can place the order, we need your full postal address. Please click on "Edit account" to add it."
\ No newline at end of file
<?php
/** @var \fid\Service\DataTransferObject\User $user */
/** @var \fid\Service\DataTransferObject\Address $address */
$address = $this->user->getDeliveryAddress();
/** @var \fid\Service\DataTransferObject\User $user */
/** @var \fid\Service\DataTransferObject\Address $address */
$address = $this->user->getDeliveryAddress();
?>
<h2><?=$this->translate("fid::acquisition_delivery_to")?></h2>
<?php if (!$this->user->getDeliveryAddress()->isCompleteAddress()): ?>
<div class="flash-message alert alert-danger" role="alert">
<?php
// BBI-specific - Add icon based on namespace
$iconHelper = $this->plugin('icon');
$icon = $iconHelper('error');
?>
<?= $icon ?>
<?= $this->translate("fid::acquisition_address_missing") ?>
</div>
<?php endif; ?>
<table class="table table-striped">
<tbody>
<tr>
......@@ -11,8 +24,18 @@ $address = $this->user->getDeliveryAddress();
<td><?= $this->user->getFirstname() ?> <?= $this->user->getLastname() ?></td>
</tr>
<tr>
<th><?= $this->translate("Email Address") ?></th>
<td><?= $this->user->getUsername() ?></td>
<th><?= $this->translate("fid::order_delivery_address") ?></th>
<td>
<?php if($user->deliveryAddressIsBusinessAddress() && !empty($college=$user->getCollege())): ?>
<?= $college ?><br>
<?php endif ?>
<?= $address->getLine1() ?><br>
<?= !empty($address->getLine2()) ? $address->getLine2() . '<br>' : '' ?>
<?= $address->getZip() ?> <?= $address->getCity() ?><br>
<?= $address->getCountry() ?>
</td>
</tr>
</tbody>
</table>
<a href="<?=$this->url('fid/user/update')?>" class="btn btn-primary"><?=$this->transEsc('fid::Edit Account')?></a>
\ No newline at end of file
<?php
/** @var \fid\Service\DataTransferObject\User $user */
/** @var \fid\Service\DataTransferObject\Address $address */
$address = $this->user->getDeliveryAddress();
?>
<h2><?=$this->translate("fid::acquisition_delivery_to")?></h2>
<table class="table table-striped">
<tbody>
<tr>
<th><?= $this->translate("fid::acquisition_order_delivery_name") ?></th>
<td><?= $this->user->getFirstname() ?> <?= $this->user->getLastname() ?></td>
</tr>
<tr>
<th><?= $this->translate("Email Address") ?></th>
<td><?= $this->user->getUsername() ?></td>
</tr>
</tbody>
</table>
......@@ -35,7 +35,7 @@ $form->setAttribute('class','fid-acquisition-form');
]); ?>
</div>
<?=$this->render('fid/record/acquisition-address-details'); ?>
<?=$this->render('fid/record/acquisition-contact-details'); ?>
<?php if (isset($this->driver)): ?>
<?php $driver = $this->driver; ?>
......
<?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 version 2 as
* published by the Free Software Foundation.
*
* 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, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* @author Alexander Purr <purr@ub.uni-leipzig.de>
* @license http://opensource.org/licenses/gpl-2.0.php GNU GPLv2
*/
use Zend\Form\Element;
use Zend\Form\Form;
use Zend\Form\View\Helper\FormElementErrors;
use Zend\Form\View\Helper\FormLabel;
use Zend\Form\View\Helper\FormSubmit;
$driver = $this->driver;
/** @var Form $form */
/** @var FormLabel $formLabel */
/** @var FormSubmit $formSubmit */
/** @var FormElementErrors $formElementErrors */
$form = $this->form;
$formLabel = $this->formLabel();
$formLabel->setTranslatorTextDomain('fid');
$formSubmit = $this->formSubmit();
$formSubmit->setTranslatorTextDomain('fid');
$formElementErrors = $this->formElementErrors();
$formElementErrors->setTranslatorTextDomain('fid');
$this->headTitle($title = $this->translate("fid::acquisition_pda"));
$form->setAttribute('class','fid-acquisition-form');
?>
<h1><?= $title ?></h1>
<?= $this->flashmessages() ?>
<p>
<?= $this->translate("fid::acquisition_pda_info") ?>
</p>
<?= $this->form()->openTag($form) ?>
<?=$this->render('fid/record/acquisition-address-details'); ?>
<?php
$formatter = $this->recordDataFormatter();
$this->coreFields = $formatter->getData($driver, $formatter->getDefaults('fid-acquisition-general'));
?>
<?=$this->render('fid/record/acquisition-record-details'); ?>
<? /* comments */ ?>
<?php
/** @var Element\Textarea $elemComment */
$elemComment = $form->get('comment');
$elemComment->setLabelAttributes(['class' => 'control-label']);
$elemComment->setAttributes(['class' => 'form-control']);
?>
<div class="form-group">
<?= $this->formElementErrors($elemComment) ?>
<?= $this->formLabel($elemComment) ?>
<?= $this->formElement($elemComment) ?>
</div>
<?php // eula privacy policy ?>
<div class="form-group eula">
<p>
<?php
$policy_link = '<a data-lightbox href="'
. $this->url('fid/user/policy')
. '">'
. $this->transEsc("fid::policy")
. '</a>';
$terms_link = '<a data-lightbox href="'
. $this->url('fid/user/terms')
. '">'
. $this->transEsc("fid::terms")
. '</a>';
?>
<?=$this->translate("fid::policy_terms_text", [
'%%policy%%' => $policy_link,
'%%terms%%' => $terms_link
])?>
</p>
</div>
<?php if ($this->user->getDeliveryAddress()->isCompleteAddress()): ?>
<?php /* submit button */ ?>
<?php
/** @var Element\Submit $elemSubmit */
$elemSubmit = $form->get('submit');
$elemSubmit->setAttributes(['class' => 'btn btn-primary']);
?>
<div class="form-group right">
<?= $this->formElement($elemSubmit) ?>
</div>
<?php endif; ?>
<?= $this->form()->closeTag($form) ?>
\ No newline at end of file
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment