فینورا پرو - سامانه جامع حسابداری و صدور فاکتور
fix(security): secure ledger print and remove external print dependency
davoodmehraban89 committed
Oct 31, 2026 at 00:37 UTC
526203bc39d7e1053a07ef5ad2f82facef98f4b8
1 file changed
+7
-8
src/views/ContactLedgerModal.js
+7
-8
@@ -18,7 +18,7 @@ class ContactLedgerModalImpl {
18
const body = this._buildBody(contact, ledger);
19
const footer = `
20
<button class="btn btn-secondary" onclick="FINORA.Modal.close()">بستن</button>
21
- <button class="btn" onclick="window.ContactLedgerModal._printLedger('${contactId}')">🖨️ چاپ صورتحساب</button>
21
+ <button class="btn" onclick="window.ContactLedgerModal._printLedger(${this._esc(JSON.stringify(String(contactId ?? '')))})">🖨️ چاپ صورتحساب</button>
22
`;
23
24
Modal.open({
@@ -75,9 +75,9 @@ class ContactLedgerModalImpl {
75
76
return `
77
<tr>
78
- <td style="font-size:11.5px;width:110px">${Formatters.toPersianDigits(r.date || '—')}</td>
78
+ <td style="font-size:11.5px;width:110px">${this._esc(Formatters.toPersianDigits(r.date || '—'))}</td>
79
<td><span class="badge ${typeCls}" style="font-size:10px">${this._esc(r.typeLabel)}</span></td>
80
- <td style="font-size:11.5px;color:var(--text-muted)">${r.refNumber ? '#' + Formatters.toPersianDigits(r.refNumber) : '—'}</td>
80
+ <td style="font-size:11.5px;color:var(--text-muted)">${this._esc(r.refNumber ? '#' + Formatters.toPersianDigits(r.refNumber) : '—')}</td>
81
<td style="text-align:left;font-weight:600;color:var(--danger)">
82
${r.debit > 0 ? Formatters.money(r.debit) : '—'}
83
</td>
@@ -103,7 +103,7 @@ class ContactLedgerModalImpl {
103
${tags}
104
</div>
105
${contact.mobile ? `<div style="font-size:11.5px;color:var(--text-muted)">📱 ${Formatters.phone(contact.mobile)}</div>` : ''}
106
- ${contact.nationalId ? `<div style="font-size:11.5px;color:var(--text-muted)">🆔 ${Formatters.toPersianDigits(contact.nationalId)}</div>` : ''}
106
+ ${contact.nationalId ? `<div style="font-size:11.5px;color:var(--text-muted)">🆔 ${this._esc(Formatters.toPersianDigits(contact.nationalId))}</div>` : ''}
107
</div>
108
<div style="text-align:left;min-width:200px">
109
<div style="font-size:11px;color:var(--text-muted);margin-bottom:4px">مانده حساب</div>
@@ -176,9 +176,9 @@ class ContactLedgerModalImpl {
176
177
return `
178
<tr>
179
- <td>${Formatters.toPersianDigits(r.date || '—')}</td>
179
+ <td>${this._esc(Formatters.toPersianDigits(r.date || '—'))}</td>
180
<td>${this._esc(r.typeLabel)}</td>
181
- <td>${r.refNumber ? '#' + Formatters.toPersianDigits(r.refNumber) : '—'}</td>
181
+ <td>${this._esc(r.refNumber ? '#' + Formatters.toPersianDigits(r.refNumber) : '—')}</td>
182
<td>${r.debit > 0 ? Formatters.money(r.debit) : '—'}</td>
183
<td>${r.credit > 0 ? Formatters.money(r.credit) : '—'}</td>
184
<td>${balanceCell}</td>
@@ -194,8 +194,7 @@ class ContactLedgerModalImpl {
194
<html lang="fa" dir="rtl">
195
<head>
196
<meta charset="UTF-8" />
197
- <title>صورتحساب ${contact.name}</title>
198
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/rastikerdar/vazirmatn@v33.003/misc/Farsi-Digits/Vazirmatn-FD-font-face.css" />
197
+ <title>صورتحساب ${this._esc(contact.name)}</title>
198
<style>
199
@page { size: A4 portrait; margin: 10mm; }
200
* { box-sizing: border-box; margin: 0; padding: 0; }