X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FAdmin%2FForm%2FPaymentProcessor.php;h=eda41c979c795d152ccdc6f814450da83fac0799;hb=d25dd0ee5e47188c3ea9ad2918f627cfac97ddbd;hp=90ab5b80e8329d7aae792d281cbf1222a4e6d72b;hpb=22e263ad985b62de5cf7bdaf09555bfb3f0cd322;p=civicrm-core.git diff --git a/CRM/Admin/Form/PaymentProcessor.php b/CRM/Admin/Form/PaymentProcessor.php index 90ab5b80e8..eda41c979c 100644 --- a/CRM/Admin/Form/PaymentProcessor.php +++ b/CRM/Admin/Form/PaymentProcessor.php @@ -23,7 +23,7 @@ | GNU Affero General Public License or the licensing of CiviCRM, | | see the CiviCRM license FAQ at http://civicrm.org/licensing | +--------------------------------------------------------------------+ -*/ + */ /** * @@ -59,7 +59,7 @@ class CRM_Admin_Form_PaymentProcessor extends CRM_Admin_Form { if ($this->_id) { $this->_ppType = CRM_Utils_Request::retrieve('pp', 'String', $this, FALSE, NULL); if (!$this->_ppType) { - $this->_ppType = CRM_Core_DAO::getFieldValue( 'CRM_Financial_DAO_PaymentProcessor', + $this->_ppType = CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_PaymentProcessor', $this->_id, 'payment_processor_type_id' ); @@ -71,13 +71,13 @@ class CRM_Admin_Form_PaymentProcessor extends CRM_Admin_Form { } $this->assign('ppType', $this->_ppType); - $ppTypeName = CRM_Core_DAO::getFieldValue( 'CRM_Financial_DAO_PaymentProcessorType', + $ppTypeName = CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_PaymentProcessorType', $this->_ppType, 'name' ); - $this->assign('ppTypeName', $ppTypeName ); + $this->assign('ppTypeName', $ppTypeName); - $this->_ppDAO = new CRM_Financial_DAO_PaymentProcessorType( ); + $this->_ppDAO = new CRM_Financial_DAO_PaymentProcessorType(); $this->_ppDAO->id = $this->_ppType; if (!$this->_ppDAO->find(TRUE)) { @@ -181,14 +181,17 @@ class CRM_Admin_Form_PaymentProcessor extends CRM_Admin_Form { $attributes['name'], TRUE ); - $this->addRule('name', ts('Name already exists in Database.'), 'objectExists', array('CRM_Financial_DAO_PaymentProcessor', $this->_id)); + $this->addRule('name', ts('Name already exists in Database.'), 'objectExists', array( + 'CRM_Financial_DAO_PaymentProcessor', + $this->_id, + )); $this->add('text', 'description', ts('Description'), $attributes['description'] ); $types = CRM_Core_PseudoConstant::paymentProcessorType(); - $this->add( 'select', 'payment_processor_type_id', ts('Payment Processor Type'), $types, TRUE, + $this->add('select', 'payment_processor_type_id', ts('Payment Processor Type'), $types, TRUE, array('onchange' => "reload(true)") ); @@ -239,8 +242,9 @@ class CRM_Admin_Form_PaymentProcessor extends CRM_Admin_Form { $errors = array(); if (!(self::checkSection($fields, $errors) || - self::checkSection($fields, $errors, 'test') - )) { + self::checkSection($fields, $errors, 'test') + ) + ) { $errors['_qf_default'] = ts('You must have at least the test or live section filled'); } @@ -305,8 +309,8 @@ class CRM_Admin_Form_PaymentProcessor extends CRM_Admin_Form { } $domainID = CRM_Core_Config::domainID(); - $dao = new CRM_Financial_DAO_PaymentProcessor( ); - $dao->id = $this->_id; + $dao = new CRM_Financial_DAO_PaymentProcessor(); + $dao->id = $this->_id; $dao->domain_id = $domainID; if (!$dao->find(TRUE)) { return $defaults; @@ -316,8 +320,8 @@ class CRM_Admin_Form_PaymentProcessor extends CRM_Admin_Form { // now get testID $testDAO = new CRM_Financial_DAO_PaymentProcessor(); - $testDAO->name = $dao->name; - $testDAO->is_test = 1; + $testDAO->name = $dao->name; + $testDAO->is_test = 1; $testDAO->domain_id = $domainID; if ($testDAO->find(TRUE)) { $this->_testID = $testDAO->id; @@ -339,12 +343,12 @@ class CRM_Admin_Form_PaymentProcessor extends CRM_Admin_Form { * @return Void */ public function postProcess() { - CRM_Utils_System::flushCache( 'CRM_Financial_DAO_PaymentProcessor' ); + CRM_Utils_System::flushCache('CRM_Financial_DAO_PaymentProcessor'); if ($this->_action & CRM_Core_Action::DELETE) { CRM_Financial_BAO_PaymentProcessor::del($this->_id); CRM_Core_Session::setStatus("", ts('Payment Processor Deleted.'), "success"); - return; + return NULL; } $values = $this->controller->exportValues($this->_name); @@ -367,14 +371,14 @@ class CRM_Admin_Form_PaymentProcessor extends CRM_Admin_Form { * @param int $domainID * @param $test * - * @return Void + * @return void */ public function updatePaymentProcessor(&$values, $domainID, $test) { - $dao = new CRM_Financial_DAO_PaymentProcessor( ); + $dao = new CRM_Financial_DAO_PaymentProcessor(); - $dao->id = $test ? $this->_testID : $this->_id; - $dao->domain_id = $domainID; - $dao->is_test = $test; + $dao->id = $test ? $this->_testID : $this->_id; + $dao->domain_id = $domainID; + $dao->is_test = $test; $dao->is_default = CRM_Utils_Array::value('is_default', $values, 0); $dao->is_active = CRM_Utils_Array::value('is_active', $values, 0); @@ -392,9 +396,9 @@ class CRM_Admin_Form_PaymentProcessor extends CRM_Admin_Form { } // also copy meta fields from the info DAO - $dao->is_recur = $this->_ppDAO->is_recur; + $dao->is_recur = $this->_ppDAO->is_recur; $dao->billing_mode = $this->_ppDAO->billing_mode; - $dao->class_name = $this->_ppDAO->class_name; + $dao->class_name = $this->_ppDAO->class_name; $dao->payment_type = $this->_ppDAO->payment_type; $dao->save(); @@ -406,8 +410,9 @@ class CRM_Admin_Form_PaymentProcessor extends CRM_Admin_Form { 'entity_table' => 'civicrm_payment_processor', 'entity_id' => $dao->id, 'account_relationship' => $relationTypeId, - 'financial_account_id' => $values['financial_account_id'] + 'financial_account_id' => $values['financial_account_id'], ); CRM_Financial_BAO_FinancialTypeAccount::add($params); } + }