Commit 9d72cede authored by Eileen McNaughton's avatar Eileen McNaughton

whitepace y, std is => array( on same line,

Reports have always been all over the place on this leading to PRs often going stale
parent d638fee1
......@@ -145,10 +145,7 @@ class CRM_Activity_Form_Activity extends CRM_Contact_Form_Task {
'location' => array(
'type' => 'text',
'label' => ts('Location'),
'attributes' =>
CRM_Core_DAO::getAttribute('CRM_Activity_DAO_Activity',
'location'
),
'attributes' => CRM_Core_DAO::getAttribute('CRM_Activity_DAO_Activity', 'location'),
'required' => FALSE
),
'details' => array(
......
......@@ -102,8 +102,7 @@ class CRM_Activity_Import_Form_DataSource extends CRM_Core_Form {
}
$this->setDefaults(array(
'onDuplicate' =>
CRM_Import_Parser::DUPLICATE_SKIP,
'onDuplicate' => CRM_Import_Parser::DUPLICATE_SKIP,
));
//build date formats
......
......@@ -46,8 +46,7 @@ class CRM_Admin_Form_Preferences_Address extends CRM_Admin_Form_Preferences {
'' => '- select -') + CRM_Core_SelectValues::addressProvider();
$this->_varNames = array(
CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME =>
array(
CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME => array(
'address_options' => array(
'html_type' => 'checkboxes',
'title' => ts('Address Fields'),
......@@ -66,8 +65,7 @@ class CRM_Admin_Form_Preferences_Address extends CRM_Admin_Form_Preferences {
'weight' => 3,
),
),
CRM_Core_BAO_Setting::ADDRESS_STANDARDIZATION_PREFERENCES_NAME =>
array(
CRM_Core_BAO_Setting::ADDRESS_STANDARDIZATION_PREFERENCES_NAME => array(
'address_standardization_provider' => array(
'html_type' => 'select',
'title' => ts('Provider'),
......
......@@ -41,8 +41,7 @@ class CRM_Admin_Form_Preferences_Campaign extends CRM_Admin_Form_Preferences {
function preProcess() {
CRM_Utils_System::setTitle(ts('CiviCampaign Component Settings'));
$this->_varNames = array(
CRM_Core_BAO_Setting::CAMPAIGN_PREFERENCES_NAME =>
array(
CRM_Core_BAO_Setting::CAMPAIGN_PREFERENCES_NAME => array(
'tag_unconfirmed' => array(
'html_type' => 'text',
'title' => ts('Tag for Unconfirmed Petition Signers'),
......
......@@ -16,75 +16,70 @@ class CRM_Admin_Form_Preferences_Contribute extends CRM_Admin_Form_Preferences {
$config = CRM_Core_Config::singleton();
CRM_Utils_System::setTitle(ts('CiviContribute Component Settings'));
$this->_varNames = array(
CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME =>
array(
'invoice_prefix' =>
array(
'html_type' => 'text',
'title' => ts('Invoice Prefix'),
'weight' => 1,
'description' => ts('Enter prefix to be display on PDF for invoice'),
),
'credit_notes_prefix' =>
array(
'html_type' => 'text',
'title' => ts('Credit Notes Prefix'),
'weight' => 2,
'description' => ts('Enter prefix to be display on PDF for credit notes.'),
),
'due_date' =>
array(
'html_type' => 'text',
'title' => ts('Due Date'),
'weight' => 3,
),
'due_date_period' =>
array(
'html_type' => 'select',
'title' => ts('For transmission'),
'weight' => 4,
'description' => ts('Select the interval for due date.'),
'option_values' =>
array(
'select' => ts('- select -'),
'days' => ts('Days'),
'months' => ts('Months'),
'years' => ts('Years'),
CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME => array(
'invoice_prefix' => array(
'html_type' => 'text',
'title' => ts('Invoice Prefix'),
'weight' => 1,
'description' => ts('Enter prefix to be display on PDF for invoice'),
),
),
'notes' =>
array(
'html_type' => 'wysiwyg',
'title' => ts('Notes or Standard Terms'),
'weight' => 5,
'description' => ts('Enter note or message to be displayed on PDF invoice or credit notes '),
'attributes' => array('rows' => 2, 'cols' => 40),
),
'is_email_pdf' =>
array(
'html_type' => 'checkbox',
'title' => ts('Automatically email invoice when user purchases online'),
'weight' => 6,
),
'tax_term' =>
array(
'html_type' => 'text',
'title' => ts('Tax Term'),
'weight' => 7,
),
'tax_display_settings'=>
array(
'html_type' => 'select',
'title' => ts('Tax Display Settings'),
'weight' => 8,
'option_values' =>
array(
'Do_not_show' => ts('Do not show breakdown, only show total -i.e '.$config->defaultCurrencySymbol.'120.00'),
'Inclusive' => ts('Show [tax term] inclusive price - i.e. '.$config->defaultCurrencySymbol.'120.00 (includes [tax term] of '.$config->defaultCurrencySymbol.'20.00)'),
'Exclusive' => ts('Show [tax term] exclusive price - i.e. '.$config->defaultCurrencySymbol.'100.00 + '.$config->defaultCurrencySymbol.'20.00 [tax term]'),
'credit_notes_prefix' => array(
'html_type' => 'text',
'title' => ts('Credit Notes Prefix'),
'weight' => 2,
'description' => ts('Enter prefix to be display on PDF for credit notes.'),
),
'due_date' => array(
'html_type' => 'text',
'title' => ts('Due Date'),
'weight' => 3,
),
'due_date_period' => array(
'html_type' => 'select',
'title' => ts('For transmission'),
'weight' => 4,
'description' => ts('Select the interval for due date.'),
'option_values' => array(
'select' => ts('- select -'),
'days' => ts('Days'),
'months' => ts('Months'),
'years' => ts('Years'),
),
),
'notes' => array(
'html_type' => 'wysiwyg',
'title' => ts('Notes or Standard Terms'),
'weight' => 5,
'description' => ts('Enter note or message to be displayed on PDF invoice or credit notes '),
'attributes' => array('rows' => 2, 'cols' => 40),
),
'is_email_pdf' => array(
'html_type' => 'checkbox',
'title' => ts('Automatically email invoice when user purchases online'),
'weight' => 6,
),
'tax_term' => array(
'html_type' => 'text',
'title' => ts('Tax Term'),
'weight' => 7,
),
'tax_display_settings' => array(
'html_type' => 'select',
'title' => ts('Tax Display Settings'),
'weight' => 8,
'option_values' => array(
'Do_not_show' => ts('Do not show breakdown, only show total -i.e ' .
$config->defaultCurrencySymbol . '120.00'),
'Inclusive' => ts('Show [tax term] inclusive price - i.e. ' .
$config->defaultCurrencySymbol .
'120.00 (includes [tax term] of ' .
$config->defaultCurrencySymbol . '20.00)'),
'Exclusive' => ts('Show [tax term] exclusive price - i.e. ' .
$config->defaultCurrencySymbol . '100.00 + ' .
$config->defaultCurrencySymbol . '20.00 [tax term]'),
),
),
),
),
);
parent::preProcess();
}
......@@ -109,7 +104,7 @@ class CRM_Admin_Form_Preferences_Contribute extends CRM_Admin_Form_Preferences {
* @return void
*/
function setDefaultValues() {
$defaults = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME,'contribution_invoice_settings');
$defaults = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME, 'contribution_invoice_settings');
return $defaults;
}
......@@ -134,14 +129,19 @@ class CRM_Admin_Form_Preferences_Contribute extends CRM_Admin_Form_Preferences {
if (isset($params['invoicing'])) {
$value = array($setKey => $optionValues[$setKey]);
$setInvoice = CRM_Core_DAO::VALUE_SEPARATOR . implode(CRM_Core_DAO::VALUE_SEPARATOR, array_keys($value)) . CRM_Core_DAO::VALUE_SEPARATOR;
CRM_Core_BAO_Setting::setItem($values['user_dashboard_options'] . $setInvoice, 'CiviCRM Preferences', 'user_dashboard_options');
$setInvoice = CRM_Core_DAO::VALUE_SEPARATOR .
implode(CRM_Core_DAO::VALUE_SEPARATOR, array_keys($value)) .
CRM_Core_DAO::VALUE_SEPARATOR;
CRM_Core_BAO_Setting::setItem($values['user_dashboard_options'] .
$setInvoice, 'CiviCRM Preferences', 'user_dashboard_options');
}
else {
$setting = explode(CRM_Core_DAO::VALUE_SEPARATOR, substr($values['user_dashboard_options'], 1, -1));
$invoiceKey = array_search ($setKey, $setting);
$invoiceKey = array_search($setKey, $setting);
unset($setting[$invoiceKey]);
$settingName = CRM_Core_DAO::VALUE_SEPARATOR . implode(CRM_Core_DAO::VALUE_SEPARATOR, array_values($setting)) . CRM_Core_DAO::VALUE_SEPARATOR;
$settingName = CRM_Core_DAO::VALUE_SEPARATOR .
implode(CRM_Core_DAO::VALUE_SEPARATOR, array_values($setting)) .
CRM_Core_DAO::VALUE_SEPARATOR;
CRM_Core_BAO_Setting::setItem($settingName, 'CiviCRM Preferences', 'user_dashboard_options');
}
}
......
......@@ -42,8 +42,7 @@ class CRM_Admin_Form_Preferences_Display extends CRM_Admin_Form_Preferences {
CRM_Utils_System::setTitle(ts('Settings - Display Preferences'));
$this->_varNames = array(
CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME =>
array(
CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME => array(
'contact_view_options' => array(
'html_type' => 'checkboxes',
'title' => ts('Viewing Contacts'),
......
......@@ -48,8 +48,7 @@ class CRM_Admin_Form_Preferences_Event extends CRM_Admin_Form_Preferences {
$optionValues[$i] = $i;
}
$this->_varNames = array(
CRM_Core_BAO_Setting::EVENT_PREFERENCES_NAME =>
array(
CRM_Core_BAO_Setting::EVENT_PREFERENCES_NAME => array(
'enable_cart' => array(
'html_type' => 'checkbox',
'title' => ts('Use Shopping Cart Style Event Registration'),
......
......@@ -41,80 +41,68 @@ class CRM_Admin_Form_Preferences_Mailing extends CRM_Admin_Form_Preferences {
function preProcess() {
CRM_Utils_System::setTitle(ts('CiviMail Component Settings'));
$this->_varNames = array(
CRM_Core_BAO_Setting::MAILING_PREFERENCES_NAME =>
array(
'profile_double_optin' =>
array(
CRM_Core_BAO_Setting::MAILING_PREFERENCES_NAME => array(
'profile_double_optin' => array(
'html_type' => 'checkbox',
'title' => ts('Enable Double Opt-in for Profile Group(s) field'),
'weight' => 1,
'description' => ts('When CiviMail is enabled, users who "subscribe" to a group from a profile Group(s) checkbox will receive a confirmation email. They must respond (opt-in) before they are added to the group.'),
),
'profile_add_to_group_double_optin' =>
array(
'profile_add_to_group_double_optin' => array(
'html_type' => 'checkbox',
'title' => ts('Enable Double Opt-in for Profiles which use the "Add to Group" setting'),
'weight' => 2,
'description' => ts('When CiviMail is enabled and a profile uses the "Add to Group" setting, users who complete the profile form will receive a confirmation email. They must respond (opt-in) before they are added to the group.'),
),
'track_civimail_replies' =>
array(
'track_civimail_replies' => array(
'html_type' => 'checkbox',
'title' => ts('Track replies using VERP in Reply-To header'),
'weight' => 3,
'description' => ts('If checked, mailings will default to tracking replies using VERP-ed Reply-To.'),
),
'civimail_workflow' =>
array(
'civimail_workflow' => array(
'html_type' => 'checkbox',
'title' => ts('Enable workflow support for CiviMail'),
'weight' => 4,
'description' => ts('Drupal-only. Rules module must be enabled (beta feature - use with caution).'),
),
'civimail_multiple_bulk_emails' =>
array(
'civimail_multiple_bulk_emails' => array(
'html_type' => 'checkbox',
'title' => ts('Enable multiple bulk email address for a contact.'),
'weight' => 5,
'description' => ts('CiviMail will deliver a copy of the email to each bulk email listed for the contact.'),
),
'civimail_server_wide_lock' =>
array(
'civimail_server_wide_lock' => array(
'html_type' => 'checkbox',
'title' => ts('Enable global server wide lock for CiviMail'),
'weight' => 6,
'description' => NULL,
),
'include_message_id' =>
array(
'include_message_id' => array(
'html_type' => 'checkbox',
'title' => ts('Enable CiviMail to generate Message-ID header'),
'weight' => 7,
'description' => NULL,
),
'write_activity_record' =>
array(
'write_activity_record' => array(
'html_type' => 'checkbox',
'title' => ts('Enable CiviMail to create activities on delivery'),
'weight' => 8,
'description' => NULL,
),
'disable_mandatory_tokens_check' =>
array(
'disable_mandatory_tokens_check' => array(
'html_type' => 'checkbox',
'title' => ts('Disable check for mandatory tokens'),
'weight' => 9,
'description' => ts('Don\'t check for presence of mandatory tokens (domain address; unsubscribe/opt-out) before sending mailings. WARNING: Mandatory tokens are a safe-guard which facilitate compliance with the US CAN-SPAM Act. They should only be disabled if your organization adopts other mechanisms for compliance or if your organization is not subject to CAN-SPAM.'),
),
'dedupe_email_default' =>
array(
'dedupe_email_default' => array(
'html_type' => 'checkbox',
'title' => ts('CiviMail dedupes e-mail addresses by default'),
'weight' => 10,
'description' => NULL,
),
'hash_mailing_url' =>
array(
'hash_mailing_url' => array(
'html_type' => 'checkbox',
'title' => ts('Hashed Mailing URL\'s'),
'weight' => 11,
......@@ -150,4 +138,4 @@ class CRM_Admin_Form_Preferences_Mailing extends CRM_Admin_Form_Preferences {
parent::postProcess();
}
}
\ No newline at end of file
}
......@@ -41,8 +41,7 @@ class CRM_Admin_Form_Preferences_Member extends CRM_Admin_Form_Preferences {
function preProcess() {
CRM_Utils_System::setTitle(ts('CiviMember Component Settings'));
$this->_varNames = array(
CRM_Core_BAO_Setting::MEMBER_PREFERENCES_NAME =>
array(
CRM_Core_BAO_Setting::MEMBER_PREFERENCES_NAME => array(
'default_renewal_contribution_page' => array(
'html_type' => 'select',
'title' => ts('Default online membership renewal page'),
......
......@@ -42,8 +42,7 @@ class CRM_Admin_Form_Preferences_Multisite extends CRM_Admin_Form_Preferences {
$msDoc = CRM_Utils_System::docURL2('Multi Site Installation', NULL, NULL, NULL, NULL, "wiki");
CRM_Utils_System::setTitle(ts('Multi Site Settings'));
$this->_varNames = array(
CRM_Core_BAO_Setting::MULTISITE_PREFERENCES_NAME =>
array(
CRM_Core_BAO_Setting::MULTISITE_PREFERENCES_NAME => array(
'is_enabled' => array(
'html_type' => 'checkbox',
'title' => ts('Enable Multi Site Configuration'),
......
......@@ -85,8 +85,7 @@ class CRM_Admin_Form_Setting_Url extends CRM_Admin_Form_Setting {
);
if (!CRM_Utils_System::checkURL($url, TRUE)) {
$errors = array(
'enableSSL' =>
ts('You need to set up a secure server before you can use the Force Secure URLs option'),
'enableSSL' => ts('You need to set up a secure server before you can use the Force Secure URLs option'),
);
return $errors;
}
......
......@@ -65,27 +65,23 @@ class CRM_Admin_Page_ContactType extends CRM_Core_Page_Basic {
function &links() {
if (!(self::$_links)) {
self::$_links = array(
CRM_Core_Action::UPDATE =>
array(
CRM_Core_Action::UPDATE => array(
'name' => ts('Edit'),
'url' => 'civicrm/admin/options/subtype',
'qs' => 'action=update&id=%%id%%&reset=1',
'title' => ts('Edit Contact Type'),
),
CRM_Core_Action::DISABLE =>
array(
CRM_Core_Action::DISABLE => array(
'name' => ts('Disable'),
'ref' => 'crm-enable-disable',
'title' => ts('Disable Contact Type'),
),
CRM_Core_Action::ENABLE =>
array(
CRM_Core_Action::ENABLE => array(
'name' => ts('Enable'),
'ref' => 'crm-enable-disable',
'title' => ts('Enable Contact Type'),
),
CRM_Core_Action::DELETE =>
array(
CRM_Core_Action::DELETE => array(
'name' => ts('Delete'),
'url' => 'civicrm/admin/options/subtype',
'qs' => 'action=delete&id=%%id%%',
......
......@@ -64,10 +64,10 @@ class CRM_Campaign_Form_Survey_Results extends CRM_Campaign_Form_Survey {
$this->set('values', $this->_values);
}
$query = "SELECT MAX(id) as id, title FROM civicrm_report_instance WHERE name = %1";
$params = array( 1 => array("survey_{$this->_surveyId}",'String') );
$query = "SELECT MAX(id) as id, title FROM civicrm_report_instance WHERE name = %1";
$params = array(1 => array("survey_{$this->_surveyId}", 'String'));
$result = CRM_Core_DAO::executeQuery($query, $params);
if ( $result->fetch() ) {
if ($result->fetch()) {
$this->_reportId = $result->id;
$this->_reportTitle = $result->title;
}
......@@ -112,14 +112,16 @@ class CRM_Campaign_Form_Survey_Results extends CRM_Campaign_Form_Survey {
$optionTypes = array('1' => ts('Create new result set'));
}
else {
$optionTypes = array('1' => ts('Create new result set'),
$optionTypes = array(
'1' => ts('Create new result set'),
'2' => ts('Use existing result set'),
);
$this->add('select',
'option_group_id',
ts('Select Result Set'),
array(
'' => ts('- select -')) + $optionGroups, FALSE,
'' => ts('- select -')
) + $optionGroups, FALSE,
array('onChange' => 'loadOptionGroup( )')
);
}
......@@ -128,7 +130,8 @@ class CRM_Campaign_Form_Survey_Results extends CRM_Campaign_Form_Survey {
ts('Survey Responses'),
$optionTypes,
array(
'onclick' => "showOptionSelect();"), '<br/>', TRUE
'onclick' => "showOptionSelect();"
), '<br/>', TRUE
);
if (empty($optionGroups) || empty($this->_values['result_id'])) {
......@@ -137,8 +140,8 @@ class CRM_Campaign_Form_Survey_Results extends CRM_Campaign_Form_Survey {
elseif (!empty($this->_values['result_id'])) {
$this->setdefaults(array(
'option_type' => 2,
'option_group_id' => $this->_values['result_id'],
));
'option_group_id' => $this->_values['result_id'],
));
}
// form fields of Custom Option rows
......@@ -175,7 +178,8 @@ class CRM_Campaign_Form_Survey_Results extends CRM_Campaign_Form_Survey {
$optionAttributes['weight']
);
$this->add('text', 'option_interval[' . $i . ']', ts('Recontact Interval'),
$this->add('text', 'option_interval[' . $i .
']', ts('Recontact Interval'),
CRM_Core_DAO::getAttribute('CRM_Campaign_DAO_Survey', 'release_frequency')
);
......@@ -190,12 +194,15 @@ class CRM_Campaign_Form_Survey_Results extends CRM_Campaign_Form_Survey {
$this->addElement('checkbox', 'create_report', ts('Create Report'));
$this->addElement('text', 'report_title', ts('Report Title'));
if( $this->_reportId){
if ($this->_reportId) {
$this->freeze('create_report');
$this->freeze('report_title');
}
$this->addFormRule(array('CRM_Campaign_Form_Survey_Results', 'formRule'), $this);
$this->addFormRule(array(
'CRM_Campaign_Form_Survey_Results',
'formRule'
), $this);
parent::buildQuickForm();
}
......@@ -218,7 +225,8 @@ class CRM_Campaign_Form_Survey_Results extends CRM_Campaign_Form_Survey {
}
if (
$fields['option_type'] == 2 && empty($fields['option_group_id'])) {
$fields['option_type'] == 2 && empty($fields['option_group_id'])
) {
$errors['option_group_id'] = ts("Please select a Survey Result Set.");
return $errors;
}
......@@ -237,12 +245,15 @@ class CRM_Campaign_Form_Survey_Results extends CRM_Campaign_Form_Survey {
$nextIndex = $start + 1;
while ($nextIndex <= self::NUM_OPTION) {
if ($fields['option_value'][$start] == $fields['option_value'][$nextIndex] &&
if ($fields['option_value'][$start] ==
$fields['option_value'][$nextIndex] &&
!empty($fields['option_value'][$nextIndex])
) {
$errors['option_value[' . $start . ']'] = ts('Duplicate Option values');
$errors['option_value[' . $nextIndex . ']'] = ts('Duplicate Option values');
$errors['option_value[' . $start .
']'] = ts('Duplicate Option values');
$errors['option_value[' . $nextIndex .
']'] = ts('Duplicate Option values');
$_flagOption = 1;
}
$nextIndex++;
......@@ -263,9 +274,14 @@ class CRM_Campaign_Form_Survey_Results extends CRM_Campaign_Form_Survey {
$nextIndex = $start + 1;
while ($nextIndex <= self::NUM_OPTION) {
if ($fields['option_label'][$start] == $fields['option_label'][$nextIndex] && !empty($fields['option_label'][$nextIndex])) {
$errors['option_label[' . $start . ']'] = ts('Duplicate Option label');
$errors['option_label[' . $nextIndex . ']'] = ts('Duplicate Option label');
if ($fields['option_label'][$start] ==
$fields['option_label'][$nextIndex] &&
!empty($fields['option_label'][$nextIndex])
) {
$errors['option_label[' . $start .
']'] = ts('Duplicate Option label');
$errors['option_label[' . $nextIndex .
']'] = ts('Duplicate Option label');
$_flagOption = 1;
}
$nextIndex++;
......@@ -278,7 +294,8 @@ class CRM_Campaign_Form_Survey_Results extends CRM_Campaign_Form_Survey {
for ($i = 1; $i <= self::NUM_OPTION; $i++) {
if (!$fields['option_label'][$i]) {
if ($fields['option_value'][$i]) {
$errors['option_label[' . $i . ']'] = ts('Option label cannot be empty');
$errors['option_label[' . $i .
']'] = ts('Option label cannot be empty');
$_flagOption = 1;
}
else {
......@@ -287,14 +304,18 @@ class CRM_Campaign_Form_Survey_Results extends CRM_Campaign_Form_Survey {
}
elseif (!strlen(trim($fields['option_value'][$i]))) {
if (!$fields['option_value'][$i]) {
$errors['option_value[' . $i . ']'] = ts('Option value cannot be empty');
$errors['option_value[' . $i .
']'] = ts('Option value cannot be empty');
$_flagOption = 1;
}
}
if (!empty($fields['option_interval'][$i]) && !CRM_Utils_Rule::integer($fields['option_interval'][$i])) {
if (!empty($fields['option_interval'][$i]) &&
!CRM_Utils_Rule::integer($fields['option_interval'][$i])
) {
$_flagOption = 1;
$errors['option_interval[' . $i . ']'] = ts('Please enter a valid integer.');
$errors['option_interval[' . $i .
']'] = ts('Please enter a valid integer.');
}
$showBlocks = 'optionField_' . $i;
......@@ -338,7 +359,9 @@ class CRM_Campaign_Form_Survey_Results extends CRM_Campaign_Form_Survey {
$updateResultSet = FALSE;
$resultSetOptGrpId = NULL;
if ((CRM_Utils_Array::value('option_type', $params) == 2) && !empty($params['option_group_id'])) {
if ((CRM_Utils_Array::value('option_type', $params) == 2) &&
!empty($params['option_group_id'])
) {
$updateResultSet = TRUE;
$resultSetOptGrpId = $params['option_group_id'];
}
......@@ -382,7 +405,7 @@ class CRM_Campaign_Form_Survey_Results extends CRM_Campaign_Form_Survey {
$optionValue->save();
// using is_numeric since 0 is a valid value for option_interval