From 507bc932f24cae4efd64bd0cdcc6ca33b7db982d Mon Sep 17 00:00:00 2001 From: scardinius Date: Thu, 15 Jul 2021 13:37:27 +0200 Subject: [PATCH 1/3] Add ts() function within CRM_Core_Error::statusBounce() method --- CRM/Batch/Form/Entry.php | 2 +- CRM/Campaign/Form/Petition/Signature.php | 8 ++++---- CRM/Case/Form/Activity/ChangeCaseStartDate.php | 4 ++-- CRM/Case/Form/Activity/ChangeCaseType.php | 2 +- CRM/Case/Form/Activity/OpenCase.php | 6 +++--- CRM/Case/Page/Tab.php | 2 +- CRM/Contact/Form/Search/Custom.php | 2 +- CRM/Contribute/Form/CancelSubscription.php | 2 +- CRM/Contribute/Page/ContributionRecur.php | 4 ++-- CRM/Core/Form/RecurringEntity.php | 4 ++-- CRM/Core/Invoke.php | 2 +- CRM/Core/Page/File.php | 6 +++--- CRM/Core/Page/Redirect.php | 2 +- CRM/Event/Form/Task/Batch.php | 2 +- CRM/Event/Page/ParticipantListing.php | 2 +- CRM/Financial/Page/FinancialTypeAccount.php | 2 +- CRM/Member/Form/Task/Batch.php | 2 +- CRM/Profile/Page/Listings.php | 2 +- CRM/Queue/Page/Runner.php | 2 +- CRM/Report/Page/Instance.php | 2 +- CRM/Report/Page/Options.php | 2 +- 21 files changed, 31 insertions(+), 31 deletions(-) diff --git a/CRM/Batch/Form/Entry.php b/CRM/Batch/Form/Entry.php index ff306545cf55..00a8725545dd 100644 --- a/CRM/Batch/Form/Entry.php +++ b/CRM/Batch/Form/Entry.php @@ -314,7 +314,7 @@ public function buildQuickForm() { $offset = 50; if ((count($this->_elementIndex) + $offset) > ini_get("max_input_vars")) { // Avoiding 'ts' for obscure messages. - CRM_Core_Error::statusBounce('Batch size is too large. Increase value of php.ini setting "max_input_vars" (current val = ' . ini_get("max_input_vars") . ')'); + CRM_Core_Error::statusBounce(ts('Batch size is too large. Increase value of php.ini setting "max_input_vars" (current val = %1)', [1 => ini_get("max_input_vars")])); } $this->assign('fields', $this->_fields); diff --git a/CRM/Campaign/Form/Petition/Signature.php b/CRM/Campaign/Form/Petition/Signature.php index 31e7edde2198..2d1e5df0a10a 100644 --- a/CRM/Campaign/Form/Petition/Signature.php +++ b/CRM/Campaign/Form/Petition/Signature.php @@ -182,7 +182,7 @@ public function preProcess() { //some sanity checks if (!$this->_surveyId) { - CRM_Core_Error::statusBounce('Petition id is not valid. (it needs a "sid" in the url).'); + CRM_Core_Error::statusBounce(ts('Petition id is not valid. (it needs a "sid" in the url).')); return; } //check petition is valid and active @@ -190,10 +190,10 @@ public function preProcess() { $this->petition = []; CRM_Campaign_BAO_Survey::retrieve($params, $this->petition); if (empty($this->petition)) { - CRM_Core_Error::statusBounce('Petition doesn\'t exist.'); + CRM_Core_Error::statusBounce(ts('Petition doesn\'t exist.')); } if ($this->petition['is_active'] == 0) { - CRM_Core_Error::statusBounce('Petition is no longer active.'); + CRM_Core_Error::statusBounce(ts('Petition is no longer active.')); } //get userID from session @@ -219,7 +219,7 @@ public function preProcess() { $this->_contactProfileFields = CRM_Core_BAO_UFGroup::getFields($this->_contactProfileId, FALSE, CRM_Core_Action::ADD); } if (!isset($this->_contactProfileFields['email-Primary'])) { - CRM_Core_Error::statusBounce('The contact profile needs to contain the primary email address field'); + CRM_Core_Error::statusBounce(ts('The contact profile needs to contain the primary email address field')); } $ufJoinParams['weight'] = 1; diff --git a/CRM/Case/Form/Activity/ChangeCaseStartDate.php b/CRM/Case/Form/Activity/ChangeCaseStartDate.php index 998127ec75cf..670982cbcde4 100644 --- a/CRM/Case/Form/Activity/ChangeCaseStartDate.php +++ b/CRM/Case/Form/Activity/ChangeCaseStartDate.php @@ -128,7 +128,7 @@ public static function endPostProcess(&$form, &$params, $activity) { !$caseId || !$caseType ) { - CRM_Core_Error::statusBounce('Required parameter missing for ChangeCaseType - end post processing'); + CRM_Core_Error::statusBounce(ts('Required parameter missing for ChangeCaseType - end post processing')); } $config = CRM_Core_Config::singleton(); @@ -199,7 +199,7 @@ public static function endPostProcess(&$form, &$params, $activity) { $newActivity = CRM_Activity_BAO_Activity::create($openCaseParams); if (is_a($newActivity, 'CRM_Core_Error')) { - CRM_Core_Error::statusBounce('Unable to update Open Case activity'); + CRM_Core_Error::statusBounce(ts('Unable to update Open Case activity')); } else { // Create linkage to case diff --git a/CRM/Case/Form/Activity/ChangeCaseType.php b/CRM/Case/Form/Activity/ChangeCaseType.php index 6d6366c57a8b..212fe07ac6f6 100644 --- a/CRM/Case/Form/Activity/ChangeCaseType.php +++ b/CRM/Case/Form/Activity/ChangeCaseType.php @@ -134,7 +134,7 @@ public static function endPostProcess(&$form, &$params, $activity) { !$params['case_type_id'] || !$caseType ) { - CRM_Core_Error::statusBounce('Required parameter missing for ChangeCaseType - end post processing'); + CRM_Core_Error::statusBounce(ts('Required parameter missing for ChangeCaseType - end post processing')); } $params['status_id'] = CRM_Core_PseudoConstant::getKey('CRM_Activity_BAO_Activity', 'activity_status_id', 'Completed'); diff --git a/CRM/Case/Form/Activity/OpenCase.php b/CRM/Case/Form/Activity/OpenCase.php index eb47e3f0e328..65eb900f74c1 100644 --- a/CRM/Case/Form/Activity/OpenCase.php +++ b/CRM/Case/Form/Activity/OpenCase.php @@ -260,18 +260,18 @@ public static function endPostProcess(&$form, &$params) { $isMultiClient = $xmlProcessorProcess->getAllowMultipleCaseClients(); if (!$isMultiClient && !$form->_currentlyViewedContactId) { - CRM_Core_Error::statusBounce('Required parameter missing for OpenCase - end post processing'); + CRM_Core_Error::statusBounce(ts('Required parameter missing for OpenCase - end post processing')); } if (!$form->_currentUserId || !$params['case_id'] || !$params['case_type']) { - CRM_Core_Error::statusBounce('Required parameter missing for OpenCase - end post processing'); + CRM_Core_Error::statusBounce(ts('Required parameter missing for OpenCase - end post processing')); } // 1. create case-contact if ($isMultiClient && $form->_context == 'standalone') { foreach ($params['client_id'] as $cliId) { if (empty($cliId)) { - CRM_Core_Error::statusBounce('client_id cannot be empty for OpenCase - end post processing'); + CRM_Core_Error::statusBounce(ts('client_id cannot be empty for OpenCase - end post processing')); } $contactParams = [ 'case_id' => $params['case_id'], diff --git a/CRM/Case/Page/Tab.php b/CRM/Case/Page/Tab.php index 12f6cd06714d..8c91b6ffb5ea 100644 --- a/CRM/Case/Page/Tab.php +++ b/CRM/Case/Page/Tab.php @@ -63,7 +63,7 @@ public function preProcess() { } else { if ($this->_action & CRM_Core_Action::VIEW) { - CRM_Core_Error::statusBounce('Contact Id is required for view action.'); + CRM_Core_Error::statusBounce(ts('Contact Id is required for view action.')); } } diff --git a/CRM/Contact/Form/Search/Custom.php b/CRM/Contact/Form/Search/Custom.php index d2b4fd4cdd39..8380d5f3bc27 100644 --- a/CRM/Contact/Form/Search/Custom.php +++ b/CRM/Contact/Form/Search/Custom.php @@ -37,7 +37,7 @@ public function preProcess() { ) = CRM_Contact_BAO_SearchCustom::details($csID, $ssID, $gID); if (!$this->_customSearchID) { - CRM_Core_Error::statusbounce('Could not get details for custom search.'); + CRM_Core_Error::statusbounce(ts('Could not get details for custom search.')); } // stash this as a hidden element so we can potentially go there if the session diff --git a/CRM/Contribute/Form/CancelSubscription.php b/CRM/Contribute/Form/CancelSubscription.php index a1b8abf9e0cc..22137d5d7934 100644 --- a/CRM/Contribute/Form/CancelSubscription.php +++ b/CRM/Contribute/Form/CancelSubscription.php @@ -89,7 +89,7 @@ public function preProcess() { (!$this->_crid && !$this->_coid && !$this->_mid) || (!$this->getSubscriptionDetails()) ) { - CRM_Core_Error::statusBounce('Required information missing.'); + CRM_Core_Error::statusBounce(ts('Required information missing.')); } $this->assign('cancelRecurDetailText', $this->_paymentProcessorObj->getText('cancelRecurDetailText', $cancelRecurTextParams)); diff --git a/CRM/Contribute/Page/ContributionRecur.php b/CRM/Contribute/Page/ContributionRecur.php index 65a1453eed3b..150aaf76561e 100644 --- a/CRM/Contribute/Page/ContributionRecur.php +++ b/CRM/Contribute/Page/ContributionRecur.php @@ -38,7 +38,7 @@ protected function getDefaultAction() { */ public function view() { if (empty($this->getEntityId())) { - CRM_Core_Error::statusBounce('Recurring contribution not found'); + CRM_Core_Error::statusBounce(ts('Recurring contribution not found')); } try { @@ -47,7 +47,7 @@ public function view() { ]); } catch (Exception $e) { - CRM_Core_Error::statusBounce('Recurring contribution not found (ID: ' . $this->getEntityId()); + CRM_Core_Error::statusBounce(ts('Recurring contribution not found (ID: %1', [1 => $this->getEntityId()])); } $contributionRecur['payment_processor'] = CRM_Financial_BAO_PaymentProcessor::getPaymentProcessorName( diff --git a/CRM/Core/Form/RecurringEntity.php b/CRM/Core/Form/RecurringEntity.php index 4e663693a82f..053346a886cc 100644 --- a/CRM/Core/Form/RecurringEntity.php +++ b/CRM/Core/Form/RecurringEntity.php @@ -424,7 +424,7 @@ public static function postProcess($params, $type, $linkedEntities = []) { ] ); if ($result['error']) { - CRM_Core_Error::statusBounce('Error creating recurring list'); + CRM_Core_Error::statusBounce(ts('Error creating recurring list')); } } } @@ -440,7 +440,7 @@ public static function postProcess($params, $type, $linkedEntities = []) { ] ); if ($result['error']) { - CRM_Core_Error::statusBounce('Error creating recurring list'); + CRM_Core_Error::statusBounce(ts('Error creating recurring list')); } } } diff --git a/CRM/Core/Invoke.php b/CRM/Core/Invoke.php index dbd42aa066a9..033632d0719b 100644 --- a/CRM/Core/Invoke.php +++ b/CRM/Core/Invoke.php @@ -103,7 +103,7 @@ public static function hackMenuRebuild($args) { return CRM_Utils_System::redirect(); } else { - CRM_Core_Error::statusBounce('You do not have permission to execute this url'); + CRM_Core_Error::statusBounce(ts('You do not have permission to execute this url')); } } } diff --git a/CRM/Core/Page/File.php b/CRM/Core/Page/File.php index a0a8636c09b5..f92802d79e36 100644 --- a/CRM/Core/Page/File.php +++ b/CRM/Core/Page/File.php @@ -38,7 +38,7 @@ public function run() { if (empty($fileName)) { $hash = CRM_Utils_Request::retrieve('fcs', 'Alphanumeric', $this); if (!CRM_Core_BAO_File::validateFileHash($hash, $entityId, $fileId)) { - CRM_Core_Error::statusBounce('URL for file is not valid'); + CRM_Core_Error::statusBounce(ts('URL for file is not valid')); } list($path, $mimeType) = CRM_Core_BAO_File::path($fileId, $entityId); @@ -52,7 +52,7 @@ public function run() { } if (!$path) { - CRM_Core_Error::statusBounce('Could not retrieve the file'); + CRM_Core_Error::statusBounce(ts('Could not retrieve the file')); } if (empty($mimeType)) { @@ -71,7 +71,7 @@ public function run() { $buffer = file_get_contents($path); if (!$buffer) { - CRM_Core_Error::statusBounce('The file is either empty or you do not have permission to retrieve the file'); + CRM_Core_Error::statusBounce(ts('The file is either empty or you do not have permission to retrieve the file')); } if ($action & CRM_Core_Action::DELETE) { diff --git a/CRM/Core/Page/Redirect.php b/CRM/Core/Page/Redirect.php index ed855d1df010..4f0b83dde4b6 100644 --- a/CRM/Core/Page/Redirect.php +++ b/CRM/Core/Page/Redirect.php @@ -38,7 +38,7 @@ public function run($path = NULL, $pageArgs = []) { */ public static function createUrl($requestPath, $requestArgs, $pageArgs, $absolute) { if (empty($pageArgs['url'])) { - CRM_Core_Error::statusBounce('This page is configured as a redirect, but it does not have a target.'); + CRM_Core_Error::statusBounce(ts('This page is configured as a redirect, but it does not have a target.')); } $vars = []; diff --git a/CRM/Event/Form/Task/Batch.php b/CRM/Event/Form/Task/Batch.php index 430285370c1d..0107df02de5c 100644 --- a/CRM/Event/Form/Task/Batch.php +++ b/CRM/Event/Form/Task/Batch.php @@ -80,7 +80,7 @@ public function preProcess() { public function buildQuickForm() { $ufGroupId = $this->get('ufGroupId'); if (!$ufGroupId) { - CRM_Core_Error::statusBounce('ufGroupId is missing'); + CRM_Core_Error::statusBounce(ts('ufGroupId is missing')); } $this->_title = ts('Update multiple participants') . ' - ' . CRM_Core_BAO_UFGroup::getTitle($ufGroupId); diff --git a/CRM/Event/Page/ParticipantListing.php b/CRM/Event/Page/ParticipantListing.php index 6d58554a3724..0ea5de7ae67d 100644 --- a/CRM/Event/Page/ParticipantListing.php +++ b/CRM/Event/Page/ParticipantListing.php @@ -75,7 +75,7 @@ public function run() { ) . '.php'; $error = include_once $classFile; if ($error == FALSE) { - CRM_Core_Error::statusBounce('Participant listing code file: ' . $classFile . ' does not exist. Please verify your custom particpant listing settings in CiviCRM administrative panel.'); + CRM_Core_Error::statusBounce(ts('Participant listing code file: %1 does not exist. Please verify your custom particpant listing settings in CiviCRM administrative panel.', [1 => $classFile])); } $participantListingClass = new $className(); diff --git a/CRM/Financial/Page/FinancialTypeAccount.php b/CRM/Financial/Page/FinancialTypeAccount.php index cdbd3d5af913..b451ee5a9800 100644 --- a/CRM/Financial/Page/FinancialTypeAccount.php +++ b/CRM/Financial/Page/FinancialTypeAccount.php @@ -166,7 +166,7 @@ public function browse() { $this->assign('financialTypeTitle', $this->_title); } else { - CRM_Core_Error::statusBounce('No Financial Accounts found for the Financial Type'); + CRM_Core_Error::statusBounce(ts('No Financial Accounts found for the Financial Type')); } } diff --git a/CRM/Member/Form/Task/Batch.php b/CRM/Member/Form/Task/Batch.php index 5c9f9760886f..603bd9d3ca5a 100644 --- a/CRM/Member/Form/Task/Batch.php +++ b/CRM/Member/Form/Task/Batch.php @@ -74,7 +74,7 @@ public function buildQuickForm() { $ufGroupId = $this->get('ufGroupId'); if (!$ufGroupId) { - CRM_Core_Error::statusBounce('ufGroupId is missing'); + CRM_Core_Error::statusBounce(ts('ufGroupId is missing')); } $this->_title = ts('Update multiple memberships') . ' - ' . CRM_Core_BAO_UFGroup::getTitle($ufGroupId); CRM_Utils_System::setTitle($this->_title); diff --git a/CRM/Profile/Page/Listings.php b/CRM/Profile/Page/Listings.php index c521848e1cf7..38bfdb35d731 100644 --- a/CRM/Profile/Page/Listings.php +++ b/CRM/Profile/Page/Listings.php @@ -281,7 +281,7 @@ public function run() { $ufgroupDAO = new CRM_Core_DAO_UFGroup(); $ufgroupDAO->id = $this->_gid; if (!$ufgroupDAO->find(TRUE)) { - CRM_Core_Error::statusBounce('Unable to find matching UF Group'); + CRM_Core_Error::statusBounce(ts('Unable to find matching UF Group')); } } diff --git a/CRM/Queue/Page/Runner.php b/CRM/Queue/Page/Runner.php index ac46d87104ec..24501db5e06a 100644 --- a/CRM/Queue/Page/Runner.php +++ b/CRM/Queue/Page/Runner.php @@ -36,7 +36,7 @@ public function run() { $qrid = CRM_Utils_Request::retrieve('qrid', 'String', $this, TRUE); $runner = CRM_Queue_Runner::instance($qrid); if (!is_object($runner)) { - CRM_Core_Error::statusBounce('Queue runner must be configured before execution.'); + CRM_Core_Error::statusBounce(ts('Queue runner must be configured before execution.')); } CRM_Utils_System::setTitle($runner->title); diff --git a/CRM/Report/Page/Instance.php b/CRM/Report/Page/Instance.php index 9eab4d008f8c..fe10f9270e07 100644 --- a/CRM/Report/Page/Instance.php +++ b/CRM/Report/Page/Instance.php @@ -44,7 +44,7 @@ public function run() { $optionVal = CRM_Report_Utils_Report::getValueFromUrl($instanceId); $templateInfo = CRM_Core_OptionGroup::getRowValues('report_template', "{$optionVal}", 'value'); if (empty($templateInfo)) { - CRM_Core_Error::statusBounce('You have tried to access a report that does not exist.'); + CRM_Core_Error::statusBounce(ts('You have tried to access a report that does not exist.')); } $extKey = strpos($templateInfo['name'], '.'); diff --git a/CRM/Report/Page/Options.php b/CRM/Report/Page/Options.php index a5852f190283..894ba22e3a13 100644 --- a/CRM/Report/Page/Options.php +++ b/CRM/Report/Page/Options.php @@ -63,7 +63,7 @@ public function preProcess() { self::$_gId = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionGroup', self::$_gName, 'id', 'name'); } else { - CRM_Core_Error::statusBounce('Unable to determine the Option Group'); + CRM_Core_Error::statusBounce(ts('Unable to determine the Option Group')); } self::$_GName = ucwords(str_replace('_', ' ', self::$_gName)); From cd3286d3a586f92bfb543b183392aa1c5661941e Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Sat, 24 Jul 2021 12:57:08 +1200 Subject: [PATCH 2/3] Update CRM/Contribute/Page/ContributionRecur.php Co-authored-by: demeritcowboy --- CRM/Contribute/Page/ContributionRecur.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CRM/Contribute/Page/ContributionRecur.php b/CRM/Contribute/Page/ContributionRecur.php index 150aaf76561e..273ecf8000e7 100644 --- a/CRM/Contribute/Page/ContributionRecur.php +++ b/CRM/Contribute/Page/ContributionRecur.php @@ -47,7 +47,7 @@ public function view() { ]); } catch (Exception $e) { - CRM_Core_Error::statusBounce(ts('Recurring contribution not found (ID: %1', [1 => $this->getEntityId()])); + CRM_Core_Error::statusBounce(ts('Recurring contribution not found (ID: %1)', [1 => $this->getEntityId()])); } $contributionRecur['payment_processor'] = CRM_Financial_BAO_PaymentProcessor::getPaymentProcessorName( From 61e912dafc280c3d090aaedc58c1f7c0f9b9ea75 Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Sat, 24 Jul 2021 13:00:10 +1200 Subject: [PATCH 3/3] Fix spelling --- CRM/Event/Page/ParticipantListing.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CRM/Event/Page/ParticipantListing.php b/CRM/Event/Page/ParticipantListing.php index 0ea5de7ae67d..23ec40564531 100644 --- a/CRM/Event/Page/ParticipantListing.php +++ b/CRM/Event/Page/ParticipantListing.php @@ -27,7 +27,7 @@ class CRM_Event_Page_ParticipantListing extends CRM_Core_Page { public function preProcess() { $this->_id = CRM_Utils_Request::retrieve('id', 'Integer', $this, TRUE); - // ensure that there is a particpant type for this + // ensure that there is a participant type for this $this->_participantListingID = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', $this->_id, 'participant_listing_id' @@ -75,7 +75,7 @@ public function run() { ) . '.php'; $error = include_once $classFile; if ($error == FALSE) { - CRM_Core_Error::statusBounce(ts('Participant listing code file: %1 does not exist. Please verify your custom particpant listing settings in CiviCRM administrative panel.', [1 => $classFile])); + CRM_Core_Error::statusBounce(ts('Participant listing code file: %1 does not exist. Please verify your custom participant listing settings in CiviCRM administrative panel.', [1 => $classFile])); } $participantListingClass = new $className();