[Koha-patches] [PATCH] (bug #3284) fix borrower deletion in independantbranches mode
Galen Charlton
galen.charlton at liblime.com
Sat Jun 6 01:03:00 CEST 2009
Hi Nahuel,
This patch doesn't apply against HEAD - note the patch for 2997 that
was pushed on 28 May. Please rebase and resubmit.
Regards,
Galen
On Wed, Jun 3, 2009 at 5:58 AM, Nahuel ANGELINETTI
<nahuel.angelinetti at biblibre.com> wrote:
> 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).
> ---
> .../prog/en/includes/members-toolbar.inc | 2 +-
> members/deletemem.pl | 9 +++++----
> members/moremember.pl | 3 +++
> 3 files changed, 9 insertions(+), 5 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 ed490d2..eecf2f1 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=<!-- 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 -->}
> ];
>
> diff --git a/members/deletemem.pl b/members/deletemem.pl
> index e41157b..a1694f6 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 151f9c2..6226e39 100755
> --- a/members/moremember.pl
> +++ b/members/moremember.pl
> @@ -203,6 +203,8 @@ if ( C4::Context->preference("IndependantBranches") ) {
> $samebranch = ( $data->{'branchcode'} eq $userenv->{branch} );
> }
> $samebranch = 1 if ( $userenv->{flags} == 1 );
> +}else{
> + $samebranch = 1;
> }
> my $branchdetail = GetBranchDetail( $data->{'branchcode'});
> $data->{'branchname'} = $branchdetail->{branchname};
> @@ -370,6 +372,7 @@ $template->param(
> is_child => ($category_type eq 'C'),
> # reserveloop => \@reservedata,
> dateformat => C4::Context->preference("dateformat"),
> + samebranch => $samebranch,
> );
>
> output_html_with_http_headers $input, $cookie, $template->output;
> --
> 1.6.0.4
>
> _______________________________________________
> Koha-patches mailing list
> Koha-patches at lists.koha.org
> http://lists.koha.org/mailman/listinfo/koha-patches
>
--
Galen Charlton
VP, Research & Development, LibLime
galen.charlton at liblime.com
p: 1-888-564-2457 x709
skype: gmcharlt
More information about the Koha-patches
mailing list