Bugzilla – Attachment 101215 Details for
Bug 20443
Move C4::Members::Attributes to Koha namespace
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 20443: Remove DeleteBorrowerAttributes
Bug-20443-Remove-DeleteBorrowerAttributes.patch (text/plain), 2.97 KB, created by
Jonathan Druart
on 2020-03-20 15:05:19 UTC
(
hide
)
Description:
Bug 20443: Remove DeleteBorrowerAttributes
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2020-03-20 15:05:19 UTC
Size:
2.97 KB
patch
obsolete
>From afe7ebfdc25d9de49e7d5e6ed453061b655045e1 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Fri, 13 Jul 2018 12:42:08 -0300 >Subject: [PATCH] Bug 20443: Remove DeleteBorrowerAttributes > >This subroutine was only used once, easy to replace. >SetBorrowerAttributes must replace the attributes for the ones logged-in >user is allowed to edit, that's why we filter by the library limits > >Signed-off-by: Nick Clemens <nick@bywatersolutions.com> >--- > C4/Members/Attributes.pm | 40 ++++++--------------------------------- > Koha/Patron/Attributes.pm | 2 +- > 2 files changed, 7 insertions(+), 35 deletions(-) > >diff --git a/C4/Members/Attributes.pm b/C4/Members/Attributes.pm >index 96fb139410..d52584096c 100644 >--- a/C4/Members/Attributes.pm >+++ b/C4/Members/Attributes.pm >@@ -128,7 +128,12 @@ sub SetBorrowerAttributes { > > my $dbh = C4::Context->dbh; > >- DeleteBorrowerAttributes( $borrowernumber, $no_branch_limit ); >+ my $attributes = Koha::Patrons->find($borrowernumber)->get_extended_attributes; >+ >+ unless ( $no_branch_limit ) { >+ $attributes = $attributes->filter_by_branch_limitations; >+ } >+ $attributes->delete; > > my $sth = $dbh->prepare("INSERT INTO borrower_attributes (borrowernumber, code, attribute) > VALUES (?, ?, ?)"); >@@ -142,39 +147,6 @@ sub SetBorrowerAttributes { > return 1; # borrower attributes successfully set > } > >-=head2 DeleteBorrowerAttributes >- >- DeleteBorrowerAttributes($borrowernumber); >- >-Delete borrower attributes for the patron identified by C<$borrowernumber>. >- >-=cut >- >-sub DeleteBorrowerAttributes { >- my $borrowernumber = shift; >- my $no_branch_limit = @_ ? shift : 0; >- my $branch_limit = $no_branch_limit >- ? 0 >- : C4::Context->userenv ? C4::Context->userenv->{"branch"} : 0; >- >- my $dbh = C4::Context->dbh; >- my $query = q{ >- DELETE borrower_attributes FROM borrower_attributes >- }; >- >- $query .= $branch_limit >- ? q{ >- LEFT JOIN borrower_attribute_types_branches ON bat_code = code >- WHERE ( b_branchcode = ? OR b_branchcode IS NULL ) >- AND borrowernumber = ? >- } >- : q{ >- WHERE borrowernumber = ? >- }; >- >- $dbh->do( $query, undef, $branch_limit ? $branch_limit : (), $borrowernumber ); >-} >- > =head2 DeleteBorrowerAttribute > > DeleteBorrowerAttribute($borrowernumber, $attribute); >diff --git a/Koha/Patron/Attributes.pm b/Koha/Patron/Attributes.pm >index f7289a0be0..47ba594f74 100644 >--- a/Koha/Patron/Attributes.pm >+++ b/Koha/Patron/Attributes.pm >@@ -41,7 +41,7 @@ my $attributes = Koha::Patron::Attributes->search( $params ); > sub search { > my ( $self, $params, $attributes ) = @_; > >- unless ( exists $attributes->{order_by} ) { $attributes->{order_by} = ['code', 'attribute'] } >+ unless ( exists $attributes->{order_by} ) { $attributes->{order_by} = ['me.code', 'attribute'] } > > return $self->SUPER::search( $params, $attributes ); > } >-- >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 20443
:
101122
|
101123
|
101124
|
101125
|
101126
|
101127
|
101128
|
101129
|
101130
|
101131
|
101132
|
101133
|
101134
|
101135
|
101136
|
101137
|
101138
|
101139
|
101140
|
101141
|
101142
|
101143
|
101144
|
101145
|
101146
|
101147
|
101148
|
101149
|
101150
|
101209
|
101210
|
101211
|
101212
|
101213
|
101214
| 101215 |
101216
|
101217
|
101218
|
101219
|
101220
|
101221
|
101222
|
101223
|
101224
|
101225
|
101226
|
101227
|
101228
|
101229
|
101230
|
101231
|
101232
|
101233
|
101234
|
101235
|
101236
|
101237
|
101472
|
104519