On bug 17591 we discovered that there was something weird going on with
the way we export and use subroutines/modules.
This patch tries to standardize our EXPORT to use EXPORT_OK only.
That way we will need to explicitely define the subroutine we want to
use from a module.
This patch is a squashed version of:
Bug 17600: After export.pl
Bug 17600: After perlimport
Bug 17600: Manual changes
Bug 17600: Other manual changes after second perlimports run
Bug 17600: Fix tests
And a lot of other manual changes.
export.pl is a dirty script that can be found on bug 17600.
"perlimport" is:
git clone https://github.com/oalders/App-perlimports.git
cd App-perlimports/
cpanm --installdeps .
export PERL5LIB="$PERL5LIB:/kohadevbox/koha/App-perlimports/lib"
find . \( -name "*.pl" -o -name "*.pm" \) -exec perl App-perlimports/script/perlimports --inplace-edit --no-preserve-unused --filename {} \;
The ideas of this patch are to:
* use EXPORT_OK instead of EXPORT
* perltidy the EXPORT_OK list
* remove '&' before the subroutine names
* remove some uneeded use statements
* explicitely import the subroutines we need within the controllers or
modules
Note that the private subroutines (starting with _) should not be
exported (and not used from outside of the module except from tests).
EXPORT vs EXPORT_OK (from
https://www.thegeekstuff.com/2010/06/perl-exporter-examples/)
"""
Export allows to export the functions and variables of modules to user’s namespace using the standard import method. This way, we don’t need to create the objects for the modules to access it’s members.
@EXPORT and @EXPORT_OK are the two main variables used during export operation.
@EXPORT contains list of symbols (subroutines and variables) of the module to be exported into the caller namespace.
@EXPORT_OK does export of symbols on demand basis.
"""
If this patch caused a conflict with a patch you wrote prior to its
push:
* Make sure you are not reintroducing a "use" statement that has been
removed
* "$subroutine" is not exported by the C4::$MODULE module
means that you need to add the subroutine to the @EXPORT_OK list
* Bareword "$subroutine" not allowed while "strict subs"
means that you didn't imported the subroutine from the module:
- use $MODULE qw( $subroutine list );
You can also use the fully qualified namespace: C4::$MODULE::$subroutine
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Use the UI language for the manual, if exists. Use the pref as a
fallback.
With the call to get_template_and_user the value of preferred_language
switched from 'es' (spanish) to 'en' from one click to another (??)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Test Plan:
Test Plan:
Check the following files have been updated from
use strict;
use warnings;
to
use Modern::Perl;
services/itemrecorddisplay.pl
suggestion/suggestion.pl
tags/list.pl
tags/review.pl
virtualshelves/sendshelf.pl
help.pl
changelanguage.pl
koha_perl_deps.pl
debian/bd-to-depends
debian/build-git-snapshot
debian/list-deps
docs/CAS/CASProxy/examples/koha_webservice.pl
docs/CAS/CASProxy/examples/proxy_cas.pl
docs/CAS/CASProxy/examples/proxy_cas_callback.pl
docs/CAS/CASProxy/examples/proxy_cas_data.pl
Signed-off-by: Jon Knight <J.P.Knight@lboro.ac.uk>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Since the numbering changes, the online doc links are broken.
Test plan:
Make sure the online doc links work on the help pages.
Signed-off-by: Mirko Tietgen <mirko@abunchofthings.net>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
If opaclanguages != language, the language of the help page is the
default one (en).
Test plan:
1/ Set language to en, fr-FR, ar-Arab and opaclanguages to en, fr-FR
2/ Translate the fr-FR and ar-Arab templates.
3/ Go on the mainpage, switch to ar-Arab, go to the help page.
The help page content should be in Arabian, not English.
Signed-off-by: Magnus Enger <magnus@libriotech.no>
Set language = en, sv-SE, nb-NO. opaclanguage = en, nb-NO
Went to the intranet main page, selected Swedish and clicked on help
Without the patch, help was displayed in English
With the patch, help was displayed in Swedish. Yay!
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Chris Nighswonger <cnighswonger@foundations.edu>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
http://bugs.koha-community.org/show_bug.cgi?id=9987
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
This patch uses the version number of the Koha database to
dynamically generate links from help to the appropriate version
of the manual.
Test plan (for 3.15 branch):
- Open a help page
- Verify the manual link is correct (point to 3.14 manual)
- change the version in mysql:
update systempreferences set value="3.1600000" where variable="version";
- Verify the manual link now points to the future 3.16 manual.
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Work as described. No koha-qa errors
Tested on top of Bug 10671
On master (BD version 3.13.xxx) help links point to 3.12 manual
Changing version to 3.14/15 points to 3.14 manual
Changing version to 3.16 points to the future :)
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
As Katrin pointed out, the intranetstylesheet setting was not respected in the
help pages. The script help.pl does not use get_template_and_user which sets
these variables via Auth.pm but calls gettemplate.
This makes it necessary to 'manually' set them. This patch does that.
Evidently, this could be the case for some other templates vars too..
Test plan:
Apply all patches for 10052.
Change intranetstylesheet. Check a help page.
Change intranetcolorstylesheet. Check a help page.
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Looks all good to me now.
Passes tests and still no string changes.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
The problem was probably a side effect of bug 7038
I've checked that things are OK in translated languages.
Test plan:
* open help on a page with help in english (mainpage.pl)
* open help on a page with help in another language (mainpage.pl)
=> you'll see the online help, as usual
* open help on a page without help in english (acqui/addorderiso2709.pl)
* open help on a page without help in another language (acqui/addorderiso2709.pl)
=> you'll get the "oops, no help available, sorry", no more the Perl error
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Passed-QA-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Signed-off-by: Frère Sébastien Marie <semarie-koha@latrappe.fr>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
- verified help pages still work
- verified /cgi-bin/koha/help.pl?url=koha/../catalogue/advsearch.pl does not
show the template file (did work on master, not after applying patch)
- verified cgi-bin/koha/help.pl?url=koha/../../../../../../etc/passwd%00.pl does not work (didn't work on master or after applying patch)
Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
The potential vulnerability would allow anyone to see the content of any .tt file, and .tt only. Was much less critical than the vulnerability for 6629, but it's worth fixing !
When another language than English is selected in pro interface, the software
strings are in this language, but when clicking ?, on the top right of any
page, the contextual help page which pop-up is always in English.
This patch fixes this bug and another side bug affecting editing contextual
help when not in English. help.pl script were in sync with the recently
patched/improved theme/language/template selection.
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Context help now matches the selected template language.
Signed-off-by: Ian Walls <ian.walls@bywatersolutions.com>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
edithelp.pl hadn't been updated to allow help screen editing.
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Only a note: Apparently you need to be 'superlibrarian' permission
to edit help pages.
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Fix help.pl script to deal with Template Toolkit.
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Ian Walls <ian.walls@bywatersolutions.com>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
This updates help.pl to pass the yuipath variable correctly. It also adds some script references to help-top.inc to avoid other js errors.
Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
HTML::Template is no more used, some were remaining,
fixing the "use ...;" to H::T::Pro only
Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
So this implies quite a change for files.
Sorry about conflicts which will be caused.
directory Interface::CGI should now be dropped.
I noticed that many scripts (reports ones, but also some circ/stats.pl or opac-topissues) still use Date::Manip.
On each template, a "HELP" link has been added.
it opens a popup, filled with an help template.
the help template is in the help/ directory.
The help.pl files builds the online help using the name of the caller page (referer).
If the user clic on "help" when on page "admin/itemtypes.pl", the "help/admin/itemtypes.tmpl" is opened.
If the "help/admin/itemtypes.tmpl" does not exists, a default "sorry, no help on this topic" page is shown.
Works fine, but now, the big work has to be done : create the online help pages...