From f225af6025d172cb574bbce49cede9bf69d05f3f Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Mon, 10 Mar 2014 11:02:01 -0400 Subject: [PATCH] Bug 10276 [QA Followup 3] - Fix inability to change patron's branch Signed-off-by: Mark Tompsett --- members/memberentry.pl | 31 ++++++++++++++++++++++--------- 1 files changed, 22 insertions(+), 9 deletions(-) diff --git a/members/memberentry.pl b/members/memberentry.pl index dee53c5..7c84ef8 100755 --- a/members/memberentry.pl +++ b/members/memberentry.pl @@ -316,14 +316,22 @@ if ($op eq 'save' || $op eq 'insert'){ $newdata{'surname'} = uc($newdata{'surname'}); } - if (C4::Context->preference("IndependentBranches")) { - unless ( C4::Context->IsSuperLibrarian() ){ - $debug and print STDERR " $newdata{'branchcode'} : ".$userenv->{flags}.":".$userenv->{branch}; - unless (!$newdata{'branchcode'} || $userenv->{branch} eq $newdata{'branchcode'}){ - push @errors, "ERROR_branch"; - } +if ( C4::Context->preference("IndependentBranches") ) { + unless ( C4::Context->IsSuperLibrarian() ) { + $debug && warn " $newdata{'branchcode'} : " . $userenv->{flags} . ":" . $userenv->{branch}; + + unless ( + !$newdata{'branchcode'} + || GetIndependentGroupModificationRights( + { for => $newdata{'branchcode'} } + ) + ) + { + push @errors, "ERROR_branch"; + } } - } +} + # Check if the userid is unique unless (Check_Userid($newdata{'userid'},$borrowernumber)) { push @errors, "ERROR_login_exist"; @@ -447,10 +455,15 @@ if ($nok or !$nodouble){ $template->param( step_1 => 1,step_2 => 1,step_3 => 1, step_4 => 1, step_5 => 1, step_6 => 1); } } -if (C4::Context->preference("IndependentBranches")) { +if ( C4::Context->preference("IndependentBranches") ) { my $userenv = C4::Context->userenv; if ( !C4::Context->IsSuperLibrarian() && $data{'branchcode'} ) { - unless ($userenv->{branch} eq $data{'branchcode'}){ + unless ( + GetIndependentGroupModificationRights( + { for => $data{'branchcode'} } + ) + ) + { print $input->redirect("/cgi-bin/koha/members/members-home.pl"); exit; } -- 1.7.2.5