v1.0.102: шаг9 — UNRESOLVED вместо cfthrow при UPDATE target not found
This commit is contained in:
+16
-2
@@ -130,8 +130,21 @@
|
|||||||
<cfelseif action EQ "UPDATE">
|
<cfelseif action EQ "UPDATE">
|
||||||
<cfset th = op.target_hash>
|
<cfset th = op.target_hash>
|
||||||
<cfif NOT structKeyExists(oldValues, th)>
|
<cfif NOT structKeyExists(oldValues, th)>
|
||||||
<cfthrow message="UPDATE target not found: #th#">
|
<!--- target_hash не найден — создаём UNRESOLVED вместо падения --->
|
||||||
</cfif>
|
<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 old = oldValues[th]>
|
||||||
<cfset nv = structKeyExists(op, 'new_values') ? op.new_values : {}>
|
<cfset nv = structKeyExists(op, 'new_values') ? op.new_values : {}>
|
||||||
<cfset newPrice = structKeyExists(nv, 'price') AND isNumeric(nv.price) ? nv.price : old.price>
|
<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">
|
AND name_hash = <cfqueryparam value="#th#" cfsqltype="cf_sql_varchar">
|
||||||
</cfquery>
|
</cfquery>
|
||||||
<cfset summary.updated++>
|
<cfset summary.updated++>
|
||||||
|
</cfif>
|
||||||
|
|
||||||
<cfelseif action EQ "DELETE">
|
<cfelseif action EQ "DELETE">
|
||||||
<cfset th = op.target_hash>
|
<cfset th = op.target_hash>
|
||||||
|
|||||||
Reference in New Issue
Block a user