[Bug 17168] New: Add a command line script for updating patron category based on status

classic Classic list List threaded Threaded
63 messages Options
123
Reply | Threaded
Open this post in threaded view
|

[Bug 17168] New: Add a command line script for updating patron category based on status

bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17168

            Bug ID: 17168
           Summary: Add a command line script for updating patron category
                    based on status
 Change sponsored?: ---
           Product: Koha
           Version: master
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P5 - low
         Component: Command-line Utilities
          Assignee: [hidden email]
          Reporter: [hidden email]
        QA Contact: [hidden email]
                CC: [hidden email]

Work to be done:
* Create a script to run on a regular basis that updates patrons from one
category to another based on parameters passed in as defined below
* checks fine amount
* checks registration date
* checks patron fields for specific value

--
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[hidden email]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
Reply | Threaded
Open this post in threaded view
|

[Bug 17168] Add a command line script for updating patron category based on status

bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17168

Nick Clemens <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|[hidden email]          |[hidden email]
  Change sponsored?|---                         |Sponsored
                 CC|                            |[hidden email]

--
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[hidden email]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
Reply | Threaded
Open this post in threaded view
|

[Bug 17168] Add a command line script for updating patron category based on status

bugzilla-daemon
In reply to this post by bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17168

[hidden email] changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[hidden email]

--
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[hidden email]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
Reply | Threaded
Open this post in threaded view
|

[Bug 17168] Add a command line script for updating patron category based on status

bugzilla-daemon
In reply to this post by bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17168

Nick Clemens <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Patch complexity|---                         |Small patch
             Status|NEW                         |Needs Signoff

--
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[hidden email]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
Reply | Threaded
Open this post in threaded view
|

[Bug 17168] Add a command line script for updating patron category based on status

bugzilla-daemon
In reply to this post by bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17168

--- Comment #1 from Nick Clemens <[hidden email]> ---
Created attachment 60279
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=60279&action=edit
Bug 17168 - Add a command line script for updating patron category based on
status

This patch adds a new script update_patrons_category.pl which allows for
updating patron categories in a batch upon meeting provided criteria.
This script additionally can replace j2a.pl.

To test:
1 - perl update_patrons_category.pl -h
2 - Ensure help text makes sense and covers all options
3 - Test converting patrons supplying only fromcat and tocat
    perl update_patrons_category.pl -f PT -t J -v
    perl update_patrons_category.pl -f PT -t J -v
4 - All patrons should have been switched to and from Juveniles
5 - Try with -n switch
    perl update_patrons_category.pl -f PT -t J -v -n
6 - Should list all patrons but not update
7 - Set the age for juvenile patrons to be outside the range provided in
categories (or set the upper age limit for juveniles to '2')
8 - Test with verbosity and with without -n
    perl update_patrons_category.pl -f J -a -t PT -v -n
    perl update_patrons_category.pl -f J -a -t PT -v
9 - Repeat above and verify linked/unlinked guarantors are removed in above
scenario
10 - Test various fine and registration limits
11 - Test matching on specific fields i.e. --field surname=acosta
12 - Sign off

--
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[hidden email]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
Reply | Threaded
Open this post in threaded view
|

[Bug 17168] Add a command line script for updating patron category based on status

bugzilla-daemon
In reply to this post by bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17168

Nick Clemens <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #60279|0                           |1
        is obsolete|                            |

--- Comment #2 from Nick Clemens <[hidden email]> ---
Created attachment 60280
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=60280&action=edit
Bug 17168 - Add a command line script for updating patron category based on
status

This patch adds a new script update_patrons_category.pl which allows for
updating patron categories in a batch upon meeting provided criteria.
This script additionally can replace j2a.pl.

To test:
1 - perl update_patrons_category.pl -h
2 - Ensure help text makes sense and covers all options
3 - Test converting patrons supplying only fromcat and tocat
    perl update_patrons_category.pl -f PT -t J -v
    perl update_patrons_category.pl -f PT -t J -v
4 - All patrons should have been switched to and from Juveniles
5 - Try with -n switch
    perl update_patrons_category.pl -f PT -t J -v -n
6 - Should list all patrons but not update
7 - Set the age for juvenile patrons to be outside the range provided in
categories (or set the upper age limit for juveniles to '2')
8 - Test with verbosity and with without -n
    perl update_patrons_category.pl -f J -a -t PT -v -n
    perl update_patrons_category.pl -f J -a -t PT -v
9 - Repeat above and verify linked/unlinked guarantors are removed in above
scenario
10 - Test various fine and registration limits
11 - Test matching on specific fields i.e. --field surname=acosta
12 - Sign off

Sponsored by: Round Rock Public Library
(https://www.roundrocktexas.gov/departments/library/)

--
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[hidden email]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
Reply | Threaded
Open this post in threaded view
|

[Bug 17168] Add a command line script for updating patron category based on status

bugzilla-daemon
In reply to this post by bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17168

Barton Chittenden <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[hidden email]

--- Comment #3 from Barton Chittenden <[hidden email]> ---
update_patrons_category.pl --help shows

Usage:
    update_patrons_category.pl [ -b=<branchcode> -f=<categorycode>
    -t=<categorycode> ]

but

Options:

...

    -f      *required* defines the category to update. Expects the code from
            categories.categorycode.

    -t      *required* defines the category patrons will be converted to.
            Expects the code from categories.categorycode.

Square brackets indicate optional arguments. You don't need angle brackets
surrounding <branchcode> and <categorycode>. Elipses show repeated arguments,
and a pipe shows alternative arguments.

Here's what I would expect for usage, given the options:

Usage:
    update_patrons_category.pl -f=categorycode -t=categorycode
                               [-b=branchcode] [-n] [-a] [-fo=X] [-fu=X]
                               [-rb=date] [-ra=date] [-v]
                               [--field column=value ...]
    update_patrons_category.pl --help | --man

--
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[hidden email]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
Reply | Threaded
Open this post in threaded view
|

[Bug 17168] Add a command line script for updating patron category based on status

bugzilla-daemon
In reply to this post by bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17168

--- Comment #4 from Barton Chittenden <[hidden email]> ---
POD ERRORS
    Hey! The above document had some coding errors, which are explained
    below:

    Around line 94:
        '=item' outside of any '=over'

    Around line 100:
        '=item' outside of any '=over'

    Around line 106:
        '=item' outside of any '=over'

    Around line 112:
        '=item' outside of any '=over'

    Around line 118:
        '=item' outside of any '=over'

    Around line 124:
        '=item' outside of any '=over'

--
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[hidden email]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
Reply | Threaded
Open this post in threaded view
|

[Bug 17168] Add a command line script for updating patron category based on status

bugzilla-daemon
In reply to this post by bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17168

--- Comment #5 from Barton Chittenden <[hidden email]> ---
The use of

    -n      No Action. With this flag set, script will report changes but not
            actually execute them on the database.

matches the options of j2a.pl, but I think that the use of

 --confirm  Don't commit changes to the database unless the --confirm option is
            used

Is preferred by the Koha community.

--
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[hidden email]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
Reply | Threaded
Open this post in threaded view
|

[Bug 17168] Add a command line script for updating patron category based on status

bugzilla-daemon
In reply to this post by bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17168

--- Comment #6 from Barton Chittenden <[hidden email]> ---
When -n is used, so that status is not updated, the script still prints

22 patrons updated

This is the kind of thing that makes my blood pressure go up until I
double-check in the database. Yes, I see at the top of the run, 'No actions
will be taken (test mode)', but I would still prefer

22 patrons would have been updated

Just for my peace of mind.

--
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[hidden email]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
Reply | Threaded
Open this post in threaded view
|

[Bug 17168] Add a command line script for updating patron category based on status

bugzilla-daemon
In reply to this post by bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17168

Nick Clemens <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #60280|0                           |1
        is obsolete|                            |

--- Comment #7 from Nick Clemens <[hidden email]> ---
Created attachment 60665
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=60665&action=edit
Bug 17168 - Add a command line script for updating patron category based on
status

This patch adds a new script update_patrons_category.pl which allows for
updating patron categories in a batch upon meeting provided criteria.
This script additionally can replace j2a.pl.

To test:
1 - perl update_patrons_category.pl -h
2 - Ensure help text makes sense and covers all options
3 - Test converting patrons supplying only fromcat and tocat
    perl update_patrons_category.pl -f PT -t J -v --confirm
    perl update_patrons_category.pl -f J -t PT -v --confirm
4 - All patrons should have been switched to and from Juveniles
5 - Try without --confirm switch
    perl update_patrons_category.pl -f PT -t J -v
6 - Should list all patrons but not update
7 - Set the age for juvenile patrons to be outside the range provided in
categories (or set the upper age limit for juveniles to '2')
8 - Test with verbosity and with without --confirm
    perl update_patrons_category.pl -f J -a -t PT -v
    perl update_patrons_category.pl -f J -a -t PT -v --confirm
9 - Repeat above and verify linked/unlinked guarantors are removed in above
scenario
10 - Test various fine and registration limits
11 - Test matching on specific fields i.e. --field surname=acosta
12 - Sign off

Sponsored by: Round Rock Public Library
(https://www.roundrocktexas.gov/departments/library/)

--
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[hidden email]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
Reply | Threaded
Open this post in threaded view
|

[Bug 17168] Add a command line script for updating patron category based on status

bugzilla-daemon
In reply to this post by bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17168

Liz Rea <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[hidden email]

--- Comment #8 from Liz Rea <[hidden email]> ---
Hi Nick,

I think this exists already in the form of j2a.pl, though it may not be as
extensible as this verison.

--
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[hidden email]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
Reply | Threaded
Open this post in threaded view
|

[Bug 17168] Add a command line script for updating patron category based on status

bugzilla-daemon
In reply to this post by bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17168

--- Comment #9 from Nick Clemens <[hidden email]> ---
(In reply to Liz Rea from comment #8)
> Hi Nick,
>
> I think this exists already in the form of j2a.pl, though it may not be as
> extensible as this verison.

Yup, the idea was initially to make a script to update new patrons to regular
patrons after a period of time. I added as much flexibility as possible, and
included the j2a functionality so we could have a single script instead of two

--
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[hidden email]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
Reply | Threaded
Open this post in threaded view
|

[Bug 17168] Add a command line script for updating patron category based on status

bugzilla-daemon
In reply to this post by bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17168

Barton Chittenden <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|Needs Signoff               |ASSIGNED

--- Comment #10 from Barton Chittenden <[hidden email]> ---
Per Nick 'Yes, you can mark it as assigned - it needs rewrites to respect
current guidelines'

--
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[hidden email]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
Reply | Threaded
Open this post in threaded view
|

[Bug 17168] Add a command line script for updating patron category based on status

bugzilla-daemon
In reply to this post by bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17168

--- Comment #11 from Nick Clemens <[hidden email]> ---
To be done:
Move business/logic to a module
Add unit tests
Remove MySQLisms

--
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[hidden email]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
Reply | Threaded
Open this post in threaded view
|

[Bug 17168] Add a command line script for updating patron category based on status

bugzilla-daemon
In reply to this post by bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17168

Nick Clemens <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |Needs Signoff

--
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[hidden email]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
Reply | Threaded
Open this post in threaded view
|

[Bug 17168] Add a command line script for updating patron category based on status

bugzilla-daemon
In reply to this post by bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17168

Nick Clemens <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #60665|0                           |1
        is obsolete|                            |

--- Comment #12 from Nick Clemens <[hidden email]> ---
Created attachment 70921
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=70921&action=edit
Bug 17168 - Add a command line script for updating patron category based on
status

This patch adds a new script update_patrons_category.pl which allows for
updating patron categories in a batch upon meeting provided criteria.
This script additionally can replace j2a.pl.

To test:
1 - perl update_patrons_category.pl -h
2 - Ensure help text makes sense and covers all options
3 - Test converting patrons supplying only fromcat and tocat
    perl update_patrons_category.pl -f PT -t J -v --confirm
    perl update_patrons_category.pl -f J -t PT -v --confirm
4 - All patrons should have been switched to and from Juveniles
5 - Try without --confirm switch
    perl update_patrons_category.pl -f PT -t J -v
6 - Should list all patrons but not update
7 - Set the age for juvenile patrons to be outside the range provided in
categories (or set the upper age limit for juveniles to '2')
8 - Test with verbosity and with without --confirm
    perl update_patrons_category.pl -f J -a -t PT -v
    perl update_patrons_category.pl -f J -a -t PT -v --confirm
9 - Repeat above and verify linked/unlinked guarantors are removed in above
scenario
10 - Test various fine and registration limits
11 - Test matching on specific fields i.e. --field surname=acosta
12 - Sign off

Sponsored by: Round Rock Public Library
(https://www.roundrocktexas.gov/departments/library/)

--
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[hidden email]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
Reply | Threaded
Open this post in threaded view
|

[Bug 17168] Add a command line script for updating patron category based on status

bugzilla-daemon
In reply to this post by bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17168

Jesse Maseto <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|Needs Signoff               |Signed Off

--
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[hidden email]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
Reply | Threaded
Open this post in threaded view
|

[Bug 17168] Add a command line script for updating patron category based on status

bugzilla-daemon
In reply to this post by bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17168

Jesse Maseto <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #70921|0                           |1
        is obsolete|                            |

--- Comment #13 from Jesse Maseto <[hidden email]> ---
Created attachment 73012
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=73012&action=edit
Bug 17168 - Add a command line script for updating patron category based on
status

This patch adds a new script update_patrons_category.pl which allows for
updating patron categories in a batch upon meeting provided criteria.
This script additionally can replace j2a.pl.

To test:
1 - perl update_patrons_category.pl -h
2 - Ensure help text makes sense and covers all options
3 - Test converting patrons supplying only fromcat and tocat
    perl update_patrons_category.pl -f PT -t J -v --confirm
    perl update_patrons_category.pl -f J -t PT -v --confirm
4 - All patrons should have been switched to and from Juveniles
5 - Try without --confirm switch
    perl update_patrons_category.pl -f PT -t J -v
6 - Should list all patrons but not update
7 - Set the age for juvenile patrons to be outside the range provided in
categories (or set the upper age limit for juveniles to '2')
8 - Test with verbosity and with without --confirm
    perl update_patrons_category.pl -f J -a -t PT -v
    perl update_patrons_category.pl -f J -a -t PT -v --confirm
9 - Repeat above and verify linked/unlinked guarantors are removed in above
scenario
10 - Test various fine and registration limits
11 - Test matching on specific fields i.e. --field surname=acosta
12 - Sign off

Sponsored by: Round Rock Public Library
(https://www.roundrocktexas.gov/departments/library/)

Signed-off-by: Jesse Maseto <[hidden email]>

--
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[hidden email]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
Reply | Threaded
Open this post in threaded view
|

[Bug 17168] Add a command line script for updating patron category based on status

bugzilla-daemon
In reply to this post by bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17168

Katrin Fischer <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|Signed Off                  |Patch doesn't apply
                 CC|                            |[hidden email]

--- Comment #14 from Katrin Fischer <[hidden email]> ---
Patch doesn't apply, please rebase!

Apply? [(y)es, (n)o, (i)nteractive] y
Applying: Bug 17168 - Add a command line script for updating patron category
based on status
Using index info to reconstruct a base tree...
M       Koha/Patrons.pm
Falling back to patching base and 3-way merge...
Auto-merging Koha/Patrons.pm
CONFLICT (content): Merge conflict in Koha/Patrons.pm
Failed to merge in the changes.
Patch failed at 0001 Bug 17168 - Add a command line script for updating patron
category based on status
The copy of the patch that failed is found in:
   /home/vagrant/kohaclone/.git/rebase-apply/patch
When you have resolved this problem run "git bz apply --continue".
If you would prefer to skip this patch, instead run "git bz apply --skip".
To restore the original branch and stop patching run "git bz apply --abort".
Patch left in
/tmp/Bug-17168---Add-a-command-line-script-for-updating-hwoO66.patch

--
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[hidden email]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
Reply | Threaded
Open this post in threaded view
|

[Bug 17168] Add a command line script for updating patron category based on status

bugzilla-daemon
In reply to this post by bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17168

Nick Clemens <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|Patch doesn't apply         |Signed Off

--
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[hidden email]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
Reply | Threaded
Open this post in threaded view
|

[Bug 17168] Add a command line script for updating patron category based on status

bugzilla-daemon
In reply to this post by bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17168

Nick Clemens <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #73012|0                           |1
        is obsolete|                            |

--- Comment #15 from Nick Clemens <[hidden email]> ---
Created attachment 74936
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=74936&action=edit
Bug 17168 - Add a command line script for updating patron category based on
status

This patch adds a new script update_patrons_category.pl which allows for
updating patron categories in a batch upon meeting provided criteria.
This script additionally can replace j2a.pl.

To test:
1 - perl update_patrons_category.pl -h
2 - Ensure help text makes sense and covers all options
3 - Test converting patrons supplying only fromcat and tocat
    perl update_patrons_category.pl -f PT -t J -v --confirm
    perl update_patrons_category.pl -f J -t PT -v --confirm
4 - All patrons should have been switched to and from Juveniles
5 - Try without --confirm switch
    perl update_patrons_category.pl -f PT -t J -v
6 - Should list all patrons but not update
7 - Set the age for juvenile patrons to be outside the range provided in
categories (or set the upper age limit for juveniles to '2')
8 - Test with verbosity and with without --confirm
    perl update_patrons_category.pl -f J -a -t PT -v
    perl update_patrons_category.pl -f J -a -t PT -v --confirm
9 - Repeat above and verify linked/unlinked guarantors are removed in above
scenario
10 - Test various fine and registration limits
11 - Test matching on specific fields i.e. --field surname=acosta
12 - Sign off

Sponsored by: Round Rock Public Library
(https://www.roundrocktexas.gov/departments/library/)

Signed-off-by: Jesse Maseto <[hidden email]>

--
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[hidden email]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
Reply | Threaded
Open this post in threaded view
|

[Bug 17168] Add a command line script for updating patron category based on status

bugzilla-daemon
In reply to this post by bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17168

Jonathan Druart <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[hidden email]-c
                   |                            |ommunity.org
             Status|Signed Off                  |Failed QA

--- Comment #16 from Jonathan Druart <[hidden email]> ---
Can you refresh this script a bit please?

At first glance, at least:
1. Indentation
2. More readable options
3. More readable parameters
4. I do not think update_category should be a Koha::Patrons method, to me it
belongs to Koha::Patron
5. Why?
+    my $remove_guarantor = ( $to_cat->category_type ne 'C' ||
$to_cat->category_type ne 'P' ) ? 1 : 0;
6. Date handling is not the way to do

--
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[hidden email]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
Reply | Threaded
Open this post in threaded view
|

[Bug 17168] Add a command line script for updating patron category based on status

bugzilla-daemon
In reply to this post by bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17168

Nick Clemens <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|Failed QA                   |Signed Off

--
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[hidden email]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
Reply | Threaded
Open this post in threaded view
|

[Bug 17168] Add a command line script for updating patron category based on status

bugzilla-daemon
In reply to this post by bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17168

--- Comment #17 from Nick Clemens <[hidden email]> ---
Created attachment 75698
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=75698&action=edit
Bug 17168: (follow-up) Tidy, clean params/options, use date tools

--
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[hidden email]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
Reply | Threaded
Open this post in threaded view
|

[Bug 17168] Add a command line script for updating patron category based on status

bugzilla-daemon
In reply to this post by bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17168

--- Comment #18 from Nick Clemens <[hidden email]> ---
(In reply to Jonathan Druart from comment #16)
> 1. Indentation
Tidied

> 2. More readable options
> 3. More readable parameters
OK, longer names available

> 4. I do not think update_category should be a Koha::Patrons method, to me it
> belongs to Koha::Patron
Hmm, I don't know that it does enough to a single patron to be a method, the
utility is acting on many at once. I can move if you feel strongly

> 5. Why?
> +    my $remove_guarantor = ( $to_cat->category_type ne 'C' ||
> $to_cat->category_type ne 'P' ) ? 1 : 0;
When this was written adults couldn't have guarantors and we stripped them when
updating - I suppose this can be removed?

> 6. Date handling is not the way to do
OK, fixed

--
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[hidden email]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
Reply | Threaded
Open this post in threaded view
|

[Bug 17168] Add a command line script for updating patron category based on status

bugzilla-daemon
In reply to this post by bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17168

--- Comment #19 from Nick Clemens <[hidden email]> ---
(In reply to Nick Clemens from comment #18)
> > 5. Why?
> > +    my $remove_guarantor = ( $to_cat->category_type ne 'C' ||
> > $to_cat->category_type ne 'P' ) ? 1 : 0;
> When this was written adults couldn't have guarantors and we stripped them
> when updating - I suppose this can be removed?
Ah, j2a still does this - I think removing for children makes sense, maybe not
touch otherwise so maybe:
my $remove_guarantor = ( $from_cat->category_type eq 'C');

--
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[hidden email]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
Reply | Threaded
Open this post in threaded view
|

[Bug 17168] Add a command line script for updating patron category based on status

bugzilla-daemon
In reply to this post by bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17168

--- Comment #20 from Jonathan Druart <[hidden email]> ---
(In reply to Nick Clemens from comment #18)
> > 4. I do not think update_category should be a Koha::Patrons method, to me it
> > belongs to Koha::Patron
> Hmm, I don't know that it does enough to a single patron to be a method, the
> utility is acting on many at once. I can move if you feel strongly

The method iterates on the patrons, so to me it should be replaced with:
    while ( my $p = $patrons->next ) {
        $p->update_category($params);
    }
and the method moved.

As the signoff comes from Jesse I would prefer to wait for another QA point of
view anyway.

--
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[hidden email]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
Reply | Threaded
Open this post in threaded view
|

[Bug 17168] Add a command line script for updating patron category based on status

bugzilla-daemon
In reply to this post by bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17168

Martin Renvoize <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |martin.renvoize@ptfs-europe
                   |                            |.com

--- Comment #21 from Martin Renvoize <[hidden email]> ---
I intend on writing a much more generic 'filter_by' method for the
Koha::Patrons class which could easily be shared between bulk deletions, bulk
anonymizations and this bulk category change enhancement along with some others
down the line.. it seems somewhat crazy to add a method for each type of
filtering (feels like we're backing ourselves into the same position we ended
up in C4)..

I'll submit that against bug 11983 which I've adopted.. and likely build a
small tree of bugs hanging off it that could use this..

Obviously this is just my opinionated ramblings, but thought it worth
highlighting the intention to write similar code.

--
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[hidden email]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
Reply | Threaded
Open this post in threaded view
|

[Bug 17168] Add a command line script for updating patron category based on status

bugzilla-daemon
In reply to this post by bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17168

--- Comment #22 from Martin Renvoize <[hidden email]> ---
As a hint at where I'm going with it.. I had to throw something together
quickly for customers to satisfy GDPR
https://gist.github.com/mrenvoize/a0c37b1350d1fe532143784dee124b80.. It's
basically pulling out the construction of the $where and $attr 'select' clause
that I'm looking to put in a `filter_by` method

--
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[hidden email]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
123