Skip to content

Commit

Permalink
Fix contract helper null-value escape
Browse files Browse the repository at this point in the history
  • Loading branch information
dolfinus committed Apr 14, 2020
1 parent 274cf4b commit aa0fc69
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions src/org/camunda/latera/bss/helpers/hydra/Contract.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@ trait Contract {
String baseContractPrefix = "${capitalize(params.baseContractPrefix)}BaseContract"
String prefix = "${capitalize(params.prefix)}Contract"

def contractId = order."${prefix}Id" ?: [is: null]
def contractId = order."${prefix}Id"
if (isEmpty(contractId)) {
return
}

Map contract = hydra.getContract(contractId)

order."${prefix}Number" = contract?.vc_doc_no
Expand Down Expand Up @@ -333,7 +337,7 @@ trait Contract {
* @param prefix {@link CharSequence String}. Contract app prefix. Optional. Default: empty string
* @param contractPrefix {@link CharSequence String}. Contract prefix. Optional. Default: empty string
*/
Boolean fetchContractApp(Map input = [:]) {
void fetchContractApp(Map input = [:]) {
Map params = [
contractPrefix : '',
prefix : ''
Expand All @@ -342,7 +346,12 @@ trait Contract {
String prefix = "${capitalize(params.prefix)}ContractApp"
String contractPrefix = "${capitalize(params.contractPrefix)}Contract"

Map contractApp = hydra.getContractApp(order."${prefix}Id")
def contractAppId = order."${prefix}Id"
if (isEmpty(contractAppId)) {
return
}

Map contractApp = hydra.getContractApp(contractAppId)

order."${prefix}Number" = contractApp?.vc_doc_no
order."${prefix}Name" = contractApp?.vc_name
Expand Down Expand Up @@ -603,7 +612,12 @@ trait Contract {
String prefix = "${capitalize(params.prefix)}AddAgreement"
String contractPrefix = "${capitalize(params.contractPrefix)}Contract"

Map addAgreement = hydra.getAddAgreement(order."${prefix}Id")
def addAgreementId = order."${prefix}Id"
if (isEmpty(addAgreementId)) {
return
}

Map addAgreement = hydra.getAddAgreement(addAgreementId)

order."${prefix}Number" = addAgreement?.vc_doc_no
order."${prefix}Name" = addAgreement?.vc_name
Expand Down

0 comments on commit aa0fc69

Please sign in to comment.