(bug #2856) Activate the duplicate patrons detection and check birthdate only if...
authorNahuel ANGELINETTI <nahuel.angelinetti@biblibre.com>
Thu, 11 Dec 2008 08:56:06 +0000 (09:56 +0100)
committerHenri-Damien LAURENT <henridamien.laurent@biblibre.com>
Fri, 6 Mar 2009 09:47:32 +0000 (10:47 +0100)
This patch activate the check of unique member, it was checked but not shown, and the member was added even if a duplicate was
detected.
It improve the duplicate detection, to check the birthdate only if it was specified in the form.
And fix an url of "Yes" link(if the borrower added IS the duplicate detected).

Signed-off-by: Henri-Damien LAURENT <henridamien.laurent@biblibre.com>
C4/Members.pm
members/memberentry.pl

index 3c63f7d..ec7ffe5 100644 (file)
@@ -1242,17 +1242,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=?";
+            ($dateofbirth) ?
+            "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);
+    warn $request;
     if ($collectivity) {
         $sth->execute( uc($surname) );
-    } else {
-        if($dateofbirth){
-            $request .= " and dateofbirth=?";
-            $sth->execute( uc($surname), ucfirst($firstname), $dateofbirth );
-        }else{
-            $sth->execute( uc($surname), ucfirst($firstname));
-        }
+    } elsif($dateofbirth){
+        $sth->execute( uc($surname), ucfirst($firstname), $dateofbirth );
+    }else{
+        $sth->execute( uc($surname), ucfirst($firstname));
     }
     my @data = $sth->fetchrow;
     $sth->finish;
index d4619f7..b3582f3 100755 (executable)
@@ -303,13 +303,13 @@ if ($delete){
 }
 
 if ($nok or !$nodouble){
-    $op="add" if ($op eq "insert");
-    $op="modify" if ($op eq "save");
-    %data=%newdata; 
-    $template->param( updtype => ($op eq 'add' ?'I':'M'));     # used to check for $op eq "insert"... but we just changed $op!
-    unless ($step){  
-        $template->param( step_1 => 1,step_2 => 1,step_3 => 1, step_4 => 1);
-    }  
+  $op="add" if ($op eq "insert");
+  $op="modify" if ($op eq "save");
+  %data=%newdata; 
+  $template->param( updtype => ($op eq 'add' ?'I':'M'));       # used to check for $op eq "insert"... but we just changed $op!
+  unless ($step){  
+    $template->param( step_1 => 1,step_2 => 1,step_3 => 1, step_4 => 1);
+  }  
 } 
 if (C4::Context->preference("IndependantBranches")) {
     my $userenv = C4::Context->userenv;