Bug 27364 - Making previous patron cardnumbers searchable
Summary: Making previous patron cardnumbers searchable
Status: ASSIGNED
Alias: None
Product: Koha
Classification: Unclassified
Component: Patrons (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: Jake Deery
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-01-08 11:04 UTC by Fiona Borthwick
Modified: 2026-02-25 09:29 UTC (History)
6 users (show)

See Also:
GIT URL:
Initiative type: ---
Sponsorship status: ---
Comma delimited list of Sponsors:
Crowdfunding goal: 0
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments
Bug 27364: Add historic_cardnumbers to Patron object & API (8.71 KB, patch)
2026-02-25 09:29 UTC, Jake Deery
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Fiona Borthwick 2021-01-08 11:04:49 UTC
Bug 18626 introduced the logging of changes to patron cardnumbers which is great, but this still does not link together previous cardnumbers.

Imagine this scenario:

A library patron loses their library card.
They are issued with a replacement.
Old and new cardnumbers are recorded in the Modification log.

The old card is found (doesn't matter who finds it) and brought to the library.
A member of library staff scan the barcode - get no results.

This means they are none the wiser as to who this card belonged to.

Would it not be a good idea to allow previous cardnumbers to be searchable?

Some libraries may record this information somewhere in the patron record, but a search by cardnumber would be extremely helpful. It would be useful if the cardnumber moved into a linked field automatically when a new cardnumber was entered.
Comment 1 susan.murphy 2025-12-12 14:11:15 UTC
We really don't want them searchable or usable BUT do want staff to be able to see them without giving staff access to the modification logs. Mostly for troubleshooting the eResources where patrons used their old card to set up their accounts and now they have a new card that doesn't recognize them. Hoopla is our biggest issue.
Comment 2 Jake Deery 2026-02-25 09:29:21 UTC
Created attachment 193836 [details] [review]
Bug 27364: Add historic_cardnumbers to Patron object & API

This patch adds an historic_cardnumbers field to the patron object, staff client, and API call (which will return an array of objects containing information about the cardnumber and when it was changed).

TO TEST:
== APPLY PATCH ==
a)  Ensure 'CardnumberLog' is on in the sysprefs
b)  Change the koha user's cardnumber from 42 to 67
c)  Reverse step b)
d)  Go to the koha user's details page
    *)  note how there is a historic cardnumbers box
    *)  note how each change is marked, next to the date and time
    performed
    *)  note how the time is accurate to minutes
e)  Go to /api/v1/patrons/51
    *)  notice how the historic_cardnumbers array is populated with two
    objects
    *)  each object is per cardnumber change
    *)  each object contains the new and old cardnumber, as well as the
    timestamp of the transaction
== RESET_ALL ==
f)  repeat steps d-e
    *)  notice how the historic cardnumbers section is missing if no
    cardnumber change has occured, on the patron details page
    *)  notice how the historic_cardnumbers array is empty in the api
    call, if no cardnumber change has occured
== SIGN OFF ==