From 0b4c3e5dbf6034aa6be97745b2b9d790249b595f Mon Sep 17 00:00:00 2001 From: Nahuel ANGELINETTI Date: Thu, 25 Jun 2009 12:57:35 +0200 Subject: [PATCH] (bug #3284) fix borrower deletion in independantbranches mode 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 --- .../prog/en/includes/members-toolbar.inc | 2 +- members/deletemem.pl | 9 ++++--- members/moremember.pl | 26 ++++++++++++++++++- 3 files changed, 31 insertions(+), 6 deletions(-) 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 ed490d26bd..eecf2f1ce4 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 } }, + { text: _("Delete"), onclick: { fn: confirm_deletion}, disabled: true }, { text: _("Update Child to Adult Patron") , onclick: { fn: update_child }, disabled: true} ]; diff --git a/members/deletemem.pl b/members/deletemem.pl index e41157b386..a1694f655f 100755 --- a/members/deletemem.pl +++ b/members/deletemem.pl @@ -57,14 +57,15 @@ if ($bor->{category_type} eq "S") { } if (C4::Context->preference("IndependantBranches")) { - unless ($userenv->{flags} == 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); diff --git a/members/moremember.pl b/members/moremember.pl index 941272d8bd..1fcfa57697 100755 --- a/members/moremember.pl +++ b/members/moremember.pl @@ -202,7 +202,9 @@ if ( C4::Context->preference("IndependantBranches") ) { unless ( $userenv->{flags} == 1 ) { $samebranch = ( $data->{'branchcode'} eq $userenv->{branch} ); } - $samebranch = 1 if ( $userenv->{flags} == 1 ); + $samebranch = 1 if ( $userenv->{flags} % 2 == 1 ); +}else{ + $samebranch = 1; } my $branchdetail = GetBranchDetail( $data->{'branchcode'}); $data->{'branchname'} = $branchdetail->{branchname}; @@ -353,6 +355,7 @@ if (C4::Context->preference('ExtendedPatronAttributes')) { $template->param( detailview => 1, AllowRenewalLimitOverride => C4::Context->preference("AllowRenewalLimitOverride"), +<<<<<<< HEAD:members/moremember.pl DHTMLcalendar_dateformat=>C4::Dates->DHTMLcalendar(), roaddetails => $roaddetails, borrowernumber => $borrowernumber, @@ -370,6 +373,27 @@ $template->param( is_child => ($category_type eq 'C'), # reserveloop => \@reservedata, dateformat => C4::Context->preference("dateformat"), +======= + DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar(), + roaddetails => $roaddetails, + borrowernumber => $borrowernumber, + categoryname => $data->{'description'}, + reregistration => $reregistration, + branch => $branch, + totalprice => sprintf("%.2f", $totalprice), + totaldue => sprintf("%.2f", $total), + totaldue_raw => $total, + issueloop => \@issuedata, + overdues_exist => $overdues_exist, + error => $error, + $error => 1, + StaffMember => ($category_type eq 'S'), + is_child => ($category_type eq 'C'), +# reserveloop => \@reservedata, + dateformat => C4::Context->preference("dateformat"), + "dateformat_" . (C4::Context->preference("dateformat") || '') => 1, + samebranch => $samebranch, +>>>>>>> 1be2c41... (bug #3284) fix borrower deletion in independantbranches mode:members/moremember.pl ); output_html_with_http_headers $input, $cookie, $template->output; -- 2.39.5