Bug 33245 - Add $patron->is_active
Summary: Add $patron->is_active
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: Marcel de Rooy
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks: 15504 28688 33522
  Show dependency treegraph
 
Reported: 2023-03-16 14:53 UTC by Marcel de Rooy
Modified: 2024-07-04 20:38 UTC (History)
3 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
23.11.00
Circulation function:


Attachments
Bug 33245: TestBuilder: Default value for anonymized (1.06 KB, patch)
2023-05-30 14:42 UTC, Marcel de Rooy
Details | Diff | Splinter Review
Bug 33245: Introduce patron->is_active (3.25 KB, patch)
2023-05-30 14:42 UTC, Marcel de Rooy
Details | Diff | Splinter Review
Bug 33245: Add unit test (4.19 KB, patch)
2023-05-30 14:42 UTC, Marcel de Rooy
Details | Diff | Splinter Review
Bug 33245: TestBuilder: Default value for anonymized (1.10 KB, patch)
2023-07-14 08:15 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 33245: Introduce patron->is_active (3.29 KB, patch)
2023-07-14 08:15 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 33245: Add unit test (4.23 KB, patch)
2023-07-14 08:15 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 33245: TestBuilder: Default value for anonymized (1.18 KB, patch)
2023-09-01 06:24 UTC, Marcel de Rooy
Details | Diff | Splinter Review
Bug 33245: Introduce patron->is_active (3.43 KB, patch)
2023-09-01 06:24 UTC, Marcel de Rooy
Details | Diff | Splinter Review
Bug 33245: Add unit test (4.54 KB, patch)
2023-09-01 06:24 UTC, Marcel de Rooy
Details | Diff | Splinter Review
Bug 33245: TestBuilder: Default value for anonymized (1.18 KB, patch)
2023-09-02 06:52 UTC, Marcel de Rooy
Details | Diff | Splinter Review
Bug 33245: Introduce patron->is_active (3.47 KB, patch)
2023-09-02 06:52 UTC, Marcel de Rooy
Details | Diff | Splinter Review
Bug 33245: Add unit test (4.69 KB, patch)
2023-09-02 06:52 UTC, Marcel de Rooy
Details | Diff | Splinter Review
Bug 33245: TestBuilder: Default value for anonymized (1.21 KB, patch)
2023-10-04 13:03 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 33245: Introduce patron->is_active (3.51 KB, patch)
2023-10-04 13:03 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 33245: Add unit test (4.76 KB, patch)
2023-10-04 13:03 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 33245: TestBuilder: Default value for anonymized (1.25 KB, patch)
2023-10-04 13:50 UTC, Marcel de Rooy
Details | Diff | Splinter Review
Bug 33245: Introduce patron->is_active (3.55 KB, patch)
2023-10-04 13:50 UTC, Marcel de Rooy
Details | Diff | Splinter Review
Bug 33245: Add unit test (4.89 KB, patch)
2023-10-04 13:50 UTC, Marcel de Rooy
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Marcel de Rooy 2023-03-16 14:53:12 UTC

    
Comment 1 Marcel de Rooy 2023-04-13 14:00:05 UTC
Still have some code for this in the pipeline. Coming up.
Comment 2 Marcel de Rooy 2023-05-30 14:42:48 UTC
Created attachment 151800 [details] [review]
Bug 33245: TestBuilder: Default value for anonymized

When we create a patron with TestBuilder, we normally
do not expect an anonymized status. This will certainly
hold for the patrons we are creating for testing is_active
in a following patch.

Test plan:
Run t/db_dependent/Koha/Patron.t
Run t/db_dependent/Koha/Patrons.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 3 Marcel de Rooy 2023-05-30 14:42:50 UTC
Created attachment 151801 [details] [review]
Bug 33245: Introduce patron->is_active

Does only add the new patron method.

NOTE: We may define additional criteria at some point, but I think
that this is a good starting point.

Test plan:
Run perl -MKoha::Patron -e'print Koha::Patrons->find(X)->is_active;'
Note: replace X by a valid borrowernumber.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 4 Marcel de Rooy 2023-05-30 14:42:52 UTC
Created attachment 151802 [details] [review]
Bug 33245: Add unit test

Test plan:
Run t/db_dependent/Koha/Patron.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 5 Matt Blenkinsop 2023-07-14 08:15:17 UTC
Created attachment 153435 [details] [review]
Bug 33245: TestBuilder: Default value for anonymized

When we create a patron with TestBuilder, we normally
do not expect an anonymized status. This will certainly
hold for the patrons we are creating for testing is_active
in a following patch.

Test plan:
Run t/db_dependent/Koha/Patron.t
Run t/db_dependent/Koha/Patrons.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Comment 6 Matt Blenkinsop 2023-07-14 08:15:19 UTC
Created attachment 153436 [details] [review]
Bug 33245: Introduce patron->is_active

Does only add the new patron method.

NOTE: We may define additional criteria at some point, but I think
that this is a good starting point.

Test plan:
Run perl -MKoha::Patron -e'print Koha::Patrons->find(X)->is_active;'
Note: replace X by a valid borrowernumber.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Comment 7 Matt Blenkinsop 2023-07-14 08:15:22 UTC
Created attachment 153437 [details] [review]
Bug 33245: Add unit test

Test plan:
Run t/db_dependent/Koha/Patron.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Comment 8 Jonathan Druart 2023-08-31 13:50:07 UTC
Please amend and tidy the patches.

+        $dt = dt_from_string()->subtract( days => 180 ); # default fallback
Where is 180 coming from?
Comment 9 Marcel de Rooy 2023-09-01 06:23:56 UTC
(In reply to Jonathan Druart from comment #8)
> Please amend and tidy the patches.

Will submit.

> +        $dt = dt_from_string()->subtract( days => 180 ); # default fallback
> Where is 180 coming from?

The 180 is a fallback as noted in the comment. Normally you should pass the desired number of days, months to the routine. The follow-up patch does this in a cron script:

Bug 33522
+    my $patron_active = $recent->is_active({ months => $active // $inactive }); # checked already that only one is defined
Comment 10 Marcel de Rooy 2023-09-01 06:24:27 UTC
Created attachment 155050 [details] [review]
Bug 33245: TestBuilder: Default value for anonymized

When we create a patron with TestBuilder, we normally
do not expect an anonymized status. This will certainly
hold for the patrons we are creating for testing is_active
in a following patch.

Test plan:
Run t/db_dependent/Koha/Patron.t
Run t/db_dependent/Koha/Patrons.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Comment 11 Marcel de Rooy 2023-09-01 06:24:29 UTC
Created attachment 155051 [details] [review]
Bug 33245: Introduce patron->is_active

Does only add the new patron method.

NOTE: We may define additional criteria at some point, but I think
that this is a good starting point.

Test plan:
Run perl -MKoha::Patron -e'print Koha::Patrons->find(X)->is_active;'
Note: replace X by a valid borrowernumber.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Comment 12 Marcel de Rooy 2023-09-01 06:24:31 UTC
Created attachment 155052 [details] [review]
Bug 33245: Add unit test

Test plan:
Run t/db_dependent/Koha/Patron.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Comment 13 Jonathan Druart 2023-09-01 07:12:04 UTC
(In reply to Marcel de Rooy from comment #9)
> (In reply to Jonathan Druart from comment #8)
> > +        $dt = dt_from_string()->subtract( days => 180 ); # default fallback
> > Where is 180 coming from?
> 
> The 180 is a fallback as noted in the comment. Normally you should pass the
> desired number of days, months to the routine.

So maybe make it mandatory?
Comment 14 Marcel de Rooy 2023-09-02 06:52:22 UTC
Created attachment 155161 [details] [review]
Bug 33245: TestBuilder: Default value for anonymized

When we create a patron with TestBuilder, we normally
do not expect an anonymized status. This will certainly
hold for the patrons we are creating for testing is_active
in a following patch.

Test plan:
Run t/db_dependent/Koha/Patron.t
Run t/db_dependent/Koha/Patrons.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Comment 15 Marcel de Rooy 2023-09-02 06:52:24 UTC
Created attachment 155162 [details] [review]
Bug 33245: Introduce patron->is_active

Does only add the new patron method.

NOTE: We may define additional criteria at some point, but I think
that this is a good starting point.

Test plan:
Run perl -MKoha::Patron -e'print Koha::Patrons->find(X)->is_active(Y);'
Note: replace X by a valid borrowernumber and Y by date criterium.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Comment 16 Marcel de Rooy 2023-09-02 06:52:26 UTC
Created attachment 155163 [details] [review]
Bug 33245: Add unit test

Test plan:
Run t/db_dependent/Koha/Patron.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Comment 17 Marcel de Rooy 2023-09-02 06:52:58 UTC
(In reply to Jonathan Druart from comment #13)
> (In reply to Marcel de Rooy from comment #9)
> > (In reply to Jonathan Druart from comment #8)
> > > +        $dt = dt_from_string()->subtract( days => 180 ); # default fallback
> > > Where is 180 coming from?
> > 
> > The 180 is a fallback as noted in the comment. Normally you should pass the
> > desired number of days, months to the routine.
> 
> So maybe make it mandatory?

Fixed. Throws exception now.
Comment 18 Jonathan Druart 2023-10-04 13:03:27 UTC
Created attachment 156528 [details] [review]
Bug 33245: TestBuilder: Default value for anonymized

When we create a patron with TestBuilder, we normally
do not expect an anonymized status. This will certainly
hold for the patrons we are creating for testing is_active
in a following patch.

Test plan:
Run t/db_dependent/Koha/Patron.t
Run t/db_dependent/Koha/Patrons.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 19 Jonathan Druart 2023-10-04 13:03:29 UTC
Created attachment 156529 [details] [review]
Bug 33245: Introduce patron->is_active

Does only add the new patron method.

NOTE: We may define additional criteria at some point, but I think
that this is a good starting point.

Test plan:
Run perl -MKoha::Patron -e'print Koha::Patrons->find(X)->is_active(Y);'
Note: replace X by a valid borrowernumber and Y by date criterium.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 20 Jonathan Druart 2023-10-04 13:03:32 UTC
Created attachment 156530 [details] [review]
Bug 33245: Add unit test

Test plan:
Run t/db_dependent/Koha/Patron.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>

JD amended patch: Adjust number of tests
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 21 Tomás Cohen Arazi (tcohen) 2023-10-04 13:39:15 UTC
Please rebase the tests.
Comment 22 Marcel de Rooy 2023-10-04 13:50:08 UTC
Created attachment 156541 [details] [review]
Bug 33245: TestBuilder: Default value for anonymized

When we create a patron with TestBuilder, we normally
do not expect an anonymized status. This will certainly
hold for the patrons we are creating for testing is_active
in a following patch.

Test plan:
Run t/db_dependent/Koha/Patron.t
Run t/db_dependent/Koha/Patrons.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 23 Marcel de Rooy 2023-10-04 13:50:10 UTC
Created attachment 156542 [details] [review]
Bug 33245: Introduce patron->is_active

Does only add the new patron method.

NOTE: We may define additional criteria at some point, but I think
that this is a good starting point.

Test plan:
Run perl -MKoha::Patron -e'print Koha::Patrons->find(X)->is_active(Y);'
Note: replace X by a valid borrowernumber and Y by date criterium.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 24 Marcel de Rooy 2023-10-04 13:50:12 UTC
Created attachment 156543 [details] [review]
Bug 33245: Add unit test

Test plan:
Run t/db_dependent/Koha/Patron.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>

JD amended patch: Adjust number of tests
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 25 Tomás Cohen Arazi (tcohen) 2023-10-04 15:09:27 UTC
Pushed to master for 23.11.

Nice work everyone, thanks!
Comment 26 Fridolin Somers 2023-10-06 00:30:51 UTC
Enhancement not pushed to 23.05.x