diff --git a/CRM/Civicase/Hook/Post/CreateSalesOrderContribution.php b/CRM/Civicase/Hook/Post/CreateSalesOrderContribution.php
index 29944571a..bf81455b7 100644
--- a/CRM/Civicase/Hook/Post/CreateSalesOrderContribution.php
+++ b/CRM/Civicase/Hook/Post/CreateSalesOrderContribution.php
@@ -42,11 +42,17 @@ public function run($op, $objectName, $objectId, &$objectRef) {
$salesOrderStatusId = CRM_Utils_Request::retrieve('sales_order_status_id', 'Integer');
if (empty($salesOrderStatusId)) {
- $salesOrder = $salesOrder['status_id'];
+ $salesOrderStatusId = $salesOrder['status_id'];
}
$transaction = CRM_Core_Transaction::create();
try {
+ Contribution::update(FALSE)
+ ->addWhere('id', '=', $objectId)
+ ->addValue('Opportunity_Details.Case_Opportunity', $salesOrder['case_id'] ?? NULL)
+ ->addValue('Opportunity_Details.Quotation', $salesOrderId)
+ ->execute();
+
$caseSaleOrderContributionService = new CRM_Civicase_Service_CaseSalesOrderContributionCalculator($salesOrderId);
$paymentStatusID = $caseSaleOrderContributionService->calculatePaymentStatus();
$invoicingStatusID = $caseSaleOrderContributionService->calculateInvoicingStatus();
diff --git a/ang/afsearchQuotations.aff.html b/ang/afsearchQuotations.aff.html
index cff2c00b4..4316be718 100644
--- a/ang/afsearchQuotations.aff.html
+++ b/ang/afsearchQuotations.aff.html
@@ -17,7 +17,7 @@
+
+
diff --git a/ang/civicase-features/quotations/directives/quotations-list.directive.js b/ang/civicase-features/quotations/directives/quotations-list.directive.js
index 1d414ff7a..fa6da244b 100644
--- a/ang/civicase-features/quotations/directives/quotations-list.directive.js
+++ b/ang/civicase-features/quotations/directives/quotations-list.directive.js
@@ -52,7 +52,8 @@
if ($('.civicase__features-filters-clear').length) {
// Handle clear filter button.
- $('.civicase__features-filters-clear').click(event => {
+ $('.civicase__features-filters-clear').off('click').click(event => {
+ CRM.$("input[id*='id']").select2('data', null);
CRM.$('.civicase__features input, .civicase__features textarea').val('').change();
});
}
diff --git a/js/sales-order-contribution.js b/js/sales-order-contribution.js
index 02c2245de..c54458166 100644
--- a/js/sales-order-contribution.js
+++ b/js/sales-order-contribution.js
@@ -43,11 +43,11 @@
$(``).insertBefore('#source');
$(' #totalAmountORaddLineitem, #totalAmountORPriceSet, #price_set_id, #choose-manual').hide();
- if ($('#customData')) {
+ if ($('#customData_Contribution')) {
CRM.$(`[name^=${caseCustomField}_]`).val(caseSalesOrder.case_id).trigger('change');
CRM.$(`[name^=${quotationCustomField}_]`).val(caseSalesOrder.id).trigger('change');
}
- waitForElement($, '#customData', function ($, elem) {
+ waitForElement($, '#customData_Contribution', function ($, elem) {
CRM.$(`[name^=${caseCustomField}_]`).val(caseSalesOrder.case_id).trigger('change');
CRM.$(`[name^=${quotationCustomField}_]`).val(caseSalesOrder.id).trigger('change');
});