Skip to content

Commit

Permalink
Merge pull request #1049 from compucorp/COMCL-703-fix-qto
Browse files Browse the repository at this point in the history
COMCL-703: Resolve quotation link and search filter issues
  • Loading branch information
olayiwola-compucorp authored Oct 9, 2024
2 parents 5765e30 + 779ab1c commit 2dfa77d
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 5 deletions.
8 changes: 7 additions & 1 deletion CRM/Civicase/Hook/Post/CreateSalesOrderContribution.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
8 changes: 7 additions & 1 deletion ang/afsearchQuotations.aff.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

<div class="af-container row civicase__case-filter-form-elements" ng-show="expanded">
<af-field name="status_id" defn="{input_attrs: {multiple: true}}" class="col-md-2" />
<af-field name="quotation_date" defn="{input_attrs: {time: false}, search_range: true, label: 'Date'}" class="col-md-4 civicase__ui-range" />
<af-field name="DATE_quotation_date" defn="{search_range: true, time: false, input_attrs: {}, label: 'Date'}" class="col-md-4 civicase__ui-range" />
<div class="col-md-1">
<button type="button" class="btn btn-link civicase__features-filters-clear" style="margin-top: 2em;">Clear All</button>
</div>
Expand All @@ -26,3 +26,9 @@
<crm-search-display-table search-name="Civicase_Quotations" display-name="Civicase_Quotations_Table" filters="{case_id: routeParams.caseId}"></crm-search-display-table>
</div>

<style>
af-field[name="DATE_quotation_date"] input.form-control.hasTimeEntry {
display: none !important;
}
</style>

Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
}
Expand Down
4 changes: 2 additions & 2 deletions js/sales-order-contribution.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@
$(`<input type="hidden" value="${salesOrderStatusId}" name="sales_order_status_id" />`).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');
});
Expand Down

0 comments on commit 2dfa77d

Please sign in to comment.