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

Smarty variables] Remove isset from batch form #22187

Merged
merged 1 commit into from
Dec 10, 2021
Merged
Show file tree
Hide file tree
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
6 changes: 3 additions & 3 deletions CRM/Financial/Form/BatchTransaction.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,22 +30,21 @@ 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');

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 +67,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