Bugzilla – Attachment 6723 Details for
Bug 7157
Improve the j2a.pl cronjob
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 7157 - Improve the j2a.pl cronjob
Bug-7157---Improve-the-j2apl-cronjob.patch (text/plain), 3.82 KB, created by
Liz Rea
on 2011-12-12 23:01:44 UTC
(
hide
)
Description:
Bug 7157 - Improve the j2a.pl cronjob
Filename:
MIME Type:
Creator:
Liz Rea
Created:
2011-12-12 23:01:44 UTC
Size:
3.82 KB
patch
obsolete
>From bbb6bd66577ab2e339d2924af6cec0f6c3e42b9e Mon Sep 17 00:00:00 2001 >From: Liz Rea <wizzyrea@gmail.com> >Date: Mon, 12 Dec 2011 16:54:26 -0600 >Subject: [PATCH] Bug 7157 - Improve the j2a.pl cronjob >Content-Type: text/plain; charset="utf-8" > >- 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. >--- > misc/cronjobs/j2a.pl | 15 +++++++++------ > 1 files changed, 9 insertions(+), 6 deletions(-) > >diff --git a/misc/cronjobs/j2a.pl b/misc/cronjobs/j2a.pl >index 9988d81..b445b10 100644 >--- a/misc/cronjobs/j2a.pl >+++ b/misc/cronjobs/j2a.pl >@@ -43,8 +43,8 @@ juv2adult.pl - convert juvenile/child patrons from juvenile patron category and > juv2adult.pl [ -branch=<branchcode> -fromcat=<categorycode> -tocat=<categorycode> ] > > Options: >- -help brief help message >- -man full documentation >+ --help brief help message >+ --man full documentation > -v verbose mode > -n take no action, display only > -branch <branchname> only deal with patrons from this library/branch >@@ -54,11 +54,11 @@ juv2adult.pl [ -branch=<branchcode> -fromcat=<categorycode> -tocat=<categorycode > > =over 8 > >-=item B<-help> >+=item B<--help> > > Print a brief help message and exits. > >-=item B<-man> >+=item B<--man> > > Prints the manual page and exits. > >@@ -140,6 +140,10 @@ my $sth=$dbh->prepare( $query ); > $sth->execute( $fromcat ) > or die "Couldn't execute statement: " . $sth->errstr; > my $agelimit = $sth->fetchrow_array(); >+if ( not $agelimit ) { >+ >+ die "No patron category with that category code. Please try again. \n"; >+} > $sth->finish( ); > $year -=$agelimit; > >@@ -222,8 +226,7 @@ if ( not $noaction) { > $birthday = $res[3]; > print "$firstname $surname $barcode $birthday\n"; > } >- } >+ } > $sth->finish( ); > } >- > $dbh->disconnect(); >-- >1.7.2.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 7157
:
6209
|
6250
|
6723
|
6724
|
6757
|
7004
|
7005
|
7131
|
7132
|
7137
|
7201