211 exception handling bugfix

This commit is contained in:
2026-03-10 13:31:31 +03:00
parent c29d5bec2b
commit 051e4bcc04
+14 -15
View File
@@ -57,7 +57,7 @@
//variables.framework.docs={};
variables.framework.docs.APIName="svc-api";
variables.framework.docs.APIVersion="0.210"; /*$ git config --global --unset user.password*/
variables.framework.docs.APIVersion="0.211"; /*$ git config --global --unset user.password*/
variables.framework.globalHeaders = structNew();
variables.framework.globalHeaders["Access-Control-Expose-Headers"] = "Location";
@@ -441,40 +441,39 @@
<!--- *** хватается первый попавшийся контракт и спецификация --->
<cfquery name="local.qGetContragentInfo">
select z.contragent_id, c.contragent_id, c.contract_id, s.specification_id
select z.contragent_id, c.contract_id, s.specification_id
from contragent z
join contract c on (z.contragent_id=c.contragent_id)
join specification s on (c.contract_id=s.contract_id)
left outer join contract c on (z.contragent_id=c.contragent_id)
left outer join specification s on (c.contract_id=s.contract_id)
where z.external_uid=<cfqueryparam cfsqltype="cf_sql_other" value="#arguments.contragentUid#" null=#!isValid('guid',arguments.contragentUid)#/>
order by s.specification_id desc
limit 1;
</cfquery>
<cfif local.qGetContragentInfo.recordCount EQ 0>
<cfthrow message="Contragent Not Found in CMDB" detail="Contragent with uuid=(#arguments.contragentUid#) not found in CMDB"/>
</cfif>
</cfif>
<cfif !len(local.qGetContragentInfo.contract_id)>
<cfthrow message="Contragent does not have a contract in CMDB" detail="No contract for contragent with uuid=(#arguments.contragentUid#) found in CMDB (contragent_id=#local.qGetContragentInfo.contragent_id#)"/>
</cfif>
<cfquery name="local.qGetUserInfo">
select u.usr_id, c.contragent_id, c.contract_id, s.specification_id
select u.usr_id, u.contragent_id, k.contragent_id as c_contragent_id,
from usr u
left outer join contract c on (u.contragent_id=c.contragent_id)
left outer join specification s on (c.contract_id=s.contract_id)
left outer join contragent k on (u.contragent_id=k.contragent_id)
where u.idp_usr_uid=<cfqueryparam cfsqltype="cf_sql_other" value="#arguments.usrUid#" null=#!isValid('guid',arguments.usrUid)#/>
order by s.specification_id desc
limit 1;
</cfquery>
<cfif local.qGetUserInfo.recordCount EQ 0>
<cfthrow message="User Not Found in CMDB" detail="User with uuid=(#arguments.usrUid#) not found in CMDB"/>
</cfif>
<cfif !len(local.qGetUserInfo.contragent_id)>
<cfthrow message="User is not mapped to Contragent in CMDB" detail="Contragent for user with uuid=(#arguments.usrUid#) not found in CMDB"/>
<cfthrow message="User is not mapped to Contragent in CMDB" detail="Contragent for user with uuid=(#arguments.usrUid#) not specified in CMDB"/>
</cfif>
<cfif !len(local.qGetUserInfo.contract_id)>
<cfthrow message="Contract for user not found in CMDB" detail="Contract for user with uuid=(#arguments.usrUid#) not found in CMDB"/>
<cfif !len(local.qGetUserInfo.c_contragent_id)>
<cfthrow message="User is not mapped to Contragent in CMDB" detail="Contragent for user with uuid=(#arguments.usrUid#) not found in CMDB (specified contragent_id=#local.qGetUserInfo.contragent_id#)"/>
</cfif>
<cfif !len(local.qGetUserInfo.specification_id)>
<cfthrow message="Specification for user not found in CMDB" detail="Specification for user with uuid=(#arguments.usrUid#) not found in CMDB"/>
</cfif>
<!--- <cfdump var=#local.qGetCustomerInfo#/><cfabort/> --->
<cfreturn {