X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FAdmin%2FForm%2FPaymentProcessor.php;h=e444eea37a23fa0b34bf384ac44a6782d5ee8dde;hb=cb4100bc439690c0cd4840286377d1de7cbaf345;hp=2f0fd1a15f9b88f0559760cb43affb4fada6c99a;hpb=a9d5a84d8badcf5858b024d655b19974b2aba873;p=civicrm-core.git diff --git a/CRM/Admin/Form/PaymentProcessor.php b/CRM/Admin/Form/PaymentProcessor.php index 2f0fd1a15f..e444eea37a 100644 --- a/CRM/Admin/Form/PaymentProcessor.php +++ b/CRM/Admin/Form/PaymentProcessor.php @@ -3,7 +3,7 @@ +--------------------------------------------------------------------+ | CiviCRM version 4.7 | +--------------------------------------------------------------------+ - | Copyright CiviCRM LLC (c) 2004-2016 | + | Copyright CiviCRM LLC (c) 2004-2017 | +--------------------------------------------------------------------+ | This file is a part of CiviCRM. | | | @@ -28,7 +28,7 @@ /** * * @package CRM - * @copyright CiviCRM LLC (c) 2004-2016 + * @copyright CiviCRM LLC (c) 2004-2017 */ /** @@ -43,16 +43,18 @@ class CRM_Admin_Form_PaymentProcessor extends CRM_Admin_Form { protected $_ppDAO; + /** + * Get the name of the base entity being edited. + * + * @return string + */ + public function getDefaultEntity() { + return 'PaymentProcessor'; + } + public function preProcess() { - if (!CRM_Core_Permission::check('administer payment processors')) { - CRM_Core_Error::statusBounce('The \'administer payment processors\' permission is required to add or edit a payment processor.'); - } parent::preProcess(); - CRM_Utils_System::setTitle(ts('Settings - Payment Processor')); - - // get the payment processor meta information - if ($this->_id) { $this->_ppType = CRM_Utils_Request::retrieve('pp', 'String', $this, FALSE, NULL); if (!$this->_ppType) { @@ -77,9 +79,7 @@ class CRM_Admin_Form_PaymentProcessor extends CRM_Admin_Form { $this->_ppDAO = new CRM_Financial_DAO_PaymentProcessorType(); $this->_ppDAO->id = $this->_ppType; - if (!$this->_ppDAO->find(TRUE)) { - CRM_Core_Error::fatal(ts('Could not find payment processor meta information')); - } + $this->_ppDAO->find(TRUE); if ($this->_id) { $refreshURL = CRM_Utils_System::url('civicrm/admin/paymentProcessor', @@ -179,6 +179,8 @@ class CRM_Admin_Form_PaymentProcessor extends CRM_Admin_Form { $this->addRule('name', ts('Name already exists in Database.'), 'objectExists', array( 'CRM_Financial_DAO_PaymentProcessor', $this->_id, + 'name', + CRM_Core_Config::domainID(), )); $this->add('text', 'description', ts('Description'), @@ -219,10 +221,13 @@ class CRM_Admin_Form_PaymentProcessor extends CRM_Admin_Form { continue; } - $this->add('text', $field['name'], - $field['label'], $attributes[$field['name']] - ); - $this->add('text', "test_{$field['name']}", + $this->addField($field['name'], array('label' => $field['label'])); + + $fieldSpec = civicrm_api3($this->getDefaultEntity(), 'getfield', array( + 'name' => $field['name'], + 'action' => 'create', + )); + $this->add($fieldSpec['values']['html']['type'], "test_{$field['name']}", $field['label'], $attributes[$field['name']] ); if (!empty($field['rule'])) {