From 274618ccd227d7faf0e37543949dea4bcb9ac944 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 eecf2f1ce4..d70c56684b 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc @@ -57,7 +57,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 286a811f00..5b763f4648 100755 --- a/members/moremember.pl +++ b/members/moremember.pl @@ -356,6 +356,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 @@ -379,6 +393,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