From: Nahuel ANGELINETTI <[email protected]>

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 <[email protected]>
---
 C4/Members.pm          |   16 ++++++++--------
 members/memberentry.pl |   14 +++++++-------
 2 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/C4/Members.pm b/C4/Members.pm
index 3c63f7d..ec7ffe5 100644
--- a/C4/Members.pm
+++ b/C4/Members.pm
@@ -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;
diff --git a/members/memberentry.pl b/members/memberentry.pl
index d4619f7..b3582f3 100755
--- a/members/memberentry.pl
+++ b/members/memberentry.pl
@@ -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;
-- 
1.5.6.3

_______________________________________________
Koha-patches mailing list
[email protected]
http://lists.koha.org/mailman/listinfo/koha-patches

Reply via email to