Add url field to subscription

This commit is contained in:
ellite
2023-12-08 22:33:24 +01:00
parent 2d7fb4bb6d
commit f4da6b735e
10 changed files with 48 additions and 4 deletions
+6 -4
View File
@@ -144,6 +144,7 @@
$payerUserId = $_POST["payer_user_id"];
$categoryId = $_POST['category_id'];
$notes = $_POST["notes"];
$url = $_POST['url'];
$logoUrl = $_POST['logo-url'];
$logo = "";
$notify = isset($_POST['notifications']) ? true : false;
@@ -158,15 +159,15 @@
if (!$isEdit) {
$sql = "INSERT INTO subscriptions (name, logo, price, currency_id, next_payment, cycle, frequency, notes,
payment_method_id, payer_user_id, category_id, notify)
payment_method_id, payer_user_id, category_id, notify, url)
VALUES (:name, :logo, :price, :currencyId, :nextPayment, :cycle, :frequency, :notes,
:paymentMethodId, :payerUserId, :categoryId, :notify)";
:paymentMethodId, :payerUserId, :categoryId, :notify, :url)";
} else {
$id = $_POST['id'];
if ($logo != "") {
$sql = "UPDATE subscriptions SET name = :name, logo = :logo, price = :price, currency_id = :currencyId, next_payment = :nextPayment, cycle = :cycle, frequency = :frequency, notes = :notes, payment_method_id = :paymentMethodId, payer_user_id = :payerUserId, category_id = :categoryId, notify = :notify WHERE id = :id";
$sql = "UPDATE subscriptions SET name = :name, logo = :logo, price = :price, currency_id = :currencyId, next_payment = :nextPayment, cycle = :cycle, frequency = :frequency, notes = :notes, payment_method_id = :paymentMethodId, payer_user_id = :payerUserId, category_id = :categoryId, notify = :notify, url = :url WHERE id = :id";
} else {
$sql = "UPDATE subscriptions SET name = :name, price = :price, currency_id = :currencyId, next_payment = :nextPayment, cycle = :cycle, frequency = :frequency, notes = :notes, payment_method_id = :paymentMethodId, payer_user_id = :payerUserId, category_id = :categoryId, notify = :notify WHERE id = :id";
$sql = "UPDATE subscriptions SET name = :name, price = :price, currency_id = :currencyId, next_payment = :nextPayment, cycle = :cycle, frequency = :frequency, notes = :notes, payment_method_id = :paymentMethodId, payer_user_id = :payerUserId, category_id = :categoryId, notify = :notify, url = :url WHERE id = :id";
}
}
@@ -188,6 +189,7 @@
$stmt->bindParam(':payerUserId', $payerUserId, SQLITE3_INTEGER);
$stmt->bindParam(':categoryId', $categoryId, SQLITE3_INTEGER);
$stmt->bindParam(':notify', $notify, SQLITE3_INTEGER);
$stmt->bindParam(':url', $url, SQLITE3_TEXT);
if ($stmt->execute()) {
$success['status'] = "Success";
+1
View File
@@ -25,6 +25,7 @@
$subscriptionData['payer_user_id'] = $row['payer_user_id'];
$subscriptionData['category_id'] = $row['category_id'];
$subscriptionData['notify'] = $row['notify'];
$subscriptionData['url'] = $row['url'];
$subscriptionJson = json_encode($subscriptionData);
header('Content-Type: application/json');