feat: add stats about inactive subscriptions (#146)

feat: sort disabled subscription at the bottom
This commit is contained in:
Miguel Ribeiro
2024-02-24 13:24:51 +01:00
committed by GitHub
parent 66cd5c2d2f
commit ccac17a6f2
14 changed files with 66 additions and 40 deletions
+2 -2
View File
@@ -5,7 +5,7 @@
include_once 'includes/list_subscriptions.php';
$sort = "next_payment";
$sql = "SELECT * FROM subscriptions ORDER BY next_payment ASC";
$sql = "SELECT * FROM subscriptions ORDER BY next_payment ASC, inactive ASC";
if (isset($_COOKIE['sortOrder']) && $_COOKIE['sortOrder'] != "") {
$sort = $_COOKIE['sortOrder'];
$allowedSortCriteria = ['name', 'id', 'next_payment', 'price', 'payer_user_id', 'category_id', 'payment_method_id'];
@@ -14,7 +14,7 @@
$order = "DESC";
}
if (in_array($sort, $allowedSortCriteria)) {
$sql = "SELECT * FROM subscriptions ORDER BY $sort $order";
$sql = "SELECT * FROM subscriptions ORDER BY $sort $order, inactive ASC";
}
}