Bug 26311 - Add patron invalid age to search_for_data_inconsistencies.pl
Summary: Add patron invalid age to search_for_data_inconsistencies.pl
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Command-line Utilities (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: Fridolin Somers
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks: 34505
  Show dependency treegraph
 
Reported: 2020-08-27 15:20 UTC by Fridolin Somers
Modified: 2024-07-04 20:38 UTC (History)
7 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Documentation contact: Caroline Cyr La Rose
Documentation submission: https://gitlab.com/koha-community/koha-manual/-/merge_requests/680
Text to go in the release notes:
This enhancement to the command line script used for searching for data inconsistencies (misc/maintenance/search_for_data_inconsistencies.pl) now lists patrons where their age doesn't match the criteria set for the patron category. This includes where there is: - a minimum age required - an upper age limit - a minimum age and an upper age limit An example of the output: Patrons with invalid age for category: * Patron borrowernumber=49 has an invalid age of 10 for their category 'PT' (24 to unlimited) * Patron borrowernumber=49 has an invalid age of 71 for their category 'PT' (0 to 50) * Patron borrowernumber=44 has an invalid age of 70 for their category 'PT' (20 to 60) Note: Where a patron's age can't be calculated (for example: a school or other organisation, or the date of birth is missing), then they are not included in the checks.
Version(s) released in:
22.11.00
Circulation function:


Attachments
Bug 26311: Add patron invalid age to search_for_data_inconsistencies.pl (2.01 KB, patch)
2020-08-27 15:23 UTC, Fridolin Somers
Details | Diff | Splinter Review
Bug 26311: Add patron invalid age to search_for_data_inconsistencies.pl (2.07 KB, patch)
2020-09-15 12:43 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 26311: Add patron invalid age to search_for_data_inconsistencies.pl (2.12 KB, patch)
2020-09-15 20:56 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 26311: (QA follow-up) Rephrase output message (1.69 KB, patch)
2020-09-15 20:56 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 26311: Loop through the patron with date of birth and in categories having age limits (2.67 KB, patch)
2020-09-30 11:25 UTC, Fridolin Somers
Details | Diff | Splinter Review
Bug 26311: (follow-up) loop through the patron with date of birth and in categories having age limits (2.68 KB, patch)
2020-09-30 11:27 UTC, Fridolin Somers
Details | Diff | Splinter Review
Bug 26311: (follow-up) loop through the patron with date of birth and in categories having age limits (2.90 KB, patch)
2020-09-30 11:33 UTC, Fridolin Somers
Details | Diff | Splinter Review
Bug 26311: (follow-up) loop through the patron with date of birth and in categories having age limits (2.83 KB, patch)
2020-09-30 15:30 UTC, Fridolin Somers
Details | Diff | Splinter Review
Bug 26311: Add patron invalid age to search_for_data_inconsistencies.pl (2.17 KB, patch)
2021-12-03 21:13 UTC, Fridolin Somers
Details | Diff | Splinter Review
Bug 26311: (QA follow-up) Rephrase output message (1.71 KB, patch)
2021-12-03 21:13 UTC, Fridolin Somers
Details | Diff | Splinter Review
Bug 26311: (follow-up) loop through the patron with date of birth and in categories having age limits (2.86 KB, patch)
2021-12-03 21:14 UTC, Fridolin Somers
Details | Diff | Splinter Review
Bug 26311: Add patron invalid age to search_for_data_inconsistencies.pl (2.17 KB, patch)
2022-03-02 20:28 UTC, Fridolin Somers
Details | Diff | Splinter Review
Bug 26311: (QA follow-up) Rephrase output message (1.71 KB, patch)
2022-03-02 20:28 UTC, Fridolin Somers
Details | Diff | Splinter Review
Bug 26311: (follow-up) loop through the patron with date of birth and in categories having age limits (2.80 KB, patch)
2022-03-02 20:28 UTC, Fridolin Somers
Details | Diff | Splinter Review
Bug 30063: Fix missing TT filters (1.67 KB, patch)
2022-04-05 14:53 UTC, Fridolin Somers
Details | Diff | Splinter Review
Bug 26311: Add patron invalid age to search_for_data_inconsistencies.pl (2.17 KB, patch)
2022-06-28 06:18 UTC, Fridolin Somers
Details | Diff | Splinter Review
Bug 26311: (QA follow-up) Rephrase output message (1.71 KB, patch)
2022-06-28 06:18 UTC, Fridolin Somers
Details | Diff | Splinter Review
Bug 26311: (follow-up) loop through the patron with date of birth and in categories having age limits (2.80 KB, patch)
2022-06-28 06:18 UTC, Fridolin Somers
Details | Diff | Splinter Review
Bug 26311: (follow-up) Fix undefined values in sprintf (1.56 KB, patch)
2022-06-28 06:19 UTC, Fridolin Somers
Details | Diff | Splinter Review
Bug 26311: Add patron invalid age to search_for_data_inconsistencies.pl (2.22 KB, patch)
2022-06-29 20:48 UTC, David Nind
Details | Diff | Splinter Review
Bug 26311: (QA follow-up) Rephrase output message (1.76 KB, patch)
2022-06-29 20:48 UTC, David Nind
Details | Diff | Splinter Review
Bug 26311: (follow-up) loop through the patron with date of birth and in categories having age limits (2.84 KB, patch)
2022-06-29 20:48 UTC, David Nind
Details | Diff | Splinter Review
Bug 26311: (follow-up) Fix undefined values in sprintf (1.61 KB, patch)
2022-06-29 20:48 UTC, David Nind
Details | Diff | Splinter Review
Bug 26311: Add patron invalid age to search_for_data_inconsistencies.pl (2.28 KB, patch)
2022-07-02 22:01 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 26311: (QA follow-up) Rephrase output message (1.82 KB, patch)
2022-07-02 22:02 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 26311: (follow-up) loop through the patron with date of birth and in categories having age limits (2.90 KB, patch)
2022-07-02 22:02 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 26311: (follow-up) Fix undefined values in sprintf (1.67 KB, patch)
2022-07-02 22:02 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 26311: (QA follow-up) Update script documentation (1010 bytes, patch)
2022-07-02 22:02 UTC, Katrin Fischer
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Fridolin Somers 2020-08-27 15:20:21 UTC
Patron categories may have age limits.
Add to script misc/maintenance/search_for_data_inconsistencies.pl the list of patrons which age is invalid regarding there category.
Comment 1 Fridolin Somers 2020-08-27 15:23:42 UTC
Created attachment 109239 [details] [review]
Bug 26311: Add patron invalid age to search_for_data_inconsistencies.pl

Patron categories may have age limits.
Add to script misc/maintenance/search_for_data_inconsistencies.pl the list of patrons which age is invalid regarding there category.

Test plan :
1) Create an adult patron category limited to 18-99 years
2) Create a patron in the category
3) Edit in database its date of birth so that he is 17 years old
4) Run misc/maintenance/search_for_data_inconsistencies.pl
=> You see the patron
Comment 2 Owen Leonard 2020-09-15 12:43:14 UTC
Created attachment 110106 [details] [review]
Bug 26311: Add patron invalid age to search_for_data_inconsistencies.pl

Patron categories may have age limits.
Add to script misc/maintenance/search_for_data_inconsistencies.pl the list of patrons which age is invalid regarding there category.

Test plan :
1) Create an adult patron category limited to 18-99 years
2) Create a patron in the category
3) Edit in database its date of birth so that he is 17 years old
4) Run misc/maintenance/search_for_data_inconsistencies.pl
=> You see the patron

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Comment 3 Katrin Fischer 2020-09-15 20:56:43 UTC
Created attachment 110130 [details] [review]
Bug 26311: Add patron invalid age to search_for_data_inconsistencies.pl

Patron categories may have age limits.
Add to script misc/maintenance/search_for_data_inconsistencies.pl the list of patrons which age is invalid regarding there category.

Test plan :
1) Create an adult patron category limited to 18-99 years
2) Create a patron in the category
3) Edit in database its date of birth so that he is 17 years old
4) Run misc/maintenance/search_for_data_inconsistencies.pl
=> You see the patron

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 4 Katrin Fischer 2020-09-15 20:56:48 UTC
Created attachment 110131 [details] [review]
Bug 26311: (QA follow-up) Rephrase output message

This is a suggestion for rephrasing the message slightly:

Before:
* Patron borrowernumber=15 in category 'J' has invalid age '56'

After:
* Patron borrowernumber=37 has an invalid age of 37 for their category 'K'

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 5 Fridolin Somers 2020-09-17 10:44:33 UTC
(In reply to Katrin Fischer from comment #4)
> Created attachment 110131 [details] [review] [review]
> Bug 26311: (QA follow-up) Rephrase output message
> 
> This is a suggestion for rephrasing the message slightly:
> 
> Before:
> * Patron borrowernumber=15 in category 'J' has invalid age '56'
> 
> After:
> * Patron borrowernumber=37 has an invalid age of 37 for their category 'K'
> 
> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Yep better thanks
Comment 6 Jonathan Druart 2020-09-29 14:37:17 UTC
I am wondering if we could not improve this a bit.
1. We could retrieve patrons with a dob
2. We could retrieve patrons from categories with dateofbirthrequired

Looping on all patrons does not seem very efficient.

What do you think?
Comment 7 Fridolin Somers 2020-09-29 15:33:00 UTC
(In reply to Jonathan Druart from comment #6)

I like calling $patron->is_valid_age so its the same behaviour as staff interface.

> Looping on all patrons does not seem very efficient.
I agree but actually script is looping on all biblio records, which already can be very long.

But I'm open to changes ;)
Comment 8 Katrin Fischer 2020-09-29 17:54:17 UTC
I think having a dob makes sense, because it's won't work otherwise, but I would not rely on dob required.
Comment 9 David Cook 2020-09-30 07:03:11 UTC
(In reply to Jonathan Druart from comment #6)
> I am wondering if we could not improve this a bit.
> 1. We could retrieve patrons with a dob
> 2. We could retrieve patrons from categories with dateofbirthrequired
> 
> Looping on all patrons does not seem very efficient.
> 
> What do you think?

I agree about improving efficiency.

Why not loop through the patron categories that have age limits, and then only retrieve the patrons for those categories?

Depending on how inconsistencies want to be reported, you could then note patrons with null dateofbirth, or only select patrons where their dateofbirth is outside the allowed scope. 

Much better than looping through all patrons I think.
Comment 10 Fridolin Somers 2020-09-30 11:25:57 UTC
Created attachment 110978 [details] [review]
Bug 26311: Loop through the patron with date of birth and in categories having age limits

Also added category limits in message, for example (12-18)
Comment 11 Fridolin Somers 2020-09-30 11:27:13 UTC
Created attachment 110979 [details] [review]
Bug 26311: (follow-up) loop through the patron with date of birth and in categories having age limits

Also added category limits in message, for example (12-18)
Comment 12 Fridolin Somers 2020-09-30 11:31:18 UTC
Good points.

Here is a follow-up that limits on patrons :
- having a Date Of Birth
- in category having an age limit

Patrons search is quite complex so tell me if its the correct syntax.
Comment 13 Fridolin Somers 2020-09-30 11:33:37 UTC
Created attachment 110980 [details] [review]
Bug 26311: (follow-up) loop through the patron with date of birth and in categories having age limits

Also added category limits in message, for example (12-18)

Check patron :
- with no date of birth
- with invalid age in category having age required
- with invalid age in category having upper age limit
- with invalid age in category having age required and upper age limit
Comment 14 Fridolin Somers 2020-09-30 15:30:06 UTC
Oh I changed 'thier category' to 'his category'.
I understand now its wrong = gender neutral pronoun

I repush
Comment 15 Fridolin Somers 2020-09-30 15:30:25 UTC
Created attachment 110998 [details] [review]
Bug 26311: (follow-up) loop through the patron with date of birth and in categories having age limits

Also added category limits in message, for example (12-18)

Check patron :
- with no date of birth
- with invalid age in category having age required
- with invalid age in category having upper age limit
- with invalid age in category having age required and upper age limit
Comment 16 Séverine Queune 2021-04-01 12:55:16 UTC
No problem pllying the patchs, but I don't have any alert in the script.
Maybe the problem comes from my side, I prefer not updating the status and let someone else try.
Comment 17 Fridolin Somers 2021-12-03 21:13:21 UTC
Created attachment 128235 [details] [review]
Bug 26311: Add patron invalid age to search_for_data_inconsistencies.pl

Patron categories may have age limits.
Add to script misc/maintenance/search_for_data_inconsistencies.pl the list of patrons which age is invalid regarding there category.

Test plan :
1) Create an adult patron category limited to 18-99 years
2) Create a patron in the category
3) Edit in database its date of birth so that he is 17 years old
4) Run misc/maintenance/search_for_data_inconsistencies.pl
=> You see the patron

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 18 Fridolin Somers 2021-12-03 21:13:52 UTC
Created attachment 128236 [details] [review]
Bug 26311: (QA follow-up) Rephrase output message

This is a suggestion for rephrasing the message slightly:

Before:
* Patron borrowernumber=15 in category 'J' has invalid age '56'

After:
* Patron borrowernumber=37 has an invalid age of 37 for their category 'K'

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 19 Fridolin Somers 2021-12-03 21:14:08 UTC
Created attachment 128237 [details] [review]
Bug 26311: (follow-up) loop through the patron with date of birth and in categories having age limits

Also added category limits in message, for example (12-18)

Check patron :
- with no date of birth
- with invalid age in category having age required
- with invalid age in category having upper age limit
- with invalid age in category having age required and upper age limit
Comment 20 David Nind 2021-12-04 02:10:55 UTC
Testing notes and issues identified (using koha-testing-docker):

1. Database query for step 3: update borrowers set dateofbirth = '2004-11-01' where borrowernumber = 49;

2. Main patch test plan worked as expected.

3. Had issues with some of the tests in the third patch (see details below), others worked as expected:
   . with no date of birth: doesn't seem to work if age is NULL
   . with invalid age in category having age required: 'Use of uninitialized value in sprintf...' message
   . with invalid age in category having upper age limit: 'Use of uninitialized value in sprintf...' message

with no date of birth
~~~~~~~~~~~~~~~~~~~~~

1. Edited a staff patron (Henry - 34) and removed date of birth
2. Changed the staff patron category (S) so age required = 18-99 years
3. Error message after running (note: dateofbirth is NULL in database):
   => Patron borrowernumber=34 has an invalid age of 104 for their category 'S' (18-99)
   => This looks wrong to me - with no date of birth I'm not sure how it works out they 104 years of age
4. If I update in the database so dateofbirth = '' (which becomes 0000-00-00) I get this message:
   ==> Can't call method "strftime" on an undefined value at /kohadevbox/koha/Koha/Patron.pm line 1149.

with invalid age in category having age required
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

1. Edited a patron (Mary Burton - 49) so that age is less than 24.
2. Changed patron category (PT) so age required = 24 and no maximum age.
3. Worked as expected except for 'Use of unitialized value...' message:
   ==> Use of uninitialized value in sprintf at misc/maintenance/search_for_data_inconsistencies.pl line 256.
         * Patron borrowernumber=49 has an invalid age of 10 for their category 'PT' (24-)
4. If they have the correct age (changed so they were older than 24)

with invalid age in category having upper age limit
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

1. Edited a patron (Mary Burton - 49) so that age is more than 50.
2. Changed patron category (PT) so that no age required and upper age limit was 50.
3. Output as expected except for 'Use of uninitialized value in sprintf...' message:
   ==> Use of uninitialized value in sprintf at misc/maintenance/search_for_data_inconsistencies.pl line 256.
         * Patron borrowernumber=49 has an invalid age of 71 for their category 'PT' (-50)

with invalid age in category having age required and upper age limit
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

1. Edited a patron (Mary Burton - 49) so that age is more than 60.
2. Changed patron category (PT) so that age required = 20 and upper age limit = 60.
3. Output as expected:
   ==> * Patron borrowernumber=44 has an invalid age of 70 for their category 'PT' (20-60)
Comment 21 Fridolin Somers 2022-03-02 20:28:00 UTC
Created attachment 131295 [details] [review]
Bug 26311: Add patron invalid age to search_for_data_inconsistencies.pl

Patron categories may have age limits.
Add to script misc/maintenance/search_for_data_inconsistencies.pl the list of patrons which age is invalid regarding there category.

Test plan :
1) Create an adult patron category limited to 18-99 years
2) Create a patron in the category
3) Edit in database its date of birth so that he is 17 years old
4) Run misc/maintenance/search_for_data_inconsistencies.pl
=> You see the patron

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 22 Fridolin Somers 2022-03-02 20:28:05 UTC
Created attachment 131296 [details] [review]
Bug 26311: (QA follow-up) Rephrase output message

This is a suggestion for rephrasing the message slightly:

Before:
* Patron borrowernumber=15 in category 'J' has invalid age '56'

After:
* Patron borrowernumber=37 has an invalid age of 37 for their category 'K'

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 23 Fridolin Somers 2022-03-02 20:28:09 UTC
Created attachment 131297 [details] [review]
Bug 26311: (follow-up) loop through the patron with date of birth and in categories having age limits

Also added category limits in message, for example (12-18)

Check patron :
- with no date of birth
- with invalid age in category having age required
- with invalid age in category having upper age limit
- with invalid age in category having age required and upper age limit
Comment 24 Fridolin Somers 2022-03-02 20:30:46 UTC
(In reply to David Nind from comment #20)
> Testing notes and issues identified (using koha-testing-docker):
Thanks a lot for testing David.
I've found an error in patrons select.
Fixed with prefetch of patron category.

You may test again
Comment 25 Fridolin Somers 2022-04-05 14:53:52 UTC Comment hidden (obsolete)
Comment 26 David Nind 2022-06-27 09:01:31 UTC
Apologies that it has taken me so long to retest.

Summary from testing: 

- test plan for first patch: worked as expected

- with no date of birth: does not appear in the list, no warnings on the patron page in staff interface [1]

- with invalid age in category having age required: unitilized value message if upper age limit blank [2]

- with invalid age in category having upper age limit: unitilized value message if upper age limit blank [3]

- with invalid age in category having age required and upper age limit: works as expected

Hopefully I haven't misinterpreted what is expected here!

[1] with no date of birth
~~~~~~~~~~~~~~~~~~~~~~~~~

1. Edited a staff patron (Henry: patron id = 19) and removed date of birth using the staff interface (dateofbirth shows as NULL in database)
2. Changed the staff patron category (S) so age required = 18-99 years
3. Does not appear in the list after running the script

[2] with invalid age in category having age required
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

1. Edited a patron (Mary Burton - borrowernumber = 49) so that age is less than 24.
2. Changed patron category (PT) so age required = 24 and no maximum age (left blank).
3. Worked as expected except for 'Use of unitialized value...' message:
   ==> Use of uninitialized value in sprintf at misc/maintenance/search_for_data_inconsistencies.pl line 304.
	* Patron borrowernumber=49 has an invalid age of 21 for their category 'PT' (24-)

4. If they have the correct age (changed so they were older than 24), then no unitialized value message

[3] with invalid age in category having upper age limit
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

1. Edited a patron (Mary Burton - 49) so that age is more than 50.
2. Changed patron category (PT) so that no age required and upper age limit was 50.
3. Output as expected, except for 'Use of uninitialized value in sprintf...' message:
   ==> Use of uninitialized value in sprintf at misc/maintenance/search_for_data_inconsistencies.pl line 304.
	* Patron borrowernumber=49 has an invalid age of 58 for their category 'PT' (-50)
Comment 27 Fridolin Somers 2022-06-28 06:18:17 UTC
Created attachment 136665 [details] [review]
Bug 26311: Add patron invalid age to search_for_data_inconsistencies.pl

Patron categories may have age limits.
Add to script misc/maintenance/search_for_data_inconsistencies.pl the list of patrons which age is invalid regarding there category.

Test plan :
1) Create an adult patron category limited to 18-99 years
2) Create a patron in the category
3) Edit in database its date of birth so that he is 17 years old
4) Run misc/maintenance/search_for_data_inconsistencies.pl
=> You see the patron

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 28 Fridolin Somers 2022-06-28 06:18:34 UTC
Created attachment 136666 [details] [review]
Bug 26311: (QA follow-up) Rephrase output message

This is a suggestion for rephrasing the message slightly:

Before:
* Patron borrowernumber=15 in category 'J' has invalid age '56'

After:
* Patron borrowernumber=37 has an invalid age of 37 for their category 'K'

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 29 Fridolin Somers 2022-06-28 06:18:48 UTC
Created attachment 136667 [details] [review]
Bug 26311: (follow-up) loop through the patron with date of birth and in categories having age limits

Also added category limits in message, for example (12-18)

Check patron :
- with no date of birth
- with invalid age in category having age required
- with invalid age in category having upper age limit
- with invalid age in category having age required and upper age limit
Comment 30 Fridolin Somers 2022-06-28 06:19:59 UTC
Created attachment 136668 [details] [review]
Bug 26311: (follow-up) Fix undefined values in sprintf

Avoid warns 'Use of uninitialized value in sprintf' by using
'0' if lower age is undefined
'unlimited' if upper are is undefined
Comment 31 Fridolin Somers 2022-06-28 06:20:55 UTC
Warns uninitialized value in sprintf removed.
Thanks again for testing David :D
Comment 32 David Nind 2022-06-29 19:43:37 UTC
(In reply to Fridolin Somers from comment #31)
> Warns uninitialized value in sprintf removed.

Thanks Fridolin - the warnings are now removed and things work as expected.

The only thing that's not working for me is when the date of birth is empty.

Is this supposed to show in the list of data inconsistencies? For example, if a patron has no date of birth but is in the patron category with an age range from 18-99, then I would expect it to show - as there is no way to know how old they are.
Comment 33 Fridolin Somers 2022-06-29 20:22:47 UTC
(In reply to David Nind from comment #32)
> (In reply to Fridolin Somers from comment #31)
> > Warns uninitialized value in sprintf removed.
> 
> Thanks Fridolin - the warnings are now removed and things work as expected.
> 
> The only thing that's not working for me is when the date of birth is empty.
> 
> Is this supposed to show in the list of data inconsistencies? For example,
> if a patron has no date of birth but is in the patron category with an age
> range from 18-99, then I would expect it to show - as there is no way to
> know how old they are.

Hi

We decided in comment 6 to skip patron with no date of birth.
So indeed they do not show in list of data inconsistencies.
Some patron can be a virtual person (like a school) so no date of birth.
Comment 34 David Nind 2022-06-29 20:48:10 UTC
Created attachment 136750 [details] [review]
Bug 26311: Add patron invalid age to search_for_data_inconsistencies.pl

Patron categories may have age limits.
Add to script misc/maintenance/search_for_data_inconsistencies.pl the list of patrons which age is invalid regarding there category.

Test plan :
1) Create an adult patron category limited to 18-99 years
2) Create a patron in the category
3) Edit in database its date of birth so that he is 17 years old
4) Run misc/maintenance/search_for_data_inconsistencies.pl
=> You see the patron

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: David Nind <david@davidnind.com>
Comment 35 David Nind 2022-06-29 20:48:15 UTC
Created attachment 136751 [details] [review]
Bug 26311: (QA follow-up) Rephrase output message

This is a suggestion for rephrasing the message slightly:

Before:
* Patron borrowernumber=15 in category 'J' has invalid age '56'

After:
* Patron borrowernumber=37 has an invalid age of 37 for their category 'K'

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: David Nind <david@davidnind.com>
Comment 36 David Nind 2022-06-29 20:48:20 UTC
Created attachment 136752 [details] [review]
Bug 26311: (follow-up) loop through the patron with date of birth and in categories having age limits

Also added category limits in message, for example (12-18)

Check patron :
- with no date of birth
- with invalid age in category having age required
- with invalid age in category having upper age limit
- with invalid age in category having age required and upper age limit

Signed-off-by: David Nind <david@davidnind.com>
Comment 37 David Nind 2022-06-29 20:48:25 UTC
Created attachment 136753 [details] [review]
Bug 26311: (follow-up) Fix undefined values in sprintf

Avoid warns 'Use of uninitialized value in sprintf' by using
'0' if lower age is undefined
'unlimited' if upper are is undefined

Signed-off-by: David Nind <david@davidnind.com>
Comment 38 David Nind 2022-06-29 20:49:39 UTC
(In reply to Fridolin Somers from comment #33)
> We decided in comment 6 to skip patron with no date of birth.
> So indeed they do not show in list of data inconsistencies.
> Some patron can be a virtual person (like a school) so no date of birth.

I didn't see that, and that makes sense.

Now signed-off!
Comment 39 Katrin Fischer 2022-07-02 22:01:54 UTC
Created attachment 137039 [details] [review]
Bug 26311: Add patron invalid age to search_for_data_inconsistencies.pl

Patron categories may have age limits.
Add to script misc/maintenance/search_for_data_inconsistencies.pl the list of patrons which age is invalid regarding there category.

Test plan :
1) Create an adult patron category limited to 18-99 years
2) Create a patron in the category
3) Edit in database its date of birth so that he is 17 years old
4) Run misc/maintenance/search_for_data_inconsistencies.pl
=> You see the patron

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

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

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 40 Katrin Fischer 2022-07-02 22:02:00 UTC
Created attachment 137040 [details] [review]
Bug 26311: (QA follow-up) Rephrase output message

This is a suggestion for rephrasing the message slightly:

Before:
* Patron borrowernumber=15 in category 'J' has invalid age '56'

After:
* Patron borrowernumber=37 has an invalid age of 37 for their category 'K'

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

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

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 41 Katrin Fischer 2022-07-02 22:02:05 UTC
Created attachment 137041 [details] [review]
Bug 26311: (follow-up) loop through the patron with date of birth and in categories having age limits

Also added category limits in message, for example (12-18)

Check patron :
- with no date of birth
- with invalid age in category having age required
- with invalid age in category having upper age limit
- with invalid age in category having age required and upper age limit

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

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 42 Katrin Fischer 2022-07-02 22:02:10 UTC
Created attachment 137042 [details] [review]
Bug 26311: (follow-up) Fix undefined values in sprintf

Avoid warns 'Use of uninitialized value in sprintf' by using
'0' if lower age is undefined
'unlimited' if upper are is undefined

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

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 43 Katrin Fischer 2022-07-02 22:02:15 UTC
Created attachment 137043 [details] [review]
Bug 26311: (QA follow-up) Update script documentation

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 44 Tomás Cohen Arazi (tcohen) 2022-07-05 12:23:23 UTC
Pushed to master for 22.11.

Nice work everyone, thanks!
Comment 45 Lucas Gass (lukeg) 2022-08-09 22:15:26 UTC
Enhancement will not be backported to 22.05.x series