Bugzilla – Attachment 139799 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]
Bug 31458: Add add_restriction to Koha::Patron
Bug-31458-Add-addrestriction-to-KohaPatron.patch (text/plain), 1.74 KB, created by
Martin Renvoize (ashimema)
on 2022-08-25 15:30:09 UTC
(
hide
)
Description:
Bug 31458: Add add_restriction to Koha::Patron
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2022-08-25 15:30:09 UTC
Size:
1.74 KB
patch
obsolete
>From 73e9dfb80838c32576468432bec9dba813bf74f6 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Thu, 25 Aug 2022 12:13:08 +0100 >Subject: [PATCH] Bug 31458: Add add_restriction to Koha::Patron > >This patch adds the beggnings of an add_restriction method to >Koha::Patron. >--- > Koha/Patron.pm | 33 ++++++++++++++++++++++++++++++++- > 1 file changed, 32 insertions(+), 1 deletion(-) > >diff --git a/Koha/Patron.pm b/Koha/Patron.pm >index 2080c33504..3699574ecb 100644 >--- a/Koha/Patron.pm >+++ b/Koha/Patron.pm >@@ -1223,8 +1223,9 @@ sub overdues { > ); > } > >+=head3 Patron Restrictions > >-=head3 restrictions >+=head4 restrictions > > my $restrictions = $patron->restrictions; > >@@ -1238,6 +1239,36 @@ sub restrictions { > return Koha::Patron::Restrictions->_new_from_dbic($restrictions_rs); > } > >+=head4 add_restriction >+ >+ my $new_restriction = $patron->add_restriction({}); >+ >+Method to add a new restriction to a patrons account >+ >+=cut >+ >+sub add_restriction { >+ my ($self, $params) = @_; >+ >+ my $manager_id = $params->{'manager_id'}; >+ $manager_id //= C4::Context->userenv ? C4::Context->userenv->{'number'} : undef; >+ >+ my $restriction_rs = $self->_result->add_to_borrower_debarments( >+ { >+ expiration => $params->{expiration}, >+ type => $params->{type}, >+ comment => $params->{comment}, >+ manager_id => $manager_id, >+ created => \'NOW()' >+ } >+ )->discard_changes; >+ >+ # FIXME: Drop this next >+ Koha::Patron::Debarments::UpdateBorrowerDebarmentFlags($self->borrowernumber); >+ >+ return Koha::Patron::Restriction->_new_from_dbic($restriction_rs); >+} >+ > =head3 get_routing_lists > > my $routinglists = $patron->get_routing_lists >-- >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