Skip to content

Commit

Permalink
Merge branch 'develop-5'
Browse files Browse the repository at this point in the history
  • Loading branch information
jschultze committed Oct 16, 2020
2 parents d612f41 + d7efbcb commit d1a1544
Show file tree
Hide file tree
Showing 26 changed files with 1,065 additions and 80 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,11 @@ private function prepareUrl($driver, $id, $listView, $urlAccess = '', $urlAccess
$openUrl .= '&rft.genre=' . $format;
}

$sfxUrl = $this->config['DAIA']['sfxUrl'] ?? ''
$sfxDomain = $this->config['DAIA']['sfxDomain'] ?? '';
$sfxLink = urlencode('http://sfx.gbv.de/sfx_' . $sfxDomain . '?' . $sfxLink);
if (!empty($sfxUrl) && !empty($sfxDomain)) {
$sfxLink = urlencode($sfxUrl . '/sfx_' . $sfxDomain . '?' . $sfxLink);
}

$isil = $this->config['Global']['isil'];
$url = $this->config['DAIA_' . $isil]['url'];
Expand All @@ -217,7 +220,7 @@ private function prepareUrl($driver, $id, $listView, $urlAccess = '', $urlAccess
$url .= '&url-access-level=' . $urlAccessLevel;
}

if ($sfxDomain) {
if (!empty($sfxUrl) && !empty($sfxDomain)) {
$url .= '&sfx=' . $sfxLink;
}

Expand Down
11 changes: 9 additions & 2 deletions module/Delivery/src/Delivery/AvailabilityHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,18 @@ public function checkSignature()
}
if (in_array($format, $availabilityConfig['formats'])) {
if (empty($sortedSignatureData)) {
foreach ($signatureData as $signatureDate) {
if ($this->checkSigel($signatureDate, $format)) {
if (empty($signatureData)) {
if ($this->checkSigel([], $format)) {
$this->signatureList[] = '!!';
return true;
}
} else {
foreach ($signatureData as $signatureDate) {
if ($this->checkSigel($signatureDate, $format)) {
$this->signatureList[] = '!!';
return true;
}
}
}
}

Expand Down
43 changes: 33 additions & 10 deletions module/Delivery/src/Delivery/Controller/DeliveryController.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ public function homeAction()

$view = $this->createViewModel();
$view->title = $templateParams['title'];
$view->message = $message;
$view->domain = $deliveryDomain;
$view->message = $message;
$view->error = $error;
$view->catalog_id = $this->user->cat_id;
$view->delivery_email = $this->user->delivery_email;
Expand Down Expand Up @@ -205,19 +206,41 @@ public function orderAction()
}
}
$dataHandler->collectData($preset);
$formData = $dataHandler->getFormData();
$infoData = $dataHandler->getInfoData();
// $formData = $dataHandler->getFormData();
// $infoData = $dataHandler->getInfoData();

if (!empty($id)) {
$view->formTitle = $formData['title'];
$view->id = $id;
$view->formFields = $formData['fields'];
$view->checkboxFields = $formData['checkbox'];
$view->infoTitle = $infoData['title'];
$view->infoFields = $infoData['fields'];
$forms = [];
$forms[] = ['type' => 'input',
'title' => $dataHandler->getFormTitle('form'),
'fields' => $dataHandler->getFormData('form')];
$forms[] = ['type' => 'checkbox',
'fields' => $dataHandler->getFormData('checkbox')];
$forms[] = ['type' => 'text',
'title' => $dataHandler->getFormTitle('info'),
'fields' => $dataHandler->getFormData('info')];
$view->forms = $forms;
/*
$view->formTitle = $dataHandler->getFormTitle('form');
$view->formFields = $dataHandler->getFormData('form');
$view->checkboxFields = $dataHandler->getFormData('checkbox');
$view->infoTitle = $dataHandler->getFormTitle('info');
$view->infoFields = $dataHandler->getFormData('info');
*/
} elseif (!empty($presetFormat)) {
$view->formTitle = $formData['title'];
$view->formFields = array_merge($formData['fields'], $infoData['fields']);
$forms = [];
$forms[] = ['type' => 'input',
'title' => $dataHandler->getFormTitle('openformarticle'),
'fields' => $dataHandler->getFormData('openformarticle')];
$forms[] = ['type' => 'input',
'title' => $dataHandler->getFormTitle('openform'),
'fields' => $dataHandler->getFormData('openform')];
$view->forms = $forms;
/*
$view->formTitle = $dataHandler->getFormTitle('openform');
$view->formFields = $dataHandler->getFormData('openform');
*/
} else {
$view->selectFormats = $mainConfig['formats_to_select'];
}
Expand Down
46 changes: 26 additions & 20 deletions module/Delivery/src/Delivery/DataHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@ class DataHandler {

protected $params;

protected $formData = ['title' => '', 'fields' => []];
protected $formData;

protected $infoData = ['title' => '', 'fields' => []];
protected $formTitle;

// protected $infoData = ['title' => '', 'fields' => []];

protected $errors = [];

Expand Down Expand Up @@ -74,8 +76,12 @@ public function sendOrder($user)
foreach ($this->dataFields as $fieldSpecs) {
if (!empty($fieldSpecs['orderfield']) && !empty($fieldSpecs['form_name'])) {
$prefix = $fieldSpecs['orderfieldprefix'] ?? '';
$orderData[$fieldSpecs['orderfield']] .= (empty($orderData[$fieldSpecs['orderfield']])) ? '' : ', ';
$orderData[$fieldSpecs['orderfield']] .= $prefix . $this->params->fromPost($fieldSpecs['form_name']) ?: '';
$value = $prefix . $this->params->fromPost($fieldSpecs['form_name']);
if (empty($orderData[$fieldSpecs['orderfield']])) {
$orderData[$fieldSpecs['orderfield']] = $value;
} elseif ($value != $orderData[$fieldSpecs['orderfield']]) {
$orderData[$fieldSpecs['orderfield']] .= ', ' . $value;
}
}
}
if ($this->order_id = $this->deliveryDriver->sendOrder($orderData)) {
Expand Down Expand Up @@ -143,7 +149,9 @@ private function checkData()
$failed = false;
$this->missingFields = [];
foreach ($this->dataFields as $fieldSpecs) {
if (in_array('all', $fieldSpecs['formats']) || in_array($this->format, $fieldSpecs['formats'])) {
if (null !== $this->params->fromPost($fieldSpecs['form_name'])
&& (in_array('all', $fieldSpecs['formats'])
|| in_array($this->format, $fieldSpecs['formats']))) {
if (isset($fieldSpecs['mandatory']) && $fieldSpecs['mandatory'] == 1) {
if (empty($this->params->fromPost($fieldSpecs['form_name']))) {
$failed = true;
Expand Down Expand Up @@ -193,37 +201,35 @@ public function collectData($presetData = [])
$data = $flatData[$fieldKey];
}
$dataArray = array_merge($this->dataFields[$fieldKey], ['value' => $data]);
if ($fieldSpecs['type'] == 'info') {
$this->infoData['fields'][$fieldKey] = $dataArray;
} elseif ($fieldSpecs['type'] == 'form') {
$this->formData['fields'][$fieldKey] = $dataArray;
} elseif ($fieldSpecs['type'] == 'checkbox') {
$this->formData['checkbox'][$fieldKey] = $dataArray;
$fieldTypes = explode(',', $fieldSpecs['type']);
foreach ($fieldTypes as $fieldType) {
$this->formData[$fieldType][$fieldKey] = $dataArray;
if (empty($this->formTitle[$fieldType])) {
$this->formTitle[$fieldType] = $this->getTitle($format, $fieldType);
}
}
}
}
$this->infoData['title'] = $this->getTitle($format, 'info');
$this->formData['title'] = $this->getTitle($format, 'form');
}

public function getFormData()
public function getFormData($fieldType)
{
return $this->formData;
return $this->formData[$fieldType];
}
public function getInfoData()

public function getFormTitle($fieldType)
{
return $this->infoData;
return $this->formTitle[$fieldType];
}

private function getTitle($format, $type = 'info')
{
if ($format == 'Article' || $format == 'electronic Article') {
return ($type == 'info') ? 'Journal' : 'Article';
} elseif ($format == 'Journal' || $format == 'eJournal' || $format == 'Serial Volume') {
return ($type == 'info') ? 'Journal' : 'Article';
return ($type == 'info' || $type == 'openform') ? 'Journal' : 'Article';
} else {
return ($type == 'info') ? 'Book' : 'Copy';
return ($type == 'info' || $type == 'openform') ? 'Book' : 'Article';
}
}

Expand Down
10 changes: 6 additions & 4 deletions module/LMS/src/LMS/Controller/MyResearchController.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,12 @@ public function mylistAction()
if ($results->getListObject() && $results->getListObject()->isPublic()) {
if ($lmsConfig = parse_ini_file(realpath(getenv('VUFIND_LOCAL_DIR') . '/config/vufind/lms.ini'), true)) {
$patron = $this->catalogLogin();
foreach ($lmsConfig['lms-list-id-export']['allowed-user-types'] as $allowedUserType) {
foreach ($patron['type'] as $type) {
if ($type == $allowedUserType) {
$showExportButton = true;
if (is_array($patron)) {
foreach ($lmsConfig['lms-list-id-export']['allowed-user-types'] as $allowedUserType) {
foreach ($patron['type'] as $type) {
if ($type == $allowedUserType) {
$showExportButton = true;
}
}
}
}
Expand Down
4 changes: 3 additions & 1 deletion module/LimitBatch/src/LimitBatch/Backend/Solr/Backend.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ class Backend extends BackendBase

public function setPageSize($pageSize)
{
$this->pageSize = $pageSize;
if(!empty($pageSize)) {
$this->pageSize = $pageSize;
}
}

/**
Expand Down
20 changes: 18 additions & 2 deletions module/PAIAplus/src/PAIAplus/ILS/Driver/PAIA.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,22 @@ public function getMyHolds($patron)
}
}

/**
* Mapping the location signet to a proper location name
*
* @param string $signet
*
* @return string
*/
protected function mapLocation($signet) {
foreach ($this->locationMap as $signetExpression => $locationName) {
if (preg_match('#^' . $signetExpression . '$#', $signet)) {
return $locationName;
}
}
return '';
}

/**
* This PAIA helper function allows custom overrides for mapping of PAIA response
* to getMyHolds data structure.
Expand Down Expand Up @@ -150,7 +166,7 @@ protected function myHoldsMapping($items)
$result['available'] = $doc['status'] == 4 ? true : false;

list($signet, ) = explode(':', $doc['label']);
$result['institution_name'] = $this->locationMap[$signet] ?? '';
$result['institution_name'] = $this->mapLocation($signet);

$results[] = $result;
}
Expand Down Expand Up @@ -247,7 +263,7 @@ protected function myTransactionsMapping($items)
$result['callnumber'] = $this->getCallNumber($doc);

list($signet, ) = explode(':', $doc['label']);
$result['institution_name'] = $this->locationMap[$signet] ?? '';
$result['institution_name'] = $this->mapLocation($signet);

// Optional VuFind fields
/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
use RelevancePicker\Backend\Solr\Response\Json\RecordCollectionFactory;
use Libraries\Backend\Solr\Connector;
use Libraries\Search\Factory\SolrDefaultBackendFactory as BackendFactory;
use LimitBatch\Search\Factory\AbstractSolrBackendFactory;

class SolrDefaultBackendFactory extends BackendFactory
{
Expand All @@ -43,7 +42,7 @@ class SolrDefaultBackendFactory extends BackendFactory
*/
protected function createBackend(Connector $connector)
{
$backend = AbstractSolrBackendFactory::createBackend($connector);
$backend = parent::createBackend($connector);
$manager = $this->serviceLocator->get('RecordDriver\RecordDriver\PluginManager');
$factory = new RecordCollectionFactory([$manager, 'getSolrRecord']);
$backend->setRecordCollectionFactory($factory);
Expand Down
92 changes: 92 additions & 0 deletions module/StorageInfo/Module.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
<?php
/**
* Template for ZF2 module for storing local overrides.
*
* PHP version 5
*
* Copyright (C) Villanova University 2010.
*
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* @category VuFind2
* @package Module
* @author Demian Katz <demian.katz@villanova.edu>
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
* @link https://github.com/dmj/vf2-proxy
*/
namespace StorageInfo;
use Zend\ModuleManager\ModuleManager,
Zend\Mvc\MvcEvent;

/**
* Template for ZF2 module for storing local overrides.
*
* @category VuFind2
* @package Module
* @author Demian Katz <demian.katz@villanova.edu>
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
* @link https://github.com/dmj/vf2-proxy
*/
class Module
{
/**
* Get module configuration
*
* @return array
*/
public function getConfig()
{
return include __DIR__ . '/config/module.config.php';
}

/**
* Get autoloader configuration
*
* @return array
*/
public function getAutoloaderConfig()
{
return array(
'Zend\Loader\StandardAutoloader' => array(
'namespaces' => array(
__NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__,
),
),
);
}

/**
* Initialize the module
*
* @param ModuleManager $m Module manager
*
* @return void
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
public function init(ModuleManager $m)
{
}

/**
* Bootstrap the module
*
* @param MvcEvent $e Event
*
* @return void
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
public function onBootstrap(MvcEvent $e)
{
}
}
17 changes: 17 additions & 0 deletions module/StorageInfo/config/module.config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php
namespace ResultFeedback\Module\Configuration;

$config = [
'controllers' => [
'factories' => [
'StorageInfo\Controller\StorageInfoController' => 'StorageInfo\Controller\StorageInfoControllerFactory',
],
'aliases' => [
'StorageInfo' => 'StorageInfo\Controller\StorageInfoController',
'storageinfo' => 'StorageInfo\Controller\StorageInfoController',
],
],
];

return $config;

Loading

0 comments on commit d1a1544

Please sign in to comment.