From b2a7517259f73ffe54562bdc9bebef5e724feb0e Mon Sep 17 00:00:00 2001 From: Paul Derscheid Date: Thu, 17 Aug 2023 14:48:33 +0000 Subject: [PATCH] Bug 33766: (follow-up) Fix ambiguous "Login" field This follow-up fixes some problems w/ the unconventional parts of the first commit. We now use conditionals in a BLOCK to map the selected value from the preference to string representations which should now be easily translatable. To test: - Check that the label for - The masthead inc - The opac-auth template - The opac-main template - The opac-password-recovery template - The opac-registration-confirmation template - The opac-reset-password template - The sco-main template reflect the changes you made to the syspref Signed-off-by: Matt Blenkinsop Signed-off-by: Owen Leonard --- ...-a11y_fix_ambiguous_form-field_in_opac-auth.tt.pl} | 2 +- installer/data/mysql/mandatory/sysprefs.sql | 2 +- .../prog/en/modules/admin/preferences/opac.pref | 7 +++---- .../opac-tmpl/bootstrap/en/includes/html_helpers.inc | 11 +++++++++++ .../opac-tmpl/bootstrap/en/includes/masthead.inc | 2 +- koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-auth.tt | 2 +- koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-main.tt | 2 +- .../bootstrap/en/modules/opac-password-recovery.tt | 3 ++- .../en/modules/opac-registration-confirmation.tt | 3 ++- .../bootstrap/en/modules/opac-reset-password.tt | 2 +- .../opac-tmpl/bootstrap/en/modules/sco/sco-main.tt | 5 ++--- 11 files changed, 26 insertions(+), 15 deletions(-) rename installer/data/mysql/atomicupdate/{bug_33766-a11y_fix_ambiguous_form-field_in_opac-auth.tt => bug_33766-a11y_fix_ambiguous_form-field_in_opac-auth.tt.pl} (89%) diff --git a/installer/data/mysql/atomicupdate/bug_33766-a11y_fix_ambiguous_form-field_in_opac-auth.tt b/installer/data/mysql/atomicupdate/bug_33766-a11y_fix_ambiguous_form-field_in_opac-auth.tt.pl similarity index 89% rename from installer/data/mysql/atomicupdate/bug_33766-a11y_fix_ambiguous_form-field_in_opac-auth.tt rename to installer/data/mysql/atomicupdate/bug_33766-a11y_fix_ambiguous_form-field_in_opac-auth.tt.pl index 3bb5322875..290103bd97 100755 --- a/installer/data/mysql/atomicupdate/bug_33766-a11y_fix_ambiguous_form-field_in_opac-auth.tt +++ b/installer/data/mysql/atomicupdate/bug_33766-a11y_fix_ambiguous_form-field_in_opac-auth.tt.pl @@ -9,7 +9,7 @@ return { # Do you stuffs here $dbh->do( - q{INSERT IGNORE INTO systempreferences (variable,value) VALUES ('OPACLoginLabelTextContent','Cardnumber') } + q{INSERT IGNORE INTO systempreferences (variable,value) VALUES ('OPACLoginLabelTextContent','cardnumber') } ); # sysprefs diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql index e3264ecf45..55de86ef05 100644 --- a/installer/data/mysql/mandatory/sysprefs.sql +++ b/installer/data/mysql/mandatory/sysprefs.sql @@ -489,7 +489,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('OPACLocalCoverImages','0','1','Display local cover images on OPAC search and details pages.','YesNo'), ('OpacLocationBranchToDisplay','holding','holding|home|both','In the OPAC, under location show which branch for Location in the record details.','Choice'), ('OpacLocationOnDetail','holding','holding|home|both|column','In the OPAC detail, display the shelving location on its own column or under a library columns.', 'Choice'), -('OPACLoginLabelTextContent','Cardnumber',NULL,NULL,NULL), +('OPACLoginLabelTextContent','cardnumber',NULL,NULL,NULL), ('OPACMandatoryHoldDates', '', '|start|end|both', 'Define which hold dates are required on OPAC reserve form', 'Choice'), ('OpacMaintenance','0','','If ON, enables maintenance warning in OPAC','YesNo'), ('OpacMaxItemsToDisplay','50','','Max items to display at the OPAC on a biblio detail','Integer'), diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref index 0f818689b8..957f86d96a 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref @@ -170,9 +170,9 @@ OPAC: - pref: OPACLoginLabelTextContent default: Cardnumber choices: - Cardnumber: Cardnumber - Username: Username - "Cardnumber or Username": Cardnumber or Username + cardnumber: Cardnumber + username: Username + cardnumberorusername: Cardnumber or Username - "as the text content of the userid input field's label." - - pref: OPACShowMusicalInscripts @@ -526,7 +526,6 @@ OPAC: type: textarea syntax: text/html class: code - - - pref: OpacBrowseSearch default: 0 diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/html_helpers.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/html_helpers.inc index b98e31d483..3fe6385b8a 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/html_helpers.inc +++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/html_helpers.inc @@ -168,3 +168,14 @@ [% END %] [% END %] + +[% BLOCK login_label %] + [%- SET preference_value = Koha.Preference('OPACLoginLabelTextContent') %] + [%- SET label = "Cardnumber" %] + [%- IF preference_value == "username" %] + [%- SET label = "Username" %] + [%- ELSIF preference_value == "cardnumberorusername" %] + [%- SET label = "Cardnumber or Username" %] + [%- END %] + +[% END %] diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc index 225ff49fb8..c96e139570 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc +++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc @@ -426,7 +426,7 @@