The existing cronjob for transitioning juvenile patron types to adult patron types is limited to the point of uselessness. It needs to do the following: - Calculate update date based on the upper age limit defined in the patron categories. - Allow libraries to work on all branches or only one. - Allow libraries to specify which patron category to update child categories to. - Allow libraries to specify a single Child patron category to update to an adult category. Nice to have, but not essential: - Have a test mode to display what transforms would be done on the database without executing the changes. - email changes completed to the admin email address for the branch upon job execution. - allow more granular transitions - a "toddler" category to a "child" category, for example - one wouldn't need to change the patron type to A in this case. - allow specifying multiple from and to categories. - a way to do this from the UI, working in about the same way.
Created attachment 6209 [details] [review] Bug 7157 - Improve the j2a.pl cronjob - Calculates updates date based on the upper age limit defined in the patron categories. - Allows libraries to work on all branches or only one. - Allows libraries to specify which Adult patron category to update child categories to. - Allows libraries to specify a single Child patron category to update to an adult category. - Has a test mode to display what transforms would be done on the database without executing the changes. Includes improved help, copyright statement, and uses warnings. To test: Create two patron categories, a child and an adult category. Make sure they have an upper age limit. Create or modify some patrons in multiple branches that fall into the category of "my birthdate is less than or equal to today's date minus the upper age limit" 1. Run the script with no flags - nothing should happen, it will suggest you try the -help flag. 2. Run the script with the -help flag - you should see the help 3. Run the script with the -fromcat=<child category> -tocat=<adult category> -v -n - should show you results from all branches but take no action and tell you what its computations are. 4. Run the script with the -fromcat=<child category> -tocat=<adult category> -branch=<branchcode> -v -n - should show you results from your specified branch, but take no action and tell you what it's computations are. 5. Run the script with the -fromcat=<child category> -tocat=<adult category> -v -branch=<branchcode> - should show you the computations and tell you how many patrons were modified in your single branch. It will not show you the information on which patrons were updated. 6. Run the script with the -fromcat=<child category> -tocat=<adult category> -v - should show you the computations and tell you how many patrons were modified across all branches. 7. Run the script without the -v flag, if you care what the non-verbose output looks like. There is more this script could do, please feel free to take it and run.
Created attachment 6250 [details] [review] Bug 7157 - Improve the j2a.pl cronjob - Calculates updates date based on the upper age limit defined in the patron categories. - Allows libraries to work on all branches or only one. - Allows libraries to specify which Adult patron category to update child categories to. - Allows libraries to specify a single Child patron category to update to an adult category. - Has a test mode to display what transforms would be done on the database without executing the changes. Includes improved help, copyright statement, and uses warnings. To test: Create two patron categories, a child and an adult category. Make sure they have an upper age limit. Create or modify some patrons in multiple branches that fall into the category of "my birthdate is less than or equal to today's date minus the upper age limit" 1. Run the script with no flags - nothing should happen, it will suggest you try the -help flag. 2. Run the script with the -help flag - you should see the help 3. Run the script with the -fromcat=<child category> -tocat=<adult category> -v -n - should show you results from all branches but take no action and tell you what its computations are. 4. Run the script with the -fromcat=<child category> -tocat=<adult category> -branch=<branchcode> -v -n - should show you results from your specified branch, but take no action and tell you what it's computations are. 5. Run the script with the -fromcat=<child category> -tocat=<adult category> -v -branch=<branchcode> - should show you the computations and tell you how many patrons were modified in your single branch. It will not show you the information on which patrons were updated. 6. Run the script with the -fromcat=<child category> -tocat=<adult category> -v - should show you the computations and tell you how many patrons were modified across all branches. 7. Run the script without the -v flag, if you care what the non-verbose output looks like. There is more this script could do, please feel free to take it and run. Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
QA Comment: Code looks good. Did not test it, but has a solid signoff. Marked as Passed QA.
(In reply to comment #3) > QA Comment: Code looks good. Did not test it, but has a solid signoff. Marked > as Passed QA. Applies, but with whitespace errors.
A small problem not noticed by Marcel or Chris: the syntax of the parameters: http://search.cpan.org/~jv/Getopt-Long-2.38/lib/Getopt/Long.pm => 1 character parameters are called with a single -, others are with -- the -man means in fact -m -a -n the -help means -h -e -l -p You should have written --help and --man Your script is working, but: * a new option/parameter may result in strange results that will be hard to understand * cronjob scripts are with -- for long options So, please resubmit your patch with help=s and updated documentation (great script though !)
Created attachment 6723 [details] [review] Bug 7157 - Improve the j2a.pl cronjob - Calculates updates date based on the upper age limit defined in the patron categories. - Allows libraries to work on all branches or only one. - Allows libraries to specify which Adult patron category to update child categories to. - Allows libraries to specify a single Child patron category to update to an adult category. - Has a test mode to display what transforms would be done on the database without executing the changes. Includes improved help, copyright statement, and uses warnings. Also incorporates Paul's suggestions regarding --help and --man. To test: Create two patron categories, a child and an adult category. Make sure they have an upper age limit. Create or modify some patrons in multiple branches that fall into the category of "my birthdate is less than or equal to today's date minus the upper age limit" 1. Run the script with no flags - nothing should happen, it will suggest you try the -help flag. 2. Run the script with the -help flag - you should see the help 3. Run the script with the -fromcat=<child category> -tocat=<adult category> -v -n - should show you results from all branches but take no action and tell you what its computations are. 4. Run the script with the -fromcat=<child category> -tocat=<adult category> -branch=<branchcode> -v -n - should show you results from your specified branch, but take no action and tell you what it's computations are. 5. Run the script with the -fromcat=<child category> -tocat=<adult category> -v -branch=<branchcode> - should show you the computations and tell you how many patrons were modified in your single branch. It will not show you the information on which patrons were updated. 6. Run the script with the -fromcat=<child category> -tocat=<adult category> -v - should show you the computations and tell you how many patrons were modified across all branches. 7. Run the script without the -v flag, if you care what the non-verbose output looks like. Known limitation - if you give it an unknown tocat, it will fail with a rather ugly error. I'm going to fix that but in another patch. There is more this script could do, please feel free to take it and run.
Comment on attachment 6723 [details] [review] Bug 7157 - Improve the j2a.pl cronjob Gah. Too late in the day and I did it wrong.
Created attachment 6724 [details] [review] Bug 7157 - Improve the j2a.pl cronjob - Calculates updates date based on the upper age limit defined in the patron categories. - Allows libraries to work on all branches or only one. - Allows libraries to specify which Adult patron category to update child categories to. - Allows libraries to specify a single Child patron category to update to an adult category. - Has a test mode to display what transforms would be done on the database without executing the changes. Includes improved help, copyright statement, and uses warnings. Also incorporates Paul's suggestions regarding --help and --man. To test: Create two patron categories, a child and an adult category. Make sure they have an upper age limit. Create or modify some patrons in multiple branches that fall into the category of "my birthdate is less than or equal to today's date minus the upper age limit" 1. Run the script with no flags - nothing should happen, it will suggest you try the -help flag. 2. Run the script with the -help flag - you should see the help 3. Run the script with the -fromcat=<child category> -tocat=<adult category> -v -n - should show you results from all branches but take no action and tell you what its computations are. 4. Run the script with the -fromcat=<child category> -tocat=<adult category> -branch=<branchcode> -v -n - should show you results from your specified branch, but take no action and tell you what it's computations are. 5. Run the script with the -fromcat=<child category> -tocat=<adult category> -v -branch=<branchcode> - should show you the computations and tell you how many patrons were modified in your single branch. It will not show you the information on which patrons were updated. 6. Run the script with the -fromcat=<child category> -tocat=<adult category> -v - should show you the computations and tell you how many patrons were modified across all branches. 7. Run the script without the -v flag, if you care what the non-verbose output looks like. Known limitation - if you give it an unknown tocat, it will fail with a rather ugly error. I'm going to fix that but in another patch. There is more this script could do, please feel free to take it and run.
Created attachment 6757 [details] [review] Bug 7157 - followup - error catching for nonexistent categories. This applies on top of the original patch - may not be the best implementation ever, suggestions are welcome.
Sorry liz The script still has -branch -fromcat -tocat which should either be -b -f -t or --branch --fromcat --tocat
Before I submit making them all -b -t -f Is there a preference for which way they go? No landmines? ;)
Created attachment 7004 [details] [review] Bug 7157 - Improve the j2a.pl cronjob - Calculates updates date based on the upper age limit defined in the patron categories. - Allows libraries to work on all branches or only one. - Allows libraries to specify which Adult patron category to update child categories to. - Allows libraries to specify a single Child patron category to update to an adult category. - Has a test mode to display what transforms would be done on the database without executing the changes. Includes improved help, copyright statement, and uses warnings. Also incorporates Paul's suggestions regarding --help and --man. To test: Create two patron categories, a child and an adult category. Make sure they have an upper age limit. Create or modify some patrons in multiple branches that fall into the category of "my birthdate is less than or equal to today's date minus the upper age limit" 1. Run the script with no flags - nothing should happen, it will suggest you try the -help flag. 2. Run the script with the -help flag - you should see the help 3. Run the script with the -f=<child category> -t=<adult category> -v -n - should show you results from all branches but take no action and tell you what its computations are. 4. Run the script with the -f=<child category> -t=<adult category> -b=<branchcode> -v -n - should show you results from your specified branch, but take no action and tell you what it's computations are. 5. Run the script with the -f=<child category> -t=<adult category> -v -b=<branchcode> - should show you the computations and tell you how many patrons were modified in your single branch. It will not show you the information on which patrons were updated. 6. Run the script with the -f=<child category> -t=<adult category> -v - should show you the computations and tell you how many patrons were modified across all branches. 7. Run the script without the -v flag, if you care what the non-verbose output looks like. Fixed in this revision: Known limitation - if you give it an unknown tocat, it will fail with a rather ugly error. There is more this script could do, please feel free to take it and run.
Created attachment 7005 [details] [review] Bug 7157 - Improve the j2a.pl cronjob - Calculates updates date based on the upper age limit defined in the patron categories. - Allows libraries to work on all branches or only one. - Allows libraries to specify which Adult patron category to update child categories to. - Allows libraries to specify a single Child patron category to update to an adult category. - Has a test mode to display what transforms would be done on the database without executing the changes. Includes improved help, copyright statement, and uses warnings. Also incorporates Paul's suggestions regarding --help and --man. To test: Create two patron categories, a child and an adult category. Make sure they have an upper age limit. Create or modify some patrons in multiple branches that fall into the category of "my birthdate is less than or equal to today's date minus the upper age limit" 1. Run the script with no flags - nothing should happen, it will suggest you try the --help flag. 2. Run the script with the --help flag - you should see the help 3. Run the script with the -f=<child category> -t=<adult category> -v -n - should show you results from all branches but take no action and tell you what its computations are. 4. Run the script with the -f=<child category> -t=<adult category> -b=<branchcode> -v -n - should show you results from your specified branch, but take no action and tell you what it's computations are. 5. Run the script with the -f=<child category> -t=<adult category> -v -b=<branchcode> - should show you the computations and tell you how many patrons were modified in your single branch. It will not show you the information on which patrons were updated. 6. Run the script with the -f=<child category> -t=<adult category> -v - should show you the computations and tell you how many patrons were modified across all branches. 7. Run the script without the -v flag, if you care what the non-verbose output looks like. Fixed in this revision: Known limitation - if you give it an unknown tocat, it will fail with a rather ugly error. Minor changes to the commit message to reflect new longopts (which I missed the last time) There is more this script could do, please feel free to take it and run.
Created attachment 7131 [details] [review] Bug 7157 - Improve the j2a.pl cronjob - Calculates updates date based on the upper age limit defined in the patron categories. - Allows libraries to work on all branches or only one. - Allows libraries to specify which Adult patron category to update child categories to. - Allows libraries to specify a single Child patron category to update to an adult category. - Has a test mode to display what transforms would be done on the database without executing the changes. Includes improved help, copyright statement, and uses warnings. Also incorporates Paul's suggestions regarding --help and --man. To test: Create two patron categories, a child and an adult category. Make sure they have an upper age limit. Create or modify some patrons in multiple branches that fall into the category of "my birthdate is less than or equal to today's date minus the upper age limit" 1. Run the script with no flags - nothing should happen, it will suggest you try the --help flag. 2. Run the script with the --help flag - you should see the help 3. Run the script with the -f=<child category> -t=<adult category> -v -n - should show you results from all branches but take no action and tell you what its computations are. 4. Run the script with the -f=<child category> -t=<adult category> -b=<branchcode> -v -n - should show you results from your specified branch, but take no action and tell you what it's computations are. 5. Run the script with the -f=<child category> -t=<adult category> -v -b=<branchcode> - should show you the computations and tell you how many patrons were modified in your single branch. It will not show you the information on which patrons were updated. 6. Run the script with the -f=<child category> -t=<adult category> -v - should show you the computations and tell you how many patrons were modified across all branches. 7. Run the script without the -v flag, if you care what the non-verbose output looks like. Fixed in this revision: Known limitation - if you give it an unknown tocat, it will fail with a rather ugly error. Minor changes to the commit message to reflect new longopts (which I missed the last time) There is more this script could do, please feel free to take it and run. Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Created attachment 7132 [details] [review] Bug 7157 : Follow up, fixing FSF address
Created attachment 7137 [details] [review] [SIGNED] Followup for FSF address
QA: On the first patch I see this construct a few times: SET categorycode='A', guarantorid ='0', categorycode =? Could you correct that please? You only need to update the code once ;)
Sorry, but yet another "dumb" question: Couldn't this be done easier: AND categorycode IN (select categorycode from categories where category_type='C' and categorycode=?)|; Don't you mean categorycode=? Do you still need the check on type=C?
Created attachment 7201 [details] [review] Bug 7157 - Improve the j2a.pl cronjob - Calculates updates date based on the upper age limit defined in the patron categories. - Allows libraries to work on all branches or only one. - Allows libraries to specify which Adult patron category to update child categories to. - Allows libraries to specify a single Child patron category to update to an adult category. - Has a test mode to display what transforms would be done on the database without executing the changes. Includes improved help, copyright statement, and uses warnings. Also incorporates Paul's suggestions regarding --help and --man, changes -fromcat and -tocat to -f and -t, and removes a redundant update to categorycode (per M. deRooy). To test: Create two patron categories, a child and an adult category. Make sure they have an upper age limit. Create or modify some patrons in multiple branches that fall into the category of "my birthdate is less than or equal to today's date minus the upper age limit" 1. Run the script with no flags - nothing should happen, it will suggest you try the --help flag. 2. Run the script with the --help flag - you should see the help 3. Run the script with the -f=<child category> -t=<adult category> -v -n - should show you results from all branches but take no action and tell you what its computations are. 4. Run the script with the -f=<child category> -t=<adult category> -b=<branchcode> -v -n - should show you results from your specified branch, but take no action and tell you what it's computations are. 5. Run the script with the -f=<child category> -t=<adult category> -v -b=<branchcode> - should show you the computations and tell you how many patrons were modified in your single branch. It will not show you the information on which patrons were updated. 6. Run the script with the -f=<child category> -t=<adult category> -v - should show you the computations and tell you how many patrons were modified across all branches. 7. Run the script without the -v flag, if you care what the non-verbose output looks like. Fixed in this revision: Known limitation - if you give it an unknown tocat, it will fail with a rather ugly error. Minor changes to the commit message to reflect new longopts (which I missed the last time) There is more this script could do, please feel free to take it and run. Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz> Bug 7157 : Follow up, fixing FSF address Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
QA Comment: Thank you, Liz, for patiently resubmitting new versions. I am marking it again as Passed QA. Hopefully, Paul agrees too now ;)
mmm... the patch changes the permissions of this script and remove the x (executable). Could you confirm it's a mistake, (I can fix it when pushing, no problem)
I am sure that is a mistake. :)
*** Bug 3410 has been marked as a duplicate of this bug. ***