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>
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>
This patch modifies the way data is passed to the staged MARC record
management template, splitting author, ISBN, and ISSN out of the
"citation" variable and passing them separately.
The DataTables configuration for the staged MARC record management page
is modified so that those now-separate variables are conditionally
displayed.
Unrelated minor change: Added a class to the MARC preview modal so that
it displays wider.
To test, apply the patch and view the "Staged MARC management" page for
both batches of bibliographic records and batches of authority records.
In each case the title or authority heading should be displayed as a
link while author, ISBN, and ISSN (if any) should not.
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
To test:
1 - Have or make some authority records
2 - Have or make an authority matching rule
3 - Export your authrotities
4 - Import them using the matching rule
5 - On the 'Manage staged records' page view some diffs
6 - The import record is correct, but the existing records pull form
bibs
7 - Apply patch
8 - Repeat
9 - Confirm you see the expected authority matches
Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Marjorie Vila <marjorie.barry-vila@collecto.ca>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
TEST PLAN
---------
1) Run the following on a kohadevbox:
git checkout -b bug_19937 origin/master
sudo koha-shell -c bash kohadev
prove t/db_dependent/www/batch.t
cat /var/log/koha/kohadev/plack-error.log
The following errors are triggered at the end of the log file:
Use of uninitialized value in array element at
/home/vagrant/kohaclone/tools/batch_records_ajax.pl line 50.
Use of uninitialized value $results_per_page in numeric eq (==) at
/home/vagrant/kohaclone/tools/batch_records_ajax.pl line 53.
Use of uninitialized value in uc at
/home/vagrant/kohaclone/C4/ImportBatch.pm line 1120.
2) Run the following on a kohadevbox:
exit
git bz apply 19937
restart_all
sudo koha-shell -c bash kohadev
prove t/db_dependent/www/batch.t
cat /var/log/koha/kohadev/plack-error.log
The log file will end with the restarting of plack, not the
errors.
3) run koha qa test tools
Signed-off-by: Lee Jamison <ldjamison@marywood.edu>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Amended handling of $results_per_page.
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This follow up makes some corrections to the previously added files and
adds some functionality to the diff: A Javascript diff plugin highlights
the differences between the records in the two columns.
Corrections made: Converted tab indentation to spaces, corrected GPL
statement.
File organization: Moved showdiffmarc.pl and .tt to /tools/ to match the
location of the page with which it functions,
tools/manage-marc-import.pl. Corrected permissions on showdiffmarc.pl
accordingly.
Updates to the template: Added standard includes inclucing header menu
and breadcrumbs; converted custom layout to YUI Grid standard.
To test, follow the test plan previously defined:
- Stage a MARC record batch which contains at least one record match for
something already in your catalog.
- Locate the staged MARC record batch in Tools -> Manage staged records
and click to view the contents.
- Find the record which matched an existing record and click the "View"
link in the Diff column.
- The compare screen should include the header menu and breadcrumbs. The
differences between your staged file and the existing record should be
higlighted.
- You should be able to return to the MARC batch you were previously
viewing by following the link in the breadcrumbs or the link at the
bottom of the page.
- Confirm that the "About" page includes information about the new
JavaScript plugin on the Licenses tab.
Signed-off-by: Nick Clemens <nick@quecheelibrary.org>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
New patch should apply correctly.
modified: C4/ImportBatch.pm
modified: koha-tmpl/intranet-tmpl/prog/en/modules/tools/manage-marc-import.tt
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Bug 11876 - Diff column is now displayed.
If a match is found, a 'View' link appears in the Diff column.
Old patch was not implementing datatables, and therefore was not compatible with this version of Koha.
modified: koha-tmpl/intranet-tmpl/prog/en/modules/tools/manage-marc-import.tt
modified: tools/batch_records_ajax.pl
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
These patches have some issues but I'm going to submit a follow-up which
I think will address them all and offer some improvements as well.
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
This patch addresses a number of issues with the main patch:
- regression on bug 2060 (i.e., displaying authority import batches
correctly)
- regression on bug 10170 (translation of import record states)A
- use of datatables.inc
- lack of clarity as to the licensing of tools/batch_records_ajax.pl
- insufficent sanitizing of input used to generate an SQL statement
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Some libraries would like to sort by columns for the records of an
import batch. This seems like a good use of Ajax DataTables.
Test plan:
1) Apply this patch
2) Import a record batch into Koha
a) Use some form of matching
b) Have some records that will match and some that won't
c) Have at least 30 records so you can test the pager
3) Verify the new table is functionally equivalent to the old static one
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Tests fine and looks good with the exception of the corrections I put in
a follow-up.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>