diff --git a/CRM/MembershipExtras/DAO/PaymentScheme.php b/CRM/MembershipExtras/DAO/PaymentScheme.php index 7606dd76..be9eca2f 100644 --- a/CRM/MembershipExtras/DAO/PaymentScheme.php +++ b/CRM/MembershipExtras/DAO/PaymentScheme.php @@ -6,7 +6,7 @@ * * Generated from uk.co.compucorp.membershipextras/xml/schema/CRM/MembershipExtras/PaymentScheme.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:08284c4d333470d57b11f295d2159886) + * (GenCodeChecksum:4c9369ab33edde1eedc52b603af295af) */ use CRM_MembershipExtras_ExtensionUtil as E; @@ -42,39 +42,46 @@ class CRM_MembershipExtras_DAO_PaymentScheme extends CRM_Core_DAO { /** * @var string - * (SQL type: varchar(255)) + * (SQL type: varchar(250)) * Note that values will be retrieved from the database as a string. */ public $name; /** - * @var string - * (SQL type: varchar(255)) + * @var string|null + * (SQL type: varchar(250)) * Note that values will be retrieved from the database as a string. */ public $admin_title; /** * @var string|null - * (SQL type: varchar(255)) + * (SQL type: varchar(500)) * Note that values will be retrieved from the database as a string. */ - public $admin_description; + public $description; /** * @var string - * (SQL type: varchar(255)) + * (SQL type: varchar(250)) * Note that values will be retrieved from the database as a string. */ public $public_title; /** - * @var string|null - * (SQL type: varchar(255)) + * @var string + * (SQL type: varchar(500)) * Note that values will be retrieved from the database as a string. */ public $public_description; + /** + * @var int|string + * (SQL type: int unsigned) + * Note that values will be retrieved from the database as a string. + */ + public $payment_processor; + /** * @var string * (SQL type: varchar(10)) @@ -96,13 +103,6 @@ class CRM_MembershipExtras_DAO_PaymentScheme extends CRM_Core_DAO { */ public $parameters; - /** - * @var int|string - * (SQL type: int unsigned) - * Note that values will be retrieved from the database as a string. - */ - public $payment_processor; - /** * Class constructor. */ @@ -165,7 +165,7 @@ public static function &fields() { 'type' => CRM_Utils_Type::T_STRING, 'title' => E::ts('Name'), 'required' => TRUE, - 'maxlength' => 255, + 'maxlength' => 250, 'size' => CRM_Utils_Type::HUGE, 'where' => 'membershipextras_payment_scheme.name', 'table_name' => 'membershipextras_payment_scheme', @@ -178,8 +178,7 @@ public static function &fields() { 'name' => 'admin_title', 'type' => CRM_Utils_Type::T_STRING, 'title' => E::ts('Admin title'), - 'required' => TRUE, - 'maxlength' => 255, + 'maxlength' => 250, 'size' => CRM_Utils_Type::HUGE, 'where' => 'membershipextras_payment_scheme.admin_title', 'table_name' => 'membershipextras_payment_scheme', @@ -188,13 +187,13 @@ public static function &fields() { 'localizable' => 0, 'add' => NULL, ], - 'admin_description' => [ - 'name' => 'admin_description', + 'description' => [ + 'name' => 'description', 'type' => CRM_Utils_Type::T_STRING, - 'title' => E::ts('Admin Description'), - 'maxlength' => 255, + 'title' => E::ts('Description'), + 'maxlength' => 500, 'size' => CRM_Utils_Type::HUGE, - 'where' => 'membershipextras_payment_scheme.admin_description', + 'where' => 'membershipextras_payment_scheme.description', 'table_name' => 'membershipextras_payment_scheme', 'entity' => 'PaymentScheme', 'bao' => 'CRM_MembershipExtras_DAO_PaymentScheme', @@ -206,7 +205,7 @@ public static function &fields() { 'type' => CRM_Utils_Type::T_STRING, 'title' => E::ts('Public title'), 'required' => TRUE, - 'maxlength' => 255, + 'maxlength' => 250, 'size' => CRM_Utils_Type::HUGE, 'where' => 'membershipextras_payment_scheme.public_title', 'table_name' => 'membershipextras_payment_scheme', @@ -219,7 +218,8 @@ public static function &fields() { 'name' => 'public_description', 'type' => CRM_Utils_Type::T_STRING, 'title' => E::ts('Public description'), - 'maxlength' => 255, + 'required' => TRUE, + 'maxlength' => 500, 'size' => CRM_Utils_Type::HUGE, 'where' => 'membershipextras_payment_scheme.public_description', 'table_name' => 'membershipextras_payment_scheme', @@ -228,6 +228,19 @@ public static function &fields() { 'localizable' => 0, 'add' => NULL, ], + 'payment_processor' => [ + 'name' => 'payment_processor', + 'type' => CRM_Utils_Type::T_INT, + 'title' => E::ts('Payment Processor'), + 'required' => TRUE, + 'where' => 'membershipextras_payment_scheme.payment_processor', + 'table_name' => 'membershipextras_payment_scheme', + 'entity' => 'PaymentScheme', + 'bao' => 'CRM_MembershipExtras_DAO_PaymentScheme', + 'localizable' => 0, + 'FKClassName' => 'CRM_Financial_DAO_PaymentProcessor', + 'add' => NULL, + ], 'permission' => [ 'name' => 'permission', 'type' => CRM_Utils_Type::T_STRING, @@ -267,19 +280,6 @@ public static function &fields() { 'localizable' => 0, 'add' => NULL, ], - 'payment_processor' => [ - 'name' => 'payment_processor', - 'type' => CRM_Utils_Type::T_INT, - 'title' => E::ts('Payment Processor'), - 'required' => TRUE, - 'where' => 'membershipextras_payment_scheme.payment_processor', - 'table_name' => 'membershipextras_payment_scheme', - 'entity' => 'PaymentScheme', - 'bao' => 'CRM_MembershipExtras_DAO_PaymentScheme', - 'localizable' => 0, - 'FKClassName' => 'CRM_Financial_DAO_PaymentProcessor', - 'add' => NULL, - ], ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } diff --git a/CRM/MembershipExtras/Form/PaymentScheme.php b/CRM/MembershipExtras/Form/PaymentScheme.php index 98e3ace6..05d526bc 100644 --- a/CRM/MembershipExtras/Form/PaymentScheme.php +++ b/CRM/MembershipExtras/Form/PaymentScheme.php @@ -55,15 +55,16 @@ public function buildQuickForm() { return; } - $this->add('text', 'name', ts('Name'), NULL, TRUE); - $this->add('text', 'admin_title', ts('Admin Title'), NULL, TRUE); - $this->add('textarea', 'admin_description', ts('Admin Description')); - $this->add('text', 'public_title', ts('Public Title'), NULL, TRUE); - $this->add('textarea', 'public_description', ts('Public Description')); + $this->add('text', 'name', ts('Name'), ['maxlength' => 250, 'size' => 50], TRUE); + $this->add('text', 'admin_title', ts('Admin Title'), ['maxlength' => 250, 'size' => 50]); + $this->add('textarea', 'description', ts('Description'), ['maxlength' => 500, 'cols' => 49]); + $this->add('text', 'public_title', ts('Public Title'), ['maxlength' => 250, 'size' => 50], TRUE); + $this->add('textarea', 'public_description', ts('Public Description'), ['maxlength' => 500, 'cols' => 49], TRUE); + $this->addPaymentProcessorField(); $this->add( 'select', 'permission', - 'permission', + ts('Permission'), [ 'public' => ts('Public'), 'admin' => ts('Admin'), @@ -71,8 +72,7 @@ public function buildQuickForm() { TRUE ); $this->add('checkbox', 'enabled', ts('Enabled'), NULL, FALSE); - $this->addPaymentProcessorField(); - $this->add('textarea', 'parameters', ts('Parameters'), NULL, TRUE); + $this->add('textarea', 'parameters', ts('Parameters'), ['cols' => 49], TRUE); $this->addButtons([ [ @@ -115,13 +115,13 @@ public function setDefaultValues() { 'id' => $scheme['id'], 'name' => $scheme['name'], 'admin_title' => $scheme['admin_title'], - 'admin_description' => $scheme['admin_title'], + 'description' => $scheme['description'], 'public_title' => $scheme['public_title'], 'public_description' => $scheme['public_description'], + 'payment_processor' => $scheme['payment_processor'], 'permission' => $scheme['permission'], 'enabled' => $scheme['enabled'], 'parameters' => $scheme['parameters'], - 'payment_processor' => $scheme['payment_processor'], ]; } @@ -138,6 +138,7 @@ public function getRenderableElementNames() { $elementNames[] = $element->getName(); } } + return $elementNames; } @@ -165,7 +166,6 @@ private function addPaymentProcessorField() { $select = ['' => ts('- select -')] + $paymentProcessors; $this->add('select', 'payment_processor', ts('Payment Processor'), $select, TRUE); - } private function isDeleteContext() { @@ -189,13 +189,13 @@ private function postProcessFormSubmission() { $params = [ 'name' => $values['name'], 'admin_title' => $values['admin_title'], - 'admin_description' => $values['admin_description'], + 'description' => $values['description'], 'public_title' => $values['public_title'], 'public_description' => $values['public_description'], + 'payment_processor' => $values['payment_processor'], 'permission' => $values['permission'], 'enabled' => CRM_Utils_Array::value('enabled', $values, FALSE), 'parameters' => $values['parameters'], - 'payment_processor' => $values['payment_processor'], ]; if (!empty($this->id)) { diff --git a/sql/auto_install.sql b/sql/auto_install.sql index bc628fdf..0c14de69 100644 --- a/sql/auto_install.sql +++ b/sql/auto_install.sql @@ -4,7 +4,6 @@ DROP TABLE IF EXISTS `membershipextras_payment_scheme`; SET FOREIGN_KEY_CHECKS=1; -- /******************************************************* --- * Create recurring contribution line items table -- *******************************************************/ CREATE TABLE `membershipextras_subscription_line` ( `id` int unsigned NOT NULL AUTO_INCREMENT COMMENT 'Discount Item ID', @@ -32,20 +31,24 @@ CREATE TABLE `membershipextras_subscription_line` ( ); -- /******************************************************* --- * Creates membershipextras_payment_scheme +-- * +-- * membershipextras_payment_scheme +-- * +-- * A table that store payment scheme that will be used for creating a payment plan +-- * -- *******************************************************/ CREATE TABLE `membershipextras_payment_scheme` ( `id` int unsigned NOT NULL AUTO_INCREMENT COMMENT 'Unique PaymentScheme ID', - `name` varchar(255) NOT NULL, - `admin_title` varchar(255) NOT NULL, - `admin_description` varchar(255), - `public_title` varchar(255) NOT NULL, - `public_description` varchar(255), + `name` varchar(250) NOT NULL, + `admin_title` varchar(250), + `description` varchar(500), + `public_title` varchar(250) NOT NULL, + `public_description` varchar(500) NOT NULL, + `payment_processor` int unsigned NOT NULL, `permission` varchar(10) NOT NULL, `enabled` tinyint NOT NULL DEFAULT false, `parameters` text NOT NULL, - `payment_processor` int unsigned NOT NULL, PRIMARY KEY (`id`), CONSTRAINT FK_membershipextras_payment_scheme_payment_processor FOREIGN KEY (`payment_processor`) REFERENCES `civicrm_payment_processor`(`id`) ON DELETE CASCADE ) - ENGINE=InnoDB; +ENGINE=InnoDB; diff --git a/sql/upgrade/Step0010.sql b/sql/upgrade/Step0010.sql index 8e2ec1f1..13292c6b 100644 --- a/sql/upgrade/Step0010.sql +++ b/sql/upgrade/Step0010.sql @@ -3,15 +3,15 @@ -- *******************************************************/ CREATE TABLE `membershipextras_payment_scheme` ( `id` int unsigned NOT NULL AUTO_INCREMENT COMMENT 'Unique PaymentScheme ID', - `name` varchar(255) NOT NULL, - `admin_title` varchar(255) NOT NULL, - `admin_description` varchar(255), - `public_title` varchar(255) NOT NULL, - `public_description` varchar(255), + `name` varchar(250) NOT NULL, + `admin_title` varchar(250), + `description` varchar(500), + `public_title` varchar(250) NOT NULL, + `public_description` varchar(500) NOT NULL, + `payment_processor` int unsigned NOT NULL, `permission` varchar(10) NOT NULL, `enabled` tinyint NOT NULL DEFAULT false, `parameters` text NOT NULL, - `payment_processor` int unsigned NOT NULL, PRIMARY KEY (`id`), CONSTRAINT FK_membershipextras_payment_scheme_payment_processor diff --git a/tests/phpunit/CRM/MembershipExtras/BAO/PaymentSchemeTest.php b/tests/phpunit/CRM/MembershipExtras/BAO/PaymentSchemeTest.php index 3ba3fff4..297b23d2 100644 --- a/tests/phpunit/CRM/MembershipExtras/BAO/PaymentSchemeTest.php +++ b/tests/phpunit/CRM/MembershipExtras/BAO/PaymentSchemeTest.php @@ -15,7 +15,7 @@ public function testCreatePaymentScheme() { $params = [ 'name' => 'Test scheme', 'admin_title' => 'Admin title', - 'admin_description' => 'Admin description', + 'description' => 'description', 'public_title' => 'Public value', 'public_description' => 'Public description', 'permission' => 'public', @@ -39,7 +39,7 @@ public function testGetAll() { $param = [ 'admin_title' => 'Admin title', - 'admin_description' => 'Admin description', + 'description' => 'description', 'public_title' => 'Public value', 'public_description' => 'Public description', 'permission' => 'public', diff --git a/tests/phpunit/CRM/MembershipExtras/Job/OfflineAutoRenewal/BaseRenewalJobTestHelper.php b/tests/phpunit/CRM/MembershipExtras/Job/OfflineAutoRenewal/BaseRenewalJobTestHelper.php index fb8bfcba..2278d901 100644 --- a/tests/phpunit/CRM/MembershipExtras/Job/OfflineAutoRenewal/BaseRenewalJobTestHelper.php +++ b/tests/phpunit/CRM/MembershipExtras/Job/OfflineAutoRenewal/BaseRenewalJobTestHelper.php @@ -163,7 +163,7 @@ protected function createPaymentScheme() { $params = [ 'name' => 'Test scheme', 'admin_title' => 'Admin title', - 'admin_description' => 'Admin description', + 'description' => 'description', 'public_title' => 'Public value', 'public_description' => 'Public description', 'permission' => 'public', diff --git a/tests/phpunit/CRM/MembershipExtras/Service/PaymentScheme/PaymentPlanScheduleGeneratorTest.php b/tests/phpunit/CRM/MembershipExtras/Service/PaymentScheme/PaymentPlanScheduleGeneratorTest.php index 17bdb6f2..2cda8250 100644 --- a/tests/phpunit/CRM/MembershipExtras/Service/PaymentScheme/PaymentPlanScheduleGeneratorTest.php +++ b/tests/phpunit/CRM/MembershipExtras/Service/PaymentScheme/PaymentPlanScheduleGeneratorTest.php @@ -66,7 +66,7 @@ private function createPaymentSchemeAndLinkToPaymentPlanOrder() { $params = [ 'name' => 'Test scheme', 'admin_title' => 'Admin title', - 'admin_description' => 'Admin description', + 'description' => 'description', 'public_title' => 'Public value', 'public_description' => 'Public description', 'permission' => 'public', diff --git a/xml/schema/CRM/MembershipExtras/PaymentScheme.xml b/xml/schema/CRM/MembershipExtras/PaymentScheme.xml index 2825cd08..77a4e13b 100644 --- a/xml/schema/CRM/MembershipExtras/PaymentScheme.xml +++ b/xml/schema/CRM/MembershipExtras/PaymentScheme.xml @@ -25,7 +25,7 @@ name Name varchar - 255 + 250 true @@ -33,22 +33,21 @@ admin_title Admin title varchar - 255 - true + 250 - admin_description - Admin Description + description + Description varchar - 255 + 500 public_title Public title varchar - 255 + 250 true @@ -56,9 +55,23 @@ public_description Public description varchar - 255 + 500 + true + + payment_processor + Payment Processor + int unsigned + true + + + payment_processor + civicrm_payment_processor
+ id + CASCADE +
+ permission Permission @@ -82,16 +95,4 @@ true - - payment_processor - Payment Processor - int unsigned - true - - - payment_processor - civicrm_payment_processor
- id - CASCADE -