Bug 14498 - uri_escape error triggered by duplicate accountno's for patron
Summary: uri_escape error triggered by duplicate accountno's for patron
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Patrons (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low normal (vote)
Assignee: Kyle M Hall
QA Contact: Testopia
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-07-06 15:00 UTC by Kyle M Hall
Modified: 2016-12-05 21:23 UTC (History)
7 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Bot Control: ---
When did the bot last check this:
Who signed the patch off:
Text to go in the release notes:


Attachments
Bug 14498 - uri_escape error triggered by duplicate accountno's for patron (6.97 KB, patch)
2015-07-06 15:03 UTC, Kyle M Hall
Details | Diff | Splinter Review
Bug 14498 - uri_escape error triggered by duplicate accountno's for patron (6.72 KB, patch)
2015-07-06 15:04 UTC, Kyle M Hall
Details | Diff | Splinter Review
Bug 14498 - uri_escape error triggered by duplicate accountno's for patron (6.78 KB, patch)
2015-07-06 17:13 UTC, Kyle M Hall
Details | Diff | Splinter Review
Bug 14498 - uri_escape error triggered by duplicate accountno's for patron (6.85 KB, patch)
2015-08-18 14:28 UTC, Jonathan Druart
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Kyle M Hall 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 2015-07-06 15:03:05 UTC Comment hidden (obsolete)
Comment 2 Kyle M Hall 2015-07-06 15:04:15 UTC Comment hidden (obsolete)
Comment 3 Kyle M Hall 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 2015-08-20 16:47:24 UTC
Patch pushed to master.

Thanks Kyle!