Bugzilla – Attachment 146031 Details for
Bug 32560
Mark expired borrowers as having lost their card
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 32560: Cronjob to mark expired borrowers as lost their card
Bug-32560-Cronjob-to-mark-expired-borrowers-as-los.patch (text/plain), 1.81 KB, created by
David Nind
on 2023-02-02 19:59:34 UTC
(
hide
)
Description:
Bug 32560: Cronjob to mark expired borrowers as lost their card
Filename:
MIME Type:
Creator:
David Nind
Created:
2023-02-02 19:59:34 UTC
Size:
1.81 KB
patch
obsolete
>From 65d0fd080e845643cd11bcb380ecf4f293504c9b Mon Sep 17 00:00:00 2001 >From: Alex Buckley <alexbuckley@catalyst.net.nz> >Date: Tue, 3 Jan 2023 23:24:00 +0000 >Subject: [PATCH] Bug 32560: Cronjob to mark expired borrowers as lost their > card > >Test plan: >1. Edit a borrower to have an expiration date in the past - also make >sure they have 'Lost card' set to 'No' > >2. Run the set_expired_lost.pl script: >sudo koha-shell <instance> >cd misc/cronjobs >./set_expired_lost.pl > >3. Notice you get output saying the number of borrowers are to be changed > >4. View the borrower account from #1 and notice they have a 'Lost card' >value of 'Yes' > >5. Run the set_expired_lost.pl script again and observe no output is >printed to the terminal - this is because all expired borrowers have >already been marked as lost. > >Sponsored-by: Dalton McCaughey Library, Australia >Signed-off-by: David Nind <david@davidnind.com> >--- > misc/cronjobs/set_expired_lost.pl | 24 ++++++++++++++++++++++++ > 1 file changed, 24 insertions(+) > create mode 100755 misc/cronjobs/set_expired_lost.pl > >diff --git a/misc/cronjobs/set_expired_lost.pl b/misc/cronjobs/set_expired_lost.pl >new file mode 100755 >index 0000000000..2dc17e4ed2 >--- /dev/null >+++ b/misc/cronjobs/set_expired_lost.pl >@@ -0,0 +1,24 @@ >+#!/usr/bin/perl >+ >+use strict; >+use C4::Context; >+ >+my $dbh = C4::Context->dbh(); >+my $DEBUG = 1; >+ >+my $sth = $dbh->prepare("SELECT COUNT(*) AS amount FROM borrowers WHERE dateexpiry < NOW() AND lost <> 1"); >+$sth->execute; >+my $row = $sth->fetchrow_hashref(); >+ >+# Output for email only if borrowers need changing >+if ($row->{'amount'}) { >+ $DEBUG && print $row->{'amount'} . " borrowers to be changed"; >+} >+$sth->finish(); >+ >+$sth = $dbh->prepare("UPDATE borrowers SET lost = 1 WHERE dateexpiry < NOW() AND lost <> 1"); >+ >+$sth->execute; >+ >+$sth->finish; >+$dbh->disconnect; >-- >2.30.2
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 32560
:
144967
|
145782
|
145989
|
146031
|
146032
|
147814
|
154222
|
154223
|
154224