Bugzilla – Attachment 57302 Details for
Bug 17578
Replace GetMemberDetails with GetMember
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 17578: GetMemberDetails - Remove authflags - 1
Bug-17578-GetMemberDetails---Remove-authflags---1.patch (text/plain), 4.02 KB, created by
Jonathan Druart
on 2016-11-08 11:16:41 UTC
(
hide
)
Description:
Bug 17578: GetMemberDetails - Remove authflags - 1
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2016-11-08 11:16:41 UTC
Size:
4.02 KB
patch
obsolete
>From 75baab982e6e7d820daa69d0fbf72debf0475326 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Mon, 7 Nov 2016 17:02:55 +0100 >Subject: [PATCH] Bug 17578: GetMemberDetails - Remove authflags - 1 > >GetMemberDetails create a authflags key, but this key is only used from >2 different places. >One is a very simple script, which does not seem very usefull >C4/SIP/interactive_members_dump.pl. I propose to simply remove it. >The other one is the member-flags.pl script. What is done in this one is >a bit weird since we a doing twice the same query (it was not highlighted >before this patch). We will need to fix that later. >At the moment the goal it to remove the GetMemberDetails subroutine >without introducing any regressions (and so without adding big changes) > >Test plan: >Select/unselect permissions for a patron, save and edit again. >The behavior of the permission checkboxes should be ok >--- > C4/Members.pm | 18 +----------------- > members/member-flags.pl | 20 +++++++++++++++----- > 2 files changed, 16 insertions(+), 22 deletions(-) > >diff --git a/C4/Members.pm b/C4/Members.pm >index 37d641d..da73987 100644 >--- a/C4/Members.pm >+++ b/C4/Members.pm >@@ -149,12 +149,6 @@ with a true value. > > See patronflags for more details. > >-C<$borrower-E<gt>{authflags}> is a hash giving more detailed information >-about the top-level permissions flags set for the borrower. For example, >-if a user has the "editcatalogue" permission, >-C<$borrower-E<gt>{authflags}-E<gt>{editcatalogue}> will exist and have >-the value "1". >- > =cut > > sub GetMemberDetails { >@@ -197,17 +191,7 @@ sub GetMemberDetails { > $borrower->{'amountoutstanding'} = $amount; > # FIXME - patronflags calls GetMemberAccountRecords... just have patronflags return $amount > my $flags = patronflags( $borrower); >- my $accessflagshash; >- >- $sth = $dbh->prepare("select bit,flag from userflags"); >- $sth->execute; >- while ( my ( $bit, $flag ) = $sth->fetchrow ) { >- if ( $borrower->{'flags'} && $borrower->{'flags'} & 2**$bit ) { >- $accessflagshash->{$flag} = 1; >- } >- } > $borrower->{'flags'} = $flags; >- $borrower->{'authflags'} = $accessflagshash; > > $borrower->{'is_expired'} = 0; > $borrower->{'is_expired'} = 1 if >@@ -216,7 +200,7 @@ sub GetMemberDetails { > Date_to_Days( Today() ) > > Date_to_Days( split /-/, $borrower->{'dateexpiry'} ); > >- return ($borrower); #, $flags, $accessflagshash); >+ return ($borrower); > } > > =head2 patronflags >diff --git a/members/member-flags.pl b/members/member-flags.pl >index 1d73f38..8ab4ee3 100755 >--- a/members/member-flags.pl >+++ b/members/member-flags.pl >@@ -24,7 +24,7 @@ my $input = new CGI; > > my $flagsrequired = { permissions => 1 }; > my $member=$input->param('member'); >-my $bor = GetMemberDetails( $member,''); >+my $bor = GetMember( borrowernumber => $member ); > if( $bor->{'category_type'} eq 'S' ) { > $flagsrequired->{'staffaccess'} = 1; > } >@@ -85,15 +85,25 @@ if ($input->param('newflags')) { > > print $input->redirect("/cgi-bin/koha/members/moremember.pl?borrowernumber=$member"); > } else { >-# my ($bor,$flags,$accessflags)=GetMemberDetails($member,''); >+ > my $flags = $bor->{'flags'}; >- my $accessflags = $bor->{'authflags'}; >- my $dbh=C4::Context->dbh(); >+ my $accessflags; >+ my $dbh = C4::Context->dbh(); >+ # FIXME This needs to be improved to avoid doing the same query >+ my $sth = $dbh->prepare("select bit,flag from userflags"); >+ $sth->execute; >+ while ( my ( $bit, $flag ) = $sth->fetchrow ) { >+ if ( $flags && $flags & 2**$bit ) { >+ $accessflags->{$flag} = 2; >+ } >+ } >+ > my $all_perms = get_all_subpermissions(); > my $user_perms = get_user_subpermissions($bor->{'userid'}); >- my $sth=$dbh->prepare("SELECT bit, flag FROM userflags ORDER BY bit"); >+ $sth = $dbh->prepare("SELECT bit, flag FROM userflags ORDER BY bit"); > $sth->execute; > my @loop; >+ > while (my ($bit, $flag) = $sth->fetchrow) { > my $checked=''; > if ($accessflags->{$flag}) { >-- >2.1.4
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 17578
:
57299
|
57300
|
57301
|
57302
|
57303
|
57304
|
57305
|
57306
|
57307
|
57308
|
57322
|
57323
|
57324
|
57325
|
57326
|
57793
|
57794
|
57795
|
57796
|
57797
|
57798
|
57799
|
57800
|
57801
|
57808
|
57817
|
57818
|
57819
|
57820
|
57821
|
57822
|
57823
|
57824
|
57825
|
57826
|
57972
|
57973
|
57974
|
57975
|
57976
|
57977
|
57978
|
57979
|
57980
|
57981
|
57982
|
57983
|
57984