Bugzilla – Attachment 101142 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: Use search_with_library_limits for attribute types
Bug-20443-Use-searchwithlibrarylimits-for-attribut.patch (text/plain), 5.70 KB, created by
Jonathan Druart
on 2020-03-20 14:48:12 UTC
(
hide
)
Description:
Bug 20443: Use search_with_library_limits for attribute types
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2020-03-20 14:48:12 UTC
Size:
5.70 KB
patch
obsolete
>From 1e7173e77664508200ed008b60bfb8af7a7e8b28 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 27 Nov 2019 15:35:07 +0100 >Subject: [PATCH] Bug 20443: Use search_with_library_limits for attribute types > >Dealt with that previously in the module during the rebase. >It conflicted with bug 23281. > >Signed-off-by: Signed-off-by: Nick Clemens <nick@bywatersolutions.com> >--- > C4/Auth_with_ldap.pm | 6 ++++-- > members/memberentry.pl | 3 ++- > members/moremember.pl | 3 ++- > reports/borrowers_stats.pl | 3 ++- > reports/issues_stats.pl | 3 ++- > tools/modborrowers.pl | 3 ++- > 6 files changed, 14 insertions(+), 7 deletions(-) > >diff --git a/C4/Auth_with_ldap.pm b/C4/Auth_with_ldap.pm >index 0599d9fb59..36b9071426 100644 >--- a/C4/Auth_with_ldap.pm >+++ b/C4/Auth_with_ldap.pm >@@ -231,7 +231,8 @@ sub checkpw_ldap { > return 0; # B2, D2 > } > if (C4::Context->preference('ExtendedPatronAttributes') && $borrowernumber && ($config{update} ||$config{replicate})) { >- my $attribute_types = Koha::Patron::Attribute::Types->filter_by_branch_limitations; >+ my $library_id = C4::Context->userenv ? C4::Context->userenv->{'branch'} : undef; >+ my $attribute_types = Koha::Patron::Attribute::Types->search_with_library_limits({}, {}, $library_id); > while ( my $attribute_type = $attribute_types->next ) { > my $code = $attribute_type->code; > unless (exists($borrower{$code}) && $borrower{$code} !~ m/^\s*$/ ) { >@@ -374,7 +375,8 @@ sub update_local { > # skip extended patron attributes in 'borrowers' attribute update > my @keys = keys %$borrower; > if (C4::Context->preference('ExtendedPatronAttributes')) { >- my $attribute_types = Koha::Patron::Attribute::Types->filter_by_branch_limitations; >+ my $library_id = C4::Context->userenv ? C4::Context->userenv->{'branch'} : undef; >+ my $attribute_types = Koha::Patron::Attribute::Types->search_with_library_limits({}, {}, $library_id); > while ( my $attribute_type = $attribute_types->next ) { > my $code = $attribute_type->code; > @keys = grep { $_ ne $code } @keys; >diff --git a/members/memberentry.pl b/members/memberentry.pl >index 823418bdf4..917f2ea280 100755 >--- a/members/memberentry.pl >+++ b/members/memberentry.pl >@@ -853,7 +853,8 @@ sub patron_attributes_form { > my $borrowernumber = shift; > my $op = shift; > >- my $attribute_types = Koha::Patron::Attribute::Types->filter_by_branch_limitations; >+ my $library_id = C4::Context->userenv ? C4::Context->userenv->{'branch'} : undef; >+ my $attribute_types = Koha::Patron::Attribute::Types->search_with_library_limits({}, {}, $library_id); > if ( $attribute_types->count == 0 ) { > $template->param(no_patron_attribute_types => 1); > return; >diff --git a/members/moremember.pl b/members/moremember.pl >index cf0496dd2e..656ee35a93 100755 >--- a/members/moremember.pl >+++ b/members/moremember.pl >@@ -154,7 +154,8 @@ if (C4::Context->preference('ExtendedPatronAttributes')) { > attributes_loop => \@attributes_loop > ); > >- my $nb_of_attribute_types = Koha::Patron::Attribute::Types->filter_by_branch_limitations->count; >+ my $library_id = C4::Context->userenv ? C4::Context->userenv->{'branch'} : undef; >+ my $nb_of_attribute_types = Koha::Patron::Attribute::Types->search_with_library_limits({}, {}, $library_id)->count; > if ( $nb_of_attribute_types == 0 ) { > $template->param(no_patron_attribute_types => 1); > } >diff --git a/reports/borrowers_stats.pl b/reports/borrowers_stats.pl >index 34c3353314..6a95f01b56 100755 >--- a/reports/borrowers_stats.pl >+++ b/reports/borrowers_stats.pl >@@ -495,7 +495,8 @@ sub parse_extended_patron_attributes { > sub patron_attributes_form { > my $template = shift; > >- my $attribute_types = Koha::Patron::Attribute::Types->filter_by_branch_limitations; >+ my $library_id = C4::Context->userenv ? C4::Context->userenv->{'branch'} : undef; >+ my $attribute_types = Koha::Patron::Attribute::Types->search_with_library_limits({}, {}, $library_id); > > my %items_by_class; > while ( my $attr_type = $attribute_types->next ) { >diff --git a/reports/issues_stats.pl b/reports/issues_stats.pl >index 994afc1e2a..16a8f77bfc 100755 >--- a/reports/issues_stats.pl >+++ b/reports/issues_stats.pl >@@ -166,7 +166,8 @@ foreach (sort {$ccodes->{$a} cmp $ccodes->{$b}} keys %$ccodes) { > my $CGIextChoice = ( 'CSV' ); # FIXME translation > my $CGIsepChoice=GetDelimiterChoices; > >-my $attribute_types = Koha::Patron::Attribute::Types->filter_by_branch_limitations; >+my $library_id = C4::Context->userenv ? C4::Context->userenv->{'branch'} : undef; >+my $attribute_types = Koha::Patron::Attribute::Types->search_with_library_limits({}, {}, $library_id); > my %attribute_types_by_class; > while ( my ( $attribute_type ) = $attribute_types->next ) { > $attribute_type = $attribute_type->unblessed; >diff --git a/tools/modborrowers.pl b/tools/modborrowers.pl >index 7ba01f638f..6c53a23912 100755 >--- a/tools/modborrowers.pl >+++ b/tools/modborrowers.pl >@@ -113,7 +113,8 @@ if ( $op eq 'show' ) { > # Construct the patron attributes list > my @patron_attributes_values; > my @patron_attributes_codes; >- my $patron_attribute_types = Koha::Patron::Attribute::Types->filter_by_branch_limitations; >+ my $library_id = C4::Context->userenv ? C4::Context->userenv->{'branch'} : undef; >+ my $patron_attribute_types = Koha::Patron::Attribute::Types->search_with_library_limits({}, {}, $library_id); > my @patron_categories = Koha::Patron::Categories->search_limited({}, {order_by => ['description']}); > while ( my $attr_type = $patron_attribute_types->next ) { > # TODO Repeatable attributes are not correctly managed and can cause data lost. >-- >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