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

(NFC) Update various files to pass future civicrm/coder ruleset #13979

Merged
merged 8 commits into from
Apr 6, 2019
Merged
30 changes: 15 additions & 15 deletions CRM/ACL/Form/ACL.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,30 +141,30 @@ public function buildQuickForm() {

$label = ts('Role');
$role = [
'-1' => ts('- select role -'),
'0' => ts('Everyone'),
] + CRM_Core_OptionGroup::values('acl_role');
'-1' => ts('- select role -'),
'0' => ts('Everyone'),
] + CRM_Core_OptionGroup::values('acl_role');
$this->add('select', 'entity_id', $label, $role, TRUE);

$group = [
'-1' => ts('- select -'),
'0' => ts('All Groups'),
] + CRM_Core_PseudoConstant::group();
'-1' => ts('- select -'),
'0' => ts('All Groups'),
] + CRM_Core_PseudoConstant::group();

$customGroup = [
'-1' => ts('- select -'),
'0' => ts('All Custom Groups'),
] + CRM_Core_PseudoConstant::get('CRM_Core_DAO_CustomField', 'custom_group_id');
'-1' => ts('- select -'),
'0' => ts('All Custom Groups'),
] + CRM_Core_PseudoConstant::get('CRM_Core_DAO_CustomField', 'custom_group_id');

$ufGroup = [
'-1' => ts('- select -'),
'0' => ts('All Profiles'),
] + CRM_Core_PseudoConstant::get('CRM_Core_DAO_UFField', 'uf_group_id');
'-1' => ts('- select -'),
'0' => ts('All Profiles'),
] + CRM_Core_PseudoConstant::get('CRM_Core_DAO_UFField', 'uf_group_id');

$event = [
'-1' => ts('- select -'),
'0' => ts('All Events'),
] + CRM_Event_PseudoConstant::event(NULL, FALSE, "( is_template IS NULL OR is_template != 1 )");
'-1' => ts('- select -'),
'0' => ts('All Events'),
] + CRM_Event_PseudoConstant::event(NULL, FALSE, "( is_template IS NULL OR is_template != 1 )");

$this->add('select', 'group_id', ts('Group'), $group);
$this->add('select', 'custom_group_id', ts('Custom Data'), $customGroup);
Expand Down
6 changes: 3 additions & 3 deletions CRM/ACL/Form/ACLBasic.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ public function buildQuickForm() {

$label = ts('Role');
$role = [
'-1' => ts('- select role -'),
'0' => ts('Everyone'),
] + CRM_Core_OptionGroup::values('acl_role');
'-1' => ts('- select role -'),
'0' => ts('Everyone'),
] + CRM_Core_OptionGroup::values('acl_role');
$entityID = &$this->add('select', 'entity_id', $label, $role, TRUE);

if ($this->_id) {
Expand Down
24 changes: 12 additions & 12 deletions CRM/ACL/Page/ACL.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,22 +123,22 @@ public function browse() {
$roles = CRM_Core_OptionGroup::values('acl_role');

$group = [
'-1' => ts('- select -'),
'0' => ts('All Groups'),
] + CRM_Core_PseudoConstant::group();
'-1' => ts('- select -'),
'0' => ts('All Groups'),
] + CRM_Core_PseudoConstant::group();
$customGroup = [
'-1' => ts('- select -'),
'0' => ts('All Custom Groups'),
] + CRM_Core_PseudoConstant::get('CRM_Core_DAO_CustomField', 'custom_group_id');
'-1' => ts('- select -'),
'0' => ts('All Custom Groups'),
] + CRM_Core_PseudoConstant::get('CRM_Core_DAO_CustomField', 'custom_group_id');
$ufGroup = [
'-1' => ts('- select -'),
'0' => ts('All Profiles'),
] + CRM_Core_PseudoConstant::get('CRM_Core_DAO_UFField', 'uf_group_id');
'-1' => ts('- select -'),
'0' => ts('All Profiles'),
] + CRM_Core_PseudoConstant::get('CRM_Core_DAO_UFField', 'uf_group_id');

$event = [
'-1' => ts('- select -'),
'0' => ts('All Events'),
] + CRM_Event_PseudoConstant::event();
'-1' => ts('- select -'),
'0' => ts('All Events'),
] + CRM_Event_PseudoConstant::event();

while ($dao->fetch()) {
$acl[$dao->id] = [];
Expand Down
1 change: 0 additions & 1 deletion CRM/Activity/ActionMapping.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
* @copyright CiviCRM LLC (c) 2004-2019
*/

use Civi\ActionSchedule\RecipientBuilder;
Copy link
Contributor

Choose a reason for hiding this comment

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

@totten this is an interesting one

Copy link
Member Author

@totten totten Apr 5, 2019

Choose a reason for hiding this comment

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

Agree. I opened that file to double-check references, and it seemed OK without the use statement. Also, CRM_Activity_ActionMappingTest, has coverage of this file. (There was an @see, but that worked with or without the use.)


/**
* Class CRM_Activity_ActionMapping
Expand Down
8 changes: 4 additions & 4 deletions CRM/Activity/BAO/Activity.php
Original file line number Diff line number Diff line change
Expand Up @@ -1207,7 +1207,7 @@ public static function sendSMS(
}

if (!isset($contactDetails) && !isset($contactIds)) {
Throw new CRM_Core_Exception('You must specify either $contactDetails or $contactIds');
throw new CRM_Core_Exception('You must specify either $contactDetails or $contactIds');
}
// Populate $contactDetails and $contactIds if only one is set
if (is_array($contactIds) && !empty($contactIds) && empty($contactDetails)) {
Expand Down Expand Up @@ -2403,9 +2403,9 @@ protected static function getActivityParamsForDashboardFunctions($params) {
$enabledComponents = self::activityComponents();
// @todo - should we move this to activity get api.
foreach ([
'case_id' => 'CiviCase',
'campaign_id' => 'CiviCampaign',
] as $attr => $component) {
'case_id' => 'CiviCase',
'campaign_id' => 'CiviCampaign',
] as $attr => $component) {
if (!in_array($component, $enabledComponents)) {
$activityParams[$attr] = ['IS NULL' => 1];
}
Expand Down
6 changes: 1 addition & 5 deletions CRM/Activity/Form/Activity.php
Original file line number Diff line number Diff line change
Expand Up @@ -260,11 +260,7 @@ public function preProcess() {
if (CRM_Contact_Form_Search::isSearchContext($this->_context)) {
$this->_context = 'search';
}
elseif (!in_array($this->_context, [
'dashlet',
'case',
'dashletFullscreen',
])
elseif (!in_array($this->_context, ['dashlet', 'case', 'dashletFullscreen'])
&& $this->_currentlyViewedContactId
) {
$this->_context = 'activity';
Expand Down
2 changes: 1 addition & 1 deletion CRM/Activity/Form/ActivityView.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public function buildQuickForm() {
'spacing' => '         ',
'isDefault' => TRUE,
],
]
]
);
}

Expand Down
3 changes: 2 additions & 1 deletion CRM/Activity/Form/Task/FileOnCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ public function postProcess() {
}
}
else {
CRM_Core_Session::setStatus(ts('Not permitted to file activity %1 %2.', [
CRM_Core_Session::setStatus(
ts('Not permitted to file activity %1 %2.', [
1 => empty($defaults['subject']) ? '' : $defaults['subject'],
2 => $defaults['activity_date_time'],
]),
Expand Down
2 changes: 1 addition & 1 deletion CRM/Activity/Import/Form/MapField.php
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ public function buildQuickForm() {
'type' => 'cancel',
'name' => ts('Cancel'),
],
]
]
);
}

Expand Down
18 changes: 6 additions & 12 deletions CRM/Activity/Import/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -240,30 +240,24 @@ public function run(
}
if ($this->_invalidRowCount) {
// removed view url for invlaid contacts
$headers = array_merge([
ts('Line Number'),
ts('Reason'),
],
$headers = array_merge(
[ts('Line Number'), ts('Reason')],
$customHeaders
);
$this->_errorFileName = self::errorFileName(self::ERROR);
self::exportCSV($this->_errorFileName, $headers, $this->_errors);
}
if ($this->_conflictCount) {
$headers = array_merge([
ts('Line Number'),
ts('Reason'),
],
$headers = array_merge(
[ts('Line Number'), ts('Reason')],
$customHeaders
);
$this->_conflictFileName = self::errorFileName(self::CONFLICT);
self::exportCSV($this->_conflictFileName, $headers, $this->_conflicts);
}
if ($this->_duplicateCount) {
$headers = array_merge([
ts('Line Number'),
ts('View Activity History URL'),
],
$headers = array_merge(
[ts('Line Number'), ts('View Activity History URL')],
$customHeaders
);

Expand Down
3 changes: 2 additions & 1 deletion CRM/Activity/Tokens.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ public function alterActionScheduleQuery(\Civi\ActionSchedule\Event\MailingQuery
// Q: Could we simplify & move the extra AND clauses into `where(...)`?
$e->query->param('casEntityJoinExpr', 'e.id = reminder.entity_id AND e.is_current_revision = 1 AND e.is_deleted = 0');

$e->query->select('e.*'); // FIXME: seems too broad.
// FIXME: seems too broad.
$e->query->select('e.*');
$e->query->select('ov.label as activity_type, e.id as activity_id');

$e->query->join("og", "!casMailingJoinType civicrm_option_group og ON og.name = 'activity_type'");
Expand Down
34 changes: 16 additions & 18 deletions CRM/Admin/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,27 +128,25 @@ public function setDefaultValues() {
public function buildQuickForm() {
if ($this->_action & CRM_Core_Action::VIEW || $this->_action & CRM_Core_Action::PREVIEW) {
$this->addButtons([
[
'type' => 'cancel',
'name' => ts('Done'),
'isDefault' => TRUE,
],
]
);
[
'type' => 'cancel',
'name' => ts('Done'),
'isDefault' => TRUE,
],
]);
}
else {
$this->addButtons([
[
'type' => 'next',
'name' => $this->_action & CRM_Core_Action::DELETE ? ts('Delete') : ts('Save'),
'isDefault' => TRUE,
],
[
'type' => 'cancel',
'name' => ts('Cancel'),
],
]
);
[
'type' => 'next',
'name' => $this->_action & CRM_Core_Action::DELETE ? ts('Delete') : ts('Save'),
'isDefault' => TRUE,
],
[
'type' => 'cancel',
'name' => ts('Cancel'),
],
]);
}
}

Expand Down
21 changes: 10 additions & 11 deletions CRM/Admin/Form/CMSUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,16 @@ class CRM_Admin_Form_CMSUser extends CRM_Core_Form {
public function buildQuickForm() {

$this->addButtons([
[
'type' => 'next',
'name' => ts('OK'),
'isDefault' => TRUE,
],
[
'type' => 'cancel',
'name' => ts('Cancel'),
],
]
);
[
'type' => 'next',
'name' => ts('OK'),
'isDefault' => TRUE,
],
[
'type' => 'cancel',
'name' => ts('Cancel'),
],
]);
}

/**
Expand Down
21 changes: 10 additions & 11 deletions CRM/Admin/Form/Extensions.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,17 +137,16 @@ public function buildQuickForm() {

$this->assign('title', $title);
$this->addButtons([
[
'type' => 'next',
'name' => $buttonName,
'isDefault' => TRUE,
],
[
'type' => 'cancel',
'name' => ts('Cancel'),
],
]
);
[
'type' => 'next',
'name' => $buttonName,
'isDefault' => TRUE,
],
[
'type' => 'cancel',
'name' => ts('Cancel'),
],
]);
}

/**
Expand Down
21 changes: 10 additions & 11 deletions CRM/Admin/Form/Generic.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,17 +84,16 @@ public function buildQuickForm() {
// @todo - do we still like this redirect?
CRM_Core_Session::singleton()->pushUserContext(CRM_Utils_System::url('civicrm/admin', 'reset=1'));
$this->addButtons([
[
'type' => 'next',
'name' => ts('Save'),
'isDefault' => TRUE,
],
[
'type' => 'cancel',
'name' => ts('Cancel'),
],
]
);
[
'type' => 'next',
'name' => ts('Save'),
'isDefault' => TRUE,
],
[
'type' => 'cancel',
'name' => ts('Cancel'),
],
]);
}

/**
Expand Down
6 changes: 3 additions & 3 deletions CRM/Admin/Form/Job.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@ public function buildQuickForm($check = FALSE) {
);

$this->addRule('name', ts('Name already exists in Database.'), 'objectExists', [
'CRM_Core_DAO_Job',
$this->_id,
]);
'CRM_Core_DAO_Job',
$this->_id,
]);

$this->add('text', 'description', ts('Description'),
$attributes['description']
Expand Down
6 changes: 3 additions & 3 deletions CRM/Admin/Form/Mapping.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ public function buildQuickForm() {
CRM_Core_DAO::getAttribute('CRM_Core_DAO_Mapping', 'name'), TRUE
);
$this->addRule('name', ts('Name already exists in Database.'), 'objectExists', [
'CRM_Core_DAO_Mapping',
$this->_id,
]);
'CRM_Core_DAO_Mapping',
$this->_id,
]);

$this->addElement('text', 'description', ts('Description'),
CRM_Core_DAO::getAttribute('CRM_Core_DAO_Mapping', 'description')
Expand Down
15 changes: 7 additions & 8 deletions CRM/Admin/Form/MessageTemplates.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,13 @@ public function buildQuickForm() {
$cancelURL = CRM_Utils_System::url('civicrm/admin/messageTemplates', 'selectedChild=workflow&reset=1');
$cancelURL = str_replace('&', '&', $cancelURL);
$this->addButtons([
[
'type' => 'cancel',
'name' => ts('Done'),
'js' => ['onclick' => "location.href='{$cancelURL}'; return false;"],
'isDefault' => TRUE,
],
]
);
[
'type' => 'cancel',
'name' => ts('Done'),
'js' => ['onclick' => "location.href='{$cancelURL}'; return false;"],
'isDefault' => TRUE,
],
]);
}
else {
$this->_workflow_id = CRM_Utils_Array::value('workflow_id', $this->_values);
Expand Down
Loading