diff --git a/local/config/vufind/config.ini b/local/config/vufind/config.ini index 94907f0f9e1c9929474826c6343ddfc591825dcc..e40e2edcb2d6336de03bf49e86f3d16bafea0398 100644 --- a/local/config/vufind/config.ini +++ b/local/config/vufind/config.ini @@ -363,7 +363,7 @@ title_level_holds_mode = "disabled" ; The number of historic loans to display per page; 0 for no limit (may cause ; memory problems for users with a large number of historic loans). Default = 50 -;historic_loan_page_size = 50 +historic_loan_page_size = 30 ; Whether to display the item barcode for each loan. Default is false. ;display_checked_out_item_barcode = true diff --git a/module/finc/src/finc/AjaxHandler/GetUserLoanHistory.php b/module/finc/src/finc/AjaxHandler/GetUserLoanHistory.php index 08e6b0ee39bf0fc09b3c85f475fbf829decf45f5..62291085896dca14acd7416f4806df0d4fa66870 100644 --- a/module/finc/src/finc/AjaxHandler/GetUserLoanHistory.php +++ b/module/finc/src/finc/AjaxHandler/GetUserLoanHistory.php @@ -55,7 +55,7 @@ class GetUserLoanHistory extends \VuFind\AjaxHandler\AbstractUserRequestAction if (!$this->ils->checkCapability('getMyTransactions')) { return $this->formatResponse('', self::STATUS_HTTP_ERROR, 405); } - $items = $this->ils->getMyLoanHistory($patron, 100); + $items = $this->ils->getMyTransactionHistory($patron, 0); $counts = [ 'ok' => $items['total'] ]; return $this->formatResponse($counts); diff --git a/module/finc/src/finc/ILS/Driver/LiberoWachtlTrait.php b/module/finc/src/finc/ILS/Driver/LiberoWachtlTrait.php index d15ced6d27d2b8a7d91712b94aca09356f844ec8..5648473798bcd21fa9d48c56c06703ec744c7743 100644 --- a/module/finc/src/finc/ILS/Driver/LiberoWachtlTrait.php +++ b/module/finc/src/finc/ILS/Driver/LiberoWachtlTrait.php @@ -626,11 +626,10 @@ trait LiberoWachtlTrait } /** - * Customized getMyLoanHistory + * Customized getMyTransactionHistory method for LiberoWachtl * - * @param array $patron Array returned from patronLogin() - * @param int $lastLine Integer until LiberoWachtl should process history - * incrementally + * @param array $patron Array returned from patronLogin() + * @param int $currentPage Current page of loan history * * @return array $retval * - ['items'] Array with items of loan history @@ -638,12 +637,12 @@ trait LiberoWachtlTrait * @throws \Exception * @throws ILSException */ - public function getMyLoanHistory($patron, $lastLine) + public function getMyTransactionHistory($patron, $currentPage = null) { $params = $this->getLiberoWachtlRequestParams(); $params['memberCode'] = $patron['cat_username']; $params['password'] = $patron['cat_password']; - $params['pageNumber'] = 1; + $params['pageNumber'] = $currentPage ?? 1; try { $result = $this->httpService->get( $this->getLiberoWachtlUrl() . 'getMyLoanHistory.jsp', @@ -675,43 +674,7 @@ trait LiberoWachtlTrait } $retval = []; $retval['total'] = $details['rowCount']; - $retval['items'] = $details['getMyLoanHistory']; - // Check if more entries are required than in first called. - if (count($details['getMyLoanHistory']) < $lastLine) { - // iteration over Libero view pager and security anchor to not iterate - // over more pages than exists - for ($page = 2; $page <= $details['pageCount']; $page++) { - // overwrite param pageNumber - $params['pageNumber'] = $page; - try { - $result = $this->httpService->get( - $this->getLiberoWachtlUrl() . 'getMyLoanHistory.jsp', - $params, - null, - $this->getLiberoWachtlRequestHeaders() - ); - } catch (\Exception $e) { - throw new ILSException($e->getMessage()); - } - if (!$result->isSuccess()) { - // log error for debugging - $this->debug( - 'HTTP status ' . $result->getStatusCode() . - ' received' - ); - return false; - } - // merge with previous request - $retval['items'] = array_merge( - $retval['items'], - $this->getLiberoWachtlResult($result, 'getMyLoanHistory') - ); - // If there are requested lines collected break the iteration - if (count($retval['items']) > $lastLine) { - break; - } - } - } + $retval['items'] = $this->getLiberoWachtlResult($result, 'getMyLoanHistory'); $ids = $this->getAlternativeItemId(array_column($retval['items'], FincILS::ILS_IDENTIFIER_BARCODE), FincILS::ILS_IDENTIFIER_BARCODE); foreach ($retval['items'] as $number => &$current) { diff --git a/themes/finc/templates/myresearch/historicloans.phtml b/themes/finc/templates/myresearch/historicloans.phtml index 3a0aef9bb9e7dfdb6d6d9cf605958b2e897d0940..c8308acf766099c2a02140daadbdef3f176d046a 100644 --- a/themes/finc/templates/myresearch/historicloans.phtml +++ b/themes/finc/templates/myresearch/historicloans.phtml @@ -17,25 +17,9 @@ <?=$this->context($this)->renderInContext('librarycards/selectcard.phtml', ['user' => $this->auth()->isLoggedIn()]); ?> - <?php if (!empty($this->transactions)): ?> + <?php if (!empty($this->recordList)): ?> <?php /* finc adds aria-label */ ?> <nav class="search-header hidden-print" aria-label="<?=$this->transEscAttr('aria_search_header')?>"> - <?php if ($this->paginator): ?> - <div class="search-stats"> - <?php - $end = min( - $this->paginator->getAbsoluteItemNumber($this->paginator->getItemCountPerPage()), - $this->paginator->getTotalItemCount() - ); - $transParams = [ - '%%start%%' => $this->localizedNumber($this->paginator->getAbsoluteItemNumber(1)), - '%%end%%' => $this->localizedNumber($end), - '%%total%%' => $this->localizedNumber($this->paginator->getTotalItemCount()) - ]; - ?> - <?=$this->translate('showing_items_of_html', $transParams); ?> - </div> - <?php endif; ?> <?php if ($this->sortList): ?> <?=$this->context($this)->renderInContext('myresearch/controls/sort.phtml', ['sortList' => $this->sortList]); ?> <?php endif; ?> @@ -43,7 +27,7 @@ <?php /* finc uses ul to present list structure correctly, adds empty 'lang' attribute #18535 */ ?> <ul class="record-list"> - <?php $i = 0; foreach ($this->transactions as $resource): ?> + <?php $i = 0; foreach ($this->recordList as $resource): ?> <?php $ilsDetails = $resource->getExtraDetail('ils_details'); ?> <?php $describedById = $resource->getSourceIdentifier() . '|' . (empty($resource->getUniqueId()) ? md5(serialize($resource->getExtraDetail("ils_details"))) : $resource->getUniqueId()); ?> <li id="record<?=$this->escapeHtmlAttr($resource->getUniqueId())?>" class="result"> diff --git a/themes/finc/templates/myresearch/menu.phtml b/themes/finc/templates/myresearch/menu.phtml index a143163ef6dd81027ca0b05d0f757057f315a374..a3c4b72f1ecd29842a323d6d08a96ae727e0becb 100644 --- a/themes/finc/templates/myresearch/menu.phtml +++ b/themes/finc/templates/myresearch/menu.phtml @@ -78,9 +78,9 @@ </li> <?php endif; ?> <?php /* finc: adds historic loans */ ?> - <?php if ($ilsOnline && $this->ils()->checkCapability('getMyLoanHistory', $capabilityParams) && $routeExists('myresearch-loanhistory')): ?> + <?php if ($ilsOnline && $this->ils()->checkCapability('getMyTransactionHistory', $capabilityParams) && $routeExists('myresearch-loanhistory')): ?> <li class="facet"> - <a href="<?=$this->url('myresearch-loanhistory')?>"<?=$this->active == 'loanhistory' ? ' class="active" aria-current="page"' : ''?>> + <a href="<?=$this->url('myresearch-historicloans')?>"<?=$this->active == 'historicloans' ? ' class="active" aria-current="page"' : ''?>> <i class="fa fa-fw fa-history" aria-hidden="true"></i> <?=$this->transEsc('Loan History')?> </a> </li>