Bug 34018 - Patron image upload silently fails without cardnumber
Summary: Patron image upload silently fails without cardnumber
Status: NEW
Alias: None
Product: Koha
Classification: Unclassified
Component: Tools (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: Bugs List
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-06-15 06:47 UTC by David Cook
Modified: 2023-11-16 05:15 UTC (History)
0 users

See Also:
Change sponsored?: ---
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 David Cook 2023-06-15 06:47:20 UTC
If a borrower doesn't have a cardnumber, you can't upload a patron image via the Patrons module.

I realize this is because it leverages the /cgi-bin/koha/tools/picture-upload.pl tool which requires a file including cardnumbers or prompts for a cardnumber, but you should be able to use borrowernumber instead - at least via the Patron module.

--

The way to do this would be to refactor tools/picture-upload.pl to use a Perl module, and then create a REST API endpoint for uploading the patron image.
Comment 1 David Cook 2023-06-15 06:52:16 UTC
I suppose there are some minor changes that could be made that could get it over the line...
Comment 2 David Cook 2023-11-16 04:49:40 UTC
(In reply to David Cook from comment #1)
> I suppose there are some minor changes that could be made that could get it
> over the line...

Actually, I don't think so. I don't know what I was thinking back in June when I wrote this comment.

While http://localhost:8081/cgi-bin/koha/members/moremember.pl does pass a borrowernumber, the handle_dir and handle_file functions are hard-coded to only accept cardnumber. 

Any change to just use borrowernumber would need to be tested, but then ./tools/picture-upload.pl isn't currently unit tested.

But to unit test it you'd need to rewrite ./tools/picture-upload.pl, so it's just going to be too much work for too little gain.

The workaround here is to just use a temporary dummy cardnumber for a patron when uploading a patron image.
Comment 3 David Cook 2023-11-16 05:15:21 UTC
I've raised bug 35344 which warns if the patron is missing the cardnumber and prevents an attempt at uploading the patron image.

I think that's the most I'm going to do on this one without sponsorship. 

Going to change this from a bug to an enhancement...