From 61ebf9160f473ff5b2adca7da7f38f00f0597878 Mon Sep 17 00:00:00 2001 From: Nahuel ANGELINETTI Date: Thu, 11 Dec 2008 10:08:15 +0100 Subject: [PATCH] (bug #2856) Activate the duplicate patrons detection and check birthdate only if one is set 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: Galen Charlton --- C4/Members.pm | 9 +++++++-- .../prog/en/modules/members/memberentrygen.tmpl | 4 ++-- members/memberentry.pl | 13 +++++++------ 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/C4/Members.pm b/C4/Members.pm index 49a29ccf67..0dcd5b4ead 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=? "; + ($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 { + } 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/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tmpl index df289a58ac..a1953d401d 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tmpl @@ -89,7 +89,7 @@

Duplicate suspected

');" >Detail Duplicate ? - &category_type=">Yes + &category_type=">Yes     No, it is not @@ -100,7 +100,7 @@

- +
Debug is on (level )
diff --git a/members/memberentry.pl b/members/memberentry.pl index 7bc41e8a42..91095ad2ea 100755 --- a/members/memberentry.pl +++ b/members/memberentry.pl @@ -140,7 +140,7 @@ if ($op eq 'insert' || $op eq 'modify' || $op eq 'save') { } #############test for member being unique ############# -if ($op eq 'insert'){ +if (($op eq 'insert') and !$nodouble){ my $category_type_send=$category_type if ($category_type eq 'I'); my $check_category; # recover the category code of the doublon suspect borrowers # ($result,$categorycode) = checkuniquemember($collectivity,$surname,$firstname,$dateofbirth) @@ -150,8 +150,10 @@ if ($op eq 'insert'){ ($newdata{firstname} ? $newdata{firstname} : $data{firstname} ), ($newdata{dateofbirth} ? $newdata{dateofbirth} : $data{dateofbirth}) ); - - # recover the category type if the borrowers is a doublon + if(!$check_member){ + $nodouble = 1; + } + # recover the category type if the borrowers is a doublon if ($check_category) { my $tmpborrowercategory=GetBorrowercategory($check_category); $check_categorytype=$tmpborrowercategory->{'category_type'}; @@ -235,9 +237,8 @@ if ($op eq 'modify' || $op eq 'insert' || $op eq 'save' ){ } ### Error checks should happen before this line. - $nok = $nok || scalar(@errors); -if ((!$nok) and ($op eq 'insert' or $op eq 'save')){ +if ((!$nok) and $nodouble and ($op eq 'insert' or $op eq 'save')){ $debug and warn "$op dates: " . join "\t", map {"$_: $newdata{$_}"} qw(dateofbirth dateenrolled dateexpiry); if ($op eq 'insert'){ # we know it's not a duplicate borrowernumber or there would already be an error @@ -299,7 +300,7 @@ if ($delete){ exit; # same as above } -if ($nok){ +if ($nok or !$nodouble){ $op="add" if ($op eq "insert"); $op="modify" if ($op eq "save"); %data=%newdata; -- 2.39.5