Commit 0d48f1cc authored by totten's avatar totten

(NFC) Apply upcoming civicrm/coder policies (batch 1)

Method:

* Checkout latest merged branch of civicrm/coder (`8.x-2.x-civi`)
* Run this command to autoclean a batch of 100 files
 `PG=1 SIZE=100 ; find Civi/ CRM/ api/ bin/ extern/ tests/ -name '*.php' | grep -v /examples/ | grep -v /DAO/ | sort | head -n $(( $PG  * $SIZE )) | tail -n $SIZE | xargs phpcbf-civi`
* Go through the diff. For anything that looks wonky, open in an editor and find a better solution

Note: The automated checker makes good points about awkward indentation, but the automated cleanup often makes it
worse.  So that's why I have to open it up.
parent cf9ccf98
...@@ -141,30 +141,30 @@ class CRM_ACL_Form_ACL extends CRM_Admin_Form { ...@@ -141,30 +141,30 @@ class CRM_ACL_Form_ACL extends CRM_Admin_Form {
$label = ts('Role'); $label = ts('Role');
$role = [ $role = [
'-1' => ts('- select role -'), '-1' => ts('- select role -'),
'0' => ts('Everyone'), '0' => ts('Everyone'),
] + CRM_Core_OptionGroup::values('acl_role'); ] + CRM_Core_OptionGroup::values('acl_role');
$this->add('select', 'entity_id', $label, $role, TRUE); $this->add('select', 'entity_id', $label, $role, TRUE);
$group = [ $group = [
'-1' => ts('- select -'), '-1' => ts('- select -'),
'0' => ts('All Groups'), '0' => ts('All Groups'),
] + CRM_Core_PseudoConstant::group(); ] + CRM_Core_PseudoConstant::group();
$customGroup = [ $customGroup = [
'-1' => ts('- select -'), '-1' => ts('- select -'),
'0' => ts('All Custom Groups'), '0' => ts('All Custom Groups'),
] + CRM_Core_PseudoConstant::get('CRM_Core_DAO_CustomField', 'custom_group_id'); ] + CRM_Core_PseudoConstant::get('CRM_Core_DAO_CustomField', 'custom_group_id');
$ufGroup = [ $ufGroup = [
'-1' => ts('- select -'), '-1' => ts('- select -'),
'0' => ts('All Profiles'), '0' => ts('All Profiles'),
] + CRM_Core_PseudoConstant::get('CRM_Core_DAO_UFField', 'uf_group_id'); ] + CRM_Core_PseudoConstant::get('CRM_Core_DAO_UFField', 'uf_group_id');
$event = [ $event = [
'-1' => ts('- select -'), '-1' => ts('- select -'),
'0' => ts('All Events'), '0' => ts('All Events'),
] + CRM_Event_PseudoConstant::event(NULL, FALSE, "( is_template IS NULL OR is_template != 1 )"); ] + 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', 'group_id', ts('Group'), $group);
$this->add('select', 'custom_group_id', ts('Custom Data'), $customGroup); $this->add('select', 'custom_group_id', ts('Custom Data'), $customGroup);
......
...@@ -80,9 +80,9 @@ SELECT object_table ...@@ -80,9 +80,9 @@ SELECT object_table
$label = ts('Role'); $label = ts('Role');
$role = [ $role = [
'-1' => ts('- select role -'), '-1' => ts('- select role -'),
'0' => ts('Everyone'), '0' => ts('Everyone'),
] + CRM_Core_OptionGroup::values('acl_role'); ] + CRM_Core_OptionGroup::values('acl_role');
$entityID = &$this->add('select', 'entity_id', $label, $role, TRUE); $entityID = &$this->add('select', 'entity_id', $label, $role, TRUE);
if ($this->_id) { if ($this->_id) {
......
...@@ -123,22 +123,22 @@ ORDER BY entity_id ...@@ -123,22 +123,22 @@ ORDER BY entity_id
$roles = CRM_Core_OptionGroup::values('acl_role'); $roles = CRM_Core_OptionGroup::values('acl_role');
$group = [ $group = [
'-1' => ts('- select -'), '-1' => ts('- select -'),
'0' => ts('All Groups'), '0' => ts('All Groups'),
] + CRM_Core_PseudoConstant::group(); ] + CRM_Core_PseudoConstant::group();
$customGroup = [ $customGroup = [
'-1' => ts('- select -'), '-1' => ts('- select -'),
'0' => ts('All Custom Groups'), '0' => ts('All Custom Groups'),
] + CRM_Core_PseudoConstant::get('CRM_Core_DAO_CustomField', 'custom_group_id'); ] + CRM_Core_PseudoConstant::get('CRM_Core_DAO_CustomField', 'custom_group_id');
$ufGroup = [ $ufGroup = [
'-1' => ts('- select -'), '-1' => ts('- select -'),
'0' => ts('All Profiles'), '0' => ts('All Profiles'),
] + CRM_Core_PseudoConstant::get('CRM_Core_DAO_UFField', 'uf_group_id'); ] + CRM_Core_PseudoConstant::get('CRM_Core_DAO_UFField', 'uf_group_id');
$event = [ $event = [
'-1' => ts('- select -'), '-1' => ts('- select -'),
'0' => ts('All Events'), '0' => ts('All Events'),
] + CRM_Event_PseudoConstant::event(); ] + CRM_Event_PseudoConstant::event();
while ($dao->fetch()) { while ($dao->fetch()) {
$acl[$dao->id] = []; $acl[$dao->id] = [];
......
...@@ -30,7 +30,6 @@ ...@@ -30,7 +30,6 @@
* @copyright CiviCRM LLC (c) 2004-2019 * @copyright CiviCRM LLC (c) 2004-2019
*/ */
use Civi\ActionSchedule\RecipientBuilder;
/** /**
* Class CRM_Activity_ActionMapping * Class CRM_Activity_ActionMapping
......
...@@ -1207,7 +1207,7 @@ class CRM_Activity_BAO_Activity extends CRM_Activity_DAO_Activity { ...@@ -1207,7 +1207,7 @@ class CRM_Activity_BAO_Activity extends CRM_Activity_DAO_Activity {
} }
if (!isset($contactDetails) && !isset($contactIds)) { 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 // Populate $contactDetails and $contactIds if only one is set
if (is_array($contactIds) && !empty($contactIds) && empty($contactDetails)) { if (is_array($contactIds) && !empty($contactIds) && empty($contactDetails)) {
...@@ -2403,9 +2403,9 @@ INNER JOIN civicrm_option_group grp ON (grp.id = option_group_id AND grp.name = ...@@ -2403,9 +2403,9 @@ INNER JOIN civicrm_option_group grp ON (grp.id = option_group_id AND grp.name =
$enabledComponents = self::activityComponents(); $enabledComponents = self::activityComponents();
// @todo - should we move this to activity get api. // @todo - should we move this to activity get api.
foreach ([ foreach ([
'case_id' => 'CiviCase', 'case_id' => 'CiviCase',
'campaign_id' => 'CiviCampaign', 'campaign_id' => 'CiviCampaign',
] as $attr => $component) { ] as $attr => $component) {
if (!in_array($component, $enabledComponents)) { if (!in_array($component, $enabledComponents)) {
$activityParams[$attr] = ['IS NULL' => 1]; $activityParams[$attr] = ['IS NULL' => 1];
} }
......
...@@ -260,11 +260,7 @@ class CRM_Activity_Form_Activity extends CRM_Contact_Form_Task { ...@@ -260,11 +260,7 @@ class CRM_Activity_Form_Activity extends CRM_Contact_Form_Task {
if (CRM_Contact_Form_Search::isSearchContext($this->_context)) { if (CRM_Contact_Form_Search::isSearchContext($this->_context)) {
$this->_context = 'search'; $this->_context = 'search';
} }
elseif (!in_array($this->_context, [ elseif (!in_array($this->_context, ['dashlet', 'case', 'dashletFullscreen'])
'dashlet',
'case',
'dashletFullscreen',
])
&& $this->_currentlyViewedContactId && $this->_currentlyViewedContactId
) { ) {
$this->_context = 'activity'; $this->_context = 'activity';
......
...@@ -130,7 +130,7 @@ class CRM_Activity_Form_ActivityView extends CRM_Core_Form { ...@@ -130,7 +130,7 @@ class CRM_Activity_Form_ActivityView extends CRM_Core_Form {
'spacing' => '         ', 'spacing' => '         ',
'isDefault' => TRUE, 'isDefault' => TRUE,
], ],
] ]
); );
} }
......
...@@ -109,7 +109,8 @@ class CRM_Activity_Form_Task_FileOnCase extends CRM_Activity_Form_Task { ...@@ -109,7 +109,8 @@ class CRM_Activity_Form_Task_FileOnCase extends CRM_Activity_Form_Task {
} }
} }
else { 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'], 1 => empty($defaults['subject']) ? '' : $defaults['subject'],
2 => $defaults['activity_date_time'], 2 => $defaults['activity_date_time'],
]), ]),
......
...@@ -251,7 +251,7 @@ class CRM_Activity_Import_Form_MapField extends CRM_Import_Form_MapField { ...@@ -251,7 +251,7 @@ class CRM_Activity_Import_Form_MapField extends CRM_Import_Form_MapField {
'type' => 'cancel', 'type' => 'cancel',
'name' => ts('Cancel'), 'name' => ts('Cancel'),
], ],
] ]
); );
} }
......
...@@ -240,30 +240,24 @@ abstract class CRM_Activity_Import_Parser extends CRM_Import_Parser { ...@@ -240,30 +240,24 @@ abstract class CRM_Activity_Import_Parser extends CRM_Import_Parser {
} }
if ($this->_invalidRowCount) { if ($this->_invalidRowCount) {
// removed view url for invlaid contacts // removed view url for invlaid contacts
$headers = array_merge([ $headers = array_merge(
ts('Line Number'), [ts('Line Number'), ts('Reason')],
ts('Reason'),
],
$customHeaders $customHeaders
); );
$this->_errorFileName = self::errorFileName(self::ERROR); $this->_errorFileName = self::errorFileName(self::ERROR);
self::exportCSV($this->_errorFileName, $headers, $this->_errors); self::exportCSV($this->_errorFileName, $headers, $this->_errors);
} }
if ($this->_conflictCount) { if ($this->_conflictCount) {
$headers = array_merge([ $headers = array_merge(
ts('Line Number'), [ts('Line Number'), ts('Reason')],
ts('Reason'),
],
$customHeaders $customHeaders
); );
$this->_conflictFileName = self::errorFileName(self::CONFLICT); $this->_conflictFileName = self::errorFileName(self::CONFLICT);
self::exportCSV($this->_conflictFileName, $headers, $this->_conflicts); self::exportCSV($this->_conflictFileName, $headers, $this->_conflicts);
} }
if ($this->_duplicateCount) { if ($this->_duplicateCount) {
$headers = array_merge([ $headers = array_merge(
ts('Line Number'), [ts('Line Number'), ts('View Activity History URL')],
ts('View Activity History URL'),
],
$customHeaders $customHeaders
); );
......
...@@ -78,7 +78,8 @@ class CRM_Activity_Tokens extends \Civi\Token\AbstractTokenSubscriber { ...@@ -78,7 +78,8 @@ class CRM_Activity_Tokens extends \Civi\Token\AbstractTokenSubscriber {
// Q: Could we simplify & move the extra AND clauses into `where(...)`? // 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->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->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'"); $e->query->join("og", "!casMailingJoinType civicrm_option_group og ON og.name = 'activity_type'");
......
...@@ -128,27 +128,25 @@ class CRM_Admin_Form extends CRM_Core_Form { ...@@ -128,27 +128,25 @@ class CRM_Admin_Form extends CRM_Core_Form {
public function buildQuickForm() { public function buildQuickForm() {
if ($this->_action & CRM_Core_Action::VIEW || $this->_action & CRM_Core_Action::PREVIEW) { if ($this->_action & CRM_Core_Action::VIEW || $this->_action & CRM_Core_Action::PREVIEW) {
$this->addButtons([ $this->addButtons([
[ [
'type' => 'cancel', 'type' => 'cancel',
'name' => ts('Done'), 'name' => ts('Done'),
'isDefault' => TRUE, 'isDefault' => TRUE,
], ],
] ]);
);
} }
else { else {
$this->addButtons([ $this->addButtons([
[ [
'type' => 'next', 'type' => 'next',
'name' => $this->_action & CRM_Core_Action::DELETE ? ts('Delete') : ts('Save'), 'name' => $this->_action & CRM_Core_Action::DELETE ? ts('Delete') : ts('Save'),
'isDefault' => TRUE, 'isDefault' => TRUE,
], ],
[ [
'type' => 'cancel', 'type' => 'cancel',
'name' => ts('Cancel'), 'name' => ts('Cancel'),
], ],
] ]);
);
} }
} }
......
...@@ -42,17 +42,16 @@ class CRM_Admin_Form_CMSUser extends CRM_Core_Form { ...@@ -42,17 +42,16 @@ class CRM_Admin_Form_CMSUser extends CRM_Core_Form {
public function buildQuickForm() { public function buildQuickForm() {
$this->addButtons([ $this->addButtons([
[ [
'type' => 'next', 'type' => 'next',
'name' => ts('OK'), 'name' => ts('OK'),
'isDefault' => TRUE, 'isDefault' => TRUE,
], ],
[ [
'type' => 'cancel', 'type' => 'cancel',
'name' => ts('Cancel'), 'name' => ts('Cancel'),
], ],
] ]);
);
} }
/** /**
......
...@@ -137,17 +137,16 @@ class CRM_Admin_Form_Extensions extends CRM_Admin_Form { ...@@ -137,17 +137,16 @@ class CRM_Admin_Form_Extensions extends CRM_Admin_Form {
$this->assign('title', $title); $this->assign('title', $title);
$this->addButtons([ $this->addButtons([
[ [
'type' => 'next', 'type' => 'next',
'name' => $buttonName, 'name' => $buttonName,
'isDefault' => TRUE, 'isDefault' => TRUE,
], ],
[ [
'type' => 'cancel', 'type' => 'cancel',
'name' => ts('Cancel'), 'name' => ts('Cancel'),
], ],
] ]);
);
} }
/** /**
......
...@@ -84,17 +84,16 @@ class CRM_Admin_Form_Generic extends CRM_Core_Form { ...@@ -84,17 +84,16 @@ class CRM_Admin_Form_Generic extends CRM_Core_Form {
// @todo - do we still like this redirect? // @todo - do we still like this redirect?
CRM_Core_Session::singleton()->pushUserContext(CRM_Utils_System::url('civicrm/admin', 'reset=1')); CRM_Core_Session::singleton()->pushUserContext(CRM_Utils_System::url('civicrm/admin', 'reset=1'));
$this->addButtons([ $this->addButtons([
[ [
'type' => 'next', 'type' => 'next',
'name' => ts('Save'), 'name' => ts('Save'),
'isDefault' => TRUE, 'isDefault' => TRUE,
], ],
[ [
'type' => 'cancel', 'type' => 'cancel',
'name' => ts('Cancel'), 'name' => ts('Cancel'),
], ],
] ]);
);
} }
/** /**
......
...@@ -78,9 +78,9 @@ class CRM_Admin_Form_Job extends CRM_Admin_Form { ...@@ -78,9 +78,9 @@ class CRM_Admin_Form_Job extends CRM_Admin_Form {
); );
$this->addRule('name', ts('Name already exists in Database.'), 'objectExists', [ $this->addRule('name', ts('Name already exists in Database.'), 'objectExists', [
'CRM_Core_DAO_Job', 'CRM_Core_DAO_Job',
$this->_id, $this->_id,
]); ]);
$this->add('text', 'description', ts('Description'), $this->add('text', 'description', ts('Description'),
$attributes['description'] $attributes['description']
......
...@@ -61,9 +61,9 @@ class CRM_Admin_Form_Mapping extends CRM_Admin_Form { ...@@ -61,9 +61,9 @@ class CRM_Admin_Form_Mapping extends CRM_Admin_Form {
CRM_Core_DAO::getAttribute('CRM_Core_DAO_Mapping', 'name'), TRUE CRM_Core_DAO::getAttribute('CRM_Core_DAO_Mapping', 'name'), TRUE
); );
$this->addRule('name', ts('Name already exists in Database.'), 'objectExists', [ $this->addRule('name', ts('Name already exists in Database.'), 'objectExists', [
'CRM_Core_DAO_Mapping', 'CRM_Core_DAO_Mapping',
$this->_id, $this->_id,
]); ]);
$this->addElement('text', 'description', ts('Description'), $this->addElement('text', 'description', ts('Description'),
CRM_Core_DAO::getAttribute('CRM_Core_DAO_Mapping', 'description') CRM_Core_DAO::getAttribute('CRM_Core_DAO_Mapping', 'description')
......
...@@ -95,14 +95,13 @@ class CRM_Admin_Form_MessageTemplates extends CRM_Admin_Form { ...@@ -95,14 +95,13 @@ class CRM_Admin_Form_MessageTemplates extends CRM_Admin_Form {
$cancelURL = CRM_Utils_System::url('civicrm/admin/messageTemplates', 'selectedChild=workflow&reset=1'); $cancelURL = CRM_Utils_System::url('civicrm/admin/messageTemplates', 'selectedChild=workflow&reset=1');
$cancelURL = str_replace('&', '&', $cancelURL); $cancelURL = str_replace('&', '&', $cancelURL);
$this->addButtons([ $this->addButtons([
[ [
'type' => 'cancel', 'type' => 'cancel',
'name' => ts('Done'), 'name' => ts('Done'),
'js' => ['onclick' => "location.href='{$cancelURL}'; return false;"], 'js' => ['onclick' => "location.href='{$cancelURL}'; return false;"],
'isDefault' => TRUE, 'isDefault' => TRUE,
], ],
] ]);
);
} }
else { else {
$this->_workflow_id = CRM_Utils_Array::value('workflow_id', $this->_values); $this->_workflow_id = CRM_Utils_Array::value('workflow_id', $this->_values);
......
...@@ -96,9 +96,9 @@ class CRM_Admin_Form_Options extends CRM_Admin_Form { ...@@ -96,9 +96,9 @@ class CRM_Admin_Form_Options extends CRM_Admin_Form {
if ($isInUse) { if ($isInUse) {
$scriptURL = "<a href='" . CRM_Utils_System::docURL2('Update Greetings and Address Data for Contacts', TRUE, NULL, NULL, NULL, "wiki") . "'>" . ts('Learn more about a script that can automatically update contact addressee and greeting options.') . "</a>"; $scriptURL = "<a href='" . CRM_Utils_System::docURL2('Update Greetings and Address Data for Contacts', TRUE, NULL, NULL, NULL, "wiki") . "'>" . ts('Learn more about a script that can automatically update contact addressee and greeting options.') . "</a>";
CRM_Core_Session::setStatus(ts('The selected %1 option has <strong>not been deleted</strong> because it is currently in use. Please update these contacts to use a different format before deleting this option. %2', [ CRM_Core_Session::setStatus(ts('The selected %1 option has <strong>not been deleted</strong> because it is currently in use. Please update these contacts to use a different format before deleting this option. %2', [
1 => $this->_gLabel, 1 => $this->_gLabel,
2 => $scriptURL, 2 => $scriptURL,
]), ts('Sorry'), 'error'); ]), ts('Sorry'), 'error');
$redirect = CRM_Utils_System::url($url, $params); $redirect = CRM_Utils_System::url($url, $params);
CRM_Utils_System::redirect($redirect); CRM_Utils_System::redirect($redirect);
} }
...@@ -193,11 +193,8 @@ class CRM_Admin_Form_Options extends CRM_Admin_Form { ...@@ -193,11 +193,8 @@ class CRM_Admin_Form_Options extends CRM_Admin_Form {
$this->add('color', 'color', ts('Color')); $this->add('color', 'color', ts('Color'));
} }
if (!in_array($this->_gName, [ if (!in_array($this->_gName, ['email_greeting', 'postal_greeting', 'addressee'])
'email_greeting', && !$isReserved
'postal_greeting',
'addressee',
]) && !$isReserved
) { ) {
$this->addRule('label', $this->addRule('label',
ts('This Label already exists in the database for this option group. Please select a different Label.'), ts('This Label already exists in the database for this option group. Please select a different Label.'),
...@@ -323,11 +320,8 @@ class CRM_Admin_Form_Options extends CRM_Admin_Form { ...@@ -323,11 +320,8 @@ class CRM_Admin_Form_Options extends CRM_Admin_Form {
} }
// get contact type for which user want to create a new greeting/addressee type, CRM-4575 // get contact type for which user want to create a new greeting/addressee type, CRM-4575
if (in_array($this->_gName, [ if (in_array($this->_gName, ['email_greeting', 'postal_greeting', 'addressee'])
'email_greeting', && !$isReserved
'postal_greeting',
'addressee',
]) && !$isReserved
) { ) {
$values = [ $values = [
1 => ts('Individual'), 1 => ts('Individual'),
...@@ -372,11 +366,8 @@ class CRM_Admin_Form_Options extends CRM_Admin_Form { ...@@ -372,11 +366,8 @@ class CRM_Admin_Form_Options extends CRM_Admin_Form {
$errors['grouping'] = ts('Status class is a required field'); $errors['grouping'] = ts('Status class is a required field');
} }
if (in_array($self->_gName, [ if (in_array($self->_gName, ['email_greeting', 'postal_greeting', 'addressee'])
'email_greeting', && empty($self->_defaultValues['is_reserved'])
'postal_greeting',
'addressee',
]) && empty($self->_defaultValues['is_reserved'])
) { ) {
$label = $fields['label']; $label = $fields['label'];
$condition = " AND v.label = '{$label}' "; $condition = " AND v.label = '{$label}' ";
...@@ -487,9 +478,9 @@ class CRM_Admin_Form_Options extends CRM_Admin_Form { ...@@ -487,9 +478,9 @@ class CRM_Admin_Form_Options extends CRM_Admin_Form {
$optionValue = CRM_Core_OptionValue::addOptionValue($params, $this->_gName, $this->_action, $this->_id); $optionValue = CRM_Core_OptionValue::addOptionValue($params, $this->_gName, $this->_action, $this->_id);
CRM_Core_Session::setStatus(ts('The %1 \'%2\' has been saved.', [ CRM_Core_Session::setStatus(ts('The %1 \'%2\' has been saved.', [
1 => $this->_gLabel, 1 => $this->_gLabel,
2 => $optionValue->label, 2 => $optionValue->label,
]), ts('Saved'), 'success'); ]), ts('Saved'), 'success');
$this->ajaxResponse['optionValue'] = $optionValue->toArray(); $this->ajaxResponse['optionValue'] = $optionValue->toArray();
} }
......
...@@ -183,11 +183,11 @@ class CRM_Admin_Form_PaymentProcessor extends CRM_Admin_Form { ...@@ -183,11 +183,11 @@ class CRM_Admin_Form_PaymentProcessor extends CRM_Admin_Form {
); );
$this->addRule('name', ts('Name already exists in Database.'), 'objectExists', [ $this->addRule('name', ts('Name already exists in Database.'), 'objectExists', [
'CRM_Financial_DAO_PaymentProcessor', 'CRM_Financial_DAO_PaymentProcessor',
$this->_id, $this->_id,
'name', 'name',
CRM_Core_Config::domainID(), CRM_Core_Config::domainID(),
]); ]);
$this->add('text', 'description', ts('Description'), $this->add('text', 'description', ts('Description'),
$attributes['description'] $attributes['description']
......
...@@ -80,9 +80,9 @@ class CRM_Admin_Form_PdfFormats extends CRM_Admin_Form { ...@@ -80,9 +80,9 @@ class CRM_Admin_Form_PdfFormats extends CRM_Admin_Form {
$this->add('number', 'weight', ts('Order'), CRM_Core_DAO::getAttribute('CRM_Core_BAO_PdfFormat', 'weight'), TRUE); $this->add('number', 'weight', ts('Order'), CRM_Core_DAO::getAttribute('CRM_Core_BAO_PdfFormat', 'weight'), TRUE);
$this->addRule('name', ts('Name already exists in Database.'), 'objectExists', [ $this->addRule('name', ts('Name already exists in Database.'), 'objectExists', [
'CRM_Core_BAO_PdfFormat', 'CRM_Core_BAO_PdfFormat',
$this->_id, $this->_id,
]); ]);
$this->addRule('margin_left', ts('Margin must be numeric'), 'numeric'); $this->addRule('margin_left', ts('Margin must be numeric'), 'numeric');
$this->addRule('margin_right', ts('Margin must be numeric'), 'numeric'); $this->addRule('margin_right', ts('Margin must be numeric'), 'numeric');
$this->addRule('margin_top', ts('Margin must be numeric'), 'numeric'); $this->addRule('margin_top', ts('Margin must be numeric'), 'numeric');
......
...@@ -73,17 +73,16 @@ class CRM_Admin_Form_Persistent extends CRM_Core_Form { ...@@ -73,17 +73,16 @@ class CRM_Admin_Form_Persistent extends CRM_Core_Form {
$this->add('text', 'name', ts('Name:'), NULL, TRUE); $this->add('text', 'name', ts('Name:'