150
This commit is contained in:
+29
-16
@@ -51,7 +51,7 @@
|
|||||||
|
|
||||||
//variables.framework.docs={};
|
//variables.framework.docs={};
|
||||||
variables.framework.docs.APIName="svc-api";
|
variables.framework.docs.APIName="svc-api";
|
||||||
variables.framework.docs.APIVersion="0.149"; /*$ git config --global --unset user.password*/
|
variables.framework.docs.APIVersion="0.150"; /*$ git config --global --unset user.password*/
|
||||||
|
|
||||||
variables.framework.globalHeaders = structNew();
|
variables.framework.globalHeaders = structNew();
|
||||||
variables.framework.globalHeaders["Access-Control-Expose-Headers"] = "Location";
|
variables.framework.globalHeaders["Access-Control-Expose-Headers"] = "Location";
|
||||||
@@ -255,7 +255,8 @@
|
|||||||
if (prefix.status_code NEQ 200) {
|
if (prefix.status_code NEQ 200) {
|
||||||
//writedump(this.iamServiceUrl);
|
//writedump(this.iamServiceUrl);
|
||||||
//writedump(resp);
|
//writedump(resp);
|
||||||
return representationOf( {"iamServiceUrl"=this.iamServiceUrl, "idpResponse"=resp} ).withStatus(500);
|
var iamStatusCode = (isValid("integer", prefix.status_code)) ? val(prefix.status_code) : 500;
|
||||||
|
return representationOf( {"iamServiceUrl"=this.iamServiceUrl, "idpResponse"=resp} ).withStatus(iamStatusCode);
|
||||||
//abort;
|
//abort;
|
||||||
//throw("IDP response not OK");
|
//throw("IDP response not OK");
|
||||||
}
|
}
|
||||||
@@ -279,7 +280,7 @@
|
|||||||
return representationOf( {"exception"=e, "idpResponse"=result} );
|
return representationOf( {"exception"=e, "idpResponse"=result} );
|
||||||
}
|
}
|
||||||
|
|
||||||
var usrCustomerInfo=getUsrCustomerInfo(idpUserData.userInfo.contactId);
|
var usrCustomerInfo=getUsrCustomerInfo(idpUserData.userInfo.contactId, idpUserData.userInfo.companyId);
|
||||||
|
|
||||||
if (lCase(arguments.cfc) EQ 'user') {
|
if (lCase(arguments.cfc) EQ 'user') {
|
||||||
if (structIsEmpty(usrCustomerInfo)) return representationOf("User information not found").withStatus(404);
|
if (structIsEmpty(usrCustomerInfo)) return representationOf("User information not found").withStatus(404);
|
||||||
@@ -392,6 +393,7 @@
|
|||||||
|
|
||||||
<cffunction name="getUsrCustomerInfo">
|
<cffunction name="getUsrCustomerInfo">
|
||||||
<cfargument name="usrUid"/>
|
<cfargument name="usrUid"/>
|
||||||
|
<cfargument name="contragentUid"/>
|
||||||
|
|
||||||
<!--- глупейшее определение спецификации по умолчанию (надо переделать, чтобы создавалась, или вообще просто записывать факты без спеки). Но помним, что при постановке на тестирование цены еше не фиксированы --->
|
<!--- глупейшее определение спецификации по умолчанию (надо переделать, чтобы создавалась, или вообще просто записывать факты без спеки). Но помним, что при постановке на тестирование цены еше не фиксированы --->
|
||||||
<!--- заметим, что у нас контрагент может быть определен параллельно, от IDP --->
|
<!--- заметим, что у нас контрагент может быть определен параллельно, от IDP --->
|
||||||
@@ -399,30 +401,41 @@
|
|||||||
|
|
||||||
<!--- Во избежании потери времени при отладке временно сделаем создание дефолтового контракта и спецификации, если их нет --->
|
<!--- Во избежании потери времени при отладке временно сделаем создание дефолтового контракта и спецификации, если их нет --->
|
||||||
<!--- *** хватается первый попавшийся контракт и спецификация --->
|
<!--- *** хватается первый попавшийся контракт и спецификация --->
|
||||||
<cfquery name="local.qGetCustomerInfo">
|
|
||||||
|
<cfquery name="local.qGetContragentInfo">
|
||||||
|
select z.contragent_id, c.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)
|
||||||
|
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>
|
||||||
|
|
||||||
|
|
||||||
|
<cfquery name="local.qGetUserInfo">
|
||||||
select u.usr_id, c.contragent_id, c.contract_id, s.specification_id
|
select u.usr_id, c.contragent_id, c.contract_id, s.specification_id
|
||||||
from usr u
|
from usr u
|
||||||
join contract c on (u.contragent_id=c.contragent_id)
|
join contract c on (u.contragent_id=c.contragent_id)
|
||||||
join specification s on (c.contract_id=s.contract_id)
|
join specification s on (c.contract_id=s.contract_id)
|
||||||
where idp_usr_uid=<cfqueryparam cfsqltype="cf_sql_other" value="#arguments.usrUid#" null=#!isValid('guid',arguments.usrUid)#/>
|
where u.idp_usr_uid=<cfqueryparam cfsqltype="cf_sql_other" value="#arguments.usrUid#" null=#!isValid('guid',arguments.usrUid)#/>
|
||||||
order by specification_id desc
|
order by s.specification_id desc
|
||||||
limit 1;
|
limit 1;
|
||||||
</cfquery>
|
</cfquery>
|
||||||
|
|
||||||
<!--- <cfdump var=#local.qGetCustomerInfo#/><cfabort/> --->
|
<!--- <cfdump var=#local.qGetCustomerInfo#/><cfabort/> --->
|
||||||
<cfif local.qGetCustomerInfo.recordCount GT 0>
|
<cfreturn {
|
||||||
<cfreturn {"usrId"=#local.qGetCustomerInfo.usr_id#,
|
"usrId"=#local.qGetUserInfo.usr_id#,
|
||||||
"contragentId"=#local.qGetCustomerInfo.contragent_id#,
|
"contragentId"=#local.qGetContragentInfo.contragent_id#,
|
||||||
"contractId"=#local.qGetCustomerInfo.contract_id#,
|
"contractId"=#local.qGetContragentInfo.contract_id#,
|
||||||
"specificationId"=#local.qGetCustomerInfo.specification_id#
|
"specificationId"=#local.qGetContragentInfo.specification_id#
|
||||||
}/>
|
}/>
|
||||||
<cfelse>
|
|
||||||
<cfreturn {}/> <!--- неуклюжий способ обозначить ошибку --->
|
|
||||||
</cfif>
|
|
||||||
</cffunction>
|
</cffunction>
|
||||||
|
|
||||||
|
|
||||||
<cffunction name="corsHeaders">
|
<cffunction name="corsHeaders">
|
||||||
<!--- фрагмент взят из taffy/core/api.cfc и немного переписан --->
|
<!--- *** фрагмент взят из taffy/core/api.cfc и немного переписан --->
|
||||||
<cfset var _taffyRequest=request._taffyRequest/>
|
<cfset var _taffyRequest=request._taffyRequest/>
|
||||||
<cfset local={}/>
|
<cfset local={}/>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user