From 05b61e4f3a57828d0bc7d400cfc4bb97c4402a71 Mon Sep 17 00:00:00 2001 From: Nahuel ANGELINETTI Date: Mon, 2 Nov 2009 16:42:01 +0100 Subject: [PATCH] (bug #3745) fix deletion of borrowers rights detection This patch fix the rights checking for borrower deletion. --- .../prog/en/includes/members-toolbar.inc | 2 +- members/moremember.pl | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc index dcd55a487e..7e5bb6c6f0 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc @@ -58,7 +58,7 @@ function update_child() { var moremenu = [ { text: _("Renew Patron"), onclick: { fn: confirm_reregistration } }, { text: _("Set Permissions"), url: "/cgi-bin/koha/members/member-flags.pl?member=", disabled: true}, - { text: _("Delete"), onclick: { fn: confirm_deletion}, disabled: true }, + { text: _("Delete"), onclick: { fn: confirm_deletion}, disabled: true }, { text: _("Update Child to Adult Patron") , onclick: { fn: update_child }, disabled: true} ]; diff --git a/members/moremember.pl b/members/moremember.pl index 63b09bf3ff..691ad1d57c 100755 --- a/members/moremember.pl +++ b/members/moremember.pl @@ -359,6 +359,20 @@ foreach (@$alerts) { $_->{relatedto} = findrelatedto( $_->{type}, $_->{externalid} ); } +my $candeleteuser; +my $userenv = C4::Context->userenv; +if($userenv->{flags} % 2 == 1){ + $candeleteuser = 1; +}elsif ( C4::Context->preference("IndependantBranches") ) { + $candeleteuser = ( $data->{'branchcode'} eq $userenv->{branch} ); +}else{ + if( C4::Auth::getuserflags( $userenv->{flags},$userenv->{number})->{borrowers} ) { + $candeleteuser = 1; + }else{ + $candeleteuser = 0; + } +} + # check to see if patron's image exists in the database # basically this gives us a template var to condition the display of # patronimage related interface on @@ -389,6 +403,7 @@ $template->param( detailview => 1, AllowRenewalLimitOverride => C4::Context->preference("AllowRenewalLimitOverride"), DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar(), + CANDELETEUSER => $candeleteuser, roaddetails => $roaddetails, borrowernumber => $borrowernumber, categoryname => $data->{'description'}, -- 2.39.5