Skip to content

Commit

Permalink
BTHA-190: Ensure contribution sales order field is always set
Browse files Browse the repository at this point in the history
  • Loading branch information
olayiwola-compucorp committed Aug 20, 2024
1 parent 04ac8e5 commit 1653b89
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
12 changes: 12 additions & 0 deletions js/contribution-entityref-field.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,18 @@
if (field.value) {
$(`[name^=${field.name}_]`).val(field.value).trigger('change');
}

$(`[name^=${field.name}_]`).on('change', field, function (event) {
const f = event.data;

$(`[name^=${f.name}_]`)
.attr('placeholder', f.placeholder)
.attr('disabled', false)
.crmEntityRef({
entity: f.entity,
create: false
});
});
});
});
});
Expand Down
8 changes: 6 additions & 2 deletions js/sales-order-contribution.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,13 @@
$(`<input type="hidden" value="${salesOrderStatusId}" name="sales_order_status_id" />`).insertBefore('#source');
$(' #totalAmountORaddLineitem, #totalAmountORPriceSet, #price_set_id, #choose-manual').hide();

if ($('#customData')) {
CRM.$(`[name^=${caseCustomField}_]`).val(caseSalesOrder.case_id).trigger('change');
CRM.$(`[name^=${quotationCustomField}_]`).val(caseSalesOrder.id).trigger('change');
}
waitForElement($, '#customData', function ($, elem) {
$(`[name^=${caseCustomField}_]`).val(caseSalesOrder.case_id).trigger('change');
$(`[name^=${quotationCustomField}_]`).val(caseSalesOrder.id).trigger('change');
CRM.$(`[name^=${caseCustomField}_]`).val(caseSalesOrder.case_id).trigger('change');
CRM.$(`[name^=${quotationCustomField}_]`).val(caseSalesOrder.id).trigger('change');
});
}).finally(() => {
CRM.$.unblockUI();
Expand Down

0 comments on commit 1653b89

Please sign in to comment.