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

AccountsTab: Avoid deprecated method call #393

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
16 changes: 8 additions & 8 deletions CRM/Banking/Form/AccountsTab.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ function buildQuickForm() {
$this->assign('reference_validation', (int) CRM_Core_BAO_Setting::getItem('CiviBanking', 'reference_validation'));

// ACCOUNT REFRENCE ITEMS
$this->add('hidden', 'contact_id', $contact_id, true);
$this->add('hidden', 'contact_id', $contact_id);
$this->add('hidden', 'reference_id');

$reference_type = $this->add(
Expand All @@ -95,7 +95,7 @@ function buildQuickForm() {
true
);


// BANK ITEMS
$this->add('hidden', 'ba_id');

Expand Down Expand Up @@ -164,10 +164,10 @@ public function validate() {
} elseif ($normalise && $result['normalised'] ) {
$values['reference'] = $result['reference'];
$this->set('reference', $result['reference']);
}
}
}
}

if (0 == count($this->_errors)) {
return TRUE;
} else {
Expand All @@ -182,15 +182,15 @@ public function validate() {
function postProcess() {
$values = $this->exportValues();
$was_created = FALSE;

// save presets
if (!empty($values['reference_type'])) {
CRM_Core_BAO_Setting::setItem($values['reference_type'], 'CiviBanking', 'account.default_reference_id');
}
if (!empty($values['country'])) {
CRM_Core_BAO_Setting::setItem($values['country'], 'CiviBanking', 'account.default_country');
}

// create bank account
$ba_id = $values['ba_id'];
if (empty($ba_id)) {
Expand Down Expand Up @@ -226,7 +226,7 @@ function postProcess() {
if (!empty($values['reference_id'])) {
$reference_update['id'] = $values['reference_id'];
}

civicrm_api3('BankingAccountReference', 'create', $reference_update);

if ($was_created) {
Expand All @@ -237,7 +237,7 @@ function postProcess() {

// return to accounts tab
if (!empty($values['contact_id'])) {
CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/contact/view', "reset=1&cid={$values['contact_id']}&selectedChild=bank_accounts"));
CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/contact/view', "reset=1&cid={$values['contact_id']}&selectedChild=bank_accounts"));
}
parent::postProcess();
}
Expand Down