From 92649f7bae669aee9f5961fd8ff2f448fc035d3f Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Fri, 20 Jan 2023 18:47:11 +0000 Subject: [PATCH] Bug 32698: Use template wrapper for serials pages tabs This patch updates three serials templates to replace tab markup with the use of WRAPPERs. To test requires more data than will be found in the sample data. You need at least one subscription with issues spanning more than one year. I suggest creating a new subscription which starts in December, then receive one issue from December and one in January. Apply the patch and go to Serials. - Perform a subscription search. - On the search results page there should be two tabs: "Open" and "Closed." These tabs should work correctly. - Open the detail view of one of your subscriptions. - You should see at least four tabs: "Information," "Planning," "Issues," and "Summary." - In some cases an "Acquisition details" tab will also appear. To test this you must go to Acquisitions and add an order to a basket by choosing "From a subscription" option. - Click "Serial collection" in the left-hand sidebar. - There should be tabs for each year of subscription issues in your collection. Signed-off-by: David Nind Signed-off-by: Katrin Fischer Signed-off-by: Tomas Cohen Arazi (cherry picked from commit d2f3c54261e34882f9134c5c8904cacf1c6fc51e) Signed-off-by: Jacob O'Mara --- .../en/modules/serials/serials-collection.tt | 33 +- .../prog/en/modules/serials/serials-search.tt | 36 ++- .../en/modules/serials/subscription-detail.tt | 305 +++++++----------- 3 files changed, 159 insertions(+), 215 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-collection.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-collection.tt index 48e104971c..19cc576664 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-collection.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-collection.tt @@ -146,22 +146,35 @@ [% IF ( years ) %]
-
- + [% END # /WRAPPER tabs_nav %] -
+ [% WRAPPER tab_panels %] [% FOREACH year IN years %] -
+ [% IF ( loop.first ) %] + [% SET bt_active = 1 %] + [% ELSE %] + [% SET bt_active = 0 %] + [% END %] + [% WRAPPER tab_panel tabname="subscription-year-${year.year}" bt_active= bt_active %] [% IF ( CAN_user_serials_receive_serials ) %]

@@ -305,11 +318,11 @@ [% END %] -
+ [% END # /WRAPPER tab_panel#subscription-year %] [% END # /FOREACH year %] -
+ [% END # /WRAPPER tab_panels %] -
+ [% END # /WRAPPER tabs#subscription_years %]
[% END # /IF years %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-search.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-search.tt index dc43ca6544..603e897da7 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-search.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-search.tt @@ -310,22 +310,23 @@ [% IF ( done_searched ) %] [% IF ( total ) %] -
- -
+ [% END # /WRAPPER tabs_nav %] + [% WRAPPER tab_panels %] [% IF mana %] -
+ [% WRAPPER tab_panel tabname="mana" bt_active= 1 %] [% INCLUDE 'mana/mana-subscription-search-result.inc' %] -
+ [% END # /WRAPPER tab_panel#mana %] [% ELSE %] -
+ [% WRAPPER tab_panel tabname="opened" bt_active= 1 %] [% IF openedsubscriptions %] [% INCLUDE subscriptions_table subscriptions = openedsubscriptions %] [% ELSE %] @@ -333,8 +334,8 @@

Your search returned no open subscriptions.

[% END %] -
-
+ [% END # /WRAPPER tab_panel#opened %] + [% WRAPPER tab_panel tabname="closed" %] [% IF closedsubscriptions %] [% INCLUDE subscriptions_table subscriptions = closedsubscriptions closed = 1 %] [% ELSE %] @@ -342,10 +343,11 @@

Your search returned no closed subscriptions.

[% END %] -
+ [% END # /WRAPPER tab_panel#closed %] [% END # /IF mana %] - - + [% END # /WRAPPER tab_panels %] + [% END # /WRAPPER tabs#serialstabs %] + [% ELSE %]

Your search returned no results.

@@ -479,7 +481,7 @@ } $(document).ready(function() { - var osrlt = $("#opened table").dataTable($.extend(true, {}, dataTablesDefaults, { + var osrlt = $("#opened_panel table").dataTable($.extend(true, {}, dataTablesDefaults, { "sPaginationType": "full", "order": [[ 2, "asc" ]], "aoColumnDefs": [ @@ -488,7 +490,7 @@ ] })); - var csrlt = $("#closed table").dataTable($.extend(true, {}, dataTablesDefaults, { + var csrlt = $("#closed_panel table").dataTable($.extend(true, {}, dataTablesDefaults, { // FIXME sort function of additional_fields! "order": [[ 2, "asc" ]], "sPaginationType": "full", diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-detail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-detail.tt index 8ddfa5a4a5..8fac9a8cfc 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-detail.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-detail.tt @@ -93,28 +93,19 @@
[% END %] -
- -
-
+ [% END # /WRAPPER tabs_nav %] + + [% WRAPPER tab_panels %] + [% WRAPPER tab_panel tabname="subscription_info" bt_active= 1 %]
@@ -182,9 +173,9 @@
[% END %] -
+ [% END # /WRAPPER#subscription_info %] -
+ [% WRAPPER tab_panel tabname="subscription_planning" %]
@@ -263,71 +254,9 @@
-
+ [% END # /WRAPPER#subscription_planning %] - - -
+ [% WRAPPER tab_panel tabname="subscription_issues" %] @@ -345,44 +274,44 @@ [% IF serialslis.planneddate %] [% serialslis.planneddate | html %] [% ELSE %] - Unknown - [% END %] - - - - - - [% END # /FOREACH serialslist %] -
Issue number - [% IF serialslis.publisheddate %] - [% serialslis.publisheddate | html %] - [% ELSE %] - Unknown - [% END %] - - [% serialslis.publisheddatetext | html %] - - [% IF ( serialslis.status1 ) %]Expected[% END %] - [% IF ( serialslis.status2 ) %]Arrived[% END %] - [% IF ( serialslis.status3 ) %]Late[% END %] - [% IF ( serialslis.status4 ) %]Missing[% END %] - [% IF ( serialslis.status41 ) %]Missing (never received)[% END %] - [% IF ( serialslis.status42 ) %]Missing (sold out)[% END %] - [% IF ( serialslis.status43 ) %]Missing (damaged)[% END %] - [% IF ( serialslis.status44 ) %]Missing (lost)[% END %] - [% IF ( serialslis.status5 ) %]Not issued[% END %] - [% IF ( serialslis.status6 ) %]Delete[% END %] - [% IF ( serialslis.status7 ) %] - Claimed - [% IF ( serialslis.claimdate ) %] - [% serialslis.claimdate | html %] + Unknown [% END %] - [% END %] - [% IF ( serialslis.status8 ) %]Stopped[% END %] -
-
+ + + [% IF serialslis.publisheddate %] + [% serialslis.publisheddate | html %] + [% ELSE %] + Unknown + [% END %] + + + [% serialslis.publisheddatetext | html %] + + + [% IF ( serialslis.status1 ) %]Expected[% END %] + [% IF ( serialslis.status2 ) %]Arrived[% END %] + [% IF ( serialslis.status3 ) %]Late[% END %] + [% IF ( serialslis.status4 ) %]Missing[% END %] + [% IF ( serialslis.status41 ) %]Missing (never received)[% END %] + [% IF ( serialslis.status42 ) %]Missing (sold out)[% END %] + [% IF ( serialslis.status43 ) %]Missing (damaged)[% END %] + [% IF ( serialslis.status44 ) %]Missing (lost)[% END %] + [% IF ( serialslis.status5 ) %]Not issued[% END %] + [% IF ( serialslis.status6 ) %]Delete[% END %] + [% IF ( serialslis.status7 ) %] + Claimed + [% IF ( serialslis.claimdate ) %] + [% serialslis.claimdate | html %] + [% END %] + [% END %] + [% IF ( serialslis.status8 ) %]Stopped[% END %] + + + [% END # /FOREACH serialslist %] + + [% END # /WRAPPER#subscription_issues %] -
+ [% WRAPPER tab_panel tabname="subscription_summary" %]
@@ -401,10 +330,10 @@
-
+ [% END # /WRAPPER#subscription_summary %] [% IF orders_grouped.size %] -
+ [% WRAPPER tab_panel tabname="acquisition_details" %]

Acquisition details

[%# ordernumber %] - - - - [%# internalnote %] - [%# vendornote %] - [%# fund %] - - - - - [% FOR order IN parent_order.orders %] - - - [%# basket %] - - - - [% SWITCH order.orderstatus %] - [% CASE 'new' %] - - - - - + [%# ordernumber %] + + + [%# internalnote %] + [%# vendornote %] + [%# fund %] + + + - [% END # /FOR order %] - [% END # /FOR ordernumber %] - -
@@ -441,76 +370,76 @@ [% IF CAN_user_acquisition_order_manage %] [% parent_order.basket.basketname | html %] ([% parent_order.basket.basketno | html %]) [% ELSE %] - [% parent_order.basket.basketname | html %] ([% parent_order.basket.basketno | html %]) - [% END %] - -
[% parent_order.basket.creationdate | $KohaDates %][% parent_order.datereceived | $KohaDates %] - [% SWITCH parent_order.orderstatus %] - [% CASE 'new' %]New - [% CASE 'ordered' %]Ordered - [% CASE 'partial' %]Partial - [% CASE 'complete' %]Complete - [% CASE 'cancelled' %]Cancelled - [% END %] - [% parent_order.quantity | html %][% parent_order.ecost_tax_excluded | $Price %] / [% parent_order.ecost_tax_included | $Price %][% parent_order.unitprice_tax_excluded | $Price %] / [% parent_order.unitprice_tax_included | $Price %]
- [% IF order.invoice %] - [% IF CAN_user_acquisition %] - - [% order.invoice.invoicenumber | html %] - [% ELSE %] - [% order.invoice.invoicenumber | html %] - [% END %] - [% END %] - [% order.ordernumber | html %][% order.basket.creationdate | $KohaDates%][% order.datereceived | $KohaDates %]New - [% CASE 'ordered' %]Ordered - [% CASE 'partial' %]Partial - [% CASE 'complete' %]Complete - [% CASE 'cancelled' %]Cancelled - [% END %] - [% order.order_internalnote | html %][% order.order_vendornote | html %][% order.fund.budget_name | html %][% order.quantity | html %] - [% UNLESS order.datereceived %] - [% order.ecost_tax_excluded * order.quantity | $Price %] / [% order.ecost_tax_included * order.quantity | $Price %] + [% parent_order.basket.basketname | html %] ([% parent_order.basket.basketno | html %]) [% END %] [% parent_order.basket.creationdate | $KohaDates %][% parent_order.datereceived | $KohaDates %] - [% IF order.datereceived %] - [%# FIXME What if unitprice has not been filled? %] - [% order.unitprice_tax_excluded * order.quantity | $Price %] / [% order.unitprice_tax_included * order.quantity | $Price %] + [% SWITCH parent_order.orderstatus %] + [% CASE 'new' %]New + [% CASE 'ordered' %]Ordered + [% CASE 'partial' %]Partial + [% CASE 'complete' %]Complete + [% CASE 'cancelled' %]Cancelled [% END %] [% parent_order.quantity | html %][% parent_order.ecost_tax_excluded | $Price %] / [% parent_order.ecost_tax_included | $Price %][% parent_order.unitprice_tax_excluded | $Price %] / [% parent_order.unitprice_tax_included | $Price %]
-
- [% END # IF orders_grouped.size %] -
-
+ [% FOR order IN parent_order.orders %] + + + [% IF order.invoice %] + [% IF CAN_user_acquisition %] + + [% order.invoice.invoicenumber | html %] + [% ELSE %] + [% order.invoice.invoicenumber | html %] + [% END %] + [% END %] + + [%# basket %] + [% order.ordernumber | html %] + [% order.basket.creationdate | $KohaDates%] + [% order.datereceived | $KohaDates %] + [% SWITCH order.orderstatus %] + [% CASE 'new' %]New + [% CASE 'ordered' %]Ordered + [% CASE 'partial' %]Partial + [% CASE 'complete' %]Complete + [% CASE 'cancelled' %]Cancelled + [% END %] + + [% order.order_internalnote | html %] + [% order.order_vendornote | html %] + [% order.fund.budget_name | html %] + [% order.quantity | html %] + + [% UNLESS order.datereceived %] + [% order.ecost_tax_excluded * order.quantity | $Price %] / [% order.ecost_tax_included * order.quantity | $Price %] + [% END %] + + + [% IF order.datereceived %] + [%# FIXME What if unitprice has not been filled? %] + [% order.unitprice_tax_excluded * order.quantity | $Price %] / [% order.unitprice_tax_included * order.quantity | $Price %] + [% END %] + + + [% END # /FOR order %] + [% END # /FOR ordernumber %] + + + [% END # /WRAPPER tab_panel#acquisition_details %] + [% END # IF orders_grouped.size %] + [% END # /WRAPPER tab_panels %] + [% END # /WRAPPER tabs#subscription_description %]
-- 2.39.5