diff --git a/db/commands.sql b/db/commands.sql index ca22d4f..1badd50 100644 --- a/db/commands.sql +++ b/db/commands.sql @@ -32,7 +32,7 @@ CREATE TABLE subscriptions ( FOREIGN KEY(cycle) REFERENCES cycles(id), FOREIGN KEY(frequency) REFERENCES frequencies(id), FOREIGN KEY(payment_method_id) REFERENCES payment_methods(id), - FOREIGN KEY(payer_user_id) REFERENCES user(id) + FOREIGN KEY(payer_user_id) REFERENCES household(id) FOREIGN KEY(category_id) REFERENCES categories(id) ); diff --git a/endpoints/cronjobs/createdatabase.php b/endpoints/cronjobs/createdatabase.php index 4fd6c15..2d54d7c 100644 --- a/endpoints/cronjobs/createdatabase.php +++ b/endpoints/cronjobs/createdatabase.php @@ -43,7 +43,7 @@ if (!file_exists($databaseFile)) { FOREIGN KEY(cycle) REFERENCES cycles(id), FOREIGN KEY(frequency) REFERENCES frequencies(id), FOREIGN KEY(payment_method_id) REFERENCES payment_methods(id), - FOREIGN KEY(payer_user_id) REFERENCES user(id) + FOREIGN KEY(payer_user_id) REFERENCES household(id) FOREIGN KEY(category_id) REFERENCES categories(id) )'); diff --git a/endpoints/subscriptions/get.php b/endpoints/subscriptions/get.php index e3781a4..84c2a92 100644 --- a/endpoints/subscriptions/get.php +++ b/endpoints/subscriptions/get.php @@ -50,6 +50,7 @@ $print[$id]['payment_method_icon'] = "images/uploads/icons/" . $payment_methods[$paymentMethodId]['icon']; $print[$id]['payment_method_name'] = $payment_methods[$paymentMethodId]['name']; $print[$id]['category_id'] = $subscription['category_id']; + $print[$id]['payer_user_id'] = $subscription['payer_user_id']; $print[$id]['price'] = $subscription['price']; if (isset($_COOKIE['convertCurrency']) && $_COOKIE['convertCurrency'] === 'true' && $currencyId != $mainCurrencyId) { @@ -66,7 +67,7 @@ } if (isset($print)) { - printSubscriptons($print, $sort, $categories); + printSubscriptons($print, $sort, $categories, $members); } if (count($subscriptions) == 0) { diff --git a/index.php b/index.php index d27fee9..03b45da 100644 --- a/index.php +++ b/index.php @@ -78,6 +78,7 @@ $print[$id]['payment_method_icon'] = "images/uploads/icons/" . $payment_methods[$paymentMethodId]['icon']; $print[$id]['payment_method_name'] = $payment_methods[$paymentMethodId]['name']; $print[$id]['category_id'] = $subscription['category_id']; + $print[$id]['payer_user_id'] = $subscription['payer_user_id']; $print[$id]['price'] = $subscription['price']; if (isset($_COOKIE['convertCurrency']) && $_COOKIE['convertCurrency'] === 'true' && $currencyId != $mainCurrencyId) { @@ -94,7 +95,7 @@ } if (isset($print)) { - printSubscriptons($print, $sort, $categories); + printSubscriptons($print, $sort, $categories, $members); } $db->close(); @@ -110,7 +111,7 @@ Add First Subscription -