From 577c1bafc7155ed07015cdb49eb8171c7e32a39a Mon Sep 17 00:00:00 2001 From: olayiwola-compucorp Date: Tue, 8 Oct 2024 06:44:02 +0100 Subject: [PATCH 1/2] COMCL-703: Ensure filter is cleared appropraitely --- ang/afsearchQuotations.aff.html | 8 +++++++- .../quotations/directives/quotations-list.directive.js | 3 ++- 2 files changed, 9 insertions(+), 2 deletions(-) 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 @@
- +
@@ -26,3 +26,9 @@
+ + diff --git a/ang/civicase-features/quotations/directives/quotations-list.directive.js b/ang/civicase-features/quotations/directives/quotations-list.directive.js index 1d414ff7a..b4ef9de52 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(); }); } From 779ab1c5f09a439a20a5b4d51282692bab98ccda Mon Sep 17 00:00:00 2001 From: olayiwola-compucorp Date: Tue, 8 Oct 2024 08:25:12 +0100 Subject: [PATCH 2/2] COMCL-866: Ensure contribution is appropraitely linked to quotation --- CRM/Civicase/Hook/Post/CreateSalesOrderContribution.php | 8 +++++++- .../quotations/directives/quotations-list.directive.js | 2 +- js/sales-order-contribution.js | 4 ++-- 3 files changed, 10 insertions(+), 4 deletions(-) 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/civicase-features/quotations/directives/quotations-list.directive.js b/ang/civicase-features/quotations/directives/quotations-list.directive.js index b4ef9de52..fa6da244b 100644 --- a/ang/civicase-features/quotations/directives/quotations-list.directive.js +++ b/ang/civicase-features/quotations/directives/quotations-list.directive.js @@ -53,7 +53,7 @@ if ($('.civicase__features-filters-clear').length) { // Handle clear filter button. $('.civicase__features-filters-clear').off('click').click(event => { - CRM.$("input[id*='id']").select2('data', null) + 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'); });