Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HCX-5 Fix contract helper null-value escape #57

Merged
merged 1 commit into from
Apr 14, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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