Bug 34883: Stop patron expiry date being set to NULL during import
authorMatt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Mon, 25 Sep 2023 10:34:18 +0000 (10:34 +0000)
committerTomas Cohen Arazi <tomascohen@theke.io>
Tue, 10 Oct 2023 12:22:33 +0000 (09:22 -0300)
commitf4f77357f63013a21e700f14df82ca9261403310
treeb91994ad85c746857fea18456d1c1a9e52a6ba66
parentf0477dfd36799b1e18b513189eddbdb9ad5164e7
Bug 34883: Stop patron expiry date being set to NULL during import

A regression has been identified whereby an empty field in the dateexpiry field in a patron import file will cause the patron's expiry date to be set to NULL. This patch addresses this by checking for an empty field and using the existing expiry date if one is found.

Test plan:
1) Setup a csv with column headers:
    surname firstname branchcode categorycode cardnumber dateenrolled dateexpiry
2) Add values:
    Acosta Edna CPL PT 23529001000463 02/01/2013
3) Leave the dateexpiry column blank
4) Check Edna and make a note of her patron expiry date
5) Run the import_patrons.pl script with the following flags:
    a) --file <filepath_for_your_csv_file>
    b) --matchpoint cardnumber
    c) --confirm
    d) --overwrite
6) Check Edna, note her expiry date is now set to NULL
7) Manually edit Edna's expiry date to be reset to what it was before you ran the script
8) Apply the patch and restart_all
9) Repeat step 5
10) Check Edna, this time her expiry date should be the same as the value you set it to in step 7
11) Sign off!

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Koha/Patrons/Import.pm