From 6a7d4b19c7fa224fc1a5abd596a81d3ca52f43f9 Mon Sep 17 00:00:00 2001 From: Agustin Moyano Date: Thu, 7 Mar 2019 15:51:46 -0300 Subject: [PATCH] Bug 21772: Move OPAC holds and account tables into .inc This patch moves the code to render the account and holds information for the patron into include files. They are loaded in the opac-user.tt and opac-account.tt templates respectively. To test: 1) Have a patron with account lines and holds 2) Notice they are displayed in the patron's detail section in the OPAC 3) Apply this patch 4) Reload the patron's detail page => SUCESS: Everything looks the same, no behaviuor or layout change. 5) Sign off Sponsored-by: City of Portsmouth Public Library Signed-off-by: Sarah Cornell Signed-off-by: Josef Moravec Signed-off-by: Nick Clemens --- .../bootstrap/en/includes/account-table.inc | 112 +++++++++ .../bootstrap/en/includes/holds-table.inc | 222 ++++++++++++++++++ .../bootstrap/en/modules/opac-account.tt | 114 +-------- .../bootstrap/en/modules/opac-user.tt | 206 +--------------- 4 files changed, 337 insertions(+), 317 deletions(-) create mode 100644 koha-tmpl/opac-tmpl/bootstrap/en/includes/account-table.inc create mode 100644 koha-tmpl/opac-tmpl/bootstrap/en/includes/holds-table.inc diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/account-table.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/account-table.inc new file mode 100644 index 0000000000..7c376847fd --- /dev/null +++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/account-table.inc @@ -0,0 +1,112 @@ +

Fines and charges

+ +[% IF ( ACCOUNT_LINES ) %] +
+ + + + [% IF ENABLE_OPAC_PAYMENTS %][% END %] + + + + + + + + + + [%- IF ENABLE_OPAC_PAYMENTS -%] + [%- SET COLSPAN = 4 -%] + [%- ELSE -%] + [%- SET COLSPAN = 3 -%] + [%- END -%] + + + + + + + [% FOREACH ACCOUNT_LINE IN ACCOUNT_LINES %] + [% IF ( ACCOUNT_LINE.odd ) %][% ELSE %][% END %] + [% IF ENABLE_OPAC_PAYMENTS %] + + [% END %] + + + [% IF ( ACCOUNT_LINE.amountcredit ) %] + [% IF ( ACCOUNT_LINE.amountoutstandingcredit ) %] + + [% END %] + + +
 DateDescriptionFine amountAmount outstanding
Total due[% total | $Price %]
+ [% IF ACCOUNT_LINE.amountoutstanding > 0 %] + [% SET DISPLAY_PAYMENT_BLOCK = 1 %] + + + [% END %] + [% ACCOUNT_LINE.date | $KohaDates %] + [% SWITCH ACCOUNT_LINE.accounttype %] + [% CASE 'Pay' %]Payment, thanks + [% CASE 'Pay00' %]Payment, thanks (cash via SIP2) + [% CASE 'Pay01' %]Payment, thanks (VISA via SIP2) + [% CASE 'Pay02' %]Payment, thanks (credit card via SIP2) + [% CASE 'N' %]New card + [% CASE 'F' %]Fine + [% CASE 'A' %]Account management fee + [% CASE 'M' %]Sundry + [% CASE 'L' %]Lost item + [% CASE 'W' %]Writeoff + [% CASE 'FU' %]Accruing fine + [% CASE 'HE' %]Hold waiting too long + [% CASE 'Rent' %]Rental fee + [% CASE 'FOR' %]Forgiven + [% CASE 'LR' %]Lost item fee refund + [% CASE 'PF' %]Processing fee + [% CASE 'PAY' %]Payment + [% CASE 'WO' %]Writeoff + [% CASE 'C' %]Credit + [% CASE 'CR' %]Credit + [% CASE %][% ACCOUNT_LINE.accounttype | html %] + [%- END -%] + [%- IF ACCOUNT_LINE.payment_type %], [% AuthorisedValues.GetByCode('PAYMENT_TYPE', ACCOUNT_LINE.payment_type, 1) | html %][% END %] + [%- IF ACCOUNT_LINE.description %], [% ACCOUNT_LINE.description | html %][% END %] + [% IF ACCOUNT_LINE.title %]([% ACCOUNT_LINE.title | html %])[% END %] + [% ELSE %][% END %][% ACCOUNT_LINE.amount | $Price %][% ELSE %][% END %][% ACCOUNT_LINE.amountoutstanding | $Price %]
+ + [% IF ENABLE_OPAC_PAYMENTS && DISPLAY_PAYMENT_BLOCK %] + + [% END %] +
+[% ELSE %] +

You have no fines or charges

+[% END %] \ No newline at end of file diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/holds-table.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/holds-table.inc new file mode 100644 index 0000000000..8c8000e346 --- /dev/null +++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/holds-table.inc @@ -0,0 +1,222 @@ +[% USE Branches %] +[% USE ItemTypes %] +[% USE KohaDates %] + +[% IF ( HOLDS.count ) %] +
+ + + + + + + [% IF ( showpriority ) %] + + [% ELSE %] + + [% END %] + + [% UNLESS( singleBranchMode) %] + + [% END %] + [% IF ( showpriority ) %] + + [% END %] + + [% IF SuspendHoldsOpac and ! onlyinfo %] + + [% END %] + [% IF ! onlyinfo %] + + [% END %] + + + + [% FOREACH HOLD IN HOLDS %] + [% IF ( HOLD.is_waiting ) %] + [% IF ( HOLD.is_at_destination ) %] + [% IF ( HOLD.is_found ) %] + + [% ELSE %] + + [% END %] + [% ELSE %] + + [% END %] + [% ELSE %] + + [% END %] + + + + [% UNLESS( singleBranchMode) %] + + [% END %] + [% IF ( showpriority ) %] + + [% END %] + + [% IF SuspendHoldsOpac and ! onlyinfo %] + + [% END # / IF SuspendHoldsOpac %] + [% IF ! onlyinfo %] + + [% END # / IF onlyinfo %] + + [% END # /FOREACH HOLDS %] + +
Holds ([% HOLDS.count | html %] total)
TitlePlaced onPlaced onExpires onPick up locationPriorityStatusSuspendModify
+ [% IF ! onlyinfo %] + + [% HOLD.biblio.title | html %] + [% FOREACH s IN HOLD.biblio.subtitles %] + [% s | html %] + [% END %] + [% HOLD.item.enumchron | html %] + + [% ELSE %] + + [% HOLD.biblio.title | html %] + [% FOREACH s IN HOLD.biblio.subtitles %] + [% s | html %] + [% END %] + [% HOLD.item.enumchron | html %] + + [% END %] + [% HOLD.biblio.author | html %] + + + Hold date: + [% HOLD.reservedate | $KohaDates %] + + + [% IF ! HOLD.found %] + [% IF ( HOLD.expirationdate ) %] + + Expiration: + [% HOLD.expirationdate | $KohaDates %] + + [% ELSE %] + + Expiration: + Never expires + + [% END %] + [% ELSE %] + - + [% END %] + + Pick up location: + [% HOLD.branch.branchname | html %] + + Priority: + [% HOLD.priority | html %] + + Status: + [% IF ( HOLD.is_waiting ) %] + [% IF ( HOLD.is_at_destination ) %] + [% IF ( HOLD.found ) %] + Item waiting at [% HOLD.branch.branchname | html %] + [% IF ( HOLD.waitingdate ) %] + since [% HOLD.waitingdate | $KohaDates %] + [% IF HOLD.expirationdate %] + until [% HOLD.expirationdate | $KohaDates %] + [% END %] + [% END %] + + [% ELSE %] + Item waiting to be pulled from [% Branches.GetName( HOLD.branchcode ) | html %] + [% END %] + [% ELSE %] + Item in transit to [% Branches.GetName( HOLD.branchcode ) | html %] + [% END %] + [% ELSE %] + [% IF ( HOLD.is_in_transit ) %] + [% SET transfer = HOLD.item.get_transfer %] + Item in transit from [% Branches.GetName( transfer.frombranch ) | html %] since + [% transfer.datesent | $KohaDates %] + [% ELSIF ( HOLD.suspend ) %] + Suspended [% IF ( HOLD.suspend_until ) %] until [% HOLD.suspend_until | html %] [% END %] + [% ELSE %] + [% IF HOLD.itemtype %] + Pending for next available item of item type '[% ItemTypes.GetDescription( HOLD.itemtype ) | html %]' + [% ELSE %] + Pending + [% END %] + [% END %] + [% END %] + + [% IF ( HOLD.is_cancelable_from_opac ) %] + [% IF HOLD.suspend %] +
+ + +
+ [% ELSE %] + [% IF AutoResumeSuspendedHolds %] + Suspend + [% # hold suspend modal form %] + + [% ELSE %] +
+ + +
+ [% END # / IF AutoResumeSuspendedHolds %] + [% END # / IF HOLD.suspend %] + [% END # / IF ( HOLD.is_cancelable_from_opac )%] +
+ [% IF ( HOLD.is_cancelable_from_opac ) %] +
+ + +
+ [% END %] +
+ + [% IF SuspendHoldsOpac and ! onlyinfo %] +
+
+ + + + [% IF AutoResumeSuspendedHolds %] + + + Clear date to suspend indefinitely + [% END %] +
+
+
+
+
+ + +
+
+ [% END %] +
+[% END # / #HOLDS.count %] diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-account.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-account.tt index 23229a0485..265136d715 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-account.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-account.tt @@ -66,118 +66,8 @@ [% END %] -

Fines and charges

- - [% IF ( ACCOUNT_LINES ) %] -
- - - - [% IF ENABLE_OPAC_PAYMENTS %][% END %] - - - - - - - - - - [%- IF ENABLE_OPAC_PAYMENTS -%] - [%- SET COLSPAN = 4 -%] - [%- ELSE -%] - [%- SET COLSPAN = 3 -%] - [%- END -%] - - - - - - - [% FOREACH ACCOUNT_LINE IN ACCOUNT_LINES %] - [% IF ( ACCOUNT_LINE.odd ) %][% ELSE %][% END %] - [% IF ENABLE_OPAC_PAYMENTS %] - - [% END %] - - - [% IF ( ACCOUNT_LINE.amountcredit ) %] - [% IF ( ACCOUNT_LINE.amountoutstandingcredit ) %] - - [% END %] - - -
 DateDescriptionFine amountAmount outstanding
Total due[% total | $Price %]
- [% IF ACCOUNT_LINE.amountoutstanding > 0 %] - [% SET DISPLAY_PAYMENT_BLOCK = 1 %] - - - [% END %] - [% ACCOUNT_LINE.date | $KohaDates %] - [% SWITCH ACCOUNT_LINE.accounttype %] - [% CASE 'Pay' %]Payment, thanks - [% CASE 'Pay00' %]Payment, thanks (cash via SIP2) - [% CASE 'Pay01' %]Payment, thanks (VISA via SIP2) - [% CASE 'Pay02' %]Payment, thanks (credit card via SIP2) - [% CASE 'N' %]New card - [% CASE 'F' %]Fine - [% CASE 'A' %]Account management fee - [% CASE 'M' %]Sundry - [% CASE 'L' %]Lost item - [% CASE 'W' %]Writeoff - [% CASE 'FU' %]Accruing fine - [% CASE 'HE' %]Hold waiting too long - [% CASE 'Rent' %]Rental fee - [% CASE 'FOR' %]Forgiven - [% CASE 'LR' %]Lost item fee refund - [% CASE 'PF' %]Processing fee - [% CASE 'PAY' %]Payment - [% CASE 'WO' %]Writeoff - [% CASE 'C' %]Credit - [% CASE 'CR' %]Credit - [% CASE %][% ACCOUNT_LINE.accounttype | html %] - [%- END -%] - [%- IF ACCOUNT_LINE.payment_type %], [% AuthorisedValues.GetByCode('PAYMENT_TYPE', ACCOUNT_LINE.payment_type, 1) | html %][% END %] - [%- IF ACCOUNT_LINE.description %], [% ACCOUNT_LINE.description | html %][% END %] - [% IF ACCOUNT_LINE.title %]([% ACCOUNT_LINE.title | html %])[% END %] - [% ELSE %][% END %][% ACCOUNT_LINE.amount | $Price %][% ELSE %][% END %][% ACCOUNT_LINE.amountoutstanding | $Price %]
- - [% IF ENABLE_OPAC_PAYMENTS && DISPLAY_PAYMENT_BLOCK %] - - [% END %] -
- [% ELSE %] -

You have no fines or charges

- [% END %] + [% PROCESS 'account-table.inc' ACCOUNT_LINES = ACCOUNT_LINES, ENABLE_OPAC_PAYMENTS = ENABLE_OPAC_PAYMENTS, plugins = plugins %] + diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt index 7c55d8d86b..d52e6b89a8 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt @@ -597,211 +597,7 @@ [% END # /overdues_count %] - - [% IF ( RESERVES.count ) %] -
- - - - - - - [% IF ( showpriority ) %] - - [% ELSE %] - - [% END %] - - [% UNLESS( singleBranchMode) %] - - [% END %] - [% IF ( showpriority ) %] - - [% END %] - - [% IF SuspendHoldsOpac %] - - [% END %] - - - - - [% FOREACH RESERVE IN RESERVES %] - [% IF ( RESERVE.is_waiting ) %] - [% IF ( RESERVE.is_at_destination ) %] - [% IF ( RESERVE.is_found ) %] - - [% ELSE %] - - [% END %] - [% ELSE %] - - [% END %] - [% ELSE %] - - [% END %] - - - - [% UNLESS( singleBranchMode) %] - - [% END %] - [% IF ( showpriority ) %] - - [% END %] - - [% IF SuspendHoldsOpac %] - - [% END # / IF SuspendHoldsOpac %] - - - [% END # /FOREACH RESERVES %] - -
Holds ([% RESERVES.count | html %] total)
TitlePlaced onPlaced onExpires onPick up locationPriorityStatusSuspendModify
- - [% RESERVE.biblio.title | html %] - [% FOREACH s IN RESERVE.biblio.subtitles %] - [% s | html %] - [% END %] - [% RESERVE.item.enumchron | html %] - - [% RESERVE.biblio.author | html %] - - - Hold date: - [% RESERVE.reservedate | $KohaDates %] - - - [% IF ! RESERVE.found %] - [% IF ( RESERVE.expirationdate ) %] - - Expiration: - [% RESERVE.expirationdate | $KohaDates %] - - [% ELSE %] - - Expiration: - Never expires - - [% END %] - [% ELSE %] - - - [% END %] - - Pick up location: - [% RESERVE.branch.branchname | html %] - - Priority: - [% RESERVE.priority | html %] - - Status: - [% IF ( RESERVE.is_waiting ) %] - [% IF ( RESERVE.is_at_destination ) %] - [% IF ( RESERVE.found ) %] - Item waiting at [% RESERVE.branch.branchname | html %] - [% IF ( RESERVE.waitingdate ) %] - since [% RESERVE.waitingdate | $KohaDates %] - [% IF RESERVE.expirationdate %] - until [% RESERVE.expirationdate | $KohaDates %] - [% END %] - [% END %] - - [% ELSE %] - Item waiting to be pulled from [% Branches.GetName( RESERVE.branchcode ) | html %] - [% END %] - [% ELSE %] - Item in transit to [% Branches.GetName( RESERVE.branchcode ) | html %] - [% END %] - [% ELSE %] - [% IF ( RESERVE.is_in_transit ) %] - [% SET transfer = RESERVE.item.get_transfer %] - Item in transit from [% Branches.GetName( transfer.frombranch ) | html %] since - [% transfer.datesent | $KohaDates %] - [% ELSIF ( RESERVE.suspend ) %] - Suspended [% IF ( RESERVE.suspend_until ) %] until [% RESERVE.suspend_until | html %] [% END %] - [% ELSE %] - [% IF RESERVE.itemtype %] - Pending for next available item of item type '[% ItemTypes.GetDescription( RESERVE.itemtype ) | html %]' - [% ELSE %] - Pending - [% END %] - [% END %] - [% END %] - - [% IF ( RESERVE.is_cancelable_from_opac ) %] - [% IF RESERVE.suspend %] -
- - -
- [% ELSE %] - [% IF AutoResumeSuspendedHolds %] - Suspend - [% # hold suspend modal form %] - - [% ELSE %] -
- - -
- [% END # / IF AutoResumeSuspendedHolds %] - [% END # / IF RESERVE.suspend %] - [% END # / IF ( RESERVE.is_cancelable_from_opac )%] -
- [% IF ( RESERVE.is_cancelable_from_opac ) %] -
- - -
- [% END %] -
- - [% IF SuspendHoldsOpac %] -
-
- - - - [% IF AutoResumeSuspendedHolds %] - - - Clear date to suspend indefinitely - [% END %] -
-
-
-
-
- - -
-
- [% END %] -
- [% END # / #RESERVES.count %] + [% PROCESS 'holds-table.inc' HOLDS => RESERVES, SuspendHoldsOpac = SuspendHoldsOpac, showpriority = showpriority, AutoResumeSuspendedHolds = AutoResumeSuspendedHolds %] [% IF Koha.Preference('ArticleRequests') %]
-- 2.39.5