Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 27 additions & 21 deletions endpoints/subscription/add.php
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,10 @@ function resizeAndUploadLogo($uploadedFile, $uploadDir, $name, $settings)
$inactive = isset($_POST['inactive']) ? true : false;
$cancellationDate = $_POST['cancellation_date'] ?? null;
$replacementSubscriptionId = $_POST['replacement_subscription_id'];
$paymentMethodLastFour = isset($_POST['payment_method_last_four']) ? preg_replace('/[^0-9]/', '', $_POST['payment_method_last_four']) : null;
if ($paymentMethodLastFour === '') {
$paymentMethodLastFour = null;
}

if ($replacementSubscriptionId == 0 || $inactive == 0) {
$replacementSubscriptionId = null;
Expand All @@ -265,37 +269,38 @@ function resizeAndUploadLogo($uploadedFile, $uploadDir, $name, $settings)

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, inactive, url,
name, logo, price, currency_id, next_payment, cycle, frequency, notes,
payment_method_id, payer_user_id, category_id, notify, inactive, url,
notify_days_before, user_id, cancellation_date, replacement_subscription_id,
auto_renew, start_date
auto_renew, start_date, payment_method_last_four
) VALUES (
:name, :logo, :price, :currencyId, :nextPayment, :cycle, :frequency, :notes,
:paymentMethodId, :payerUserId, :categoryId, :notify, :inactive, :url,
:name, :logo, :price, :currencyId, :nextPayment, :cycle, :frequency, :notes,
:paymentMethodId, :payerUserId, :categoryId, :notify, :inactive, :url,
:notifyDaysBefore, :userId, :cancellationDate, :replacement_subscription_id,
:autoRenew, :startDate
:autoRenew, :startDate, :paymentMethodLastFour
)";
} else {
$id = $_POST['id'];
$sql = "UPDATE subscriptions SET
name = :name,
price = :price,
$sql = "UPDATE subscriptions SET
name = :name,
price = :price,
currency_id = :currencyId,
next_payment = :nextPayment,
next_payment = :nextPayment,
auto_renew = :autoRenew,
start_date = :startDate,
cycle = :cycle,
frequency = :frequency,
notes = :notes,
cycle = :cycle,
frequency = :frequency,
notes = :notes,
payment_method_id = :paymentMethodId,
payer_user_id = :payerUserId,
category_id = :categoryId,
notify = :notify,
inactive = :inactive,
url = :url,
notify_days_before = :notifyDaysBefore,
cancellation_date = :cancellationDate,
replacement_subscription_id = :replacement_subscription_id";
payer_user_id = :payerUserId,
category_id = :categoryId,
notify = :notify,
inactive = :inactive,
url = :url,
notify_days_before = :notifyDaysBefore,
cancellation_date = :cancellationDate,
replacement_subscription_id = :replacement_subscription_id,
payment_method_last_four = :paymentMethodLastFour";

if ($logo != "") {
$sql .= ", logo = :logo";
Expand Down Expand Up @@ -330,6 +335,7 @@ function resizeAndUploadLogo($uploadedFile, $uploadDir, $name, $settings)
}
$stmt->bindParam(':userId', $userId, SQLITE3_INTEGER);
$stmt->bindParam(':replacement_subscription_id', $replacementSubscriptionId, SQLITE3_INTEGER);
$stmt->bindParam(':paymentMethodLastFour', $paymentMethodLastFour, SQLITE3_TEXT);

if ($stmt->execute()) {
$success['status'] = "Success";
Expand Down
3 changes: 2 additions & 1 deletion endpoints/subscription/clone.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
]));
}

$query = "INSERT INTO subscriptions (name, logo, price, currency_id, next_payment, cycle, frequency, notes, payment_method_id, payer_user_id, category_id, notify, url, inactive, notify_days_before, user_id, cancellation_date, replacement_subscription_id) VALUES (:name, :logo, :price, :currency_id, :next_payment, :cycle, :frequency, :notes, :payment_method_id, :payer_user_id, :category_id, :notify, :url, :inactive, :notify_days_before, :user_id, :cancellation_date, :replacement_subscription_id)";
$query = "INSERT INTO subscriptions (name, logo, price, currency_id, next_payment, cycle, frequency, notes, payment_method_id, payer_user_id, category_id, notify, url, inactive, notify_days_before, user_id, cancellation_date, replacement_subscription_id, payment_method_last_four) VALUES (:name, :logo, :price, :currency_id, :next_payment, :cycle, :frequency, :notes, :payment_method_id, :payer_user_id, :category_id, :notify, :url, :inactive, :notify_days_before, :user_id, :cancellation_date, :replacement_subscription_id, :payment_method_last_four)";
$cloneStmt = $db->prepare($query);
$cloneStmt->bindValue(':name', $subscriptionToClone['name'], SQLITE3_TEXT);
$cloneStmt->bindValue(':logo', $subscriptionToClone['logo'], SQLITE3_TEXT);
Expand All @@ -41,6 +41,7 @@
$cloneStmt->bindValue(':user_id', $userId, SQLITE3_INTEGER);
$cloneStmt->bindValue(':cancellation_date', $subscriptionToClone['cancellation_date'], SQLITE3_TEXT);
$cloneStmt->bindValue(':replacement_subscription_id', $subscriptionToClone['replacement_subscription_id'], SQLITE3_INTEGER);
$cloneStmt->bindValue(':payment_method_last_four', $subscriptionToClone['payment_method_last_four'], SQLITE3_TEXT);

if ($cloneStmt->execute()) {
$response = [
Expand Down
1 change: 1 addition & 0 deletions endpoints/subscription/get.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
$subscriptionData['notify_days_before'] = $row['notify_days_before'];
$subscriptionData['cancellation_date'] = $row['cancellation_date'];
$subscriptionData['replacement_subscription_id'] = $row['replacement_subscription_id'];
$subscriptionData['payment_method_last_four'] = $row['payment_method_last_four'];

$subscriptionJson = json_encode($subscriptionData);
header('Content-Type: application/json');
Expand Down
3 changes: 3 additions & 0 deletions endpoints/subscriptions/get.php
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,9 @@
$print[$id]['payment_method_icon'] = $paymentIconFolder . $payment_methods[$paymentMethodId]['icon'];
$print[$id]['payment_method_name'] = $payment_methods[$paymentMethodId]['name'];
$print[$id]['payment_method_id'] = $paymentMethodId;
if (isset($subscription['payment_method_last_four'])) {
$print[$id]['payment_method_last_four'] = $subscription['payment_method_last_four'];
}
$print[$id]['category_id'] = $subscription['category_id'];
$print[$id]['payer_user_id'] = $subscription['payer_user_id'];
$print[$id]['price'] = floatval($subscription['price']);
Expand Down
7 changes: 7 additions & 0 deletions images/siteicons/svg/card.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 48 48" height="48" width="48">
<g id="credit-card">
<rect class="accent-color" x="2" y="10" width="44" height="28" rx="4" ry="4" stroke-width="1"></rect>
<path class="main-color" fill-rule="evenodd" d="M2 18h44v4H2v-4Z" clip-rule="evenodd" stroke-width="1"></path>
<rect class="main-color" x="6" y="28" width="12" height="4" rx="1" stroke-width="1"></rect>
</g>
</svg>
2 changes: 2 additions & 0 deletions includes/i18n/ca.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@
"cycle" => "Cicle",
"no_category" => "Sense categoria",
"paid_by" => "Pagat per",
"last_four_digits" => "Últims 4 Dígits",
"last_four_digits_placeholder" => "1234",
"url" => "URL",
"notes" => "Notes",
"enable_notifications" => "Activar notificacions per aquesta subscripció",
Expand Down
2 changes: 2 additions & 0 deletions includes/i18n/cs.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@
"cycle" => "Cyklus",
"no_category" => "Žádná kategorie",
"paid_by" => "Platí",
"last_four_digits" => "Poslední 4 číslice",
"last_four_digits_placeholder" => "1234",
"url" => "Adresa URL",
"notes" => "Poznámky",
"enable_notifications" => "Povolit oznámení pro toto předplatné",
Expand Down
2 changes: 2 additions & 0 deletions includes/i18n/da.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@
"cycle" => "Cyklus",
"no_category" => "Ingen kategori",
"paid_by" => "Betalt af",
"last_four_digits" => "Sidste 4 cifre",
"last_four_digits_placeholder" => "1234",
"url" => "URL",
"notes" => "Noter",
"enable_notifications" => "Aktivér notifikationer for dette abonnement",
Expand Down
2 changes: 2 additions & 0 deletions includes/i18n/de.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@
"cycle" => "Zeitraum",
"no_category" => "Keine Kategorie",
"paid_by" => "Gezahlt durch",
"last_four_digits" => "Letzte 4 Ziffern",
"last_four_digits_placeholder" => "1234",
"url" => "URL",
"notes" => "Notizen",
"enable_notifications" => "Benachrichtigungen für dieses Abonnement aktivieren",
Expand Down
2 changes: 2 additions & 0 deletions includes/i18n/el.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@
"cycle" => "Κύκλος",
"no_category" => "Καμία κατηγορία",
"paid_by" => "Πληρώνεται από",
"last_four_digits" => "Τελευταία 4 Ψηφία",
"last_four_digits_placeholder" => "1234",
"url" => "URL",
"notes" => "Σημειώσεις",
"enable_notifications" => "Ενεργοποίηση ειδοποιήσεων για αυτή τη συνδρομή",
Expand Down
2 changes: 2 additions & 0 deletions includes/i18n/en.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@
"cycle" => "Cycle",
"no_category" => "No category",
"paid_by" => "Paid by",
"last_four_digits" => "Last 4 Digits",
"last_four_digits_placeholder" => "1234",
"url" => "URL",
"notes" => "Notes",
"enable_notifications" => "Enable Notifications for this subscription",
Expand Down
2 changes: 2 additions & 0 deletions includes/i18n/es.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@
"cycle" => "Ciclo",
"no_category" => "Sin categoría",
"paid_by" => "Pagado por",
"last_four_digits" => "Últimos 4 Dígitos",
"last_four_digits_placeholder" => "1234",
"url" => "URL",
"notes" => "Notas",
"enable_notifications" => "Habilitar notificaciones para esta suscripción",
Expand Down
2 changes: 2 additions & 0 deletions includes/i18n/fr.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@
"cycle" => "Cycle",
"no_category" => "Pas de catégorie",
"paid_by" => "Payé par",
"last_four_digits" => "4 Derniers Chiffres",
"last_four_digits_placeholder" => "1234",
"url" => "URL",
"notes" => "Notes",
"enable_notifications" => "Activer les notifications pour cet abonnement",
Expand Down
2 changes: 2 additions & 0 deletions includes/i18n/id.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@
"cycle" => "Siklus",
"no_category" => "Tidak ada kategori",
"paid_by" => "Dibayar oleh",
"last_four_digits" => "4 Digit Terakhir",
"last_four_digits_placeholder" => "1234",
"url" => "URL",
"notes" => "Catatan",
"enable_notifications" => "Aktifkan Notifikasi untuk langganan ini",
Expand Down
2 changes: 2 additions & 0 deletions includes/i18n/it.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@
"cycle" => 'Ciclo',
"no_category" => 'Nessuna categoria',
"paid_by" => 'Pagato da',
"last_four_digits" => 'Ultime 4 cifre',
"last_four_digits_placeholder" => '1234',
"url" => 'URL',
"notes" => 'Note',
"enable_notifications" => 'Abilita notifiche per questo abbonamento',
Expand Down
2 changes: 2 additions & 0 deletions includes/i18n/jp.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@
"cycle" => "サイクル",
"no_category" => "カテゴリなし",
"paid_by" => "支払い元",
"last_four_digits" => "下4桁",
"last_four_digits_placeholder" => "1234",
"url" => "URL",
"notes" => "注釈",
"enable_notifications" => "この定期購入の通知を有効にする",
Expand Down
2 changes: 2 additions & 0 deletions includes/i18n/ko.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@
"cycle" => "주기",
"no_category" => "카테고리 없음",
"paid_by" => "결제하는 사람",
"last_four_digits" => "마지막 4자리",
"last_four_digits_placeholder" => "1234",
"url" => "URL",
"notes" => "메모",
"enable_notifications" => "이 구독에 대한 알림을 활성화합니다.",
Expand Down
2 changes: 2 additions & 0 deletions includes/i18n/nl.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@
"cycle" => "Cyclus",
"no_category" => "Geen categorie",
"paid_by" => "Betaald door",
"last_four_digits" => "Laatste 4 cijfers",
"last_four_digits_placeholder" => "1234",
"url" => "URL",
"notes" => "Notities",
"enable_notifications" => "Notificaties inschakelen voor dit abonnement",
Expand Down
2 changes: 2 additions & 0 deletions includes/i18n/pl.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@
"cycle" => "Cykl",
"no_category" => "Brak kategorii",
"paid_by" => "Zapłacone przez",
"last_four_digits" => "Ostatnie 4 cyfry",
"last_four_digits_placeholder" => "1234",
"url" => "URL",
"notes" => "Notatki",
"enable_notifications" => "Włącz powiadomienia dla tej subskrypcji",
Expand Down
2 changes: 2 additions & 0 deletions includes/i18n/pt.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@
"Cycle" => "Ciclo",
"no_category" => "Sem categoria",
"paid_by" => "Pago por",
"last_four_digits" => "Últimos 4 Dígitos",
"last_four_digits_placeholder" => "1234",
"url" => "URL",
"notes" => "Notas",
"enable_notifications" => "Activar notificações para esta subscrição",
Expand Down
2 changes: 2 additions & 0 deletions includes/i18n/pt_br.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@
"cycle" => "Ciclo",
"no_category" => "Sem categoria",
"paid_by" => "Pago por",
"last_four_digits" => "Últimos 4 Dígitos",
"last_four_digits_placeholder" => "1234",
"url" => "URL",
"notes" => "Anotações",
"enable_notifications" => "Ativar notificações para essa assinatura",
Expand Down
2 changes: 2 additions & 0 deletions includes/i18n/ru.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@
"cycle" => "Цикл",
"no_category" => "Нет категории",
"paid_by" => "Оплачивает",
"last_four_digits" => "Последние 4 цифры",
"last_four_digits_placeholder" => "1234",
"url" => "URL",
"notes" => "Примечания",
"enable_notifications" => "Включить уведомления для этой подписки",
Expand Down
2 changes: 2 additions & 0 deletions includes/i18n/sl.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@
"cycle" => "cikel",
"no_category" => "Brez kategorije",
"paid_by" => "Plačal",
"last_four_digits" => "Zadnje 4 številke",
"last_four_digits_placeholder" => "1234",
"url" => "URL",
"notes" => "Opombe",
"enable_notifications" => "Omogoči obvestila za to naročnino",
Expand Down
2 changes: 2 additions & 0 deletions includes/i18n/sr.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@
"cycle" => "Циклус",
"no_category" => "Без категорије",
"paid_by" => "Плаћено од",
"last_four_digits" => "Последње 4 цифре",
"last_four_digits_placeholder" => "1234",
"url" => "URL",
"notes" => "Напомене",
"enable_notifications" => "Омогући обавештења за ову претплату",
Expand Down
2 changes: 2 additions & 0 deletions includes/i18n/sr_lat.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@
"cycle" => "Ciklus",
"no_category" => "Bez kategorije",
"paid_by" => "Plaćeno od strane",
"last_four_digits" => "Poslednje 4 cifre",
"last_four_digits_placeholder" => "1234",
"url" => "URL",
"notes" => "Beleške",
"enable_notifications" => "Omogući obaveštenja za ovu pretplatu",
Expand Down
2 changes: 2 additions & 0 deletions includes/i18n/tr.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@
"cycle" => "Döngü",
"no_category" => "Kategori yok",
"paid_by" => "Ödeyen",
"last_four_digits" => "Son 4 Rakam",
"last_four_digits_placeholder" => "1234",
"url" => "URL",
"notes" => "Notlar",
"enable_notifications" => "Bu abonelik için bildirimleri etkinleştir",
Expand Down
2 changes: 2 additions & 0 deletions includes/i18n/uk.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@
"cycle" => "Цикл",
"no_category" => "Немає категорії",
"paid_by" => "Оплачує",
"last_four_digits" => "Останні 4 цифри",
"last_four_digits_placeholder" => "1234",
"url" => "URL",
"notes" => "Примітки",
"enable_notifications" => "Увімкнути сповіщення для цієї підписки",
Expand Down
2 changes: 2 additions & 0 deletions includes/i18n/vi.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@
"cycle" => "Chu kỳ",
"no_category" => "Không có danh mục",
"paid_by" => "Người thanh toán",
"last_four_digits" => "4 Số Cuối",
"last_four_digits_placeholder" => "1234",
"url" => "URL",
"notes" => "Ghi chú",
"enable_notifications" => "Bật thông báo cho đăng ký này",
Expand Down
2 changes: 2 additions & 0 deletions includes/i18n/zh_cn.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@
"cycle" => "周期",
"no_category" => "无分类",
"paid_by" => "付款人",
"last_four_digits" => "后四位数字",
"last_four_digits_placeholder" => "1234",
"url" => "链接",
"notes" => "备注",
"enable_notifications" => "为此订阅启用通知",
Expand Down
2 changes: 2 additions & 0 deletions includes/i18n/zh_tw.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@
"cycle" => "週期",
"no_category" => "未分類",
"paid_by" => "付款人",
"last_four_digits" => "後四位數字",
"last_four_digits_placeholder" => "1234",
"url" => "網址",
"notes" => "備註",
"enable_notifications" => "啟用此訂閱的通知",
Expand Down
4 changes: 4 additions & 0 deletions includes/list_subscriptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,10 @@ class="name"><?php include $imagePath . "images/siteicons/svg/subscription.php";
title="<?= translate('paid_by', $i18n) ?>"><?php include $imagePath . "images/siteicons/svg/payment.php"; ?><?= $members[$subscription['payer_user_id']]['name'] ?></span>
<span class="category"
title="<?= translate('category', $i18n) ?>"><?php include $imagePath . "images/siteicons/svg/category.php"; ?><?= $categories[$subscription['category_id']]['name'] ?></span>
<?php if (!empty($subscription['payment_method_last_four'])): ?>
<span class="last-four-digits"
title="<?= translate('last_four_digits', $i18n) ?>"><img src="<?= $subscription['payment_method_icon'] ?>" />****<?= htmlspecialchars($subscription['payment_method_last_four']) ?></span>
<?php endif; ?>
<?php
if ($subscription['url'] != "") {
$url = $subscription['url'];
Expand Down
Loading