From 1d2a585a4182475310cd5461b2be52e8184cc4cd Mon Sep 17 00:00:00 2001 From: eileen Date: Fri, 10 Mar 2017 16:23:17 +1300 Subject: [PATCH] CRM-20220 fix signature fields to be longtext --- CRM/Admin/Form/PaymentProcessor.php | 34 +++++++++++++---------- CRM/Core/xml/Menu/Admin.xml | 3 +- CRM/Financial/DAO/PaymentProcessor.php | 29 +++++++++++++++++++ xml/schema/Financial/PaymentProcessor.xml | 29 +++++++++++++++++++ 4 files changed, 80 insertions(+), 15 deletions(-) diff --git a/CRM/Admin/Form/PaymentProcessor.php b/CRM/Admin/Form/PaymentProcessor.php index efb4475355..7c0d76402b 100644 --- a/CRM/Admin/Form/PaymentProcessor.php +++ b/CRM/Admin/Form/PaymentProcessor.php @@ -43,16 +43,21 @@ class CRM_Admin_Form_PaymentProcessor extends CRM_Admin_Form { protected $_ppDAO; + /** + * Get the base entity being edited. + * + * @return string + * The entity being edited. + * + * @throws Exception + */ + 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 +82,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', @@ -221,10 +224,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'])) { diff --git a/CRM/Core/xml/Menu/Admin.xml b/CRM/Core/xml/Menu/Admin.xml index 4293f50622..f6dcf0c614 100644 --- a/CRM/Core/xml/Menu/Admin.xml +++ b/CRM/Core/xml/Menu/Admin.xml @@ -454,12 +454,13 @@ civicrm/admin/paymentProcessor - Payment Processor + Settings - Payment Processor Payment Processor setup for CiviCRM transactions CRM_Admin_Page_PaymentProcessor System Settings admin/small/online_contribution_pages.png 30 + administer payment processors civicrm/admin/setting/mapping diff --git a/CRM/Financial/DAO/PaymentProcessor.php b/CRM/Financial/DAO/PaymentProcessor.php index 287d04d762..494a3feb1c 100644 --- a/CRM/Financial/DAO/PaymentProcessor.php +++ b/CRM/Financial/DAO/PaymentProcessor.php @@ -238,6 +238,9 @@ class CRM_Financial_DAO_PaymentProcessor extends CRM_Core_DAO { 'table_name' => 'civicrm_payment_processor', 'entity' => 'PaymentProcessor', 'bao' => 'CRM_Financial_BAO_PaymentProcessor', + 'html' => array( + 'type' => 'Text', + ) , ) , 'description' => array( 'name' => 'description', @@ -300,6 +303,9 @@ class CRM_Financial_DAO_PaymentProcessor extends CRM_Core_DAO { 'table_name' => 'civicrm_payment_processor', 'entity' => 'PaymentProcessor', 'bao' => 'CRM_Financial_BAO_PaymentProcessor', + 'html' => array( + 'type' => 'Text', + ) , ) , 'password' => array( 'name' => 'password', @@ -310,14 +316,22 @@ class CRM_Financial_DAO_PaymentProcessor extends CRM_Core_DAO { 'table_name' => 'civicrm_payment_processor', 'entity' => 'PaymentProcessor', 'bao' => 'CRM_Financial_BAO_PaymentProcessor', + 'html' => array( + 'type' => 'Text', + ) , ) , 'signature' => array( 'name' => 'signature', 'type' => CRM_Utils_Type::T_TEXT, 'title' => ts('Signature') , + 'rows' => 4, + 'cols' => 40, 'table_name' => 'civicrm_payment_processor', 'entity' => 'PaymentProcessor', 'bao' => 'CRM_Financial_BAO_PaymentProcessor', + 'html' => array( + 'type' => 'TextArea', + ) , ) , 'url_site' => array( 'name' => 'url_site', @@ -328,6 +342,9 @@ class CRM_Financial_DAO_PaymentProcessor extends CRM_Core_DAO { 'table_name' => 'civicrm_payment_processor', 'entity' => 'PaymentProcessor', 'bao' => 'CRM_Financial_BAO_PaymentProcessor', + 'html' => array( + 'type' => 'Text', + ) , ) , 'url_api' => array( 'name' => 'url_api', @@ -338,6 +355,9 @@ class CRM_Financial_DAO_PaymentProcessor extends CRM_Core_DAO { 'table_name' => 'civicrm_payment_processor', 'entity' => 'PaymentProcessor', 'bao' => 'CRM_Financial_BAO_PaymentProcessor', + 'html' => array( + 'type' => 'Text', + ) , ) , 'url_recur' => array( 'name' => 'url_recur', @@ -348,6 +368,9 @@ class CRM_Financial_DAO_PaymentProcessor extends CRM_Core_DAO { 'table_name' => 'civicrm_payment_processor', 'entity' => 'PaymentProcessor', 'bao' => 'CRM_Financial_BAO_PaymentProcessor', + 'html' => array( + 'type' => 'Text', + ) , ) , 'url_button' => array( 'name' => 'url_button', @@ -358,6 +381,9 @@ class CRM_Financial_DAO_PaymentProcessor extends CRM_Core_DAO { 'table_name' => 'civicrm_payment_processor', 'entity' => 'PaymentProcessor', 'bao' => 'CRM_Financial_BAO_PaymentProcessor', + 'html' => array( + 'type' => 'Text', + ) , ) , 'subject' => array( 'name' => 'subject', @@ -368,6 +394,9 @@ class CRM_Financial_DAO_PaymentProcessor extends CRM_Core_DAO { 'table_name' => 'civicrm_payment_processor', 'entity' => 'PaymentProcessor', 'bao' => 'CRM_Financial_BAO_PaymentProcessor', + 'html' => array( + 'type' => 'Text', + ) , ) , 'class_name' => array( 'name' => 'class_name', diff --git a/xml/schema/Financial/PaymentProcessor.xml b/xml/schema/Financial/PaymentProcessor.xml index c156eebabc..55b2b19196 100644 --- a/xml/schema/Financial/PaymentProcessor.xml +++ b/xml/schema/Financial/PaymentProcessor.xml @@ -43,6 +43,9 @@ 64 Payment Processor Name. 1.8 + + Text + description @@ -113,6 +116,9 @@ varchar 255 1.8 + + Text + password @@ -120,12 +126,20 @@ varchar 255 1.8 + + Text + signature Signature text 1.8 + + TextArea + 4 + 40 + url_site @@ -133,6 +147,9 @@ varchar 255 1.8 + + Text + url_api @@ -140,6 +157,9 @@ varchar 255 1.8 + + Text + url_recur @@ -147,6 +167,9 @@ varchar 255 1.8 + + Text + url_button @@ -154,6 +177,9 @@ varchar 255 1.8 + + Text + subject @@ -161,6 +187,9 @@ varchar 255 1.8 + + Text + class_name -- 2.25.1