v1.0.154: overwrite existing file on re-upload (same filename+contract → DELETE old before INSERT)
This commit is contained in:
@@ -71,6 +71,19 @@
|
||||
</cfif>
|
||||
|
||||
<cftransaction>
|
||||
<!--- Если файл с таким именем уже есть в контракте — удалить старый --->
|
||||
<cfif len(contractId)>
|
||||
<cfquery name="oldD" datasource="baza">
|
||||
SELECT s.id as sid, s.document_id FROM supplements s
|
||||
JOIN documents d ON d.id = s.document_id
|
||||
WHERE s.contract_id = <cfqueryparam value="#contractId#" cfsqltype="cf_sql_varchar">
|
||||
AND d.filename = <cfqueryparam value="#clientFile#" cfsqltype="cf_sql_varchar">
|
||||
</cfquery>
|
||||
<cfif oldD.recordCount GT 0>
|
||||
<cfquery datasource="baza">DELETE FROM supplements WHERE id = <cfqueryparam value="#oldD.sid#" cfsqltype="cf_sql_varchar"></cfquery>
|
||||
<cfquery datasource="baza">DELETE FROM documents WHERE id = <cfqueryparam value="#oldD.document_id#" cfsqltype="cf_sql_varchar"></cfquery>
|
||||
</cfif>
|
||||
</cfif>
|
||||
<cfquery datasource="baza">
|
||||
INSERT INTO documents (filename, mime_type, original_bytes, status)
|
||||
VALUES (<cfqueryparam value="#clientFile#" cfsqltype="cf_sql_varchar">,<cfqueryparam value="#mime#" cfsqltype="cf_sql_varchar">,<cfqueryparam value="#allData#" cfsqltype="cf_sql_varchar">,'uploaded')
|
||||
|
||||
@@ -75,7 +75,7 @@
|
||||
<body>
|
||||
<div class="topbar">
|
||||
<img src="/nubes-logo.svg" alt="Nubes">
|
||||
<span class="title">Сверка договоров — LLM AI-driven Event Sourcing <span style="font-weight:400;color:var(--muted);font-size:12px;">v1.0.153 — Lucee</span></span>
|
||||
<span class="title">Сверка договоров — LLM AI-driven Event Sourcing <span style="font-weight:400;color:var(--muted);font-size:12px;">v1.0.154 — Lucee</span></span>
|
||||
</div>
|
||||
|
||||
<div class="content">
|
||||
|
||||
Reference in New Issue
Block a user