🛡️ Warracker is an open source, self-hostable warranty tracker to monitor expirations, store receipts, files. You own the data, your rules!
Block new claims on voided warranties
sassanix2ba03001f03b
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 693ae78..fdf3c3b 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -2,6 +2,8 @@## 1.0.5 - Unreleased+- **Claims can no longer be added to a voided warranty:** a voided warranty's coverage is dead, but the app still let new claims be filed against it. Claim creation now returns a clear error (code `warranty_voided`), the claims view hides the Add Claim button for voided warranties and explains why, and claims recorded before the void stay fully editable — un-voiding restores claim creation.+- **Other documents accept more than archives (#222):** the Other Document file picker in the add form and both edit modals only offered ZIP/RAR files, even though the server has always accepted PDFs and images there too — so a warranty terms PDF could not be attached through the UI. The picker now offers every type the server accepts (PDF, PNG, JPG, WebP, GIF, ZIP, RAR), and the field label no longer calls out only archives (all 20 locales).# 1.0.4 - 2026-10-31diff --git a/backend/warranties_routes.py b/backend/warranties_routes.pyindex 2852544..a8c6d91 100644--- a/backend/warranties_routes.py+++ b/backend/warranties_routes.py@@ -2356,13 +2356,21 @@ def create_claim(warranty_id):cur = conn.cursor()cur.execute("""- SELECT id, product_name FROM warranties+ SELECT id, product_name, voided_at FROM warrantiesWHERE id = %s AND user_id = %s""", (warranty_id, user_id))-+warranty = cur.fetchone()if not warranty:return jsonify({'error': 'Warranty not found or access denied'}), 404++ # A voided warranty's coverage is dead, so it cannot gain new+ # claims. Claims recorded before the void stay editable.+ if warranty[2] is not None:+ return jsonify({+ 'error': 'Claims cannot be added to a voided warranty. Un-void the warranty first.',+ 'code': 'warranty_voided',+ }), 400# Validate required fieldsclaim_date = data.get('claim_date')diff --git a/frontend/about.html b/frontend/about.htmlindex e91f3a8..e472d2d 100644--- a/frontend/about.html+++ b/frontend/about.html@@ -14,7 +14,7 @@<link rel="manifest" href="manifest.json"><!-- Stylesheets -->- <link rel="stylesheet" href="style.css?v=20261030001"> <!-- Main stylesheet -->+ <link rel="stylesheet" href="style.css?v=20261101001"> <!-- Main stylesheet --><link rel="stylesheet" href="style.css?v=20250119001"> <!-- Additional styles --><link rel="stylesheet" href="vendor/fontawesome/css/all.min.css?v=20261001001"> <!-- Font Awesome --><link rel="stylesheet" href="header-fix.css?v=20250119001"> <!-- Header specific styles -->diff --git a/frontend/auth-redirect.html b/frontend/auth-redirect.htmlindex 073fd82..8ce40a2 100644--- a/frontend/auth-redirect.html+++ b/frontend/auth-redirect.html@@ -4,7 +4,7 @@<meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Authenticating...</title>- <link rel="stylesheet" href="style.css?v=20261030001">+ <link rel="stylesheet" href="style.css?v=20261101001"><script src="theme-loader.js?v=20250119001"></script><style>body {diff --git a/frontend/index.html b/frontend/index.htmlindex 83f8ea6..0897727 100644--- a/frontend/index.html+++ b/frontend/index.html@@ -22,7 +22,7 @@<link rel="icon" type="image/png" sizes="32x32" href="img/favicon-32x32.png?v=2"><link rel="apple-touch-icon" sizes="180x180" href="img/favicon-512x512.png"><link rel="manifest" href="manifest.json">- <link rel="stylesheet" href="style.css?v=20261030001">+ <link rel="stylesheet" href="style.css?v=20261101001"><script src="theme-loader.js?v=20250119001"></script> <!-- Apply theme early --><!-- Font Awesome for icons -->diff --git a/frontend/js/components/claims.js b/frontend/js/components/claims.jsindex d1256cf..aa5137f 100644--- a/frontend/js/components/claims.js+++ b/frontend/js/components/claims.js@@ -7,6 +7,7 @@ const state = {currentWarrantyId: null,claims: [],canEdit: false,+ warrantyVoided: false,};const dom = {@@ -135,7 +136,8 @@ function bindClaimsListBodyActions() {function updateAddClaimVisibility() {if (dom.addClaimBtn) {- dom.addClaimBtn.style.display = state.canEdit ? 'inline-block' : 'none';+ dom.addClaimBtn.style.display =+ state.canEdit && !state.warrantyVoided ? 'inline-block' : 'none';}}@@ -160,6 +162,7 @@ function updateWarrantyInfo(warranty) {</span></div></div>+ ${state.warrantyVoided ? `<p class="claim-voided-note"><i class="fas fa-ban"></i> ${t('claims.voided_note', 'This warranty is void. New claims cannot be added — un-void it first if you need to file one.')}</p>` : ''}`;}@@ -301,6 +304,13 @@ async function loadClaims(warrantyId) {function openClaimFormModal(claim = null) {if (!dom.claimFormModal) return;+ if (!claim && state.warrantyVoided) {+ showToast(+ t('claims.voided_note', 'This warranty is void. New claims cannot be added — un-void it first if you need to file one.'),+ 'error'+ );+ return;+ }if (dom.claimFormTitle) {dom.claimFormTitle.textContent = claim? t('claims.edit_claim', 'Edit Claim')@@ -608,6 +618,7 @@ export async function openClaimsModal(warrantyId) {return;}state.currentWarrantyId = warrantyId;+ state.warrantyVoided = Boolean(warranty.voided_at);const currentUser = authService.getCurrentUser?.() || null;const isAdmin = Boolean(currentUser?.is_admin);const globalView = getIsGlobalView();diff --git a/frontend/login.html b/frontend/login.htmlindex 19f1fa7..e539a88 100644--- a/frontend/login.html+++ b/frontend/login.html@@ -10,7 +10,7 @@<link rel="icon" type="image/png" sizes="32x32" href="img/favicon-32x32.png?v=2"><link rel="apple-touch-icon" sizes="180x180" href="img/favicon-512x512.png"><link rel="manifest" href="manifest.json">- <link rel="stylesheet" href="style.css?v=20261030001">+ <link rel="stylesheet" href="style.css?v=20261101001"><script src="theme-loader.js?v=20250119001"></script><script>// If user is authenticated and has a theme in user_info (from previous sessions), reflect it earlydiff --git a/frontend/register.html b/frontend/register.htmlindex 636a685..1fddd45 100644--- a/frontend/register.html+++ b/frontend/register.html@@ -13,7 +13,7 @@<link rel="icon" type="image/png" sizes="32x32" href="img/favicon-32x32.png?v=2"><link rel="apple-touch-icon" sizes="180x180" href="img/favicon-512x512.png"><link rel="manifest" href="manifest.json">- <link rel="stylesheet" href="style.css?v=20261030001">+ <link rel="stylesheet" href="style.css?v=20261101001"><script src="theme-loader.js?v=20250119001"></script> <!-- Apply theme early --><!-- Font Awesome for icons --><link rel="stylesheet" href="vendor/fontawesome/css/all.min.css?v=20261001001">diff --git a/frontend/reset-password-request.html b/frontend/reset-password-request.htmlindex 6bbde71..9beac81 100644--- a/frontend/reset-password-request.html+++ b/frontend/reset-password-request.html@@ -10,7 +10,7 @@<link rel="icon" type="image/png" sizes="32x32" href="img/favicon-32x32.png?v=2"><link rel="apple-touch-icon" sizes="180x180" href="img/favicon-512x512.png"><link rel="manifest" href="manifest.json">- <link rel="stylesheet" href="style.css?v=20261030001">+ <link rel="stylesheet" href="style.css?v=20261101001"><script src="theme-loader.js?v=20250119001"></script> <!-- Apply theme early --><!-- Font Awesome for icons --><link rel="stylesheet" href="vendor/fontawesome/css/all.min.css?v=20261001001">diff --git a/frontend/reset-password.html b/frontend/reset-password.htmlindex d108fc2..6bea659 100644--- a/frontend/reset-password.html+++ b/frontend/reset-password.html@@ -10,7 +10,7 @@<link rel="icon" type="image/png" sizes="32x32" href="img/favicon-32x32.png?v=2"><link rel="apple-touch-icon" sizes="180x180" href="img/favicon-512x512.png"><link rel="manifest" href="manifest.json">- <link rel="stylesheet" href="style.css?v=20261030001">+ <link rel="stylesheet" href="style.css?v=20261101001"><script src="theme-loader.js?v=20250119001"></script> <!-- Apply theme early --><!-- Font Awesome for icons --><link rel="stylesheet" href="vendor/fontawesome/css/all.min.css?v=20261001001">diff --git a/frontend/settings-new.html b/frontend/settings-new.htmlindex 5f4f95c..f535049 100644--- a/frontend/settings-new.html+++ b/frontend/settings-new.html@@ -17,7 +17,7 @@<link rel="apple-touch-icon" sizes="180x180" href="img/favicon-512x512.png"><link rel="manifest" href="manifest.json"><!-- Load the main site styles first -->- <link rel="stylesheet" href="style.css?v=20261030001">+ <link rel="stylesheet" href="style.css?v=20261101001"><!-- Font Awesome for icons --><link rel="stylesheet" href="vendor/fontawesome/css/all.min.css?v=20261001001"><!-- Then load settings-specific styles -->diff --git a/frontend/status.html b/frontend/status.htmlindex 933335e..69dc85f 100644--- a/frontend/status.html+++ b/frontend/status.html@@ -19,7 +19,7 @@<link rel="icon" type="image/png" sizes="32x32" href="img/favicon-32x32.png?v=2"><link rel="apple-touch-icon" sizes="180x180" href="img/favicon-512x512.png"><link rel="manifest" href="manifest.json">- <link rel="stylesheet" href="style.css?v=20261030001">+ <link rel="stylesheet" href="style.css?v=20261101001"><script src="theme-loader.js?v=20250119001"></script> <!-- Apply theme early --><!-- Font Awesome for icons --><link rel="stylesheet" href="vendor/fontawesome/css/all.min.css?v=20261001001">diff --git a/frontend/style.css b/frontend/style.cssindex 18b2009..5608c92 100644--- a/frontend/style.css+++ b/frontend/style.css@@ -5493,6 +5493,12 @@ html.dark-mode .warracker-footer a:hover {font-size: 0.8rem;}+.claim-voided-note {+ margin: 8px 0 0;+ color: var(--danger-color);+ font-size: 0.9rem;+}+.claim-documents-add {display: flex;align-items: center;diff --git a/locales/ar/translation.json b/locales/ar/translation.jsonindex 9092dea..0053b55 100644--- a/locales/ar/translation.json+++ b/locales/ar/translation.json@@ -748,6 +748,7 @@"claims": "المطالبات","warranty_claims": "مطالبات الضمان","add_new_claim": "إضافة مطالبة جديدة",+ "voided_note": "هذا الضمان باطل. لا يمكن إضافة مطالبات جديدة — ألغِ حالة البطلان أولاً إذا كنت بحاجة إلى تقديم مطالبة.","add_claim": "إضافة مطالبة","edit_claim": "تعديل مطالبة","claim_date": "تاريخ المطالبة",diff --git a/locales/cs/translation.json b/locales/cs/translation.jsonindex b0d4c26..c1c1cb7 100644--- a/locales/cs/translation.json+++ b/locales/cs/translation.json@@ -745,6 +745,7 @@"claims": "Reklamace","warranty_claims": "Reklamace záruky","add_new_claim": "Přidat novou reklamaci",+ "voided_note": "Tato záruka je neplatná. Nelze přidávat nové nároky — pokud potřebujete nějaký podat, nejprve zrušte neplatnost.","add_claim": "Přidat reklamaci","edit_claim": "Upravit reklamaci","claim_date": "Datum reklamace",diff --git a/locales/de/translation.json b/locales/de/translation.jsonindex fa7bccd..266b403 100644--- a/locales/de/translation.json+++ b/locales/de/translation.json@@ -738,6 +738,7 @@"claims": "Reklamationen","warranty_claims": "Garantieansprüche","add_new_claim": "Neue Reklamation hinzufügen",+ "voided_note": "Diese Garantie ist ungültig. Neue Ansprüche können nicht hinzugefügt werden — heben Sie die Ungültigkeit zuerst auf, wenn Sie einen Anspruch einreichen möchten.","add_claim": "Reklamation hinzufügen","edit_claim": "Reklamation bearbeiten","claim_date": "Reklamationsdatum",diff --git a/locales/en/translation.json b/locales/en/translation.jsonindex 1a8813a..192818d 100644--- a/locales/en/translation.json+++ b/locales/en/translation.json@@ -738,6 +738,7 @@"claims": "Claims","warranty_claims": "Warranty Claims","add_new_claim": "Add New Claim",+ "voided_note": "This warranty is void. New claims cannot be added — un-void it first if you need to file one.","add_claim": "Add Claim","edit_claim": "Edit Claim","claim_date": "Claim Date",diff --git a/locales/es/translation.json b/locales/es/translation.jsonindex 8df5b50..f1fff29 100644--- a/locales/es/translation.json+++ b/locales/es/translation.json@@ -738,6 +738,7 @@"claims": "Reclamaciones","warranty_claims": "Reclamaciones de Garantía","add_new_claim": "Agregar nueva reclamación",+ "voided_note": "Esta garantía está anulada. No se pueden agregar nuevas reclamaciones — primero quite el estado anulado si necesita presentar una.","add_claim": "Agregar reclamación","edit_claim": "Editar reclamación","claim_date": "Fecha de la reclamación",diff --git a/locales/fa/translation.json b/locales/fa/translation.jsonindex 5afdc03..06021f0 100644--- a/locales/fa/translation.json+++ b/locales/fa/translation.json@@ -738,6 +738,7 @@"claims": "درخواستها","warranty_claims": "درخواستهای گارانتی","add_new_claim": "افزودن درخواست جدید",+ "voided_note": "این گارانتی باطل است. نمیتوان مطالبات جدیدی اضافه کرد — اگر نیاز به ثبت مطالبه دارید، ابتدا ابطال را لغو کنید.","add_claim": "افزودن درخواست","edit_claim": "ویرایش درخواست","claim_date": "تاریخ درخواست",diff --git a/locales/fr/translation.json b/locales/fr/translation.jsonindex d37a28c..4f101a6 100644--- a/locales/fr/translation.json+++ b/locales/fr/translation.json@@ -738,6 +738,7 @@"claims": "Réclamations","warranty_claims": "Réclamations de garantie","add_new_claim": "Ajouter une nouvelle réclamation",+ "voided_note": "Cette garantie est annulée. Il est impossible d'ajouter de nouvelles réclamations — rétablissez-la d'abord si vous devez en déposer une.","add_claim": "Ajouter une réclamation","edit_claim": "Modifier la réclamation","claim_date": "Date de la réclamation",diff --git a/locales/he/translation.json b/locales/he/translation.jsonindex fbe4cda..98c17db 100644--- a/locales/he/translation.json+++ b/locales/he/translation.json@@ -748,6 +748,7 @@"claims": "תביעות","warranty_claims": "תביעות אחריות","add_new_claim": "הוסף תביעה חדשה",+ "voided_note": "אחריות זו בטלה. לא ניתן להוסיף תביעות חדשות — בטל תחילה את הסטטוס אם עליך להגיש תביעה.","add_claim": "הוסף תביעה","edit_claim": "ערוך תביעה","claim_date": "תאריך התביעה",diff --git a/locales/hi/translation.json b/locales/hi/translation.jsonindex d08a29b..14b4e2c 100644--- a/locales/hi/translation.json+++ b/locales/hi/translation.json@@ -738,6 +738,7 @@"claims": "दावे","warranty_claims": "वारंटी दावे","add_new_claim": "नया दावा जोड़ें",+ "voided_note": "यह वारंटी शून्य है। नए दावे नहीं जोड़े जा सकते — यदि आपको दावा दायर करना है तो पहले शून्य स्थिति हटाएँ।","add_claim": "दावा जोड़ें","edit_claim": "दावा संपादित करें","claim_date": "दावे की तिथि",diff --git a/locales/it/translation.json b/locales/it/translation.jsonindex 5da7bce..e220926 100644--- a/locales/it/translation.json+++ b/locales/it/translation.json@@ -745,6 +745,7 @@"claims": "Reclami","warranty_claims": "Reclami di garanzia","add_new_claim": "Aggiungi nuovo reclamo",+ "voided_note": "Questa garanzia è nulla. Non è possibile aggiungere nuovi reclami — rimuovi prima lo stato nullo se devi presentarne uno.","add_claim": "Aggiungi reclamo","edit_claim": "Modifica reclamo","claim_date": "Data del reclamo",diff --git a/locales/ja/translation.json b/locales/ja/translation.jsonindex bf91e03..ee264ab 100644--- a/locales/ja/translation.json+++ b/locales/ja/translation.json@@ -738,6 +738,7 @@"claims": "クレーム","warranty_claims": "保証請求","add_new_claim": "新しいクレームを追加",+ "voided_note": "この保証は無効です。新しいクレームは追加できません — クレームを提出する必要がある場合は、まず無効を解除してください。","add_claim": "クレームを追加","edit_claim": "クレームを編集","claim_date": "クレーム日",diff --git a/locales/ko/translation.json b/locales/ko/translation.jsonindex 54a24dc..0a4a9fc 100644--- a/locales/ko/translation.json+++ b/locales/ko/translation.json@@ -738,6 +738,7 @@"claims": "클레임","warranty_claims": "보증 클레임","add_new_claim": "새 클레임 추가",+ "voided_note": "이 보증은 무효입니다. 새 클레임을 추가할 수 없습니다 — 클레임을 제출해야 한다면 먼저 무효를 해제하세요.","add_claim": "클레임 추가","edit_claim": "클레임 수정","claim_date": "클레임 날짜",diff --git a/locales/nl/translation.json b/locales/nl/translation.jsonindex dbfb186..eacb614 100644--- a/locales/nl/translation.json+++ b/locales/nl/translation.json@@ -738,6 +738,7 @@"claims": "Claims","warranty_claims": "Garantieclaims","add_new_claim": "Nieuwe claim toevoegen",+ "voided_note": "Deze garantie is ongeldig. Er kunnen geen nieuwe claims worden toegevoegd — maak de ongeldigheid eerst ongedaan als u er een moet indienen.","add_claim": "Claim toevoegen","edit_claim": "Claim bewerken","claim_date": "Claimdatum",diff --git a/locales/pl/translation.json b/locales/pl/translation.jsonindex 56d813c..31cac51 100644--- a/locales/pl/translation.json+++ b/locales/pl/translation.json@@ -738,6 +738,7 @@"claims": "Reklamacje","warranty_claims": "Reklamacje gwarancyjne","add_new_claim": "Dodaj nową reklamację",+ "voided_note": "Ta gwarancja jest unieważniona. Nie można dodawać nowych roszczeń — najpierw cofnij unieważnienie, jeśli musisz złożyć roszczenie.","add_claim": "Dodaj reklamację","edit_claim": "Edytuj reklamację","claim_date": "Data reklamacji",diff --git a/locales/pt/translation.json b/locales/pt/translation.jsonindex 7d1880e..d8c376e 100644--- a/locales/pt/translation.json+++ b/locales/pt/translation.json@@ -232,6 +232,7 @@"claims": "Reclamações","warranty_claims": "Reclamações de Garantia","add_new_claim": "Adicionar nova reclamação",+ "voided_note": "Esta garantia está anulada. Não é possível adicionar novas reivindicações — remova primeiro o estado anulado se precisar registrar uma.","add_claim": "Adicionar reclamação","edit_claim": "Editar reclamação","claim_date": "Data da reclamação",diff --git a/locales/ru/translation.json b/locales/ru/translation.jsonindex 0ab25a9..7f2f56f 100644--- a/locales/ru/translation.json+++ b/locales/ru/translation.json@@ -238,6 +238,7 @@"claims": "Обращения","warranty_claims": "Гарантийные обращения","add_new_claim": "Добавить новое обращение",+ "voided_note": "Эта гарантия аннулирована. Новые претензии добавлять нельзя — сначала снимите статус аннулированной, если нужно подать претензию.","add_claim": "Добавить обращение","edit_claim": "Редактировать обращение","claim_date": "Дата обращения",diff --git a/locales/tr/translation.json b/locales/tr/translation.jsonindex 8264452..49314f1 100644--- a/locales/tr/translation.json+++ b/locales/tr/translation.json@@ -738,6 +738,7 @@"claims": "Talepler","warranty_claims": "Garanti Talepleri","add_new_claim": "Yeni Talep Ekle",+ "voided_note": "Bu garanti geçersizdir. Yeni talepler eklenemez — talep oluşturmanız gerekiyorsa önce geçersiz durumunu kaldırın.","add_claim": "Talep Ekle","edit_claim": "Talebi Düzenle","claim_date": "Talep Tarihi",diff --git a/locales/uk/translation.json b/locales/uk/translation.jsonindex ba9e164..5e39671 100644--- a/locales/uk/translation.json+++ b/locales/uk/translation.json@@ -744,6 +744,7 @@"claims": "Звернення","warranty_claims": "Гарантійні звернення","add_new_claim": "Додати нове звернення",+ "voided_note": "Цю гарантію анульовано. Нові претензії додавати не можна — спочатку скасуйте анулювання, якщо потрібно подати претензію.","add_claim": "Додати звернення","edit_claim": "Редагувати звернення","claim_date": "Дата звернення",diff --git a/locales/zh_CN/translation.json b/locales/zh_CN/translation.jsonindex b219e51..fb3f381 100644--- a/locales/zh_CN/translation.json+++ b/locales/zh_CN/translation.json@@ -738,6 +738,7 @@"claims": "理赔","warranty_claims": "保修理赔","add_new_claim": "新增理赔记录",+ "voided_note": "此保修已无效。无法添加新索赔 — 如需提交索赔,请先取消无效状态。","add_claim": "添加理赔","edit_claim": "编辑理赔","claim_date": "理赔日期",diff --git a/locales/zh_HK/translation.json b/locales/zh_HK/translation.jsonindex 2d2a5e3..5dbe3d4 100644--- a/locales/zh_HK/translation.json+++ b/locales/zh_HK/translation.json@@ -738,6 +738,7 @@"claims": "索賠","warranty_claims": "保修索賠","add_new_claim": "新增索賠",+ "voided_note": "此保養已無效。無法新增索償 — 如需提交索償,請先取消無效狀態。","add_claim": "新增索賠","edit_claim": "編輯索賠","claim_date": "索賠日期",diff --git a/tests/test_validation_and_stats.py b/tests/test_validation_and_stats.pyindex 9932586..fe9c88c 100644--- a/tests/test_validation_and_stats.py+++ b/tests/test_validation_and_stats.py@@ -75,6 +75,40 @@ def test_statistics_buckets(client, user_factory):assert st["active"] >= 3 # two long-lived + today's+def test_claim_on_voided_warranty_rejected(client, user_factory,+ warranty_factory):+ """New claims cannot be added to a voided warranty; claims recorded+ before the void stay editable, and un-voiding restores creation."""+ h = user_factory()["headers"]+ wid = warranty_factory(h).get_json()["id"]++ r = client.post(f"/api/warranties/{wid}/claims", headers=h, json={+ "claim_date": TODAY_S, "status": "Submitted"})+ assert r.status_code == 201, r.get_data(as_text=True)+ cid = r.get_json()["id"]++ r = client.patch(f"/api/warranties/{wid}/void", headers=h,+ json={"voided": True})+ assert r.status_code == 200, r.get_data(as_text=True)++ r = client.post(f"/api/warranties/{wid}/claims", headers=h, json={+ "claim_date": TODAY_S, "status": "Submitted"})+ assert r.status_code == 400, r.get_data(as_text=True)+ assert r.get_json().get("code") == "warranty_voided"++ # The pre-existing claim is historical record: still updatable.+ r = client.put(f"/api/warranties/{wid}/claims/{cid}", headers=h,+ json={"status": "In Progress"})+ assert r.status_code == 200, r.get_data(as_text=True)++ r = client.patch(f"/api/warranties/{wid}/void", headers=h,+ json={"voided": False})+ assert r.status_code == 200, r.get_data(as_text=True)+ r = client.post(f"/api/warranties/{wid}/claims", headers=h, json={+ "claim_date": TODAY_S, "status": "Submitted"})+ assert r.status_code == 201, r.get_data(as_text=True)++def test_claim_status_validation(client, user_factory, warranty_factory):h = user_factory()["headers"]wid = warranty_factory(h).get_json()["id"]