This patch fix the checks deleting a borrower in independantbranches mode.
Now, we check the user and the librarian are from the same branch, else we deny the deletion(and disable the link to delete).
Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
var moremenu = [
{ text: _("Renew Patron"), onclick: { fn: confirm_reregistration } },
{ text: _("Set Permissions"), url: "/cgi-bin/koha/members/member-flags.pl?member=<!-- TMPL_VAR NAME="borrowernumber" -->"<!-- TMPL_UNLESS NAME="CAN_user_permissions" -->, disabled: true<!-- /TMPL_UNLESS -->},
- { text: _("Delete"), onclick: { fn: confirm_deletion } },
+ { text: _("Delete"), onclick: { fn: confirm_deletion}<!-- TMPL_UNLESS NAME="samebranch" -->, disabled: true<!-- /TMPL_IF --> },
{ text: _("Update Child to Adult Patron") , onclick: { fn: update_child }<!-- TMPL_UNLESS NAME="is_child" -->, disabled: true<!-- /TMPL_UNLESS -->}
];
}
if (C4::Context->preference("IndependantBranches")) {
- unless ($userenv->{flags} % 2 == 1){
- unless ($userenv->{'branch'} eq $bor->{'branchcode'}){
-# warn "user ".$userenv->{'branch'} ."borrower :". $bor->{'branchcode'};
+ my $userenv = C4::Context->userenv;
+ if ($userenv->{flags} != 1 && $bor->{'branchcode'}){
+ unless ($userenv->{branch} eq $bor->{'branchcode'}){
print $input->redirect("/cgi-bin/koha/members/moremember.pl?borrowernumber=$member&error=CANT_DELETE_OTHERLIBRARY");
- exit 1;
+ exit;
}
}
}
+
my $dbh = C4::Context->dbh;
my $sth=$dbh->prepare("Select * from borrowers where guarantorid=?");
$sth->execute($member);
$samebranch = ( $data->{'branchcode'} eq $userenv->{branch} );
}
$samebranch = 1 if ( $userenv->{flags} % 2 == 1 );
+}else{
+ $samebranch = 1;
}
my $branchdetail = GetBranchDetail( $data->{'branchcode'});
$data->{'branchname'} = $branchdetail->{branchname};
# reserveloop => \@reservedata,
dateformat => C4::Context->preference("dateformat"),
"dateformat_" . (C4::Context->preference("dateformat") || '') => 1,
+ samebranch => $samebranch,
);
output_html_with_http_headers $input, $cookie, $template->output;