diff --git a/a.out b/a.out new file mode 100644 index 000000000..e69de29bb diff --git a/includes/i18n/de.php b/includes/i18n/de.php index 36d7da9f6..817bea736 100644 --- a/includes/i18n/de.php +++ b/includes/i18n/de.php @@ -89,6 +89,7 @@ "cancel" => "Abbrechen", "upload_logo" => "Logo hochladen", // Statistics page + 'cant_convert_currency' => "Sie verwenden mehrere Währungen für Ihre Abonnements. Um gültige und genaue Statistiken zu erhalten, legen Sie bitte einen Fixer-API-Schlüssel auf der Einstellungsseite fest.", 'general_statistics' => "Allgemeine Statistiken", 'active_subscriptions' => "Aktive Abonnements", 'inactive_subscriptions' => "Inaktive Abonnements", diff --git a/includes/i18n/el.php b/includes/i18n/el.php index 622c7faa3..abd018cf9 100644 --- a/includes/i18n/el.php +++ b/includes/i18n/el.php @@ -89,6 +89,7 @@ "cancel" => "Ακύρωση", "upload_logo" => "Φόρτωση λογότυπου", // Statistics page + 'cant_convert_currency' => "Χρησιμοποιείτε πολλαπλά νομίσματα στις συνδρομές σας. Για να έχετε έγκυρα και ακριβή στατιστικά στοιχεία, παρακαλούμε ορίστε ένα κλειδί API Fixer στη σελίδα ρυθμίσεων.", 'general_statistics' => "Γενικές στατιστικές", 'active_subscriptions' => "Ενεργές συνδρομές", 'inactive_subscriptions' => "Ανενεργές συνδρομές", diff --git a/includes/i18n/en.php b/includes/i18n/en.php index 2f070226f..c29a2f8e4 100644 --- a/includes/i18n/en.php +++ b/includes/i18n/en.php @@ -89,6 +89,7 @@ "cancel" => "Cancel", "upload_logo" => "Upload Logo", // Statistics page + 'cant_convert_currency' => "You are using multiple currencies on your subscriptions. To have valid and accurate statistics, please set a Fixer API Key on the settings page.", 'general_statistics' => "General Statistics", 'active_subscriptions' => "Active Subscriptions", 'inactive_subscriptions' => "Inactive Subscriptions", diff --git a/includes/i18n/es.php b/includes/i18n/es.php index 06ac85f7f..558fef803 100644 --- a/includes/i18n/es.php +++ b/includes/i18n/es.php @@ -89,6 +89,7 @@ "cancel" => "Cancelar", "upload_logo" => "Cargar Logotipo", // Statistics page + 'cant_convert_currency' => "Estás utilizando varias monedas en tus suscripciones. Para disponer de estadísticas válidas y precisas, establece una clave API Fixer en la página de configuración.", 'general_statistics' => "Estadísticas Generales", 'active_subscriptions' => "Suscripciones Activas", 'inactive_subscriptions' => "Suscripciones inactivas", diff --git a/includes/i18n/fr.php b/includes/i18n/fr.php index 8b22561ee..99fcf0a80 100644 --- a/includes/i18n/fr.php +++ b/includes/i18n/fr.php @@ -89,6 +89,7 @@ "cancel" => "Annuler", "upload_logo" => "Télécharger le logo", // Page de statistiques + 'cant_convert_currency' => "Vous utilisez plusieurs devises dans vos abonnements. Pour obtenir des statistiques valides et précises, veuillez définir une clé API Fixer sur la page des paramètres.", 'general_statistics' => "Statistiques générales", 'active_subscriptions' => "Abonnements actifs", 'inactive_subscriptions' => "Abonnements inactifs", diff --git a/includes/i18n/it.php b/includes/i18n/it.php index 127729fc2..bc3f20616 100644 --- a/includes/i18n/it.php +++ b/includes/i18n/it.php @@ -95,6 +95,7 @@ 'upload_logo' => 'Carica logo', // Statistics + 'cant_convert_currency' => "Si stanno utilizzando più valute per gli abbonamenti. Per avere statistiche valide e precise, impostare una chiave API Fixer nella pagina delle impostazioni.", 'general_statistics' => 'Statistiche generali', 'active_subscriptions' => 'Abbonamenti attivi', 'inactive_subscriptions' => 'Abbonamenti inattivi', diff --git a/includes/i18n/jp.php b/includes/i18n/jp.php index 02afc4ae3..3aad65fc4 100644 --- a/includes/i18n/jp.php +++ b/includes/i18n/jp.php @@ -89,6 +89,7 @@ "cancel" => "キャンセル", "upload_logo" => "ロゴのアップロード", // Statistics page + 'cant_convert_currency' => "購読に複数の通貨を使用しています。有効で正確な統計を取るには、設定ページでFixer API Keyを設定してください。", 'general_statistics' => "一般統計", 'active_subscriptions' => "アクティブな定期購入", 'inactive_subscriptions' => "非アクティブなサブスクリプション", diff --git a/includes/i18n/ko.php b/includes/i18n/ko.php index d92deef29..36764c21c 100644 --- a/includes/i18n/ko.php +++ b/includes/i18n/ko.php @@ -89,6 +89,7 @@ "cancel" => "취소", "upload_logo" => "로고 업로드", // Statistics page + 'cant_convert_currency' => "구독에서 여러 통화를 사용하고 있습니다. 유효하고 정확한 통계를 얻으려면 설정 페이지에서 Fixer API 키를 설정하세요.", 'general_statistics' => "일반 통계", 'active_subscriptions' => "활성 구독", 'inactive_subscriptions' => "비활성 구독", diff --git a/includes/i18n/pl.php b/includes/i18n/pl.php index e154eec68..57ebfb297 100644 --- a/includes/i18n/pl.php +++ b/includes/i18n/pl.php @@ -89,6 +89,7 @@ "cancel" => "Anuluj", "upload_logo" => "Prześlij logo", // Statistics page + 'cant_convert_currency' => "Używasz wielu walut w swoich subskrypcjach. Aby uzyskać prawidłowe i dokładne statystyki, należy ustawić klucz API Fixer na stronie ustawień.", 'general_statistics' => "Statystyki ogólne", 'active_subscriptions' => "Aktywne subskrypcje", 'inactive_subscriptions' => "Nieaktywne subskrypcje", diff --git a/includes/i18n/pt.php b/includes/i18n/pt.php index 4268c10fa..1074cb359 100644 --- a/includes/i18n/pt.php +++ b/includes/i18n/pt.php @@ -89,6 +89,7 @@ "cancel" => "Cancelar", "upload_logo" => "Enviar Logo", // Statistics page + 'cant_convert_currency' => "Está a utilizar várias moedas nas suas subscrições. Para obter estatísticas válidas e exactas, defina uma chave API do Fixer na página de definições.", 'general_statistics' => "Estatísticas Gerais", 'active_subscriptions' => "Subscrições Activas", 'inactive_subscriptions' => "Subscrições inactivas", diff --git a/includes/i18n/pt_br.php b/includes/i18n/pt_br.php index a5e7febaf..6bcd5e648 100644 --- a/includes/i18n/pt_br.php +++ b/includes/i18n/pt_br.php @@ -89,6 +89,7 @@ "cancel" => "Cancelar", "upload_logo" => "Enviar Logo", // Statistics page + 'cant_convert_currency' => "Você está usando várias moedas em suas assinaturas. Para obter estatísticas válidas e precisas, defina uma chave de API do Fixer na página de configurações.", 'general_statistics' => "Estatísticas gerais", 'active_subscriptions' => "Assinaturas ativas", 'inactive_subscriptions' => "Assinaturas inativas", diff --git a/includes/i18n/ru.php b/includes/i18n/ru.php index 73ce6a6dd..99a7e61ee 100644 --- a/includes/i18n/ru.php +++ b/includes/i18n/ru.php @@ -89,6 +89,7 @@ "cancel" => "Отмена", "upload_logo" => "Загрузить логотип", // Statistics page + 'cant_convert_currency' => "Вы используете несколько валют в своих подписках. Для получения достоверной и точной статистики, пожалуйста, установите API-ключ Fixer на странице настроек.", 'general_statistics' => "Общая статистика", 'active_subscriptions' => "Активные подписки", 'inactive_subscriptions' => "Неактивные подписки", diff --git a/includes/i18n/sl.php b/includes/i18n/sl.php index 5a63a6dc0..6989cff87 100644 --- a/includes/i18n/sl.php +++ b/includes/i18n/sl.php @@ -89,6 +89,7 @@ "cancel" => "Prekliči", "upload_logo" => "Naloži logotip", // Statistics page + 'cant_convert_currency' => "Pri naročninah uporabljate več valut. Če želite imeti veljavne in točne statistične podatke, na strani z nastavitvami nastavite ključ API Fixer.", 'general_statistics' => "Splošna statistika", 'active_subscriptions' => "Aktivne naročnine", 'inactive_subscriptions' => "Neaktivne naročnine", diff --git a/includes/i18n/sr.php b/includes/i18n/sr.php index 1166039a7..c051a8987 100644 --- a/includes/i18n/sr.php +++ b/includes/i18n/sr.php @@ -89,6 +89,7 @@ "cancel" => "Откажи", "upload_logo" => "Постави логотип", // Страница са статистикама + 'cant_convert_currency' => "На својим претплатама користите више валута. Да бисте имали валидну и тачну статистику, поставите Фикер АПИ кључ на страници подешавања.", 'general_statistics' => "Опште статистике", 'active_subscriptions' => "Активне претплате", 'inactive_subscriptions' => "Неактивне претплате", diff --git a/includes/i18n/sr_lat.php b/includes/i18n/sr_lat.php index 6eef42468..0ec72440f 100644 --- a/includes/i18n/sr_lat.php +++ b/includes/i18n/sr_lat.php @@ -89,6 +89,7 @@ "cancel" => "Otkaži", "upload_logo" => "Učitaj logo", // Stranica sa statistikama + 'cant_convert_currency' => "Na svojim pretplatama koristite više valuta. Da biste imali validnu i tačnu statistiku, postavite Fiker API ključ na stranici podešavanja.", 'general_statistics' => "Opšte statistike", 'active_subscriptions' => "Aktivne pretplate", 'inactive_subscriptions' => "Neaktivne pretplate", diff --git a/includes/i18n/tr.php b/includes/i18n/tr.php index f1d3f3c0d..959ec790d 100644 --- a/includes/i18n/tr.php +++ b/includes/i18n/tr.php @@ -89,6 +89,7 @@ "cancel" => "İptal", "upload_logo" => "Logo Yükle", // Statistics page + 'cant_convert_currency' => "Aboneliklerinizde birden fazla para birimi kullanıyorsunuz. Geçerli ve doğru istatistiklere sahip olmak için lütfen ayarlar sayfasında bir Fixer API Anahtarı ayarlayın.", 'general_statistics' => "Genel İstatistikler", 'active_subscriptions' => "Aktif Abonelikler", 'inactive_subscriptions' => "Aktif Olmayan Abonelikler", diff --git a/includes/i18n/zh_cn.php b/includes/i18n/zh_cn.php index abb4aaadb..e3bd8ac94 100644 --- a/includes/i18n/zh_cn.php +++ b/includes/i18n/zh_cn.php @@ -95,6 +95,7 @@ "upload_logo" => "上传 Logo", // 统计页面 + 'cant_convert_currency' => "您在订阅中使用了多种货币。要获得有效、准确的统计数据,请在设置页面设置 Fixer API 密钥。", 'general_statistics' => "总体统计", 'active_subscriptions' => "活跃订阅", 'inactive_subscriptions' => "非活动订阅", diff --git a/includes/i18n/zh_tw.php b/includes/i18n/zh_tw.php index 3c7cee7e4..9a88dfef9 100644 --- a/includes/i18n/zh_tw.php +++ b/includes/i18n/zh_tw.php @@ -89,6 +89,7 @@ "cancel" => "取消", "upload_logo" => "上傳圖示", // 統計頁面 + 'cant_convert_currency' => "您的訂閱使用多種貨幣。為了獲得有效且準確的統計數據,請在設定頁面設定 Fixer API Key。", 'general_statistics' => "整體統計", 'active_subscriptions' => "訂閱中", 'inactive_subscriptions' => "停用訂閱", diff --git a/includes/version.php b/includes/version.php index e7940d94b..7f8a24fb4 100644 --- a/includes/version.php +++ b/includes/version.php @@ -1,3 +1,3 @@ \ No newline at end of file diff --git a/scripts/settings.js b/scripts/settings.js index 350c2edb8..ea6d71f97 100644 --- a/scripts/settings.js +++ b/scripts/settings.js @@ -848,6 +848,7 @@ function addFixerKeyButton() { const apiKeyInput = document.querySelector("#fixerKey"); apiKey = apiKeyInput.value.trim(); const provider = document.querySelector("#fixerProvider").value; + const convertCurrencyCheckbox = document.querySelector("#convertcurrency"); fetch("endpoints/currency/fixer_api_key.php", { method: "POST", headers: { @@ -860,6 +861,7 @@ function addFixerKeyButton() { if (data.success) { showSuccessMessage(data.message); document.getElementById("addFixerKey").disabled = false; + convertCurrencyCheckbox.disabled = false; // update currency exchange rates fetch("endpoints/currency/update_exchange.php?force=true"); } else { diff --git a/settings.php b/settings.php index e9ce63a77..635141d96 100644 --- a/settings.php +++ b/settings.php @@ -1215,8 +1215,10 @@ class="thin">
> + >
diff --git a/stats.php b/stats.php index 1fea28d65..66195ecd7 100644 --- a/stats.php +++ b/stats.php @@ -19,7 +19,6 @@ function getPricePerMonth($cycle, $frequency, $price) } } - function getPriceConverted($price, $currency, $database, $userId) { $query = "SELECT rate FROM currencies WHERE id = :currency AND user_id = :userId"; @@ -134,6 +133,8 @@ function getPriceConverted($price, $currency, $database, $userId) } $result = $stmt->execute(); +$usesMultipleCurrencies = false; + if ($result) { while ($row = $result->fetchArray(SQLITE3_ASSOC)) { $subscriptions[] = $row; @@ -146,6 +147,9 @@ function getPriceConverted($price, $currency, $database, $userId) $frequency = $subscription['frequency']; $cycle = $subscription['cycle']; $currency = $subscription['currency_id']; + if ($currency != $userData['main_currency']) { + $usesMultipleCurrencies = true; + } $next_payment = $subscription['next_payment']; $payerId = $subscription['payer_user_id']; $categoryId = $subscription['category_id']; @@ -219,9 +223,32 @@ function getPriceConverted($price, $currency, $database, $userId) } } +$showCantConverErrorMessage = false; +if ($usesMultipleCurrencies) { + $query = "SELECT api_key FROM fixer WHERE user_id = :userId"; + $stmt = $db->prepare($query); + $stmt->bindValue(':userId', $userId, SQLITE3_INTEGER); + $result = $stmt->execute(); + if ($result->fetchArray(SQLITE3_ASSOC) === false) { + $showCantConverErrorMessage = true; + } +} + $numberOfElements = 6; ?>
+ +
+
+ + +
+
+

@@ -272,7 +299,8 @@ function getPriceConverted($price, $currency, $database, $userId) } ?>
-
+ +

@@ -295,7 +323,8 @@ function getPriceConverted($price, $currency, $database, $userId) } ?>
-
+ + diff --git a/styles/styles.css b/styles/styles.css index 4fa58896e..4d40c6251 100644 --- a/styles/styles.css +++ b/styles/styles.css @@ -12,6 +12,7 @@ body.no-scroll { input, button, select, textarea { font-family: Barlow, 'Helvetica Neue', Helvetica, sans-serif; + font-weight: 400; } @media (max-width: 768px) { @@ -35,6 +36,20 @@ h2, h3 { box-sizing: border-box; } +.error-box { + padding: 20px 16px; + background-color: rgba(var(--error-color-rgb), 0.3); + border: 1px solid var(--error-color); + border-radius: 8px; + margin-bottom: 20px; + font-size: 16px; +} + +.error-box .error-message i { + color: var(--error-color); + margin-right: 10px; +} + .split-header { display: flex; flex-direction: row;