[Koha-patches] [PATCH][HEAD] (bug #2856) Activate the duplicate patrons detection and check birthdate only if one is set

Michael Hafen mdhafen at tech.washk12.org
Wed Dec 10 20:53:54 CET 2008


On Wed, 2008-12-10 at 17:26 +0100, Nahuel Angelinetti wrote:
[snip]
> diff --git a/C4/Members.pm b/C4/Members.pm
> index 49a29cc..09f9a08 100644
> --- a/C4/Members.pm
> +++ b/C4/Members.pm
> @@ -1235,12 +1235,17 @@ sub checkuniquemember {
>      my $dbh = C4::Context->dbh;
>      my $request = ($collectivity) ?
>          "SELECT borrowernumber,categorycode FROM borrowers WHERE surname=? " :
> -        "SELECT borrowernumber,categorycode FROM borrowers WHERE surname=? and firstname=? and dateofbirth=? ";
> +        "SELECT borrowernumber,categorycode FROM borrowers WHERE surname=? and firstname=?";
>      my $sth = $dbh->prepare($request);
>      if ($collectivity) {
>          $sth->execute( uc($surname) );
>      } else {
> -        $sth->execute( uc($surname), ucfirst($firstname), $dateofbirth );
> +        if($dateofbirth){
> +            $request .= " and dateofbirth=?";
> +            $sth->execute( uc($surname), ucfirst($firstname), $dateofbirth );
> +        }else{
> +            $sth->execute( uc($surname), ucfirst($firstname));
> +        }
>      }
[snip]

Changing the $request there isn't going to help as it's already been
prepared.  You might want to add another line to that if block to
re-prepare the modified $request.

-- 
Michael Hafen
Systems Analyst and Programmer
Washington County School District
Utah, USA

for Koha checkout
http://koha-dev.washk12.org
or
git://koha-dev.washk12.org/koha




More information about the Koha-patches mailing list