Commit graph

9 commits

Author SHA1 Message Date
9d6d641d1f Bug 17600: Standardize our EXPORT_OK
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>
2021-07-16 08:58:47 +02:00
14d843f5f4 Bug 24695: (QA follow-up) Fix POD
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-04-12 15:27:50 +02:00
48ac552699 Bug 24695: Move to Koha::Report->is_sql_valid
Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-04-12 15:27:50 +02:00
5d459283e8 Bug 27380: Add missing use statement
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-02-16 10:22:13 +01:00
45ec6ba3a4 Bug 27380: Move get_prepped_report to object and use for svc/reports
This patch moves get_prepped_report to Koha:Report->prep_report
and adds some basic tests

To test:
1 - Using the report created in last test, hit the report svc api like:
http://localhost:8081/cgi-bin/koha/svc/report?id=6&param_name=One&sql_params=One&param_name=Listy|list&sql_params=2345%0D%0A423%0D%0A3%0D%0A2%0D%0A12
2 - Note the use of %0D%0A to separate list params
3 - Test with combinations with and without param_name specified
http://localhost:8081/cgi-bin/koha/svc/report?id=6&sql_params=5&sql_params=2345%0D%0A423%0D%0A3%0D%0A2%0D%0A12

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

JD Amended patch: Perltidy prep_report

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-02-12 12:29:56 +01:00
7d8b96803f
Bug 24545: Fix license statements
Bug 9978 should have fixed them all, but some were missing.
We want all the license statements part of Koha to be identical, and
using the GPLv3 statement.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-02-24 13:31:26 +00:00
Baptiste Wojtkowski
cb01b25330 Bug 17047: SQL reports management with Mana-KB
Includes:

* code factorization
Some code from subscription & Mana-KB has been factorized in order to speed-up next developments

* SytemPreferences:
Mana Activation:
    - add a value "no, let me think about it", that is the default value.
    - as long as this value is selected, messages ask if user want to activate it ( in Administration and Add-subscription(page 2) )
AutoShareWithMana
    - Add the syspref AutoShareWithMana: user can automatically share infos with Mana-KB (not set by default)

* Interface :
    - On mana-search, rows are now sorted by date of last import, then by number of users
    - Windows redesigned to improve the user experience

* New Feature : report a mistake.
    - people can now report an invalid data (wrong, obsolete,...)
    - if a data is reported as invalid many time, it will appear differently
    - Added few tooltip (to explain the fields last import, nb of users, to explain the new feature)
    - When reporting a data as invalid, a comment can also be added. Koha will then display comments related to data in result lists

* API (svc/mana)
    - add svc/mana/addvaluetofield: allows to ask mana incrementing a field of a resource
    - no hardcoding for resources in the code of api (api needs to be called with a ressourcename)

* New feature : SQL report sharing
    - Create Koha::Report.pm and Koha::Reports.pm, objects class for Reports
    - New feature: share reports with Mana-KB
    - New feature: search report in Mana-KB with keywords
    - New feature: load reports from Mana-KB

Test plan:
    1 - Apply Patch + update database
    2 - Copy the three lines about mana config in etc/koha-conf.xml in ../etc/koha-conf.xml (after <backupdir> for example)
        <!-- URL of the mana KB server -->
        <!-- alternative value http://mana-test.koha-community.org to query the test server -->
        <mana_config>https://mana-kb.koha-community.org</mana_config>
    3 - Check Mana syspref and AutoShareWithMana syspref are not activated
    4 - Search the syspref ManaToken and follow the instructions
    5 - subscriptions
      - Try create a new subscription for a first serial  => Mana-KB shouldn't show you anything (except if the base hase been filled)
      - Share this serial with Mana-KB (on the serial individual's page there must be a Share button)
      - Try to create a new subscription for serial nr1 => a message should appear when you click on "next", click on "use", the fields should automaticaly appear
      - Activate AutoShareWithMana => Subscriptions
      - Create a new subscription for a second serial
      - There shouldn't be any Share button
      - Create a second subscription => the message should appear, click again on use

    6 - SQL Report
      - Create a new SQL report, without notes.
      - On the table with all report (reports > use saved), there should be the action "Share"
      - If you click on share, you have an error message
      - Create a new report, with a title and notes longer than 20 characters
      - You  can share it with mana => you will have a success message
      - On (report > use saved), there must be a message inviting you to search on Mana-KB for more results, enter a few word from title, notes, type of  the report you shared, it should appear. You can use it, it will load it into your report list.

    7 - Report mistakes.
      - On any table containing Mana-KB search results, you can report a mistake and add a comment.

    8 - For each previous test, try to send wrong data, to delete the security token, to send nothing: it should show a correct warning message.

Signed-off-by: Brendan A Gallagher <brendan@bywatersolutions.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Rebased-by: Alex Arnaud <alex.arnaud@biblibre.com> (2018-07-04)
Signed-off-by: Michal Denar <black23@gmail.com>

Signed-off-by: Michal Denar <black23@gmail.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2019-01-23 14:39:26 +00:00
769ae66d5e Bug 20052: (follow-up) Fix QA tool complaints and bad copy
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2018-04-02 18:08:06 -03:00
7b1dc1b608 Bug 20052: Add Koha Reports object class
To test:
prove -v t/db_dependent/Koha/Reports.t

Signed-off-by: Claire Gravely <claire.gravely@bsz-bw.de>
Signed-off-by: Maksim Sen <maksim.sen@inlibro.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2018-04-02 18:08:06 -03:00