aboutsummaryrefslogtreecommitdiff
path: root/classes/BusinessAdmin.php
diff options
context:
space:
mode:
Diffstat (limited to 'classes/BusinessAdmin.php')
-rw-r--r--classes/BusinessAdmin.php22
1 files changed, 22 insertions, 0 deletions
diff --git a/classes/BusinessAdmin.php b/classes/BusinessAdmin.php
index 7c3c76c..83fa4b3 100644
--- a/classes/BusinessAdmin.php
+++ b/classes/BusinessAdmin.php
@@ -407,6 +407,28 @@ class BusinessAdmin {
}
/**
+ * Create a new mail
+ *
+ * @param PDO $pdo The database connection
+ * @param int $contactId The contactId for the new mail
+ * @param int $offerId The offerId for the new mail
+ * @param string $subject
+ *
+ * @throws PDOException If something went wrong with the database
+ *
+ * @return Mail|bool A new instance of the Mail class, or false on failure
+ */
+ public static function createMail($pdo, $contactId, $offerId, $subject) {
+ $stmt = $pdo->prepare("INSERT INTO `".Constants::db_prefix."mail` (`contactId`, `offerId`, `subject`) VALUES (?,?,?)");
+ $stmt->execute([$contactId, $offerId, $subject]);
+ if ($stmt->rowCount() == 1) {
+ return new Mail($pdo, $pdo->lastInsertId());
+ } else {
+ return false;
+ }
+ }
+
+ /**
* Format a date nicely
*
* @todo implement $relatively = true