From: Donald A. Lobo Date: Tue, 2 Apr 2013 21:00:14 +0000 (-0700) Subject: fix php5 notices, strict warnings and code formatting X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=ed10672199514522620db069672c8d7162b88793;p=civicrm-core.git fix php5 notices, strict warnings and code formatting --- diff --git a/CRM/Contact/Form/Task/PDFLetterCommon.php b/CRM/Contact/Form/Task/PDFLetterCommon.php index cfff10dc61..b4207a0d95 100644 --- a/CRM/Contact/Form/Task/PDFLetterCommon.php +++ b/CRM/Contact/Form/Task/PDFLetterCommon.php @@ -75,38 +75,66 @@ class CRM_Contact_Form_Task_PDFLetterCommon { */ static function buildQuickForm(&$form) { $form->add('static', 'pdf_format_header', NULL, ts('Page Format')); - $form->add('select', 'format_id', ts('Select Format'), - array( - 0 => ts('- default -')) + CRM_Core_BAO_PdfFormat::getList(TRUE), FALSE, + $form->add( + 'select', + 'format_id', + ts('Select Format'), + array(0 => ts('- default -')) + CRM_Core_BAO_PdfFormat::getList(TRUE), + FALSE, array('onChange' => "selectFormat( this.value, false );") - ); - $form->add('select', 'paper_size', ts('Paper Size'), - array( - 0 => ts('- default -')) + CRM_Core_BAO_PaperSize::getList(TRUE), FALSE, + );; + $form->add( + 'select', + 'paper_size', + ts('Paper Size'), + array(0 => ts('- default -')) + CRM_Core_BAO_PaperSize::getList(TRUE), + FALSE, array('onChange' => "selectPaper( this.value ); showUpdateFormatChkBox();") ); $form->add('static', 'paper_dimensions', NULL, ts('Width x Height')); - $form->add('select', 'orientation', ts('Orientation'), CRM_Core_BAO_PdfFormat::getPageOrientations(), FALSE, + $form->add( + 'select', + 'orientation', + ts('Orientation'), + CRM_Core_BAO_PdfFormat::getPageOrientations(), + FALSE, array('onChange' => "updatePaperDimensions(); showUpdateFormatChkBox();") ); - $form->add('select', 'metric', ts('Unit of Measure'), CRM_Core_BAO_PdfFormat::getUnits(), FALSE, + $form->add( + 'select', + 'metric', + ts('Unit of Measure'), + CRM_Core_BAO_PdfFormat::getUnits(), + FALSE, array('onChange' => "selectMetric( this.value );") ); - $form->add('text', 'margin_left', ts('Left Margin'), - array( - 'size' => 8, 'maxlength' => 8, 'onkeyup' => "showUpdateFormatChkBox();"), TRUE + $form->add( + 'text', + 'margin_left', + ts('Left Margin'), + array('size' => 8, 'maxlength' => 8, 'onkeyup' => "showUpdateFormatChkBox();"), + TRUE ); - $form->add('text', 'margin_right', ts('Right Margin'), - array( - 'size' => 8, 'maxlength' => 8, 'onkeyup' => "showUpdateFormatChkBox();"), TRUE + $form->add( + 'text', + 'margin_right', + ts('Right Margin'), + array('size' => 8, 'maxlength' => 8, 'onkeyup' => "showUpdateFormatChkBox();"), + TRUE ); - $form->add('text', 'margin_top', ts('Top Margin'), - array( - 'size' => 8, 'maxlength' => 8, 'onkeyup' => "showUpdateFormatChkBox();"), TRUE + $form->add( + 'text', + 'margin_top', + ts('Top Margin'), + array('size' => 8, 'maxlength' => 8, 'onkeyup' => "showUpdateFormatChkBox();"), + TRUE ); - $form->add('text', 'margin_bottom', ts('Bottom Margin'), - array( - 'size' => 8, 'maxlength' => 8, 'onkeyup' => "showUpdateFormatChkBox();"), TRUE + $form->add( + 'text', + 'margin_bottom', + ts('Bottom Margin'), + array('size' => 8, 'maxlength' => 8, 'onkeyup' => "showUpdateFormatChkBox();"), + TRUE ); $form->add('checkbox', 'bind_format', ts('Always use this Page Format with the selected Template')); $form->add('checkbox', 'update_format', ts('Update Page Format (this will affect all templates that use this format)')); @@ -118,9 +146,12 @@ class CRM_Contact_Form_Task_PDFLetterCommon { CRM_Mailing_BAO_Mailing::commonLetterCompose($form); if ($form->_single) { - $cancelURL = CRM_Utils_System::url('civicrm/contact/view', + $cancelURL = CRM_Utils_System::url( + 'civicrm/contact/view', "reset=1&cid={$form->_cid}&selectedChild=activity", - FALSE, NULL, FALSE + FALSE, + NULL, + FALSE ); if ($form->get('action') == CRM_Core_Action::VIEW) { $form->addButtons(array( diff --git a/CRM/Contribute/Form/Search.php b/CRM/Contribute/Form/Search.php index fdafe0b881..cea7a2c33f 100644 --- a/CRM/Contribute/Form/Search.php +++ b/CRM/Contribute/Form/Search.php @@ -152,7 +152,7 @@ class CRM_Contribute_Form_Search extends CRM_Core_Form { * we allow the controller to set force/reset externally, useful when we are being * driven by the wizard framework */ - + $this->_reset = CRM_Utils_Request::retrieve('reset', 'Boolean', CRM_Core_DAO::$_nullObject); $this->_force = CRM_Utils_Request::retrieve('force', 'Boolean', $this, FALSE); $this->_limit = CRM_Utils_Request::retrieve('limit', 'Positive', $this); @@ -273,7 +273,7 @@ class CRM_Contribute_Form_Search extends CRM_Core_Form { * add form checkboxes for each row. This is needed out here to conform to QF protocol * of all elements being declared in builQuickForm */ - + $rows = $this->get('rows'); if (is_array($rows)) { if (!$this->_single) { @@ -372,36 +372,36 @@ class CRM_Contribute_Form_Search extends CRM_Core_Form { $this->_formValues[$f] = CRM_Utils_Rule::cleanMoney($this->_formValues[$f]); } } - + $config = CRM_Core_Config::singleton(); $tags = CRM_Utils_Array::value('contact_tags', $this->_formValues); if ($tags && !is_array($tags)) { unset($this->_formValues['contact_tags']); $this->_formValues['contact_tags'][$tags] = 1; } - + if ($tags && is_array($tags)) { unset($this->_formValues['contact_tags']); foreach($tags as $notImportant => $tagID) { $this->_formValues['contact_tags'][$tagID] = 1; } } - - + + if (!$config->groupTree) { $group = CRM_Utils_Array::value('group', $this->_formValues); if ($group && !is_array($group)) { unset($this->_formValues['group']); $this->_formValues['group'][$group] = 1; } - + if ($group && is_array($group)) { unset($this->_formValues['group']); foreach($group as $notImportant => $groupID) { $this->_formValues['group'][$groupID] = 1; } } - + } CRM_Core_BAO_CustomValue::fixFieldValueOfTypeMemo($this->_formValues); @@ -416,7 +416,7 @@ class CRM_Contribute_Form_Search extends CRM_Core_Form { // check actionName and if next, then do not repeat a search, since we are going to the next page // hack, make sure we reset the task values - $stateMachine = &$this->controller->getStateMachine(); + $stateMachine = $this->controller->getStateMachine(); $formName = $stateMachine->getTaskFormName(); $this->controller->resetPage($formName); return; diff --git a/CRM/Contribute/Form/Task/PDFLetter.php b/CRM/Contribute/Form/Task/PDFLetter.php index 785b2aa493..d9aafdf4c5 100644 --- a/CRM/Contribute/Form/Task/PDFLetter.php +++ b/CRM/Contribute/Form/Task/PDFLetter.php @@ -55,8 +55,8 @@ class CRM_Contribute_Form_Task_PDFLetter extends CRM_Contribute_Form_Task { * * @return void * @access public - */ function preProcess() { - + */ + function preProcess() { $this->skipOnHold = $this->skipDeceased = FALSE; CRM_Contact_Form_Task_PDFLetterCommon::preProcess($this); @@ -108,12 +108,11 @@ class CRM_Contribute_Form_Task_PDFLetter extends CRM_Contribute_Form_Task { $this->add('static', 'more_options_header', NULL, ts('Record Update Options')); $this->add('checkbox', 'receipt_update', ts('Update receipt dates for these contributions'), FALSE); $this->add('checkbox', 'thankyou_update', ts('Update thank-you dates for these contributions'), FALSE); - //$this->add( 'checkbox', 'group_recurring_contribution', ts('Group recurring contribution (1 letter by recurring contribution for the choosen period)'), false ); // Group options for tokens are not yet implemented. dgg $options = array(ts('Contact'), ts('Recurring')); $this->addRadio('is_group_by', ts('Grouping contributions in one letter based on'), $options, array(), "
", FALSE); - + $this->addButtons(array( array( 'type' => 'submit', diff --git a/CRM/Core/BAO/PdfFormat.php b/CRM/Core/BAO/PdfFormat.php index 27b42cb7b1..0ee59a53e9 100644 --- a/CRM/Core/BAO/PdfFormat.php +++ b/CRM/Core/BAO/PdfFormat.php @@ -129,7 +129,7 @@ class CRM_Core_BAO_PdfFormat extends CRM_Core_DAO_OptionValue { * @return int Group ID (null if Group ID doesn't exist) * @access private */ - private function _getGid() { + private static function _getGid() { if (!self::$_gid) { self::$_gid = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionGroup', 'pdf_format', 'id', 'name'); if (!self::$_gid) {