From 88d93b456382fe06fd3faebd70b7e7d0e3ced245 Mon Sep 17 00:00:00 2001 From: btoumi Date: Fri, 2 Jun 2006 15:48:10 +0000 Subject: [PATCH] modifiy sql syntax for modmember and newmember add right field in sql syntax move get_age function from memberentry.pl --- C4/Members.pm | 49 +++++++++++++++++++++---------------------------- 1 file changed, 21 insertions(+), 28 deletions(-) diff --git a/C4/Members.pm b/C4/Members.pm index f350c64dc0..a2ca4380f0 100644 --- a/C4/Members.pm +++ b/C4/Members.pm @@ -307,6 +307,7 @@ sub modmember { $data{'dateenrolled'}=format_date_in_iso($data{'dateenrolled'}); warn "la date:".$data{dateenrolled}; my $query; + my $sth; $data{'userid'}='' if ($data{'password'}eq ''); # test to know if u must update or not the borrower password if ($data{'password'} eq '****'){ @@ -318,27 +319,10 @@ sub modmember { B_streettype = ?,B_address = ?,B_city = ?,B_zipcode = ?,B_email = ?,B_phone = ?,dateofbirth = ?,branchcode = ?, categorycode = ?,dateenrolled = ?,dateexpiry = ?,gonenoaddress = ?,lost = ?,debarred = ?,contactname = ?, contactfirstname = ?,contacttitle = ?,guarantorid = ?,borrowernotes = ?,relationship = ?,ethnicity = ?, - ethnotes = ?,sex = ?,password = ?,flags = ?,userid = ?,opacnote = ?,contactnote = ?,sort1 = ?,sort2 = ? - WHERE borrowernumber=$data{'borrowernumber'}"; - } - else{ - - ($data{'password'}=md5_base64($data{'password'})) if ($data{'password'} ne ''); - $query="UPDATE borrowers SET - cardnumber = ?,surname = ?,firstname = ?,title = ?,othernames = ?,initials = ?, - streetnumber = ?,streettype = ?,address = ?,address2 = ?,city = ?,zipcode = ?, - email = ?,phone = ?,mobile = ?,fax = ?,emailpro = ?,phonepro = ?,B_streetnumber = ?, - B_streettype = ?,B_address = ?,B_city = ?,B_zipcode = ?,B_email = ?,B_phone = ?,dateofbirth = ?,branchcode = ?, - categorycode = ?,dateenrolled = ?,dateexpiry = ?,gonenoaddress = ?,lost = ?,debarred = ?,contactname = ?, - contactfirstname = ?,contacttitle = ?,guarantorid = ?,borrowernotes = ?,relationship = ?,ethnicity = ?, - ethnotes = ?,sex = ?,password = ?,flags = ?,userid = ?,opacnote = ?,contactnote = ?,sort1 = ?,sort2 = ? + ethnotes = ?,sex = ?,flags = ?,userid = ?,opacnote = ?,contactnote = ?,sort1 = ?,sort2 = ? WHERE borrowernumber=$data{'borrowernumber'}"; - - } - my $sth=$dbh->prepare($query); - - if ($data{'password'} eq '****'){ - $sth->execute( + $sth=$dbh->prepare($query); + $sth->execute( $data{'cardnumber'},$data{'surname'}, $data{'firstname'},$data{'title'}, $data{'othernames'},$data{'initials'}, @@ -359,14 +343,25 @@ sub modmember { $data{'contacttitle'},$data{'guarantorid'}, $data{'borrowernotes'},$data{'relationship'}, $data{'ethnicity'},$data{'ethnotes'}, - $data{'sex'},$data{'password'}, + $data{'sex'}, $data{'flags'},$data{'userid'}, $data{'opacnote'},$data{'contactnote'}, - $data{'sort1'},$data{'sort2'} - ); - - }else{ - $sth->execute( + $data{'sort1'},$data{'sort2'}); + } + else{ + + ($data{'password'}=md5_base64($data{'password'})) if ($data{'password'} ne ''); + $query="UPDATE borrowers SET + cardnumber = ?,surname = ?,firstname = ?,title = ?,othernames = ?,initials = ?, + streetnumber = ?,streettype = ?,address = ?,address2 = ?,city = ?,zipcode = ?, + email = ?,phone = ?,mobile = ?,fax = ?,emailpro = ?,phonepro = ?,B_streetnumber = ?, + B_streettype = ?,B_address = ?,B_city = ?,B_zipcode = ?,B_email = ?,B_phone = ?,dateofbirth = ?,branchcode = ?, + categorycode = ?,dateenrolled = ?,dateexpiry = ?,gonenoaddress = ?,lost = ?,debarred = ?,contactname = ?, + contactfirstname = ?,contacttitle = ?,guarantorid = ?,borrowernotes = ?,relationship = ?,ethnicity = ?, + ethnotes = ?,sex = ?,password = ?,flags = ?,userid = ?,opacnote = ?,contactnote = ?,sort1 = ?,sort2 = ? + WHERE borrowernumber=$data{'borrowernumber'}"; + $sth=$dbh->prepare($query); + $sth->execute( $data{'cardnumber'},$data{'surname'}, $data{'firstname'},$data{'title'}, $data{'othernames'},$data{'initials'}, @@ -393,8 +388,6 @@ sub modmember { $data{'sort1'},$data{'sort2'} ); } - - $sth->execute; $sth->finish; # ok if its an adult (type) it may have borrowers that depend on it as a guarantor # so when we update information for an adult we should check for guarantees and update the relevant part -- 2.39.5