Add paper presentation confirmation
Change-Id: I31b8cc168800d0bae889a2d7cbe7d21116828594
diff --git a/db_backend.php b/db_backend.php
index 182a1c7..d028241 100644
--- a/db_backend.php
+++ b/db_backend.php
@@ -34,7 +34,9 @@
$a[$key] = $value;
}
}
- $a["participation_confirmed_at"] = date("Y-m-d H:i:s UTC");
+ if ($user->participation_confirmed) {
+ $a["participation_confirmed_at"] = date("Y-m-d H:i:s UTC");
+ }
$keys = array_keys($a);
$sql = "INSERT INTO person (" . implode(", ", $keys) . ") \n";
$sql .= "VALUES ( :" . implode(", :", $keys) . ")";
@@ -55,11 +57,11 @@
$stmt = $this->pdo->prepare($sql);
$stmt->bindValue(':table', $table, PDO::PARAM_STR);
$stmt->execute();
- $output = array();
+ $persons = array();
while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
- $output[$row['COLUMN_NAME']] = $row['COLUMN_NAME'];
+ $persons[$row['COLUMN_NAME']] = $row['COLUMN_NAME'];
}
- return $output;
+ return $persons;
} catch (PDOException $pe) {
trigger_error('Could not connect to MySQL database. ' . $pe->getMessage(), E_USER_ERROR);
}
@@ -78,7 +80,7 @@
function mail_count($email)
{
- $sql = "SELECT COUNT(*) FROM person WHERE email = :email";
+ $sql = "SELECT COUNT(*) FROM person WHERE email = :email AND participation_confirmed";
try {
$stmt = $this->pdo->prepare($sql);
$stmt->bindValue(':email', $email, PDO::PARAM_STR);
@@ -89,4 +91,23 @@
trigger_error('Could not connect to MySQL database. ' . $pe->getMessage(), E_USER_ERROR);
}
}
+
+ function get_persons($filter)
+ {
+ $sql = "SELECT *, NULL as invoice FROM person " . ($filter? "WHERE " . $filter : '');
+
+ try {
+ $stmt = $this->pdo->prepare($sql);
+ $stmt->execute();
+ $persons = array();
+ while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
+ $user = new User();
+ $user->init_from_array($row);
+ $persons[] = $user;
+ }
+ return $persons;
+ } catch (PDOException $pe) {
+ trigger_error('Could not connect to MySQL database. ' . $pe->getMessage(), E_USER_ERROR);
+ }
+ }
}