Bug 23246: (follow-up) Hardcoding tab position is not enough
authorTomas Cohen Arazi <tomascohen@theke.io>
Mon, 1 Jul 2019 17:13:15 +0000 (14:13 -0300)
committerLucas Gass <lucas@bywatersolutions.com>
Fri, 20 Dec 2019 15:34:21 +0000 (15:34 +0000)
commit68f549fbb6e4be28c7b73f6b79fa87a1034c2e3a
treef9a8e52924f7665ffd9ab061a8acd725f1cb1af3
parent1de703b509589981be563fd81beab816195782dc
Bug 23246: (follow-up) Hardcoding tab position is not enough

There are many conditions that determine the tab number for 'media'.
Translated into variables that hold the tabs count on each condition, it
is clear that '3' was not good enough:
            [%- holdings      = (SeparateHoldings)   ? 2 : 1
                notes         = (MARCNOTES || notes) ? 1 : 0
                acq           = (Koha.Preference('AcquisitionDetails')) ? 1 : 0
                frbr          = (FRBRizeEditions  && XISBNS) ? 1 : 0
                local_covers  = (LocalCoverImages && (localimages || CAN_user_tools_upload_local_cover_images)) ? 1 : 0
                media_tab     = holdings + notes + acq + frbr + local_covers
            -%]

This patch gets rid of the hardcoded value, adds an id to the 'media'
tab (i.e. 'media_tab') and uses JS to get the right index.

To test:
- Play with the different options governing those variables
=> FAIL: 3 is not always the 'media' tab
- Apply this patch
- Repeat your tests
=> SUCCESS: It always picks the 'media' tab
- Sign off :-D

Sponsored-by: American Numismatics Society
Signed-off-by: Maryse Simard <maryse.simard@inlibro.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
(cherry picked from commit 0e21de15d61999183ea17624465ab0bc1a6c867e)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt