Skip to content
Snippets Groups Projects
Commit b818a98e authored by Sebastian Kehr's avatar Sebastian Kehr :rowboat_tone2:
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
Branches
Tags
No related merge requests found
...@@ -22,17 +22,17 @@ relative_path = ../../../config/vufind/FincILS.ini ...@@ -22,17 +22,17 @@ relative_path = ../../../config/vufind/FincILS.ini
;#################################################################### ;####################################################################
[DAIA] [DAIA]
baseUrl = http://139.18.19.238:9080/daialibero/daia/ baseUrl = http://139.18.19.238:9080/daiawachtl/daia/
daiaIdPrefix = "UBL:ppn:" daiaIdPrefix = "DE-15:ppn:"
ilsIdentifier = "record_id" ilsIdentifier = "record_id"
multiQuery = true multiQuery = true
daiaResponseFormat = json daiaResponseFormat = json
[PAIA]
baseUrl = http://139.18.19.238:9080/paiawachtl/paia/DE-15/
paiaCache = false
[Records] [Records]
services[] = 'loan' services[] = 'loan'
services[] = 'presentation' services[] = 'presentation'
services[] = 'custom' services[] = 'custom'
[PAIA]
; base URL of the PAIA server
baseUrl = http://139.18.19.238:9080/paialibero/paia/DE-15/
...@@ -28,7 +28,9 @@ ...@@ -28,7 +28,9 @@
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
* @link https://vufind.org/wiki/development Wiki * @link https://vufind.org/wiki/development Wiki
*/ */
namespace finc\ILS\Logic; namespace finc\ILS\Logic;
use VuFind\ILS\Connection as ILSConnection; use VuFind\ILS\Connection as ILSConnection;
/** /**
...@@ -60,6 +62,7 @@ class Holds extends \VuFind\ILS\Logic\Holds ...@@ -60,6 +62,7 @@ class Holds extends \VuFind\ILS\Logic\Holds
// Handle purchase history alongside other textual fields // Handle purchase history alongside other textual fields
$textFieldNames = $this->catalog->getHoldingsTextFieldNames(); $textFieldNames = $this->catalog->getHoldingsTextFieldNames();
// TODO: handle purchase history as is done in super class ?!
$textFieldNames[] = 'purchase_history'; $textFieldNames[] = 'purchase_history';
foreach ($holdings as $groupKey => $items) { foreach ($holdings as $groupKey => $items) {
...@@ -93,9 +96,14 @@ class Holds extends \VuFind\ILS\Logic\Holds ...@@ -93,9 +96,14 @@ class Holds extends \VuFind\ILS\Logic\Holds
} }
if (!empty($item[$fieldName])) { if (!empty($item[$fieldName])) {
$targetRef = & $retVal[$groupKey]['textfields'][$fieldName]; $targetRef
= &$retVal[$groupKey]['textfields'][$fieldName];
foreach ((array)$item[$fieldName] as $field) { foreach ((array)$item[$fieldName] as $field) {
if (empty($targetRef) || !in_array($field, $targetRef)) { if (empty($targetRef)
|| !in_array(
$field, $targetRef
)
) {
$targetRef[] = $field; $targetRef[] = $field;
} }
} }
...@@ -126,12 +134,12 @@ class Holds extends \VuFind\ILS\Logic\Holds ...@@ -126,12 +134,12 @@ class Holds extends \VuFind\ILS\Logic\Holds
// controller and view to inform the user that these credentials are // controller and view to inform the user that these credentials are
// needed for hold data. // needed for hold data.
try { try {
$patron = $this->ilsAuth->storedCatalogLogin(); $patron = $this->ilsAuth->storedCatalogLogin();
// Does this ILS Driver handle consortial holdings? // Does this ILS Driver handle consortial holdings?
$config = $this->catalog->checkFunction( $config = $this->catalog->checkFunction(
'Holds', compact('id', 'patron') 'Holds', compact('id', 'patron')
); );
} catch (ILSException $e) { } catch (ILSException $e) {
$patron = false; $patron = false;
$config = []; $config = [];
...@@ -142,26 +150,49 @@ class Holds extends \VuFind\ILS\Logic\Holds ...@@ -142,26 +150,49 @@ class Holds extends \VuFind\ILS\Logic\Holds
$id, $patron ? $patron : null, $ids $id, $patron ? $patron : null, $ids
); );
} else { } 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(); $mode = $this->catalog->getHoldsMode();
if ($mode == "disabled") { if ($mode == "disabled") {
$holdings = $this->standardHoldings($result); $holdings = $this->standardHoldings($result);
} else if ($mode == "driver") {
$holdings = $this->driverHoldings($result, $config);
} else { } 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 = $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 ...@@ -174,13 +205,14 @@ class Holds extends \VuFind\ILS\Logic\Holds
* *
* @return array Modified holdings * @return array Modified holdings
*/ */
protected function processEmailHolds($holdings, $id, $patron) protected function processEmailHolds(
$holdings, $id, $patron, $requestsBlocked
)
{ {
if (!is_array($holdings)) { if (!is_array($holdings)) {
return $holdings; return $holdings;
} }
// Are email holds allowed?
$requestConfig = $this->catalog->checkFunction( $requestConfig = $this->catalog->checkFunction(
'EmailHold', compact('id', 'patron') 'EmailHold', compact('id', 'patron')
); );
...@@ -189,29 +221,17 @@ class Holds extends \VuFind\ILS\Logic\Holds ...@@ -189,29 +221,17 @@ class Holds extends \VuFind\ILS\Logic\Holds
return $holdings; return $holdings;
} }
// Generate Links
// Loop through each holding
foreach ($holdings as &$location) { foreach ($holdings as &$location) {
foreach ($location as &$copy) { foreach ($location as &$copy) {
// Is this copy requestable if (!$requestsBlocked && isset($copy['addEmailHoldLink'])
if (isset($copy['addEmailHoldLink'])
&& $copy['addEmailHoldLink'] && $copy['addEmailHoldLink']
) { ) {
// If the request is blocked, link to an error page $copy['emailHoldLink'] = $this->getRequestDetails(
// instead of the form: $copy,
if ($copy['addEmailHoldLink'] === 'block') { $requestConfig['HMACKeys'],
$copy['emailHoldLink'] '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['checkEmailHold'] $copy['checkEmailHold']
= $copy['addEmailHoldLink'] === 'check'; = $copy['addEmailHoldLink'] === 'check';
} }
...@@ -219,20 +239,4 @@ class Holds extends \VuFind\ILS\Logic\Holds ...@@ -219,20 +239,4 @@ class Holds extends \VuFind\ILS\Logic\Holds
} }
return $holdings; 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)): ?> ...@@ -72,7 +72,7 @@ if (!empty($holdingTitleHold)): ?>
<? endif; ?> <? endif; ?>
<? /* finc-specific snippet - #9274 - END */ ?> <? /* finc-specific snippet - #9274 - END */ ?>
<? endif; ?> <? endif; ?>
<? foreach ($holdings as $holding): ?> <? foreach ($holdings['holdings'] as $holding): ?>
<? /* nxt line = finc-specific - #7841@56988450 - CK */ ?> <? /* nxt line = finc-specific - #7841@56988450 - CK */ ?>
<? $holdingsEmpty = false; ?> <? $holdingsEmpty = false; ?>
<? /* this next line produces an empty h3 heading in some cases - should be solved more elegantly - Fixme - CK*/ ?> <? /* 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