Skip to content
Snippets Groups Projects
Commit b818a98e authored by Sebastian Kehr's avatar Sebastian Kehr 🚣🏼
Browse files

refs #11810

* updated @local/dev/config/vufind/FincILS.ini.sample@ for testing against daia/paiawachtl
* changes to class @finc\ILS\Logic\Holds@:
	** changed @getHoldings@ as super method changed: copied super method and added call to @processEmailHolds@
	** changed method @processEmailHold@: copied @processILLRequests@ from super class and adjusted strings
	** removed @getBlockedEmailHoldDetails@ since not needed anymore
	** changed @formatHoldings@ as super method changed; TODO: check whether @purchase_history@ gets correctly handled
* adjusted @themes/finc/templates/RecordTab/holdingsils.phtml@ due to changes of returned values by @finc\ILS\Logic\Holds::getHoldings@
* created @themes/finc/templates/search/searchTabs.phtml@ to test whether variable @$searchTabs@ actually exists
parent ce14a54e
No related merge requests found
......@@ -22,17 +22,17 @@ relative_path = ../../../config/vufind/FincILS.ini
;####################################################################
[DAIA]
baseUrl = http://139.18.19.238:9080/daialibero/daia/
daiaIdPrefix = "UBL:ppn:"
baseUrl = http://139.18.19.238:9080/daiawachtl/daia/
daiaIdPrefix = "DE-15:ppn:"
ilsIdentifier = "record_id"
multiQuery = true
daiaResponseFormat = json
[PAIA]
baseUrl = http://139.18.19.238:9080/paiawachtl/paia/DE-15/
paiaCache = false
[Records]
services[] = 'loan'
services[] = 'presentation'
services[] = 'custom'
[PAIA]
; base URL of the PAIA server
baseUrl = http://139.18.19.238:9080/paialibero/paia/DE-15/
......@@ -28,7 +28,9 @@
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
* @link https://vufind.org/wiki/development Wiki
*/
namespace finc\ILS\Logic;
use VuFind\ILS\Connection as ILSConnection;
/**
......@@ -60,6 +62,7 @@ class Holds extends \VuFind\ILS\Logic\Holds
// Handle purchase history alongside other textual fields
$textFieldNames = $this->catalog->getHoldingsTextFieldNames();
// TODO: handle purchase history as is done in super class ?!
$textFieldNames[] = 'purchase_history';
foreach ($holdings as $groupKey => $items) {
......@@ -93,9 +96,14 @@ class Holds extends \VuFind\ILS\Logic\Holds
}
if (!empty($item[$fieldName])) {
$targetRef = & $retVal[$groupKey]['textfields'][$fieldName];
$targetRef
= &$retVal[$groupKey]['textfields'][$fieldName];
foreach ((array)$item[$fieldName] as $field) {
if (empty($targetRef) || !in_array($field, $targetRef)) {
if (empty($targetRef)
|| !in_array(
$field, $targetRef
)
) {
$targetRef[] = $field;
}
}
......@@ -126,12 +134,12 @@ class Holds extends \VuFind\ILS\Logic\Holds
// controller and view to inform the user that these credentials are
// needed for hold data.
try {
$patron = $this->ilsAuth->storedCatalogLogin();
$patron = $this->ilsAuth->storedCatalogLogin();
// Does this ILS Driver handle consortial holdings?
$config = $this->catalog->checkFunction(
'Holds', compact('id', 'patron')
);
// Does this ILS Driver handle consortial holdings?
$config = $this->catalog->checkFunction(
'Holds', compact('id', 'patron')
);
} catch (ILSException $e) {
$patron = false;
$config = [];
......@@ -142,26 +150,49 @@ class Holds extends \VuFind\ILS\Logic\Holds
$id, $patron ? $patron : null, $ids
);
} else {
$result = $this->catalog->getHolding($id, $patron ? $patron : null);
$result = $this->catalog->getHolding(
$id, $patron ? $patron : null
);
}
$grb = 'getRequestBlocks'; // use variable to shorten line below:
$blocks
= $patron
&& $this->catalog->checkCapability(
$grb, compact($patron)
)
? $this->catalog->getRequestBlocks($patron) : false;
$mode = $this->catalog->getHoldsMode();
if ($mode == "disabled") {
$holdings = $this->standardHoldings($result);
} else if ($mode == "driver") {
$holdings = $this->driverHoldings($result, $config);
} else {
$holdings = $this->generateHoldings($result, $mode, $config);
if ($mode == "driver") {
$holdings = $this->driverHoldings(
$result, $config, !empty($blocks)
);
} else {
$holdings = $this->generateHoldings(
$result, $mode, $config
);
}
}
$holdings = $this->processStorageRetrievalRequests(
$holdings, $id, $patron
$holdings, $id, $patron, !empty($blocks)
);
$holdings = $this->processILLRequests(
$holdings, $id, $patron, !empty($blocks)
);
$holdings = $this->processEmailHolds(
$holdings, $id, $patron, !empty($blocks)
);
$holdings = $this->processILLRequests($holdings, $id, $patron);
$holdings = $this->processEmailHolds($holdings, $id, $patron);
}
return $this->formatHoldings($holdings);
return [
'blocks' => $blocks,
'holdings' => $this->formatHoldings($holdings)
];
}
/**
......@@ -174,13 +205,14 @@ class Holds extends \VuFind\ILS\Logic\Holds
*
* @return array Modified holdings
*/
protected function processEmailHolds($holdings, $id, $patron)
protected function processEmailHolds(
$holdings, $id, $patron, $requestsBlocked
)
{
if (!is_array($holdings)) {
return $holdings;
}
// Are email holds allowed?
$requestConfig = $this->catalog->checkFunction(
'EmailHold', compact('id', 'patron')
);
......@@ -189,29 +221,17 @@ class Holds extends \VuFind\ILS\Logic\Holds
return $holdings;
}
// Generate Links
// Loop through each holding
foreach ($holdings as &$location) {
foreach ($location as &$copy) {
// Is this copy requestable
if (isset($copy['addEmailHoldLink'])
if (!$requestsBlocked && isset($copy['addEmailHoldLink'])
&& $copy['addEmailHoldLink']
) {
// If the request is blocked, link to an error page
// instead of the form:
if ($copy['addEmailHoldLink'] === 'block') {
$copy['emailHoldLink']
= $this->getBlockedEmailHoldDetails($copy);
} else {
$copy['emailHoldLink']
= $this->getRequestDetails(
$copy,
$requestConfig['HMACKeys'],
'EmailHold'
);
}
// If we are unsure whether request options are
// available, set a flag so we can check later via AJAX:
$copy['emailHoldLink'] = $this->getRequestDetails(
$copy,
$requestConfig['HMACKeys'],
'EmailHoldLink'
);
$copy['checkEmailHold']
= $copy['addEmailHoldLink'] === 'check';
}
......@@ -219,20 +239,4 @@ class Holds extends \VuFind\ILS\Logic\Holds
}
return $holdings;
}
/**
* Returns a URL to display a "blocked email hold" message.
*
* @param array $details An array of item data
*
* @return array Details for generating URL
*/
protected function getBlockedEmailHoldDetails($details)
{
// Build Params
return [
'action' => 'BlockedEmailHold',
'record' => $details['id']
];
}
}
......@@ -72,7 +72,7 @@ if (!empty($holdingTitleHold)): ?>
<? endif; ?>
<? /* finc-specific snippet - #9274 - END */ ?>
<? endif; ?>
<? foreach ($holdings as $holding): ?>
<? foreach ($holdings['holdings'] as $holding): ?>
<? /* nxt line = finc-specific - #7841@56988450 - CK */ ?>
<? $holdingsEmpty = false; ?>
<? /* this next line produces an empty h3 heading in some cases - should be solved more elegantly - Fixme - CK*/ ?>
......
<? if (isset($searchTabs) && count($searchTabs) > 0): ?>
<ul class="nav nav-tabs">
<? foreach ($searchTabs as $tab): ?>
<li<?=$tab['selected'] ? ' class="active"' : ''?>>
<a <?=$tab['selected'] ? '' : 'href="' . $this->escapeHtmlAttr($tab['url']) . '"' ?>><?=$this->transEsc($tab['label']); ?></a>
</li>
<? endforeach; ?>
</ul>
<? endif; ?>
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