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

Remove unused parameter, immediately overwritten parameter #17131

Merged
merged 1 commit into from
Apr 26, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 23 additions & 2 deletions CRM/Batch/Form/Entry.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,21 @@ class CRM_Batch_Form_Entry extends CRM_Core_Form {

/**
* Maximum profile fields that will be displayed.
*
* @var int
*/
protected $_rowCount = 1;

/**
* Batch id.
*
* @var int
*/
protected $_batchId;

/**
* Batch information.
*
* @var array
*/
protected $_batchInfo = [];
Expand All @@ -52,22 +55,26 @@ class CRM_Batch_Form_Entry extends CRM_Core_Form {

/**
* When not to reset sort_name.
*
* @var bool
*/
protected $_preserveDefault = TRUE;

/**
* Contact fields.
*
* @var array
*/
protected $_contactFields = [];

/**
* Fields array of fields in the batch profile.
*
* (based on the uf_field table data)
* (this can't be protected as it is passed into the CRM_Contact_Form_Task_Batch::parseStreetAddress function
* (although a future refactoring might hopefully change that so it uses the api & the function is not
* required
*
* @var array
*/
public $_fields = [];
Expand All @@ -84,6 +91,8 @@ class CRM_Batch_Form_Entry extends CRM_Core_Form {

/**
* Build all the data structures needed to build the form.
*
* @throws \CRM_Core_Exception
*/
public function preProcess() {
$this->_batchId = CRM_Utils_Request::retrieve('id', 'Positive', $this, TRUE);
Expand Down Expand Up @@ -120,6 +129,8 @@ public function setBatchID($id) {

/**
* Build the form object.
*
* @throws \CRM_Core_Exception
*/
public function buildQuickForm() {
if (!$this->_profileId) {
Expand All @@ -132,15 +143,14 @@ public function buildQuickForm() {
// get the profile information
if ($this->_batchInfo['type_id'] == $batchTypes['Contribution']) {
CRM_Utils_System::setTitle(ts('Batch Data Entry for Contributions'));
$customFields = CRM_Core_BAO_CustomField::getFields('Contribution');
Copy link
Contributor Author

Choose a reason for hiding this comment

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

not used

Copy link
Member

Choose a reason for hiding this comment

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

FWIW, to my eye, the handling of $customFields in processMembership() looks fairly similar (i.e. no obvious/meaningful reads, only obvious writes). Not saying that needs to be addressed at the same time - but just in case you're interested.

Maybe after the r-test build finishes, then we just to do 5-min r-run on the autobuild site to confirm that the custom-fields still render+save on the batch-entry screen.

}
elseif ($this->_batchInfo['type_id'] == $batchTypes['Membership']) {
CRM_Utils_System::setTitle(ts('Batch Data Entry for Memberships'));
}
elseif ($this->_batchInfo['type_id'] == $batchTypes['Pledge Payment']) {
CRM_Utils_System::setTitle(ts('Batch Data Entry for Pledge Payments'));
}
$this->_fields = [];
Copy link
Contributor Author

Choose a reason for hiding this comment

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

see next line...


$this->_fields = CRM_Core_BAO_UFGroup::getFields($this->_profileId, FALSE, CRM_Core_Action::VIEW);

// remove file type field and then limit fields
Expand Down Expand Up @@ -367,6 +377,8 @@ public function cancelAction() {

/**
* Set default values for the form.
*
* @throws \CRM_Core_Exception
*/
public function setDefaultValues() {
if (empty($this->_fields)) {
Expand Down Expand Up @@ -402,6 +414,9 @@ public function setDefaultValues() {

/**
* Process the form after the input has been submitted and validated.
*
* @throws \CRM_Core_Exception
* @throws \CiviCRM_API3_Exception
*/
public function postProcess() {
$params = $this->controller->exportValues($this->_name);
Expand Down Expand Up @@ -439,6 +454,9 @@ public function postProcess() {
* Associated array of submitted values.
*
* @return bool
*
* @throws \CRM_Core_Exception
* @throws \CiviCRM_API3_Exception
*/
private function processContribution(&$params) {

Expand Down Expand Up @@ -928,6 +946,9 @@ public function testProcessMembership($params) {
* @param array $params
*
* @return bool
*
* @throws \CRM_Core_Exception
* @throws \CiviCRM_API3_Exception
*/
public function testProcessContribution($params) {
return $this->processContribution($params);
Expand Down