From ac21232fd55939f6f896a69b2b949d52d6756620 Mon Sep 17 00:00:00 2001 From: Chris Cormack Date: Wed, 26 Dec 2007 14:00:47 -0600 Subject: [PATCH] Fix for bug 1691 Signed-off-by: Joshua Ferraro --- C4/Members.pm | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/C4/Members.pm b/C4/Members.pm index 8b3744c34c..c9ebc8b0a9 100644 --- a/C4/Members.pm +++ b/C4/Members.pm @@ -601,6 +601,9 @@ sub ModMember { } } } + if (!$data{'dateofbirth'}){ + undef $data{'dateofbirth'}; + } my $qborrower=$dbh->prepare("SHOW columns from borrowers"); $qborrower->execute; my %hashborrowerfields; @@ -663,6 +666,9 @@ sub AddMember { # $data{'dateenrolled'} = format_date_in_iso( $data{'dateenrolled'}); # $data{'dateexpiry'} = format_date_in_iso( $data{'dateexpiry'} ); # This query should be rewritten to use "?" at execute. + if (!$data{'dateofbirth'}){ + undef ($data{'dateofbirth'}); + } my $query = "insert into borrowers set cardnumber=" . $dbh->quote( $data{'cardnumber'} ) . ",surname=" . $dbh->quote( $data{'surname'} ) @@ -715,7 +721,7 @@ sub AddMember { $debug and print STDERR "AddMember SQL: ($query)\n"; my $sth = $dbh->prepare($query); # print "Executing SQL: $query\n"; - $sth->execute; + $sth->execute(); $sth->finish; $data{'borrowernumber'} = $dbh->{'mysql_insertid'}; # unneeded w/ autoincrement ? # mysql_insertid is probably bad. not necessarily accurate and mysql-specific at best. -- 2.39.5