Bugzilla – Attachment 144967 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.76 KB, created by
Alex Buckley
on 2023-01-04 01:27:57 UTC
(
hide
)
Description:
Bug 32560: Cronjob to mark expired borrowers as lost their card
Filename:
MIME Type:
Creator:
Alex Buckley
Created:
2023-01-04 01:27:57 UTC
Size:
1.76 KB
patch
obsolete
>From 572bb2b5eb7cf02e875a0ab5620c708cd7bacd1b 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 >--- > misc/cronjobs/set_expired_lost.pl | 25 +++++++++++++++++++++++++ > 1 file changed, 25 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..e9a05c8f60 >--- /dev/null >+++ b/misc/cronjobs/set_expired_lost.pl >@@ -0,0 +1,25 @@ >+#!/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.20.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 32560
:
144967
|
145782
|
145989
|
146031
|
146032
|
147814
|
154222
|
154223
|
154224