Skip to content

Commit

Permalink
Remove isset from batch form
Browse files Browse the repository at this point in the history
Affects url civicrm/financial/financialbatches?reset=1&batchStatus=1
  • Loading branch information
eileenmcnaughton committed Dec 9, 2021
1 parent 7865c26 commit e8994a1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
7 changes: 4 additions & 3 deletions CRM/Financial/Form/BatchTransaction.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,22 +30,22 @@ class CRM_Financial_Form_BatchTransaction extends CRM_Contribute_Form_Search {

/**
* Batch status name.
*
* @var string
*/
protected $_batchStatus;
protected $_batchStatus = 'open';

public function preProcess() {
// This reuses some styles from search forms
CRM_Core_Resources::singleton()->addStyleFile('civicrm', 'css/searchForm.css', 1, 'html-header');

$this->addExpectedSmartyVariable('batchStatus');
self::$_entityID = CRM_Utils_Request::retrieve('bid', 'Positive') ? CRM_Utils_Request::retrieve('bid', 'Positive') : CRM_Utils_Array::value('batch_id', $_POST);
$this->assign('entityID', self::$_entityID);
if (isset(self::$_entityID)) {
$this->_batchStatusId = CRM_Core_DAO::getFieldValue('CRM_Batch_BAO_Batch', self::$_entityID, 'status_id');
$batchStatuses = CRM_Core_PseudoConstant::get('CRM_Batch_DAO_Batch', 'status_id', ['labelColumn' => 'name', 'condition' => " v.value={$this->_batchStatusId}"]);
$this->_batchStatus = $batchStatuses[$this->_batchStatusId];
$this->assign('statusID', $this->_batchStatusId);
$this->assign('batchStatus', $this->_batchStatus);
$validStatus = FALSE;
if (in_array($this->_batchStatus, ['Open', 'Reopened'])) {
$validStatus = TRUE;
Expand All @@ -68,6 +68,7 @@ public function preProcess() {
];
$this->assign('columnHeaders', $columnHeaders);
}
$this->assign('batchStatus', $this->_batchStatus);
}

/**
Expand Down
3 changes: 0 additions & 3 deletions templates/CRM/Financial/Form/Search.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@
*}

{* Financial search component. *}
{if !isset($batchStatus)}
{assign var="batchStatus" value="open"}
{/if}
<div id="enableDisableStatusMsg" class="crm-container" style="display:none"></div>
<div class="action-link">
<a accesskey="N" href="{crmURL p='civicrm/financial/batch' q="reset=1&action=add&context=$batchStatus"}" id="newBatch" class="button"><span><i class="crm-i fa-plus-circle" aria-hidden="true"></i> {ts}New Accounting Batch{/ts}</span></a>
Expand Down

0 comments on commit e8994a1

Please sign in to comment.