From d019b4c63aa46f5eaad044178b5489aee0491ab1 Mon Sep 17 00:00:00 2001 From: Paul Poulain Date: Fri, 21 Oct 2011 17:23:36 +0200 Subject: [PATCH] Bug 6328 Fixes for comment 35 * correctly indenting with tab the debarrcomment field * setdebar.pl is called without status parameter, thus it is not working anymore. It's fixed & some dead code has been removed. To test : debar someone, then go to patron detail page and click "lift debarment" * the test function had not been updated. The fix define a debarment date of 2099-12-31 (no limit) --- C4/Auth_with_ldap.pm | 2 +- members/setdebar.pl | 18 +++++------------- .../lib/KohaTest/Members/DebarMember.pm | 2 +- 3 files changed, 7 insertions(+), 15 deletions(-) diff --git a/C4/Auth_with_ldap.pm b/C4/Auth_with_ldap.pm index a2e346c171..4749d72208 100644 --- a/C4/Auth_with_ldap.pm +++ b/C4/Auth_with_ldap.pm @@ -357,7 +357,7 @@ C4::Auth - Authenticates Koha users | gonenoaddress | tinyint(1) | YES | | NULL | | | lost | tinyint(1) | YES | | NULL | | | debarred | date | YES | | NULL | | - | debarredcomment | varchar(255) | YES | | NULL | | + | debarredcomment | varchar(255) | YES | | NULL | | | contactname | mediumtext | YES | | NULL | | | contactfirstname | text | YES | | NULL | | | contacttitle | text | YES | | NULL | | diff --git a/members/setdebar.pl b/members/setdebar.pl index b12ab57ab7..bc0bafbe52 100755 --- a/members/setdebar.pl +++ b/members/setdebar.pl @@ -1,6 +1,7 @@ #!/usr/bin/perl # Copyright 2000-2002 Katipo Communications +# Parts copyright 2011 BibLibre # # This file is part of Koha. # @@ -40,22 +41,13 @@ $flagsrequired->{borrowers} = 1; my ( $loggedinuser, $cookie, $sessionID ) = checkauth( $input, 0, $flagsrequired ); -my $destination = $input->param("destination") || ''; -my $cardnumber = $input->param("cardnumber"); my $borrowernumber = $input->param('borrowernumber'); -my $status = $input->param('status'); my $dbh = C4::Context->dbh; my $sth = - $dbh->prepare("Update borrowers set debarred = ? where borrowernumber = ?"); -$sth->execute( $status, $borrowernumber ); + $dbh->prepare("Update borrowers set debarred = NULL where borrowernumber = ?"); +$sth->execute( $borrowernumber ); $sth->finish; -if ( $destination eq "circ" ) { - print $input->redirect( - "/cgi-bin/koha/circ/circulation.pl?findborrower=".$cardnumber); -} -else { - print $input->redirect( - "/cgi-bin/koha/members/moremember.pl?borrowernumber=$borrowernumber"); -} +print $input->redirect( + "/cgi-bin/koha/members/moremember.pl?borrowernumber=$borrowernumber"); diff --git a/t/db_dependent/lib/KohaTest/Members/DebarMember.pm b/t/db_dependent/lib/KohaTest/Members/DebarMember.pm index 9e27d6647a..bf61b8ac35 100644 --- a/t/db_dependent/lib/KohaTest/Members/DebarMember.pm +++ b/t/db_dependent/lib/KohaTest/Members/DebarMember.pm @@ -21,7 +21,7 @@ sub simple_usage : Test( 6 ) { ok( ! $details->{'flags'}->{'DBARRED'}, 'this member is NOT debarred' ); # Now, let's debar this member and see what happens - my $success = C4::Members::DebarMember( $self->{'memberid'} ); + my $success = C4::Members::DebarMember( $self->{'memberid'}, '2099-12-31' ); ok( $success, 'we were able to debar the member' ); -- 2.39.5