From 4a7ad7a839ab556029cdcbfad9be81c2fe0b1763 Mon Sep 17 00:00:00 2001 From: Erawat Chamanont Date: Thu, 21 Sep 2023 22:51:07 +0100 Subject: [PATCH] BTHAB-186: Rename service class The renaming is to align with other objects and provides more meaningful --- CRM/Civicase/Hook/Post/CaseSalesOrderPayment.php | 4 ++-- CRM/Civicase/Hook/Post/CreateSalesOrderContribution.php | 2 +- ...tribution.php => CaseSalesOrderContributionCalculator.php} | 2 +- .../CaseSalesOrder/ComputeTotalAmountInvoicedAction.php | 2 +- .../Action/CaseSalesOrder/ComputeTotalAmountPaidAction.php | 2 +- Civi/Api4/Action/CaseSalesOrder/SalesOrderSaveAction.php | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) rename CRM/Civicase/Service/{CaseSaleOrderContribution.php => CaseSalesOrderContributionCalculator.php} (98%) diff --git a/CRM/Civicase/Hook/Post/CaseSalesOrderPayment.php b/CRM/Civicase/Hook/Post/CaseSalesOrderPayment.php index 412859ec4..ead823b27 100644 --- a/CRM/Civicase/Hook/Post/CaseSalesOrderPayment.php +++ b/CRM/Civicase/Hook/Post/CaseSalesOrderPayment.php @@ -9,7 +9,7 @@ class CRM_Civicase_Hook_Post_CaseSalesOrderPayment { /** - * Updates CaseSaleOrder statuses when creating a payment transcation. + * Updates CaseSalesOrder statuses when creating a payment transaction. * * @param string $op * The operation being performed. @@ -50,7 +50,7 @@ public function run($op, $objectName, $objectId, &$objectRef) { $transaction = CRM_Core_Transaction::create(); try { - $caseSaleOrderContributionService = new CRM_Civicase_Service_CaseSaleOrderContribution($salesOrderID); + $caseSaleOrderContributionService = new CRM_Civicase_Service_CaseSalesOrderContributionCalculator($salesOrderID); $paymentStatusID = $caseSaleOrderContributionService->calculatePaymentStatus(); $invoicingStatusID = $caseSaleOrderContributionService->calculateInvoicingStatus(); diff --git a/CRM/Civicase/Hook/Post/CreateSalesOrderContribution.php b/CRM/Civicase/Hook/Post/CreateSalesOrderContribution.php index c4b8a08b9..86285be05 100644 --- a/CRM/Civicase/Hook/Post/CreateSalesOrderContribution.php +++ b/CRM/Civicase/Hook/Post/CreateSalesOrderContribution.php @@ -45,7 +45,7 @@ public function run($op, $objectName, $objectId, &$objectRef) { $transaction = CRM_Core_Transaction::create(); try { - $caseSaleOrderContributionService = new CRM_Civicase_Service_CaseSaleOrderContribution($salesOrderId); + $caseSaleOrderContributionService = new CRM_Civicase_Service_CaseSalesOrderContributionCalculator($salesOrderId); $paymentStatusID = $caseSaleOrderContributionService->calculatePaymentStatus(); $invoicingStatusID = $caseSaleOrderContributionService->calculateInvoicingStatus(); diff --git a/CRM/Civicase/Service/CaseSaleOrderContribution.php b/CRM/Civicase/Service/CaseSalesOrderContributionCalculator.php similarity index 98% rename from CRM/Civicase/Service/CaseSaleOrderContribution.php rename to CRM/Civicase/Service/CaseSalesOrderContributionCalculator.php index 09a8af022..1e3a99ea8 100644 --- a/CRM/Civicase/Service/CaseSaleOrderContribution.php +++ b/CRM/Civicase/Service/CaseSalesOrderContributionCalculator.php @@ -10,7 +10,7 @@ * This class provides calculations for payment and invoices that * attached to the sale order. */ -class CRM_Civicase_Service_CaseSaleOrderContribution { +class CRM_Civicase_Service_CaseSalesOrderContributionCalculator { /** * Case Sales Order object. diff --git a/Civi/Api4/Action/CaseSalesOrder/ComputeTotalAmountInvoicedAction.php b/Civi/Api4/Action/CaseSalesOrder/ComputeTotalAmountInvoicedAction.php index a7be9c48c..d35fa3298 100644 --- a/Civi/Api4/Action/CaseSalesOrder/ComputeTotalAmountInvoicedAction.php +++ b/Civi/Api4/Action/CaseSalesOrder/ComputeTotalAmountInvoicedAction.php @@ -25,7 +25,7 @@ public function _run(Result $result) { // phpcs:ignore if (!$this->salesOrderID) { return; } - $service = new \CRM_Civicase_Service_CaseSaleOrderContribution($this->salesOrderID); + $service = new \CRM_Civicase_Service_CaseSalesOrderContributionCalculator($this->salesOrderID); $result['amount'] = $service->calculateTotalInvoicedAmount(); } diff --git a/Civi/Api4/Action/CaseSalesOrder/ComputeTotalAmountPaidAction.php b/Civi/Api4/Action/CaseSalesOrder/ComputeTotalAmountPaidAction.php index 9fcf1b8a2..7b022ae53 100644 --- a/Civi/Api4/Action/CaseSalesOrder/ComputeTotalAmountPaidAction.php +++ b/Civi/Api4/Action/CaseSalesOrder/ComputeTotalAmountPaidAction.php @@ -24,7 +24,7 @@ public function _run(Result $result) { // phpcs:ignore if (!$this->salesOrderID) { return; } - $service = new \CRM_Civicase_Service_CaseSaleOrderContribution($this->salesOrderID); + $service = new \CRM_Civicase_Service_CaseSalesOrderContributionCalculator($this->salesOrderID); $result['amount'] = $service->calculateTotalPaidAmount(); } diff --git a/Civi/Api4/Action/CaseSalesOrder/SalesOrderSaveAction.php b/Civi/Api4/Action/CaseSalesOrder/SalesOrderSaveAction.php index ce7401a9f..1f766af03 100644 --- a/Civi/Api4/Action/CaseSalesOrder/SalesOrderSaveAction.php +++ b/Civi/Api4/Action/CaseSalesOrder/SalesOrderSaveAction.php @@ -49,7 +49,7 @@ protected function writeRecord($items) { $salesOrder['total_after_tax'] = $total['totalAfterTax']; $saleOrderId = $salesOrder['id'] ?? NULL; - $caseSaleOrderContributionService = new \CRM_Civicase_Service_CaseSaleOrderContribution($saleOrderId); + $caseSaleOrderContributionService = new \CRM_Civicase_Service_CaseSalesOrderContributionCalculator($saleOrderId); $salesOrder['payment_status_id'] = $caseSaleOrderContributionService->calculateInvoicingStatus(); $salesOrder['invoicing_status_id'] = $caseSaleOrderContributionService->calculatePaymentStatus();