[Koha-bugs] [Bug 12598] New misc/import_borrowers.pl command line tool

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Sat May 14 05:44:47 CEST 2016


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=12598

--- Comment #106 from Florent Mara <florent.mara at gmail.com> ---
(Thank you Bernardo for the advice on trying to progress this) 

Here are the changes introduces in each of the 6 patches:
Patch 1 - Replace deprecated C4::Dates with Koha::DateUtils and backport fix
from master for entries with empty userids. This fix is deprecated in my last
commit due to bug 16426.

Patch 2 - Add missing dependency C4::Members::Attributes and some pod. Add the
first regression tests - none were present previously - with basic tests for
empty parameters variables and valid input file. 

Patch 3 - Introduced Moo. Refactored setting of column keys, missing borrower
category code and missing borrower branch code into 3 new methods. Features are
identical as prior. Each method is 100% test covered with subtests. 

Patch 4 - Update misc/import_patrons.pl and tools/import_borrowers.pl to use
Koha::Patrons::Import in an object oriented way.

Patch 5 - Adds missing dependency C4::Members::AttributeTypes. Refactor setting
attributes types, prepare columns and dates formatting into 3 new methods.
Features for attributes type and prepare column are identical. 

Date formatting was changes as follows after discussion with Chris.
* The previous implementation let parsing of dates silently failed then be
overwritten with system default values during import as the error was push to
@missing_criticals after this array was last considered. 
* The new implementation formats dates and uses @missing_criticals before it is
used to bail out of importing the entry. 

Each new method is 100% test covered with subtests. 

Patch 6 - Backport changes from bug 16426 and fixes the defect it introduces.
As per my comment in 16426, the fix was introduced at the wrong place in the
code which caused it to never be reached and prevents checks on duplicate
userid . 

Test plan:
1) Apply this patch. 
2) Set dateformat to mm/dd/yyyy. (Koha home->Administration->search for
dateformat -> select and save) 
3) run 'prove t/db_dependent/Koha/Patrons/Import.t'. All 122 tests should pass. 
These regression tests validate (1) Koha::Patrons::Import compiles, (2) all
fields output from the main import() method are identical before and after
refactoring (equivalence of output), (3) all 6 new methods provide the expected
feature, (4) backport duplicate userid fix. 
4) Run the online importer ( Koha home->tools->Import patrons) Load
PatronDataCSV1.csv sample file with default import parameters. It should result
in 165 imported records and 835 not imported because they are not in the
expected format.
This step validates that (1) tools/import_borrowers.pl works as previously and
wrongly formatted dates are now correctly being reported as such. 
5) Set dateformat to dd/mm/yyyy.
6) Run the new command line importer 'perl misc/import_patrons.pl -f
PatronDataCSV1.csv -c -m 'cardnumber' -v'
It should load the remaining 835 entries from the sample file.
Import complete:
Imported:    835
Overwritten: 0
Skipped:     0
Invalid:     165
Total:       1000
This step validates the new command line tool misc/import_patrons works and
confirm date validation is effective.

While this is a big patch, it contains only one feature change to fix dates
being silently overwritten and is coming with a large number of tests with
extensive test coverage for all changes made. It also contains a regression
tested fix for bug 16426.

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list