Skip to content

Commit 49ef4a5

Browse files
Fix problem with -empty- user and unknown country in treasurer interface.
1 parent 1e5362e commit 49ef4a5

File tree

2 files changed

+15
-11
lines changed

2 files changed

+15
-11
lines changed

build/admin/treasurer/admintreasurer.ctrl.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public function treasurerEditCreateDonationCallback(StdClass $args, ReadOnlyObje
7878
$id = $vars['id'];
7979
if ($id == 0) {
8080
$memberId = $vars['IdMember'] != 0 ? $vars['IdMember'] : null;
81-
$success = $this->model->createDonation($vars['IdMember'], $vars['DonatedOn'],
81+
$success = $this->model->createDonation($memberId, $vars['DonatedOn'],
8282
$vars['donate-amount'], $vars['donate-comment'], $countryid);
8383
} else {
8484
$success = $this->model->updateDonation($id, $vars['IdMember'], $vars['DonatedOn'],

build/admin/treasurer/admintreasurer.model.php

+14-10
Original file line numberDiff line numberDiff line change
@@ -73,25 +73,29 @@ public function getCountryCodeForGeonameId($geonameid) {
7373
}
7474

7575
public function createDonation($memberid, $donatedon, $amount, $comment, $countryid) {
76-
$query = "
76+
$statement = $this->dao->prepare("
7777
INSERT INTO
7878
donations
7979
SET
80-
IdMember = " . $memberid . ",
80+
IdMember = ?,
8181
Email = '',
8282
StatusPrivate = 'showamountonly',
83-
created = '" . $donatedon . "',
84-
Amount = " . $amount . ",
83+
created = ?,
84+
Amount = ?,
8585
Money = '',
86-
IdCountry = " . $countryid . ",
86+
IdCountry = ?,
8787
namegiven = '',
8888
referencepaypal = '',
8989
membercomment = '',
90-
SystemComment = '" . $this->dao->escape($comment) . "'";
91-
$affected = $this->dao->exec($query);
92-
if ($affected != 1) {
93-
return false;
94-
}
90+
SystemComment = ?
91+
");
92+
$statement->bindParam(1, $memberid);
93+
$statement->bindParam(2, $donatedon);
94+
$statement->bindParam(3, $amount);
95+
$statement->bindParam(4, $countryid);
96+
$statement->bindParam(5, $comment);
97+
$statement->execute();
98+
9599
return true;
96100
}
97101

0 commit comments

Comments
 (0)