Bug 22123 - Hardcoded values in subfield constraint visibility
Summary: Hardcoded values in subfield constraint visibility
Status: NEW
Alias: None
Product: Koha
Classification: Unclassified
Component: Templates (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Owen Leonard
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-01-14 06:46 UTC by paxed
Modified: 2019-01-16 19:56 UTC (History)
2 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description paxed 2019-01-14 06:46:16 UTC
The MARC subfield constraint editor shows checkboxes for the subfield visibility (OPAC, Intranet, Editor, Collapsed, Flagged). The state of these checkboxes is encoded in the database as a single integer, and the conversion is done in marc_subfields_structure.js via hardcoded magic values:

    if ( flagged_checked ) {
        hidden_value='-8';
    } else if ( opac_checked && ! intranet_checked && ! editor_checked && collapsed_checked ) {
        hidden_value='-7';
    } else if ( opac_checked && intranet_checked && ! editor_checked && ! collapsed_checked) {
        hidden_value='-6';


etc.

These should be moved into the database, perhaps as authorised values.
Comment 1 Katrin Fischer 2019-01-14 06:49:23 UTC
I am not sure about this one - what would be the advantage of moving them into the db? The 3 checkboxes GUI seems like the easiest way to translate this to the user.

For people working with SQL we keep some documentation here:
https://wiki.koha-community.org/wiki/Hidden_values