Skip to content

Commit

Permalink
INFRA-132 - Batch #1
Browse files Browse the repository at this point in the history
  • Loading branch information
colemanw committed Jan 13, 2015
1 parent a544796 commit 971d41b
Show file tree
Hide file tree
Showing 11 changed files with 185 additions and 202 deletions.
2 changes: 1 addition & 1 deletion CRM/Contribute/StateMachine/Search.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class CRM_Contribute_StateMachine_Search extends CRM_Core_StateMachine {
/**
* Class constructor
*/
function __construct($controller, $action = CRM_Core_Action::NONE) {
public function __construct($controller, $action = CRM_Core_Action::NONE) {
parent::__construct($controller, $action);

$this->_pages = array();
Expand Down
2 changes: 1 addition & 1 deletion CRM/Core/BAO/Log.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public static function add(&$params) {
* @param int $tableID
* @param int $userID
*/
static function register(
public static function register(
$contactID,
$tableName,
$tableID,
Expand Down
7 changes: 2 additions & 5 deletions CRM/Core/Component/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,8 @@ abstract class CRM_Core_Component_Config {
* configuration file and injects them into system wide
* configuration object.
*
* @param $config
* @param CRM_Core_Config $config
* @param $oldMode
*
* @return array
* collection of component settings
*/
public function add($config, $oldMode) {
foreach (get_class_vars(get_class($this)) as $key => $value) {
Expand All @@ -54,7 +51,7 @@ public function add($config, $oldMode) {
}

/**
* TODO
* @param array $defaults
*/
public function setDefaults(&$defaults) {
foreach (get_class_vars(get_class($this)) as $key => $value) {
Expand Down
2 changes: 1 addition & 1 deletion CRM/Event/Cart/Form/Checkout/Payment.php
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,7 @@ public function postProcess() {
/**
* @param array $params
*
* @return array
* @return array|void
* @throws Exception
*/
public function make_payment(&$params) {
Expand Down
122 changes: 60 additions & 62 deletions CRM/Report/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -356,19 +356,19 @@ public function __construct() {
}

public function preProcessCommon() {
$this->_force =
CRM_Utils_Request::retrieve(
'force',
'Boolean',
CRM_Core_DAO::$_nullObject
);
$this->_force
= CRM_Utils_Request::retrieve(
'force',
'Boolean',
CRM_Core_DAO::$_nullObject
);

$this->_dashBoardRowCount =
CRM_Utils_Request::retrieve(
'rowCount',
'Integer',
CRM_Core_DAO::$_nullObject
);
$this->_dashBoardRowCount
= CRM_Utils_Request::retrieve(
'rowCount',
'Integer',
CRM_Core_DAO::$_nullObject
);

$this->_section = CRM_Utils_Request::retrieve('section', 'Integer', CRM_Core_DAO::$_nullObject);

Expand Down Expand Up @@ -481,8 +481,8 @@ public function preProcessCommon() {
}

public function addBreadCrumb() {
$breadCrumbs =
array(
$breadCrumbs
= array(
array(
'title' => ts('Report Templates'),
'url' => CRM_Utils_System::url('civicrm/admin/report/template/list', 'reset=1'),
Expand Down Expand Up @@ -566,8 +566,8 @@ public function preProcess() {
}

// set alias = table-name, unless already set
$alias = isset($field['alias']) ? $field['alias'] : (isset($this->_columns[$tableName]['alias']) ?
$this->_columns[$tableName]['alias'] : $tableName
$alias = isset($field['alias']) ? $field['alias'] : (
isset($this->_columns[$tableName]['alias']) ? $this->_columns[$tableName]['alias'] : $tableName
);
$this->_columns[$tableName][$fieldGrp][$fieldName]['alias'] = $alias;

Expand All @@ -578,8 +578,8 @@ public function preProcess() {

// set dbAlias = alias.name, unless already set
if (!isset($this->_columns[$tableName][$fieldGrp][$fieldName]['dbAlias'])) {
$this->_columns[$tableName][$fieldGrp][$fieldName]['dbAlias'] =
$alias . '.' .
$this->_columns[$tableName][$fieldGrp][$fieldName]['dbAlias']
= $alias . '.' .
$this->_columns[$tableName][$fieldGrp][$fieldName]['name'];
}

Expand All @@ -604,8 +604,8 @@ public function preProcess() {
case CRM_Utils_Type::T_BOOLEAN:
$this->_columns[$tableName][$fieldGrp][$fieldName]['operatorType'] = CRM_Report_Form::OP_SELECT;
if (!array_key_exists('options', $this->_columns[$tableName][$fieldGrp][$fieldName])) {
$this->_columns[$tableName][$fieldGrp][$fieldName]['options'] =
array(
$this->_columns[$tableName][$fieldGrp][$fieldName]['options']
= array(
'' => ts('Any'),
'0' => ts('No'),
'1' => ts('Yes'),
Expand Down Expand Up @@ -1104,10 +1104,8 @@ public function addOrderBys() {
}
}

/* Add searchable custom fields as order-by options, if so requested
* (These are already indexed, so allowing to order on them is cheap.)
*/

// Add searchable custom fields as order-by options, if so requested
// (These are already indexed, so allowing to order on them is cheap.)

if ($this->_autoIncludeIndexedFieldsAsOrderBys &&
array_key_exists('extends', $table) && !empty($table['extends'])
Expand All @@ -1126,8 +1124,8 @@ public function addOrderBys() {

if (!empty($options)) {
$options = array(
'-' => ' - none - ',
) + $options;
'-' => ' - none - ',
) + $options;
for ($i = 1; $i <= 5; $i++) {
$this->addElement('select', "order_bys[{$i}][column]", ts('Order by Column'), $options);
$this->addElement('select', "order_bys[{$i}][order]", ts('Order by Order'), array(
Expand Down Expand Up @@ -1418,7 +1416,7 @@ public function getSQLOperator($operator = "like") {
*
* @return null|string
*/
function whereClause(
public function whereClause(
&$field, $op,
$value, $min, $max
) {
Expand Down Expand Up @@ -1492,8 +1490,8 @@ function whereClause(
foreach ($value as $key => $selection) {
$value[$key] = CRM_Utils_Type::escape($selection, $type);
}
$clause =
"( {$field['dbAlias']} $sqlOP ( '" . implode("' , '", $value) .
$clause
= "( {$field['dbAlias']} $sqlOP ( '" . implode("' , '", $value) .
"') )";
}
else {
Expand All @@ -1514,8 +1512,8 @@ function whereClause(
// mhas == multiple has
if ($value !== NULL && count($value) > 0) {
$sqlOP = $this->getSQLOperator($op);
$clause =
"{$field['dbAlias']} REGEXP '[[:<:]]" . implode('|', $value) .
$clause
= "{$field['dbAlias']} REGEXP '[[:<:]]" . implode('|', $value) .
"[[:>:]]'";
}
break;
Expand All @@ -1524,8 +1522,8 @@ function whereClause(
// mnot == multiple is not one of
if ($value !== NULL && count($value) > 0) {
$sqlOP = $this->getSQLOperator($op);
$clause =
"( {$field['dbAlias']} NOT REGEXP '[[:<:]]" . implode('|', $value) .
$clause
= "( {$field['dbAlias']} NOT REGEXP '[[:<:]]" . implode('|', $value) .
"[[:>:]]' OR {$field['dbAlias']} IS NULL )";
}
break;
Expand Down Expand Up @@ -1604,7 +1602,7 @@ function whereClause(
*
* @return null|string
*/
function dateClause(
public function dateClause(
$fieldName,
$relative, $from, $to, $type = NULL, $fromTime = NULL, $toTime = NULL
) {
Expand Down Expand Up @@ -1774,7 +1772,7 @@ public function alterCustomDataDisplay(&$rows) {
* @param $customField
* @param $fieldValueMap
*
* @return float|string
* @return float|string|void
*/
public function formatCustomValues($value, $customField, $fieldValueMap) {
if (CRM_Utils_System::isNull($value)) {
Expand Down Expand Up @@ -1812,8 +1810,6 @@ public function formatCustomValues($value, $customField, $fieldValueMap) {
}
case 'Money':
if ($htmlType == 'Text') {


$retValue = CRM_Utils_Money::format($value, NULL, '%a');
break;
}
Expand Down Expand Up @@ -2025,6 +2021,10 @@ public function buildChart(&$rows) {
// select() method below has been added recently (v3.3), and many of the report templates might
// still be having their own select() method. We should fix them as and when encountered and move
// towards generalizing the select() method below.

/**
* Generate the SELECT clause and set class variable $_select
*/
public function select() {
$select = $this->_selectAliases = array();

Expand Down Expand Up @@ -2165,8 +2165,8 @@ public function select() {
// for graphs and charts -
if (!empty($this->_params['group_bys_freq'][$fieldName])) {
$this->_interval = $field['title'];
$this->_columnHeaders["{$tableName}_{$fieldName}_start"]['title'] =
$field['title'] . ' Beginning';
$this->_columnHeaders["{$tableName}_{$fieldName}_start"]['title']
= $field['title'] . ' Beginning';
$this->_columnHeaders["{$tableName}_{$fieldName}_start"]['type'] = $field['type'];
$this->_columnHeaders["{$tableName}_{$fieldName}_start"]['group_by'] = $this->_params['group_bys_freq'][$fieldName];

Expand Down Expand Up @@ -2241,8 +2241,8 @@ public function storeWhereHavingClauseArray() {
$op = CRM_Utils_Array::value("{$fieldName}_op", $this->_params);
$value = CRM_Utils_Array::value("{$fieldName}_value", $this->_params);
if (is_array($value) && !empty($value)) {
$clause =
"(month({$field['dbAlias']}) $op (" . implode(', ', $value) .
$clause
= "(month({$field['dbAlias']}) $op (" . implode(', ', $value) .
'))';
}
}
Expand Down Expand Up @@ -2290,8 +2290,8 @@ public function processReportMode() {
CRM_Core_DAO::$_nullObject
);

$this->_sendmail =
CRM_Utils_Request::retrieve(
$this->_sendmail
= CRM_Utils_Request::retrieve(
'sendmail',
'Boolean',
CRM_Core_DAO::$_nullObject
Expand Down Expand Up @@ -2586,11 +2586,9 @@ public function sectionTotals() {
$ifnulls[] = "ifnull($alias, '') as $alias";
}

/* Group (un-limited) report by all aliases and get counts. This might
* be done more efficiently when the contents of $sql are known, ie. by
* overriding this method in the report class.
*/

// Group (un-limited) report by all aliases and get counts. This might
// be done more efficiently when the contents of $sql are known, ie. by
// overriding this method in the report class.

$query = "select " . implode(", ", $ifnulls) .
", count(*) as ct from ($sql) as subquery group by " .
Expand Down Expand Up @@ -2717,8 +2715,8 @@ public function filterStat(&$statistics) {
CRM_Utils_Array::value('operatorType', $field) !=
CRM_Report_Form::OP_MONTH
) {
list($from, $to) =
$this->getFromTo(
list($from, $to)
= $this->getFromTo(
CRM_Utils_Array::value("{$fieldName}_relative", $this->_params),
CRM_Utils_Array::value("{$fieldName}_from", $this->_params),
CRM_Utils_Array::value("{$fieldName}_to", $this->_params),
Expand Down Expand Up @@ -2833,8 +2831,8 @@ public function endPostProcess(&$rows = NULL) {
$attachments = array();

if ($this->_outputMode == 'csv') {
$content =
$this->_formValues['report_header'] . '<p>' . ts('Report URL') .
$content
= $this->_formValues['report_header'] . '<p>' . ts('Report URL') .
": {$url}</p>" . '<p>' .
ts('The report is attached as a CSV file.') . '</p>' .
$this->_formValues['report_footer'];
Expand All @@ -2859,8 +2857,8 @@ public function endPostProcess(&$rows = NULL) {
)
);
// generate Email Content
$content =
$this->_formValues['report_header'] . '<p>' . ts('Report URL') .
$content
= $this->_formValues['report_header'] . '<p>' . ts('Report URL') .
": {$url}</p>" . '<p>' .
ts('The report is attached as a PDF file.') . '</p>' .
$this->_formValues['report_footer'];
Expand Down Expand Up @@ -2892,13 +2890,13 @@ public function endPostProcess(&$rows = NULL) {
//get chart image name
$chartImg = $this->_chartId . '.png';
//get image url path
$uploadUrl =
str_replace('/persist/contribute/', '/persist/', $config->imageUploadURL) .
$uploadUrl
= str_replace('/persist/contribute/', '/persist/', $config->imageUploadURL) .
'openFlashChart/';
$uploadUrl .= $chartImg;
//get image doc path to overwrite
$uploadImg =
str_replace('/persist/contribute/', '/persist/', $config->imageUploadDir) .
$uploadImg
= str_replace('/persist/contribute/', '/persist/', $config->imageUploadDir) .
'openFlashChart/' . $chartImg;
//Load the image
$chart = imagecreatefrompng($uploadUrl);
Expand Down Expand Up @@ -3548,8 +3546,8 @@ public function isTableSelected($tableName) {
* Fetch array of DAO tables having columns included in SELECT or ORDER BY clause
* (building the array if it's unset)
*
* @return Array
* >_selectedTables
* @return array
* selectedTables
*/
public function selectedTables() {
if (!$this->_selectedTables) {
Expand Down Expand Up @@ -3980,8 +3978,8 @@ public static function uploadChartImage() {

// prepare the directory
$config = CRM_Core_Config::singleton();
$defaultPath =
str_replace('/persist/contribute/', '/persist/', $config->imageUploadDir) .
$defaultPath
= str_replace('/persist/contribute/', '/persist/', $config->imageUploadDir) .
'/openFlashChart/';
if (!file_exists($defaultPath)) {
mkdir($defaultPath, 0777, TRUE);
Expand Down
3 changes: 2 additions & 1 deletion CRM/UF/Page/ProfileEditor.php
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,8 @@ public static function convertCiviModelToBackboneModel($extends, $title, $availa
if (in_array($fieldName, $locationFields)) {
$result['schema'][$fieldName]['civiIsLocation'] = TRUE;
}
if (in_array($fieldName, array('phone', 'phone_and_ext'))) { // FIXME what about phone_ext?
if (in_array($fieldName, array('phone', 'phone_and_ext'))) {
// FIXME what about phone_ext?
$result['schema'][$fieldName]['civiIsPhone'] = TRUE;
}
}
Expand Down
Loading

0 comments on commit 971d41b

Please sign in to comment.