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

--- Comment #5 from Martin Renvoize (ashimema) 
<[email protected]> ---
Created attachment 206811
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=206811&action=edit
Bug 43637: Add async batch patron image import and matchpoint selection to
picture-upload.pl

Batch/zip uploads now go through the same two-step AJAX upload and
background-job pattern tools/import_borrowers.pl already uses, calling
Koha::BackgroundJob::PatronImageImport (which wraps
Koha::Patron::Image::Import->import_batch) instead of blocking the
request. Single-image upload - including the "Patron photo" modal and
webcam capture embedded on every patron's own record page - stays
synchronous, since that's an instant "upload and see it now" flow used
constantly by front-desk staff and doesn't benefit from being async.

Both modes gain a configurable matchpoint (card number, username, or a
patron attribute type), replacing the previous hardcoded card-number-only
lookup. Batch mode also supports filename-stem matching for zips with no
idlink.txt/datalink.txt mapping file - each image is matched by its own
filename (minus extension) against the chosen matchpoint directly.

Test plan:
1. Apply the whole patchset, update the database if prompted, restart_all.
2. Enable the "patronimages" system preference if not already on.
3. Open any patron's record, use the "Patron photo" modal to upload a
   file, and confirm it appears immediately (no job, no delay) - then
   delete it the same way. If a webcam is available, confirm the "Take
   patron photo" capture flow also still works.
4. Go to Tools > Upload patron images, select "Image file", choose a
   matchpoint (try username, and a patron attribute type if Extended
   patron attributes is enabled), type a matching identifier, upload a
   file, and confirm immediate success.
5. Prepare a zip containing two images and an idlink.txt mapping file
   using your chosen matchpoint's values, upload it via "Zip file" mode,
   and confirm you land on a "job enqueued" page; follow its link to
   view the job and confirm it shows imported/error counts once
   finished.
6. Prepare a second zip with loose images named <identifier>.<ext> and
   no mapping file; upload it and confirm each is matched by its own
   filename.
7. Prepare a zip whose idlink.txt has a row pointing outside the
   archive (e.g. "BADCARD,../../etc/passwd"); upload it and confirm the
   job's error report shows that row failed safely, with no file
   touched outside the archive.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

-- 
You are receiving this mail because:
You are watching all bug changes.
You are the assignee for the bug.
_______________________________________________
Koha-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to