فینورا پرو - سامانه جامع حسابداری و صدور فاکتور

fix(a01): guard financial confirmation against double, stale and hidden actions

davoodmehraban89 committed Oct 31, 2026 at 06:51 UTC 0707263a67a92222ec7156b9c6ac7bff486d4596
1 file changed +11 -1
src/core/Modal.js
+11 -1
@@ -190,8 +190,18 @@ class ModalManager {
190 const confirmButton = footerEl.querySelector('[data-action="confirm"]');
191 cancelButton.textContent = String(cancelText ?? '');
192 confirmButton.textContent = String(confirmText ?? '');
193 - cancelButton.onclick = () => this.close();
193 + // A confirmation can mutate posted financial records. Consume a valid
194 + // decision only once, and ignore detached/hidden parent buttons.
195 + let settled = false;
196 + const isActive = () => this.stack[this.stack.length - 1] === modal;
197 + cancelButton.onclick = () => {
198 + if (settled || !isActive()) return;
199 + settled = true;
200 + this.close();
201 + };
202 confirmButton.onclick = () => {
203 + if (settled || !isActive()) return;
204 + settled = true;
205 this.close();
206 if (onConfirm) onConfirm();
207 };