Restrict preparation document links to their tender scope
This commit is contained in:
@@ -5,10 +5,19 @@ export const HEALTH_CHECKS = [
|
||||
['delivery', 'Teslimat ve süre'],
|
||||
];
|
||||
export const documentKey = d => JSON.stringify([d.document, d.mandatory !== false, d.note || '']);
|
||||
export const documentRevision = file => JSON.stringify([file.id,file.olusturma,file.boyut,file.son_kullanma || null]);
|
||||
export function documentLinkProblem(check, files, deadlineDate) {
|
||||
export const documentRevision = file => JSON.stringify([file.id,file.olusturma,file.boyut,file.son_kullanma || null,file.tur || null,file.ikn || null]);
|
||||
export function documentScopeProblem(file, tenderIkn) {
|
||||
if (file.tur === 'firma') return null;
|
||||
if (file.tur !== 'ihale') return 'Belge türü doğrulanamadı. Doküman Deposu kaydını kontrol edin.';
|
||||
if (!tenderIkn || !file.ikn || String(file.ikn).trim() !== String(tenderIkn).trim())
|
||||
return 'Bu ihale dokümanı mevcut ihaleye bağlı değil. Doğru İKN için yüklenmiş dosyayı seçin.';
|
||||
return null;
|
||||
}
|
||||
export function documentLinkProblem(check, files, deadlineDate, tenderIkn) {
|
||||
const file = files.find(f=>f.id===check?.documentId);
|
||||
if (!file || file.erisilebilir === false) return 'Bağlı dosya bulunamadı veya erişilemiyor.';
|
||||
const scopeProblem = documentScopeProblem(file,tenderIkn);
|
||||
if (scopeProblem) return scopeProblem;
|
||||
if (check.documentRevision !== documentRevision(file)) return 'Belge bilgisi değişti; dosyayı yeniden seçip kontrol edin.';
|
||||
if (file.son_kullanma && ((!/^\d{4}-\d{2}-\d{2}$/.test(file.son_kullanma) || Number.isNaN(Date.parse(file.son_kullanma+'T00:00:00Z')) || new Date(file.son_kullanma+'T00:00:00Z').toISOString().slice(0,10) !== file.son_kullanma) ||
|
||||
!deadlineDate || file.son_kullanma < deadlineDate)) return 'Belge son teklif tarihinde geçerli değil veya tarih doğrulanamadı.';
|
||||
@@ -21,7 +30,7 @@ export function preparationBlockers(rows, documents, checks = {}, vault) {
|
||||
const c = checks.documents?.[documentKey(d)] || {};
|
||||
if (d.mandatory === false && c.status === 'notApplicable' && c.evidence?.trim()) continue;
|
||||
if (vault) {
|
||||
const problem = vault.loading ? 'Belge deposu yükleniyor.' : vault.error ? 'Belge deposu doğrulanamadı.' : documentLinkProblem(c,vault.documents || [],vault.deadlineDate);
|
||||
const problem = vault.loading ? 'Belge deposu yükleniyor.' : vault.error ? 'Belge deposu doğrulanamadı.' : documentLinkProblem(c,vault.documents || [],vault.deadlineDate,vault.tenderIkn);
|
||||
if(problem) errors.push(`${d.document}: ${problem}`);
|
||||
}
|
||||
if (c.status !== 'verified' || !c.evidence?.trim()) errors.push(`${d.document}: belge ve kaynak kontrolü eksik.`);
|
||||
|
||||
Reference in New Issue
Block a user