سامانه صدور فاکتور و حسابداری
Mirrored from https://github.com/davoodmehraban89/Factor-easy.git
Synced Dec 3, 17:00 UTC
Bind C7 OCR provenance UI to real attachments
davoodmehraban89 committed
Oct 1, 2026 at 00:32 UTC
d3c3cc74d9dd6fe99d4ac718a7fcc9c40129445b
1 file changed
+7
-2
js/office-mature.js
+7
-2
@@ -125,7 +125,12 @@ window.officeLoadArchiveIndex=async function(render=true){
125
};
126
window.officeRecordOcrEvidence=async function(correspondenceId){
127
if(!(canOffice('archive')||canOffice('configure')))return alert('برای ثبت Evidence OCR دسترسی لازم را ندارید.');
128
- const sourceRef=String(prompt('مرجع فایل/پیوست منبع OCR:')||'').trim();if(!sourceRef)return;
128
+ const attachments=(datastore.correspondenceAttachments||[]).filter(x=>x.correspondenceId===correspondenceId);
129
+ if(!attachments.length)return alert('برای ثبت OCR ابتدا باید یک پیوست/اسکن واقعی به همین نامه متصل باشد.');
130
+ const choices=attachments.map((x,i)=>({n:i+1,x}));
131
+ const pick=Number(prompt('فایل منبع OCR را انتخاب کنید:\n'+choices.map(z=>z.n+') '+(z.x.fileName||z.x.id)).join('\n')));
132
+ const chosen=choices.find(z=>z.n===pick);if(!chosen)return;
133
+ const sourceRef=chosen.x.id;
134
const provider=String(prompt('نام موتور/ارائهدهنده OCR:')||'').trim();if(!provider)return;
135
const language=String(prompt('زبان خروجی (مثلاً fa):')||'fa').trim();
136
const confidenceRaw=String(prompt('Confidence بین 0 و 1 (اختیاری):')||'').trim();
@@ -133,7 +138,7 @@ window.officeRecordOcrEvidence=async function(correspondenceId){
138
const text=String(prompt('متن خروجی OCR را وارد کنید:')||'');if(!text.trim())return;
139
const {error}=await sb.rpc('office_record_ocr_evidence',{p_organization_id:currentUser.organizationId,p_correspondence_id:correspondenceId,p_source_ref:sourceRef,p_provider:provider,p_language:language,p_confidence:confidence,p_text:text});
140
if(error){console.error('office OCR evidence failed',error);return alert('ثبت Evidence OCR انجام نشد: '+error.message)}
136
- await window.officeLoadArchiveIndex(true);alert('خروجی OCR با provenance ثبت شد. این قابلیت خودِ OCR را اجرا نمیکند.');
141
+ await window.officeLoadArchiveIndex(true);alert('خروجی OCR به پیوست واقعی همین نامه متصل و با provenance ثبت شد. این قابلیت خودِ OCR را اجرا نمیکند.');
142
};
143
window.officeCorrectOcrEvidence=async function(ocrEvidenceId){
144
if(!(canOffice('archive')||canOffice('configure')))return alert('برای اصلاح OCR دسترسی لازم را ندارید.');