Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ts() function within CRM_Core_Error::statusBounce() method #20857

Merged
merged 3 commits into from
Jul 24, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CRM/Batch/Form/Entry.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
8 changes: 4 additions & 4 deletions CRM/Campaign/Form/Petition/Signature.php
Original file line number Diff line number Diff line change
Expand Up @@ -182,18 +182,18 @@ 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
$params['id'] = $this->_surveyId;
$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
Expand All @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions CRM/Case/Form/Activity/ChangeCaseStartDate.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion CRM/Case/Form/Activity/ChangeCaseType.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
6 changes: 3 additions & 3 deletions CRM/Case/Form/Activity/OpenCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
Expand Down
2 changes: 1 addition & 1 deletion CRM/Case/Page/Tab.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.'));
}
}

Expand Down
2 changes: 1 addition & 1 deletion CRM/Contact/Form/Search/Custom.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion CRM/Contribute/Form/CancelSubscription.php
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
4 changes: 2 additions & 2 deletions CRM/Contribute/Page/ContributionRecur.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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()]));
eileenmcnaughton marked this conversation as resolved.
Show resolved Hide resolved
}

$contributionRecur['payment_processor'] = CRM_Financial_BAO_PaymentProcessor::getPaymentProcessorName(
Expand Down
4 changes: 2 additions & 2 deletions CRM/Core/Form/RecurringEntity.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
}
}
}
Expand All @@ -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'));
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion CRM/Core/Invoke.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions CRM/Core/Page/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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)) {
Expand All @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion CRM/Core/Page/Redirect.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [];
Expand Down
2 changes: 1 addition & 1 deletion CRM/Event/Form/Task/Batch.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion CRM/Event/Page/ParticipantListing.php
Original file line number Diff line number Diff line change
Expand Up @@ -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]));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't even know this existed! It's a bit technical and seems unlikely to be something a user would deal with - so it's a judgement call I guess whether to include it in translation.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also participant is spelled wrong. (particpant)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good points - I think I've managed to add a spelling fix - the other is a judgement call as you say & I'm on the side of 'getting this merged'

}

$participantListingClass = new $className();
Expand Down
2 changes: 1 addition & 1 deletion CRM/Financial/Page/FinancialTypeAccount.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
}
}

Expand Down
2 changes: 1 addition & 1 deletion CRM/Member/Form/Task/Batch.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion CRM/Profile/Page/Listings.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
}
}

Expand Down
2 changes: 1 addition & 1 deletion CRM/Queue/Page/Runner.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion CRM/Report/Page/Instance.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'], '.');
Expand Down
2 changes: 1 addition & 1 deletion CRM/Report/Page/Options.php
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down