Bug 35344

Summary: Patron image upload does not warn about missing cardnumber
Product: Koha Reporter: David Cook <dcook>
Component: PatronsAssignee: David Cook <dcook>
Status: Pushed to oldstable --- QA Contact: Testopia <testopia>
Severity: minor    
Priority: P5 - low CC: fridolin.somers, gmcharlt, kyle.m.hall, lucas
Version: Main   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=34018
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
24.05.00,23.11.01,23.05.07
Circulation function:
Attachments: Bug 35344: Warn on patron image upload if missing cardnumber
Bug 35344: Warn on patron image upload if missing cardnumber
Bug 35344: Warn on patron image upload if missing cardnumber

Description David Cook 2023-11-16 04:56:03 UTC
As noted in bug 34018, the ./tools/picture-upload.pl silently fails if a patron doesn't have a cardnumber.

It would be better to use the borrowernumber, but that would require rewriting the whole script, which seems like a lot of work for little gain.

Instead, we'll add a warning / prevent upload if the patron doesn't have a cardnumber. That way the staff user can at least know they should add a cardnumber if they want to upload a patron image.
Comment 1 David Cook 2023-11-16 05:13:33 UTC
Created attachment 159019 [details] [review]
Bug 35344: Warn on patron image upload if missing cardnumber

This change displays a warning message instead of the patron image
upload feature in the patron record when the patron is missing the
cardnumber.

Without this change, the staff user can try to upload a patron image
but it will silently fail. This change warns the staff user of the
cardnumber requirement for patron image upload.

Test plan:
0. Apply the patch
1. Enable the "patronimages" system preference
2. Go to http://localhost:8081/cgi-bin/koha/members/moremember.pl?borrowernumber=51
3. Click "Add" over the patron image placeholder
4. Note the "Upload photo" button and the ability to take a patron photo if your
device has a camera
5. Remove "cardnumber" from BorrowerMandatoryField
6. Go to http://localhost:8081/cgi-bin/koha/circ/circulation.pl?borrowernumber=51
7. Edit the patron to remove the cardnumber
8. Click "Add" over the patron image placeholder
9. Note that no patron image upload features appear. Instead, only
a warning appears stating that the patron needs a cardnumber before
the patron image upload can be performed
Comment 2 David Nind 2023-11-24 22:13:16 UTC
Created attachment 159247 [details] [review]
Bug 35344: Warn on patron image upload if missing cardnumber

This change displays a warning message instead of the patron image
upload feature in the patron record when the patron is missing the
cardnumber.

Without this change, the staff user can try to upload a patron image
but it will silently fail. This change warns the staff user of the
cardnumber requirement for patron image upload.

Test plan:
0. Apply the patch
1. Enable the "patronimages" system preference
2. Go to http://localhost:8081/cgi-bin/koha/members/moremember.pl?borrowernumber=51
3. Click "Add" over the patron image placeholder
4. Note the "Upload photo" button and the ability to take a patron photo if your
device has a camera
5. Remove "cardnumber" from BorrowerMandatoryField
6. Go to http://localhost:8081/cgi-bin/koha/circ/circulation.pl?borrowernumber=51
7. Edit the patron to remove the cardnumber
8. Click "Add" over the patron image placeholder
9. Note that no patron image upload features appear. Instead, only
a warning appears stating that the patron needs a cardnumber before
the patron image upload can be performed

Signed-off-by: David Nind <david@davidnind.com>
Comment 3 Marcel de Rooy 2023-12-01 10:49:16 UTC
Created attachment 159439 [details] [review]
Bug 35344: Warn on patron image upload if missing cardnumber

This change displays a warning message instead of the patron image
upload feature in the patron record when the patron is missing the
cardnumber.

Without this change, the staff user can try to upload a patron image
but it will silently fail. This change warns the staff user of the
cardnumber requirement for patron image upload.

Test plan:
0. Apply the patch
1. Enable the "patronimages" system preference
2. Go to http://localhost:8081/cgi-bin/koha/members/moremember.pl?borrowernumber=51
3. Click "Add" over the patron image placeholder
4. Note the "Upload photo" button and the ability to take a patron photo if your
device has a camera
5. Remove "cardnumber" from BorrowerMandatoryField
6. Go to http://localhost:8081/cgi-bin/koha/circ/circulation.pl?borrowernumber=51
7. Edit the patron to remove the cardnumber
8. Click "Add" over the patron image placeholder
9. Note that no patron image upload features appear. Instead, only
a warning appears stating that the patron needs a cardnumber before
the patron image upload can be performed

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 4 Katrin Fischer 2023-12-11 18:46:56 UTC
Pushed for 24.05!

Well done everyone, thank you!
Comment 5 Fridolin Somers 2023-12-12 07:40:34 UTC
Pushed to 23.11.x for 23.11.01
Comment 6 Lucas Gass (lukeg) 2023-12-14 21:20:24 UTC
Backported to 23.05.x for upcoming 23.05.07