Bugzilla – Attachment 44645 Details for
Bug 15157
Cronjob to automatically restrict patrons with pending/unpaid charges
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 15157 - Cronjob to automatically debar Borrowers/Patrons with pending/unpaid fines/accountlines
Bug-15157---Cronjob-to-automatically-debar-Borrowe.patch (text/plain), 2.69 KB, created by
Olli-Antti Kivilahti
on 2015-11-09 11:41:35 UTC
(
hide
)
Description:
Bug 15157 - Cronjob to automatically debar Borrowers/Patrons with pending/unpaid fines/accountlines
Filename:
MIME Type:
Creator:
Olli-Antti Kivilahti
Created:
2015-11-09 11:41:35 UTC
Size:
2.69 KB
patch
obsolete
>From 6445c9f34d65cd673a563e6b2fb2c0ae97d09df7 Mon Sep 17 00:00:00 2001 >From: Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> >Date: Mon, 9 Nov 2015 13:19:07 +0200 >Subject: [PATCH] Bug 15157 - Cronjob to automatically debar Borrowers/Patrons > with pending/unpaid fines/accountlines > >If your library wants to debar all Borrower who haven't paid their fines by the >end of the year, this script will do that trick :) >--- > misc/debarrBorrowersWithFines.pl | 73 ++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 73 insertions(+) > create mode 100755 misc/debarrBorrowersWithFines.pl > >diff --git a/misc/debarrBorrowersWithFines.pl b/misc/debarrBorrowersWithFines.pl >new file mode 100755 >index 0000000..f481a86 >--- /dev/null >+++ b/misc/debarrBorrowersWithFines.pl >@@ -0,0 +1,73 @@ >+#!/usr/bin/perl >+ >+use Modern::Perl; >+use Getopt::Long; >+ >+use C4::Accounts; >+use Koha::Borrower::Debarments; >+ >+my ($help, $confirm, $message, $expiration); >+GetOptions( >+ 'h|help' => \$help, >+ 'c|confirm:s' => \$confirm, >+ 'm|message:s' => \$message, >+ 'e|expiration:s' => \$expiration, >+); >+ >+my $HELP = <<HELP; >+ >+debarrBorrowersWithFines.pl >+ >+Creates a debarment for all Borrowers who have fines. >+ >+ -h --help This friendly reminder! >+ >+ -c --confirm Confirm that you want to make your Patrons MAD by barring >+ them from your library because they have ANY unpaid fines. >+ >+ -m --message MANDATORY. The description of the debarment visible to the end-user. >+ >+ -e --expiration OPTIONAL. When does the debarment expire? >+ As ISO8601 date, eg '2015-12-31' >+ >+ >+EXAMPLE: >+ >+ debarrBorrowersWithFines.pl --confirm -m "This is a description of you bad deeds" >+That did almost work. >+ >+ debarrBorrowersWithFines.pl -c MAD -m "You didn't play by our rules!" -e '2015-12-31' >+This works. Always RTFM. >+ >+HELP >+ >+if ($help) { >+ print $HELP; >+ exit 0; >+} >+elsif (not($confirm) || $confirm ne 'MAD' || not($message)) { >+ print $HELP; >+ exit 1; >+} >+elsif (not(length($message) > 20)) { >+ print $HELP; >+ print "\nYour --message is too short. A proper message to your end-users must be longer than 20 characters.\n"; >+ exit 1; >+} >+ >+my $badBorrowers = C4::Accounts::GetAllBorrowersWithUnpaidFines(); >+ >+foreach my $bb (@$badBorrowers) { >+ #Don't crash, but keep debarring as long as you can! >+ eval { >+ my $success = Koha::Borrower::Debarments::AddDebarment({ >+ borrowernumber => $bb->{borrowernumber}, >+ expiration => $expiration, >+ type => 'MANUAL', >+ comment => $message, >+ }); >+ }; >+ if ($@) { >+ print $@."\n"; >+ } >+} >\ No newline at end of file >-- >1.9.1
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 15157
:
44643
|
44645
|
44646
|
109220
|
124894
|
124895
|
124896
|
129701
|
129702
|
129703
|
129704
|
130103
|
158288
|
158289
|
158290
|
158291
|
158292
|
158315
|
158316
|
158317
|
158318