From e070f974f53d78b572b5d3d1087cc7d810d82e35 Mon Sep 17 00:00:00 2001 From: Blou Date: Fri, 27 Sep 2013 13:42:31 -0400 Subject: [PATCH] Bug 10951 - Adding NoLoginInstructions to system preferences On a failed login, the default message is harcorded into opac-auth.tt. It would be preferable to allow for a preference to override that message (for example: ...Please bring an ID to the front desk located on 3rd floor...) The changes modify -opac-auth.tt to allow for custom value -admin/preferences/opac.pref to add it to the preferences with a description -C4/Auth.pm for the loading of the preference -sysprefs.sql -updatedatabase.pl TESTING 1) in OPAC, logged out, try login in by entering no or wrong credentials. Acknowledge the "Don't have a password yet?" message 2) Apply the patch 3) Regression Test: Redo step 1. Same (default) message should appear. 4) Log in to intranet, - select NoLoginInstructions in system preferences. - Enter new (xml) message. Possible:
Welcome to Koha, please bring your passport to the front office
- and save 5) refresh the OPAC, try login again with invalid credentials. The new message should appear. --- C4/Auth.pm | 1 + installer/data/mysql/sysprefs.sql | 3 ++- installer/data/mysql/updatedatabase.pl | 8 ++++++++ .../prog/en/modules/admin/preferences/opac.pref | 5 +++++ koha-tmpl/opac-tmpl/prog/en/modules/opac-auth.tt | 10 ++++++++-- 5 files changed, 24 insertions(+), 3 deletions(-) diff --git a/C4/Auth.pm b/C4/Auth.pm index 1e17e59..ca386c6 100644 --- a/C4/Auth.pm +++ b/C4/Auth.pm @@ -1020,6 +1020,7 @@ sub checkauth { PatronSelfRegistrationDefaultCategory => C4::Context->preference("PatronSelfRegistrationDefaultCategory"), persona => C4::Context->preference("Persona"), opac_css_override => $ENV{'OPAC_CSS_OVERRIDE'}, + NoLoginInstructions => C4::Context->preference("NoLoginInstructions"), ); $template->param( OpacPublic => C4::Context->preference("OpacPublic")); diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index 4b0f364..fb6b57f 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -418,5 +418,6 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('XSLTResultsDisplay','default','','Enable XSL stylesheet control over results page display on intranet','Free'), ('yuipath','local','local|http://yui.yahooapis.com/2.5.1/build','Insert the path to YUI libraries, choose local if you use koha offline','Choice'), ('z3950AuthorAuthFields','701,702,700',NULL,'Define the MARC biblio fields for Personal Name Authorities to fill biblio.author','free'), -('z3950NormalizeAuthor','0','','If ON, Personal Name Authorities will replace authors in biblio.author','YesNo') +('z3950NormalizeAuthor','0','','If ON, Personal Name Authorities will replace authors in biblio.author','YesNo'), +('NoLoginInstructions', '
Don\'t have a password yet?

If you don\'t have a password yet, stop by the circulation desk the next time you\'re in the library. We\'ll happily set one up for you.

Don\'t have a library card?

If you don\'t have a library card, stop by your local library to sign up.

', '60|10', 'Instructions when a person is not connected', 'Textarea') ; diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index a37ea02..851ecd5 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -7155,6 +7155,14 @@ if ( CheckVersion($DBversion) ) { SetVersion($DBversion); } +$DBversion ="3.13.00.XXX"; +if ( CheckVersion($DBversion) ) { + $dbh->do("INSERT IGNORE INTO systempreferences (variable,value,options,explanation,type) + VALUES ('NoLoginInstructions', '
Don't have a password yet?

If you don't have a password yet, stop by the circulation desk the next time you're in the library. We'll happily set one up for you.

Don't have a library card?

If you don't have a library card, stop by your local library to sign up.

', '60|10', 'Instructions when a person is not connected', 'Textarea')"); + print "Upgrade to $DBversion done (Bug 10951: Add NoLoginInstructions pref)\n"; + SetVersion($DBversion); +} + =head1 FUNCTIONS =head2 TableExists($table) 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 a75c7ef..317bb91 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 @@ -280,6 +280,11 @@ OPAC: homebranch: 'home library' holdingbranch: 'holding library' - "is the logged in user's library. The second tab will contain all other items." + - + - "Show the following HTML when a person is not connected:" + - pref: NoLoginInstructions + type: textarea + class: code Features: - - pref: opacuserlogin diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-auth.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-auth.tt index 7b8b8f9..a83c8e0 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-auth.tt +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-auth.tt @@ -86,8 +86,14 @@ please choose against which one you would like to authenticate:

-
Don't have a password yet?

If you don't have a password yet, stop by the circulation desk the next time you're in the library. We'll happily set one up for you.

-
Don't have a library card?

If you don't have a library card, stop by your local library to sign up[% IF PatronSelfRegistration && PatronSelfRegistrationDefaultCategory %] or register here[% END %].

+[% IF NoLoginInstructions %] [% NoLoginInstructions %] +[% ELSE %] +
Don't have a password yet?
+

If you don't have a password yet, stop by the circulation desk the next time you're in the library. We'll happily set one up for you.

+
Don't have a library card?
+ If you don't have a library card, stop by your local library to sign up +[% END %] +[% IF PatronSelfRegistration && PatronSelfRegistrationDefaultCategory %] or register here[% END %].
-- 1.7.10.4