v1.0.102: шаг9 — UNRESOLVED вместо cfthrow при UPDATE target not found

This commit is contained in:
2026-06-22 08:13:13 +04:00
parent 54a1665a8b
commit 150c1d6a09
+16 -2
View File
@@ -130,8 +130,21 @@
<cfelseif action EQ "UPDATE">
<cfset th = op.target_hash>
<cfif NOT structKeyExists(oldValues, th)>
<cfthrow message="UPDATE target not found: #th#">
</cfif>
<!--- target_hash не найден — создаём UNRESOLVED вместо падения --->
<cfquery datasource="baza">
INSERT INTO spec_events (contract_id, supplement_id, seq, action, new_values, comment, status)
VALUES (
<cfqueryparam value="#url.contract_id#" cfsqltype="cf_sql_varchar">,
<cfqueryparam value="#supplementId#" cfsqltype="cf_sql_varchar">,
<cfqueryparam value="#seq#" cfsqltype="cf_sql_integer">,
'UNRESOLVED',
<cfqueryparam value="#serializeJSON(structKeyExists(op,'new_values') ? op.new_values : {})#" cfsqltype="cf_sql_varchar">::jsonb,
<cfqueryparam value="UPDATE target_hash not found: #th#" cfsqltype="cf_sql_varchar">,
'pending'
)
</cfquery>
<cfset summary.unresolved++>
<cfelse>
<cfset old = oldValues[th]>
<cfset nv = structKeyExists(op, 'new_values') ? op.new_values : {}>
<cfset newPrice = structKeyExists(nv, 'price') AND isNumeric(nv.price) ? nv.price : old.price>
@@ -166,6 +179,7 @@
AND name_hash = <cfqueryparam value="#th#" cfsqltype="cf_sql_varchar">
</cfquery>
<cfset summary.updated++>
</cfif>
<cfelseif action EQ "DELETE">
<cfset th = op.target_hash>