Bug 41073 - Import users expiry date default does not apply
Summary: Import users expiry date default does not apply
Status: NEW
Alias: None
Product: Koha
Classification: Unclassified
Component: Patrons (show other bugs)
Version: 24.11
Hardware: All All
: P5 - low minor
Assignee: Bugs List
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-10-22 15:59 UTC by Bernard
Modified: 2025-10-24 15:10 UTC (History)
2 users (show)

See Also:
GIT URL: https://github.com/Koha-Community/Koha/commit/f4f77357f63013a21e700f14df82ca9261403310
Initiative type: ---
Sponsorship status: ---
Crowdfunding goal: 0
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Bernard 2025-10-22 15:59:43 UTC
You can no longer set an expiry date into the past. Test file:

userid,cardnumber,branchcode,categorycode,surname
"12345","65432","LONDON","STANDARD","Smith"

1. User should exist and have expiry date in future (say 2099-12-31)
2. Save above as file
3. Tools > Import users 
4. Choose file saved in 2
5. Field to use for record matching: cardnumber
6. In default values set expiration date to a date in past (say 2025-10-19) using date picker
7. Select overwrite the existing one with this
8. Leave renew existing patrons as "use the expiration date in the file if present"
9. Run
10. Observe user expiry date is still 2099-12-31

NB/ Tested in 23.11.10 where the date was correctly set to the default value chosen
Comment 1 Bernard 2025-10-24 15:10:35 UTC
I think the problem occurs in Koha/Patrons/Import.pm at line 295-6

$borrower{$col} = $member->{$col}
                    if $col eq 'dateexpiry' && ( !$csvkeycol{$col} || !$columns[ $csvkeycol{$col} ] );

The above evaluates to TRUE and resets the expiry date to its database value rather than the default that was set previously and has persisted until here. Hence it is not modified as requested.

Note other default values (eg City) work fine.