diff --git a/module/fid/config/module.config.php b/module/fid/config/module.config.php index cfe29b94551b6440bbea8957107e3fc6b36cb762..6e502137932d7352820338ddaccf327b828df9f6 100644 --- a/module/fid/config/module.config.php +++ b/module/fid/config/module.config.php @@ -126,7 +126,7 @@ $config = [ ], 'factories' => [ Client::class => ClientFactory::class, - ErrorListener::class => ErrorListenerFactory:: class, + ErrorListener::class => InvokableFactory:: class, ILSAuthenticator::class => ILSAuthenticatorFactory::class, LocaleListener::class => InvokableFactory::class, ], diff --git a/module/fid/src/Controller/UserController.php b/module/fid/src/Controller/UserController.php index 4f32010a402b708e726e14de03dc54bc39703e87..bf334843995ced4b066d51ca887d5233c58b4e46 100644 --- a/module/fid/src/Controller/UserController.php +++ b/module/fid/src/Controller/UserController.php @@ -690,8 +690,7 @@ class UserController extends AbstractBase try { $user = $this->client->requestUserDetails(); $viewModel = $this->createViewModel(); - $viewModel->setVariable('orders',$user->getOrders()); - $viewModel->setVariable('addresses',$user->getAddresses()); + $viewModel->setVariable('orders', $user->getOrders()); $viewModel->setTemplate('fid/user/orders'); return $viewModel; } catch (ClientException $exception) { diff --git a/module/fid/src/Listener/ErrorListener.php b/module/fid/src/Listener/ErrorListener.php index 4bfd059b814da87d8894e31f4693fc1096ff1424..8fe6e0ce741d38c622ddf3481222ac110d689290 100644 --- a/module/fid/src/Listener/ErrorListener.php +++ b/module/fid/src/Listener/ErrorListener.php @@ -21,12 +21,9 @@ namespace fid\Listener; -use fid\Service\ClientException; -use VuFind\Auth\Manager; use Zend\EventManager\AbstractListenerAggregate; use Zend\EventManager\EventInterface; use Zend\EventManager\EventManagerInterface; -use Zend\Mvc\Controller\Plugin\Redirect; use Zend\Mvc\MvcEvent; class ErrorListener extends AbstractListenerAggregate @@ -37,22 +34,6 @@ class ErrorListener extends AbstractListenerAggregate MvcEvent::EVENT_RENDER_ERROR, ]; - /** - * @var Manager - */ - protected $manager; - - /** - * @var Redirect - */ - protected $redirect; - - public function __construct(Manager $manager, Redirect $redirect) - { - $this->manager = $manager; - $this->redirect = $redirect; - } - public function attach(EventManagerInterface $events, $priority = 20000) { foreach (static::ERROR_EVENTS as $event) { @@ -61,20 +42,10 @@ class ErrorListener extends AbstractListenerAggregate } /** - * TODO: Do we still need this listener? - * * @param EventInterface|MvcEvent $event */ public function onError(EventInterface $event): void { - // $exception = $event->getParam('exception'); - // $logoutAndRefresh = $exception instanceof ClientException; - // // && $exception->getCode() === 401; - // - // if ($logoutAndRefresh) { - // $this->manager->logout(null, true); - // $event->setResponse($this->redirect->refresh()); - // $event->stopPropagation(); - // } + return; } } \ No newline at end of file diff --git a/module/fid/src/Listener/ErrorListenerFactory.php b/module/fid/src/Listener/ErrorListenerFactory.php deleted file mode 100644 index af3d0b75e34f86566fead9ba179895ff84347011..0000000000000000000000000000000000000000 --- a/module/fid/src/Listener/ErrorListenerFactory.php +++ /dev/null @@ -1,48 +0,0 @@ -<?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 Sebastian Kehr <kehr@ub.uni-leipzig.de> - * @license http://opensource.org/licenses/gpl-2.0.php GNU GPLv2 - */ - -namespace fid\Listener; - -use ProxyManager\Factory\LazyLoadingValueHolderFactory; -use Psr\Container\ContainerInterface; -use VuFind\Auth\Manager as AuthManager; -use Zend\Mvc\Controller\Plugin\Redirect; -use Zend\Mvc\Controller\PluginManager; - -class ErrorListenerFactory -{ - public function __invoke(ContainerInterface $container) - { - /** @var AuthManager $manager */ - $manager = $container->get(AuthManager::class); - $factory = new LazyLoadingValueHolderFactory(); - /** @var Redirect $redirect */ - $redirect = $factory->createProxy(Redirect::class, - function (&$instance, $proxy, $method, $params, &$initializer) - use ($container) { - $initializer = null; - $instance = $container->get(PluginManager::class) - ->get(Redirect::class); - }); - - return new ErrorListener($manager, $redirect); - } -} \ No newline at end of file diff --git a/module/fid/src/Service/DataTransferObject/Order.php b/module/fid/src/Service/DataTransferObject/Order.php index 33b931a1e82fe83518938267a0fb455ec344c2b0..d2475b59f4cfdd2eddd3fda17facb2ac2149afc8 100644 --- a/module/fid/src/Service/DataTransferObject/Order.php +++ b/module/fid/src/Service/DataTransferObject/Order.php @@ -52,6 +52,19 @@ class Order */ protected $type = ''; + /** + * @var string + * @Groups({ + * "order:creation:request", + * "order:creation:response", + * "order:list:response", + * "user:details:response", + * "user:creation:response", + * "user:update:response" + * }) + */ + protected $label = ''; + /** * @var User|null * @Groups({ @@ -106,6 +119,22 @@ class Order $this->id = $id; } + /** + * @return string + */ + public function getLabel(): string + { + return $this->label; + } + + /** + * @param string $label + */ + public function setLabel(string $label): void + { + $this->label = $label; + } + /** * @return string */ diff --git a/themes/fid/templates/ajax/resolverLinks-button.phtml b/themes/fid/templates/ajax/resolverLinks-button.phtml index 8b727ec3286722034efe992143979603ff713819..9a30e7fc5102ff52e0666f1eda600ffe46392888 100644 --- a/themes/fid/templates/ajax/resolverLinks-button.phtml +++ b/themes/fid/templates/ajax/resolverLinks-button.phtml @@ -7,7 +7,7 @@ $user = $account->isLoggedIn(); $controllerClass = 'controller:SolrMarcFincPDA'; ?> <?php if (in_array('4', $this->showOrderButton) && $user): ?> - <a class="btn btn-primary pda-button <?=$controllerClass?>" data-lightbox href="<?=$this->url('record-pda', array('id' => $this->recordId))?>" rel="nofollow"> + <a class="btn btn-primary pda-button <?=$controllerClass?> full-order" data-lightbox href="<?=$this->url('record-fidsubitoarticle', array('id' => $this->recordId))?>" rel="nofollow"> <?=$this->transEsc('getit_order')?> </a> <? $script = <<<JS diff --git a/themes/fid/templates/fid/user/orders.phtml b/themes/fid/templates/fid/user/orders.phtml index 27c692d023e16439c4be116c2731931652dff166..b67efccf49ff82234e7c54ac1a542efe6f8a3d74 100644 --- a/themes/fid/templates/fid/user/orders.phtml +++ b/themes/fid/templates/fid/user/orders.phtml @@ -8,7 +8,7 @@ <?=$this->render('fid/user/orders/additionals-headers');?> </tr> <?php foreach ($orders as $order): ?> - <?=$this->render('fid/user/orders/entry', compact('order', 'addresses'))?> + <?=$this->render('fid/user/orders/entry', compact('order'))?> <?php endforeach; ?> </table> <?php endif; ?> diff --git a/themes/fid/templates/fid/user/orders/additionals-data.phtml b/themes/fid/templates/fid/user/orders/additionals-data.phtml index 3b352ec39a5f9fd1e7174a0d88d0aa88face618e..add6d53777536b142ab9186249e2872d25dfe4f4 100644 --- a/themes/fid/templates/fid/user/orders/additionals-data.phtml +++ b/themes/fid/templates/fid/user/orders/additionals-data.phtml @@ -1,20 +1,13 @@ <!-- fid: fid - user - orders - data --> <td> - <?php $recordId = $data['recordId']; - $recordLabel = $data['recordTitle'] ?? $recordId; - //$recordLabel = "Ê™"; + <?php + $recordId = $this->order->getData()['record']['id']; + $recordLabel = $this->order->getLabel(); if ($recordLink = $this->recordLink()->getRecordLink($recordId, 'id')): - ?> - <a onClick="$('#modal').modal('hide');" target="_self" href="<?=$recordLink?>"><?=$this->escapeHtml($recordLabel)?></a> + ?> + <a onClick="$('#modal').modal('hide');" target="_self" href="<?=$recordLink?>"><?=$this->escapeHtml($recordLabel)?></a> <?php else: ?> <?=$this->escapeHtml($recordLabel)?> <?php endif; ?> </td> -<td> - <?php $addressId = $data['deliveryAddress']; - if (isset($addresses[$addressId])): - ?> - <?=$this->render('fid/user/address-display-inline', ['address' => $addresses[$addressId]])?> - <?php endif; ?> -</td> <!-- fid: fid - user - orders - data - END --> diff --git a/themes/fid/templates/fid/user/orders/additionals-headers.phtml b/themes/fid/templates/fid/user/orders/additionals-headers.phtml index 33716cf0adf1906ecf076386107055524824a639..071f9041c26d61cb4bb592b318ae2325d3786d37 100644 --- a/themes/fid/templates/fid/user/orders/additionals-headers.phtml +++ b/themes/fid/templates/fid/user/orders/additionals-headers.phtml @@ -1,4 +1,3 @@ <!-- fid: fid - user - orders - additionals-headers --> <th><?=$this->translate('fid::order_record')?></th> -<th><?=$this->translate('fid::order_delivery_address')?></th> <!-- fid: fid - user - orders - additionals-headers - END --> \ No newline at end of file diff --git a/themes/fid/templates/fid/user/orders/entry.phtml b/themes/fid/templates/fid/user/orders/entry.phtml index 706274c226d6a3a9fc5f5ac21f7b84cd3279fa45..580b7b8b65a6662cdba5721a8e048155f08c6a23 100644 --- a/themes/fid/templates/fid/user/orders/entry.phtml +++ b/themes/fid/templates/fid/user/orders/entry.phtml @@ -1,7 +1,6 @@ <!-- fid: fid - user - orders - entry --> -<tr name="order-<?=$this->escapeHtml($order->getId())?>"> - <td><?=$this->escapeHtml($order->getCreatedAt()->format('d.m.Y'))?></td> - <?php $data = $order->getData() ?> - <?=$this->render('fid/user/orders/additionals-data', compact('data', 'addresses'))?> +<tr name="order-<?=$this->escapeHtml($this->order->getId())?>"> + <td><?=$this->escapeHtml($this->order->getCreatedAt()->format('d.m.Y'))?></td> + <?=$this->render('fid/user/orders/additionals-data', compact('order'))?> </tr> <!-- fid: fid - user - orders - entry - END --> \ No newline at end of file