Bug 12187

Summary: Duplicate TT code for serial statuses
Product: Koha Reporter: paxed <pasi.kallinen>
Component: TemplatesAssignee: paxed <pasi.kallinen>
Status: RESOLVED DUPLICATE QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: david, jonathan.druart, severine.queune
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Attachments: Bug 12187: Duplicate TT code for serial statuses
Bug 12187: Duplicate TT code for serial statuses
Bug 12187: (follow-up) Reindent new include file
Bug 12187: Duplicate TT code for serial statuses
Bug 12187: (follow-up) Reindent new include file

Description paxed 2014-05-05 10:44:22 UTC
[% IF ( latestserial.status1 ) %]Expected[% END %]
                    [% IF ( latestserial.status2 ) %]Arrived[% END %]
                    [% IF ( latestserial.status3 ) %]Late[% END %]
                    ...


These statements are repeated multiple times, in the following files:

intranet-tmpl/prog/en/modules/catalogue/detail.tt
intranet-tmpl/prog/en/modules/serials/serial-issues-full.tt
intranet-tmpl/prog/en/modules/serials/claims.tt
intranet-tmpl/prog/en/modules/serials/serials-recieve.tt
intranet-tmpl/prog/en/modules/serials/serials-collection.tt
intranet-tmpl/prog/en/modules/serials/serials-edit.tt
intranet-tmpl/prog/en/modules/serials/subscription-detail.tt
opac-tmpl/prog/en/modules/opac-full-serial-issues.tt
opac-tmpl/prog/en/modules/opac-detail.tt


To prevent things from getting out of sync, they should be folded into a single TT block or macro.
Comment 1 paxed 2018-08-27 07:59:53 UTC Comment hidden (obsolete)
Comment 2 Séverine Queune 2019-10-29 10:34:16 UTC
Hi Pasi,

I'm used to serials features and can esily test the different pages, but I don't have any idea about the differences in using .pl or .tt pages...
Can you enlighten me about the different points or behaviours I need to pay attention ?
Or do I just work as usual on the pages you mentioned and check there are no issues ?

Thanks !
Séverine
Comment 3 David Nind 2020-02-08 01:28:07 UTC
Patch no longer applies 8-(
Comment 4 Bernardo Gonzalez Kriegel 2020-02-14 15:57:10 UTC Comment hidden (obsolete)
Comment 5 David Nind 2020-02-14 19:47:00 UTC
Thanks Bernardo!

I don't know anything about serials, so will wait for a test plan.
Comment 6 Owen Leonard 2020-03-25 17:47:53 UTC Comment hidden (obsolete)
Comment 7 David Nind 2020-03-29 07:37:42 UTC
Created attachment 102047 [details] [review]
Bug 12187: Duplicate TT code for serial statuses

Instead of duplicating the code for serial statuses in multiple
files, move all of them into single include file, and use that.

Needs a test plan, but I haven't used serials.

Rebased

Signed-off-by: David Nind <david@davidnind.com>
Comment 8 David Nind 2020-03-29 07:37:45 UTC
Created attachment 102048 [details] [review]
Bug 12187: (follow-up) Reindent new include file

This patch re-indents the new include file so that it is consistent with
coding guidelines. Taking this opportunity to add a full test plan:

Instead of duplicating the code for serial statuses in multiple
files, move all of them into single include file, and use that.

To test, apply the patch and go to Serials.

 - Search for a subscription which has multiple issues.
   - On the subscription detail page, open the "Issues" tab.
     - Statuses in the "Status" column should display correctly.
   - Click the "Serial collection" link in the sidebar.
     - In the table of issues, the "Status" colunn should display the
       correct information.
   - Select some isues and click the "Edit serials" button.
     - In the "Status" column, the options should display correctly.
     - Test setting various statuses and saving. The statuses should
       save correctly.
   - Click "Claims" in the sidebar menu and select a vendor.
     - In the list of missing issues the "Status" column should show the
       correct information.
  - In the catalog, locate the bibliographic record for a subscription
    with issues.
    - Under the "Subscriptions" tab check the "Status" column. Status
      information should be displayed correctly.

Signed-off-by: David Nind <david@davidnind.com>
Comment 9 Jonathan Druart 2020-03-31 10:18:35 UTC
Hi Pasi,
That's great!
I would recommend 2 things:
1. Add a comment at the top of the include file to add a bit of doc
2. Replace HideStatuses with an array:
  HideStatuses=[1,8]
Then use grep in the include file

What do you think?
Keep in mind that we use snake_case instead of CamelCase for var names.
Comment 10 Katrin Fischer 2023-07-15 19:18:01 UTC
Bug 32752 resolved this I think. :)

*** This bug has been marked as a duplicate of bug 32752 ***