[Koha-patches] [PATCH] Fixing non placeholder sql in UpdateGuarantees
Chris Cormack
chrisc at catalyst.net.nz
Sun Aug 1 11:29:58 CEST 2010
---
C4/Members.pm | 18 ++++++------------
1 files changed, 6 insertions(+), 12 deletions(-)
diff --git a/C4/Members.pm b/C4/Members.pm
index cddbf41..267e97b 100644
--- a/C4/Members.pm
+++ b/C4/Members.pm
@@ -937,22 +937,16 @@ with the modified information
#'
sub UpdateGuarantees {
- my (%data) = @_;
+ my %data = shift;
my $dbh = C4::Context->dbh;
my ( $count, $guarantees ) = GetGuarantees( $data{'borrowernumber'} );
- for ( my $i = 0 ; $i < $count ; $i++ ) {
-
- # FIXME
- # It looks like the $i is only being returned to handle walking through
- # the array, which is probably better done as a foreach loop.
- #
+ foreach my $guarantee (@$guarantees){
my $guaquery = qq|UPDATE borrowers
- SET address='$data{'address'}',fax='$data{'fax'}',
- B_city='$data{'B_city'}',mobile='$data{'mobile'}',city='$data{'city'}',phone='$data{'phone'}'
- WHERE borrowernumber='$guarantees->[$i]->{'borrowernumber'}'
+ SET address=?,fax=?,B_city=?,mobile=?,city=?,phone=?
+ WHERE borrowernumber=?
|;
- my $sth3 = $dbh->prepare($guaquery);
- $sth3->execute;
+ my $sth = $dbh->prepare($guaquery);
+ $sth->execute($data{'address'},$data{'fax'},$data{'B_city'},$data{'mobile'},$data{'city'},$data{'phone'},$guarantee->{'borrowernumber'});
}
}
=head2 GetPendingIssues
--
1.7.0.4
More information about the Koha-patches
mailing list