Bugzilla – Attachment 139800 Details for
Bug 31458
Remove Koha::Patron::Debarment::AddDebarment and use $patron->add_restriction in preference
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Add _update_patron_restriction_fields
Add-updatepatronrestrictionfields.patch (text/plain), 2.00 KB, created by
Martin Renvoize (ashimema)
on 2022-08-25 15:30:13 UTC
(
hide
)
Description:
Add _update_patron_restriction_fields
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2022-08-25 15:30:13 UTC
Size:
2.00 KB
patch
obsolete
>From b1619984654c58317f8f8b0f7b769f759f4d8d66 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Thu, 25 Aug 2022 16:28:18 +0100 >Subject: [PATCH] Add _update_patron_restriction_fields > >This still needs some work.. picking which of the two constructs for >ordering works and removing new lines from the debarredcomment field. > >Do we even need the local debarredcomment field any more... and should >the debarred field just become a boolean.. or should we just drop the >fields from the borrowers table entirely and rely on relations. > >https://bugs.koha-community.org/show_bug.cgi?id=31458 >--- > Koha/Patron.pm | 36 ++++++++++++++++++++++++++++++++++++ > 1 file changed, 36 insertions(+) > >diff --git a/Koha/Patron.pm b/Koha/Patron.pm >index 3699574ecb..dee75b7d22 100644 >--- a/Koha/Patron.pm >+++ b/Koha/Patron.pm >@@ -1247,6 +1247,42 @@ Method to add a new restriction to a patrons account > > =cut > >+sub _update_patron_restriction_fields { >+ my $self = $_; >+ >+ # OPTION ONE >+ my $restrictions = $self->restrictions->search( >+ { expiration => [ undef, { '>=' => \'CURRENT_DATE()' } ] }, >+ { >+ order_by => [ >+ { '-desc' => \'expiration IS NULL' }, >+ { '-desc' => 'expiration' } >+ ], >+ rows => 1 >+ } >+ ); >+ >+ # OPTION TWO >+ # my $restrictions = $self->restrictions->search( >+ # { expiration => [ undef, { '>=' => \'CURRENT_DATE()' } ] }, >+ # { >+ # order_by => { '-desc' => [ \'expiration IS NULL', 'expiration' ] }, >+ # rows => 1 >+ # } >+ #); >+ >+ my ( $expiration, $comment ); >+ if ( my $restriction = $restrictions->next ) { >+ $expiration = >+ defined( $restriction->expiration ) >+ ? $restriction->expiration >+ : '9999-12-31'; >+ $comment = $restriction->comment; >+ } >+ $self->set( { debarred => $expiration, debarredcomment => $comment } ) >+ ->store; >+} >+ > sub add_restriction { > my ($self, $params) = @_; > >-- >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 31458
:
139764
|
139799
| 139800