Bug 14498

Summary: uri_escape error triggered by duplicate accountno's for patron
Product: Koha Reporter: Kyle M Hall (khall) <kyle>
Component: PatronsAssignee: Kyle M Hall (khall) <kyle>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: 1joynelson, chris, gmcharlt, gwilliams, jonathan.druart, kyle.m.hall, tomascohen
Version: unspecified   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Attachments: Bug 14498 - uri_escape error triggered by duplicate accountno's for patron
Bug 14498 - uri_escape error triggered by duplicate accountno's for patron
Bug 14498 - uri_escape error triggered by duplicate accountno's for patron
Bug 14498 - uri_escape error triggered by duplicate accountno's for patron

Description Kyle M Hall (khall) 2015-07-06 15:00:15 UTC
If a patron has duplicate accountno's for two different fines in Koha this will trigger the error

usi_escape: Unmatched [ in regex; marked by <-- HERE in m/([ <-- HERE ])/ at (eval 133) line 1.

upon attempt to pay. How those accountno's get duplicated is unknown, but considering accountno is somewhat vestigial at this point in time, it would be much more sensible to use accountlines_id which is has guaranteed uniqueness at the database level.
Comment 1 Kyle M Hall (khall) 2015-07-06 15:03:05 UTC Comment hidden (obsolete)
Comment 2 Kyle M Hall (khall) 2015-07-06 15:04:15 UTC Comment hidden (obsolete)
Comment 3 Kyle M Hall (khall) 2015-07-06 17:13:36 UTC Comment hidden (obsolete)
Comment 4 Jonathan Druart 2015-07-09 14:10:16 UTC
> 2) Edit the accountno's for those fines and set them to 0

I suppose you mean by editing the row in DB using the sql CLI?

Do you have an idea how it's possible to generate 2 rows with the same accountno for the same patron?
Comment 5 Kyle M Hall 2015-08-13 19:03:15 UTC
(In reply to Jonathan Druart from comment #4)
> > 2) Edit the accountno's for those fines and set them to 0
> 
> I suppose you mean by editing the row in DB using the sql CLI?

That is correct

> Do you have an idea how it's possible to generate 2 rows with the same
> accountno for the same patron?

I this point I do not know how the situation is occurring.
Comment 6 Joy Nelson 2015-08-13 20:02:13 UTC
I suspect this may be a data migration issue where the lines in the accountlines are not added with a tool that sequences them.  I cannot think of a way where Koha would create this natively.
Comment 7 Jonathan Druart 2015-08-18 14:28:29 UTC
Created attachment 41602 [details] [review]
Bug 14498 - uri_escape error triggered by duplicate accountno's for patron

If a patron has duplicate accountno's for two different fines in Koha this will trigger the error
usi_escape: Unmatched [ in regex; marked by <-- HERE in m/([ <-- HERE ])/ at (eval 133) line 1.
upon attempt to pay. How those accountno's get duplicated is unknown, but considering accountno
is somewhat vestigial at this point in time, it would be much more sensible to use accountlines_id
which is has guaranteed uniqueness at the database level.

Test Plan:
1) Create a patron with 2 fines
2) Edit the accountno's for those fines and set them to 0
3) Attempt to pay one, note the error
4) Apply this patch
5) Refesh the page
6) Attempt to pay one, no error this time!
7) Test Pay, Write off, Pay amount, Write off all, and Pay selected

Signed-off-by: Deborah Duce <deborah.duce@huntsvillelibrary.ca>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 8 Tomás Cohen Arazi (tcohen) 2015-08-20 16:47:24 UTC
Patch pushed to master.

Thanks Kyle!