Clarifies the role of 'title' as "for admins" and adds a new "frontend_title" for end-users.
Updates the PaymentProcessor form/dao to use hooks instead of an overloaded "create" function,
and only allows the title and frontend_title instead of the name to be entered on the form.
The name will be autogenerated from the title in the DAO::writeRecord function.
The frontend_title is required in the database but will be filled from `title` if not supplied during `create`
Updates tests, sql and sample data with required field
'name' => 'payment_processor_type_id',
'required' => TRUE,
],
- 'name' => [
- 'name' => 'name',
- 'required' => TRUE,
- ],
'title' => [
'name' => 'title',
+ 'required' => TRUE,
+ ],
+ 'frontend_title' => [
+ 'name' => 'frontend_title',
+ 'required' => TRUE,
],
'description' => [
'name' => 'description',
$attributes = CRM_Core_DAO::getAttribute('CRM_Financial_DAO_PaymentProcessor');
- $this->addRule('name', ts('Name already exists in Database.'), 'objectExists', [
- 'CRM_Financial_DAO_PaymentProcessor',
- $this->_id,
- 'name',
- CRM_Core_Config::domainID(),
- ]);
-
// @todo - remove this & let the entityForm do it - need to make sure we are handling the js though.
$this->add('select',
'payment_processor_type_id',
CRM_Core_Session::singleton()->pushUserContext($this->refreshURL);
}
else {
- CRM_Core_Session::setStatus(ts('Payment processor %1 has been saved.', [1 => "<em>{$values['name']}</em>"]), ts('Saved'), 'success');
+ CRM_Core_Session::setStatus(ts('Payment processor %1 has been saved.', [1 => "<em>{$values['title']}</em>"]), ts('Saved'), 'success');
}
}
'accepted_credit_cards' => $creditCards,
], $values);
- civicrm_api3('PaymentProcessor', 'create', $params);
+ $result = civicrm_api4('PaymentProcessor', 'save', [
+ 'records' => [$params],
+ ]);
+ // Pass autogenerated name back
+ $values['name'] = $result->single()['name'];
}
/**
CRM_Core_BAO_CustomValueTable::store($record['custom'], static::$_tableName, $instance->$idField, $op);
}
- \CRM_Utils_Hook::post($op, $entityName, $instance->$idField, $instance);
+ \CRM_Utils_Hook::post($op, $entityName, $instance->$idField, $instance, $record);
return $instance;
}
// For other operations this hook is passed an incomplete object and hook listeners can load if needed.
// But that's not possible with delete because it's gone from the database by the time this hook is called.
// So in this case the object has been pre-loaded so hook listeners have access to the complete record.
- CRM_Utils_Hook::post('delete', $entityName, $record[$idField], $instance);
+ CRM_Utils_Hook::post('delete', $entityName, $record[$idField], $instance, $record);
return $instance;
}
'options' => "text COMMENT 'Store comma-delimited list of color, size, etc. options for the product.'",
],
'civicrm_payment_processor' => [
- 'title' => "varchar(127) COMMENT 'Payment Processor Descriptive Name.'",
+ 'title' => "varchar(255) NOT NULL COMMENT 'Name of processor when shown to CiviCRM administrators.'",
+ 'frontend_title' => "varchar(255) NOT NULL COMMENT 'Name of processor when shown to users making a payment.'",
],
'civicrm_membership_type' => [
'name' => "varchar(128) NOT NULL COMMENT 'Name of Membership Type'",
],
'civicrm_payment_processor' => [
'title' => [
+ 'label' => "Backend Title",
'type' => "Text",
+ 'required' => "true",
+ ],
+ 'frontend_title' => [
+ 'label' => "Frontend Title",
+ 'type' => "Text",
+ 'required' => "true",
],
],
'civicrm_membership_type' => [
--- /dev/null
+<?php
+/*
+ +--------------------------------------------------------------------+
+ | Copyright CiviCRM LLC. All rights reserved. |
+ | |
+ | This work is published under the GNU AGPLv3 license with some |
+ | permitted exceptions and without any warranty. For full license |
+ | and copyright information, see https://civicrm.org/licensing |
+ +--------------------------------------------------------------------+
+ */
+
+/**
+ *
+ * @package CRM
+ * @copyright CiviCRM LLC https://civicrm.org/licensing
+ *
+ * Generated from schema_structure.tpl
+ * DO NOT EDIT. Generated by CRM_Core_CodeGen
+ */
+class CRM_Core_I18n_SchemaStructure_5_61_alpha1 {
+
+ /**
+ * Get translatable columns.
+ *
+ * @return array
+ * A table-indexed array of translatable columns.
+ */
+ public static function &columns() {
+ static $result = NULL;
+ if (!$result) {
+ $result = [
+ 'civicrm_location_type' => [
+ 'display_name' => "varchar(64) COMMENT 'Location Type Display Name.'",
+ ],
+ 'civicrm_option_group' => [
+ 'title' => "varchar(255) COMMENT 'Option Group title.'",
+ 'description' => "text COMMENT 'Option group description.'",
+ ],
+ 'civicrm_relationship_type' => [
+ 'label_a_b' => "varchar(64) COMMENT 'label for relationship of contact_a to contact_b.'",
+ 'label_b_a' => "varchar(64) COMMENT 'Optional label for relationship of contact_b to contact_a.'",
+ 'description' => "varchar(255) COMMENT 'Optional verbose description of the relationship type.'",
+ ],
+ 'civicrm_contact_type' => [
+ 'label' => "varchar(64) COMMENT 'localized Name of Contact Type.'",
+ 'description' => "text COMMENT 'localized Optional verbose description of the type.'",
+ ],
+ 'civicrm_batch' => [
+ 'title' => "varchar(255) COMMENT 'Friendly Name.'",
+ 'description' => "text COMMENT 'Description of this batch set.'",
+ ],
+ 'civicrm_premiums' => [
+ 'premiums_intro_title' => "varchar(255) COMMENT 'Title for Premiums section.'",
+ 'premiums_intro_text' => "text COMMENT 'Displayed in <div> at top of Premiums section of page. Text and HTML allowed.'",
+ 'premiums_nothankyou_label' => "varchar(255) COMMENT 'Label displayed for No Thank-you option in premiums block (e.g. No thank you)'",
+ ],
+ 'civicrm_membership_status' => [
+ 'label' => "varchar(128) COMMENT 'Label for Membership Status'",
+ ],
+ 'civicrm_survey' => [
+ 'title' => "varchar(255) NOT NULL COMMENT 'Title of the Survey.'",
+ 'instructions' => "text COMMENT 'Script instructions for volunteers to use for the survey.'",
+ 'thankyou_title' => "varchar(255) COMMENT 'Title for Thank-you page (header title tag, and display at the top of the page).'",
+ 'thankyou_text' => "text COMMENT 'text and html allowed. displayed above result on success page'",
+ ],
+ 'civicrm_participant_status_type' => [
+ 'label' => "varchar(255) COMMENT 'localized label for display of this status type'",
+ ],
+ 'civicrm_case_type' => [
+ 'title' => "varchar(64) NOT NULL COMMENT 'Natural language name for Case Type'",
+ 'description' => "varchar(255) COMMENT 'Description of the Case Type'",
+ ],
+ 'civicrm_tell_friend' => [
+ 'title' => "varchar(255)",
+ 'intro' => "text COMMENT 'Introductory message to contributor or participant displayed on the Tell a Friend form.'",
+ 'suggested_message' => "text COMMENT 'Suggested message to friends, provided as default on the Tell A Friend form.'",
+ 'thankyou_title' => "varchar(255) COMMENT 'Text for Tell a Friend thank you page header and HTML title.'",
+ 'thankyou_text' => "text COMMENT 'Thank you message displayed on success page.'",
+ ],
+ 'civicrm_custom_group' => [
+ 'title' => "varchar(64) NOT NULL COMMENT 'Friendly Name.'",
+ 'help_pre' => "text COMMENT 'Description and/or help text to display before fields in form.'",
+ 'help_post' => "text COMMENT 'Description and/or help text to display after fields in form.'",
+ ],
+ 'civicrm_custom_field' => [
+ 'label' => "varchar(255) NOT NULL COMMENT 'Text for form field label (also friendly name for administering this custom property).'",
+ 'help_pre' => "text COMMENT 'Description and/or help text to display before this field.'",
+ 'help_post' => "text COMMENT 'Description and/or help text to display after this field.'",
+ ],
+ 'civicrm_option_value' => [
+ 'label' => "varchar(512) NOT NULL COMMENT 'Option string as displayed to users - e.g. the label in an HTML OPTION tag.'",
+ 'description' => "text COMMENT 'Optional description.'",
+ ],
+ 'civicrm_group' => [
+ 'title' => "varchar(255) COMMENT 'Name of Group.'",
+ 'frontend_title' => "varchar(255) DEFAULT NULL COMMENT 'Alternative public title for this Group.'",
+ 'frontend_description' => "text DEFAULT NULL COMMENT 'Alternative public description of the group.'",
+ ],
+ 'civicrm_contribution_page' => [
+ 'title' => "varchar(255) COMMENT 'Contribution Page title. For top of page display'",
+ 'intro_text' => "text COMMENT 'Text and html allowed. Displayed below title.'",
+ 'pay_later_text' => "text COMMENT 'The text displayed to the user in the main form'",
+ 'pay_later_receipt' => "text COMMENT 'The receipt sent to the user instead of the normal receipt text'",
+ 'initial_amount_label' => "varchar(255) COMMENT 'Initial amount label for partial payment'",
+ 'initial_amount_help_text' => "text COMMENT 'Initial amount help text for partial payment'",
+ 'thankyou_title' => "varchar(255) COMMENT 'Title for Thank-you page (header title tag, and display at the top of the page).'",
+ 'thankyou_text' => "text COMMENT 'text and html allowed. displayed above result on success page'",
+ 'thankyou_footer' => "text COMMENT 'Text and html allowed. displayed at the bottom of the success page. Common usage is to include link(s) to other pages such as tell-a-friend, etc.'",
+ 'receipt_from_name' => "varchar(255) COMMENT 'FROM email name used for receipts generated by contributions to this contribution page.'",
+ 'receipt_text' => "text COMMENT 'text to include above standard receipt info on receipt email. emails are text-only, so do not allow html for now'",
+ 'footer_text' => "text COMMENT 'Text and html allowed. Displayed at the bottom of the first page of the contribution wizard.'",
+ 'frontend_title' => "varchar(255) DEFAULT NULL COMMENT 'Contribution Page Public title'",
+ ],
+ 'civicrm_product' => [
+ 'name' => "varchar(255) NOT NULL COMMENT 'Required product/premium name'",
+ 'description' => "text COMMENT 'Optional description of the product/premium.'",
+ 'options' => "text COMMENT 'Store comma-delimited list of color, size, etc. options for the product.'",
+ ],
+ 'civicrm_payment_processor' => [
+ 'title' => "varchar(255) NOT NULL COMMENT 'Name of processor when shown to CiviCRM administrators.'",
+ 'frontend_title' => "varchar(255) NOT NULL COMMENT 'Name of processor when shown to users making a payment.'",
+ ],
+ 'civicrm_membership_type' => [
+ 'name' => "varchar(128) NOT NULL COMMENT 'Name of Membership Type'",
+ 'description' => "varchar(255) COMMENT 'Description of Membership Type'",
+ ],
+ 'civicrm_membership_block' => [
+ 'new_title' => "varchar(255) COMMENT 'Title to display at top of block'",
+ 'new_text' => "text COMMENT 'Text to display below title'",
+ 'renewal_title' => "varchar(255) COMMENT 'Title for renewal'",
+ 'renewal_text' => "text COMMENT 'Text to display for member renewal'",
+ ],
+ 'civicrm_price_set' => [
+ 'title' => "varchar(255) NOT NULL COMMENT 'Displayed title for the Price Set.'",
+ 'help_pre' => "text COMMENT 'Description and/or help text to display before fields in form.'",
+ 'help_post' => "text COMMENT 'Description and/or help text to display after fields in form.'",
+ ],
+ 'civicrm_dashboard' => [
+ 'label' => "varchar(255) COMMENT 'dashlet title'",
+ ],
+ 'civicrm_uf_group' => [
+ 'title' => "varchar(64) NOT NULL COMMENT 'Form title.'",
+ 'frontend_title' => "varchar(64) COMMENT 'Profile Form Public title'",
+ 'help_pre' => "text COMMENT 'Description and/or help text to display before fields in form.'",
+ 'help_post' => "text COMMENT 'Description and/or help text to display after fields in form.'",
+ 'cancel_button_text' => "varchar(64) DEFAULT NULL COMMENT 'Custom Text to display on the Cancel button when used in create or edit mode'",
+ 'submit_button_text' => "varchar(64) DEFAULT NULL COMMENT 'Custom Text to display on the submit button on profile edit/create screens'",
+ ],
+ 'civicrm_uf_field' => [
+ 'help_post' => "text COMMENT 'Description and/or help text to display after this field.'",
+ 'help_pre' => "text COMMENT 'Description and/or help text to display before this field.'",
+ 'label' => "varchar(255) NOT NULL COMMENT 'To save label for fields.'",
+ ],
+ 'civicrm_price_field' => [
+ 'label' => "varchar(255) NOT NULL COMMENT 'Text for form field label (also friendly name for administering this field).'",
+ 'help_pre' => "text COMMENT 'Description and/or help text to display before this field.'",
+ 'help_post' => "text COMMENT 'Description and/or help text to display after this field.'",
+ ],
+ 'civicrm_price_field_value' => [
+ 'label' => "varchar(255) DEFAULT NULL COMMENT 'Price field option label'",
+ 'description' => "text DEFAULT NULL COMMENT 'Price field option description.'",
+ 'help_pre' => "text DEFAULT NULL COMMENT 'Price field option pre help text.'",
+ 'help_post' => "text DEFAULT NULL COMMENT 'Price field option post field help.'",
+ ],
+ 'civicrm_pcp_block' => [
+ 'link_text' => "varchar(255) DEFAULT NULL COMMENT 'Link text for PCP.'",
+ ],
+ 'civicrm_event' => [
+ 'title' => "varchar(255) COMMENT 'Event Title (e.g. Fall Fundraiser Dinner)'",
+ 'summary' => "text COMMENT 'Brief summary of event. Text and html allowed. Displayed on Event Registration form and can be used on other CMS pages which need an event summary.'",
+ 'description' => "text COMMENT 'Full description of event. Text and html allowed. Displayed on built-in Event Information screens.'",
+ 'registration_link_text' => "varchar(255) COMMENT 'Text for link to Event Registration form which is displayed on Event Information screen when is_online_registration is true.'",
+ 'event_full_text' => "text COMMENT 'Message to display on Event Information page and INSTEAD OF Event Registration form if maximum participants are signed up. Can include email address/info about getting on a waiting list, etc. Text and html allowed.'",
+ 'fee_label' => "varchar(255)",
+ 'intro_text' => "text COMMENT 'Introductory message for Event Registration page. Text and html allowed. Displayed at the top of Event Registration form.'",
+ 'footer_text' => "text COMMENT 'Footer message for Event Registration page. Text and html allowed. Displayed at the bottom of Event Registration form.'",
+ 'confirm_title' => "varchar(255) DEFAULT NULL COMMENT 'Title for Confirmation page.'",
+ 'confirm_text' => "text COMMENT 'Introductory message for Event Registration page. Text and html allowed. Displayed at the top of Event Registration form.'",
+ 'confirm_footer_text' => "text COMMENT 'Footer message for Event Registration page. Text and html allowed. Displayed at the bottom of Event Registration form.'",
+ 'confirm_email_text' => "text COMMENT 'text to include above standard event info on confirmation email. emails are text-only, so do not allow html for now'",
+ 'confirm_from_name' => "varchar(255) COMMENT 'FROM email name used for confirmation emails.'",
+ 'thankyou_title' => "varchar(255) DEFAULT NULL COMMENT 'Title for ThankYou page.'",
+ 'thankyou_text' => "text COMMENT 'ThankYou Text.'",
+ 'thankyou_footer_text' => "text COMMENT 'Footer message.'",
+ 'pay_later_text' => "text COMMENT 'The text displayed to the user in the main form'",
+ 'pay_later_receipt' => "text COMMENT 'The receipt sent to the user instead of the normal receipt text'",
+ 'initial_amount_label' => "varchar(255) COMMENT 'Initial amount label for partial payment'",
+ 'initial_amount_help_text' => "text COMMENT 'Initial amount help text for partial payment'",
+ 'waitlist_text' => "text COMMENT 'Text to display when the event is full, but participants can signup for a waitlist.'",
+ 'approval_req_text' => "text COMMENT 'Text to display when the approval is required to complete registration for an event.'",
+ 'template_title' => "varchar(255) COMMENT 'Event Template Title'",
+ ],
+ ];
+ }
+ return $result;
+ }
+
+ /**
+ * Get a table indexed array of the indices for translatable fields.
+ *
+ * @return array
+ * Indices for translatable fields.
+ */
+ public static function &indices() {
+ static $result = NULL;
+ if (!$result) {
+ $result = [
+ 'civicrm_custom_group' => [
+ 'UI_title_extends' => [
+ 'name' => 'UI_title_extends',
+ 'field' => [
+ 'title',
+ 'extends',
+ ],
+ 'unique' => 1,
+ ],
+ ],
+ 'civicrm_custom_field' => [
+ 'UI_label_custom_group_id' => [
+ 'name' => 'UI_label_custom_group_id',
+ 'field' => [
+ 'label',
+ 'custom_group_id',
+ ],
+ 'unique' => 1,
+ ],
+ ],
+ 'civicrm_group' => [
+ 'UI_title' => [
+ 'name' => 'UI_title',
+ 'field' => [
+ 'title',
+ ],
+ 'unique' => 1,
+ ],
+ ],
+ ];
+ }
+ return $result;
+ }
+
+ /**
+ * Get tables with translatable fields.
+ *
+ * @return array
+ * Array of names of tables with fields that can be translated.
+ */
+ public static function &tables() {
+ static $result = NULL;
+ if (!$result) {
+ $result = array_keys(self::columns());
+ }
+ return $result;
+ }
+
+ /**
+ * Get a list of widgets for editing translatable fields.
+ *
+ * @return array
+ * Array of the widgets for editing translatable fields.
+ */
+ public static function &widgets() {
+ static $result = NULL;
+ if (!$result) {
+ $result = [
+ 'civicrm_location_type' => [
+ 'display_name' => [
+ 'type' => "Text",
+ ],
+ ],
+ 'civicrm_option_group' => [
+ 'title' => [
+ 'type' => "Text",
+ ],
+ 'description' => [
+ 'type' => "Text",
+ ],
+ ],
+ 'civicrm_relationship_type' => [
+ 'label_a_b' => [
+ 'type' => "Text",
+ ],
+ 'label_b_a' => [
+ 'type' => "Text",
+ ],
+ 'description' => [
+ 'type' => "Text",
+ ],
+ ],
+ 'civicrm_contact_type' => [
+ 'label' => [
+ 'label' => "Label",
+ 'type' => "Text",
+ ],
+ 'description' => [
+ 'type' => "TextArea",
+ 'rows' => "2",
+ 'cols' => "60",
+ ],
+ ],
+ 'civicrm_batch' => [
+ 'title' => [
+ 'type' => "Text",
+ ],
+ 'description' => [
+ 'type' => "TextArea",
+ 'rows' => "4",
+ 'cols' => "80",
+ ],
+ ],
+ 'civicrm_premiums' => [
+ 'premiums_intro_title' => [
+ 'type' => "Text",
+ ],
+ 'premiums_intro_text' => [
+ 'type' => "Text",
+ ],
+ 'premiums_nothankyou_label' => [
+ 'type' => "Text",
+ ],
+ ],
+ 'civicrm_membership_status' => [
+ 'label' => [
+ 'type' => "Text",
+ ],
+ ],
+ 'civicrm_survey' => [
+ 'title' => [
+ 'type' => "Text",
+ 'required' => "true",
+ ],
+ 'instructions' => [
+ 'type' => "TextArea",
+ 'rows' => "20",
+ 'cols' => "80",
+ ],
+ 'thankyou_title' => [
+ 'type' => "Text",
+ ],
+ 'thankyou_text' => [
+ 'type' => "TextArea",
+ 'rows' => "8",
+ 'cols' => "60",
+ ],
+ ],
+ 'civicrm_participant_status_type' => [
+ 'label' => [
+ 'type' => "Text",
+ ],
+ ],
+ 'civicrm_case_type' => [
+ 'title' => [
+ 'type' => "Text",
+ 'required' => "true",
+ ],
+ 'description' => [
+ 'type' => "Text",
+ ],
+ ],
+ 'civicrm_tell_friend' => [
+ 'title' => [
+ 'type' => "Text",
+ ],
+ 'intro' => [
+ 'type' => "Text",
+ ],
+ 'suggested_message' => [
+ 'type' => "Text",
+ ],
+ 'thankyou_title' => [
+ 'type' => "Text",
+ ],
+ 'thankyou_text' => [
+ 'type' => "Text",
+ ],
+ ],
+ 'civicrm_custom_group' => [
+ 'title' => [
+ 'type' => "Text",
+ 'required' => "true",
+ ],
+ 'help_pre' => [
+ 'type' => "TextArea",
+ 'rows' => "4",
+ 'cols' => "80",
+ ],
+ 'help_post' => [
+ 'type' => "TextArea",
+ 'rows' => "4",
+ 'cols' => "80",
+ ],
+ ],
+ 'civicrm_custom_field' => [
+ 'label' => [
+ 'type' => "Text",
+ 'required' => "true",
+ ],
+ 'help_pre' => [
+ 'type' => "Text",
+ ],
+ 'help_post' => [
+ 'type' => "Text",
+ ],
+ ],
+ 'civicrm_option_value' => [
+ 'label' => [
+ 'type' => "Text",
+ 'required' => "true",
+ ],
+ 'description' => [
+ 'type' => "TextArea",
+ 'rows' => "8",
+ 'cols' => "60",
+ ],
+ ],
+ 'civicrm_group' => [
+ 'title' => [
+ 'type' => "Text",
+ ],
+ 'frontend_title' => [
+ 'type' => "Text",
+ ],
+ 'frontend_description' => [
+ 'type' => "TextArea",
+ 'rows' => "2",
+ 'cols' => "60",
+ ],
+ ],
+ 'civicrm_contribution_page' => [
+ 'title' => [
+ 'type' => "Text",
+ ],
+ 'intro_text' => [
+ 'type' => "RichTextEditor",
+ 'rows' => "6",
+ 'cols' => "50",
+ ],
+ 'pay_later_text' => [
+ 'type' => "Text",
+ ],
+ 'pay_later_receipt' => [
+ 'type' => "Text",
+ ],
+ 'initial_amount_label' => [
+ 'label' => "Initial Amount Label",
+ ],
+ 'initial_amount_help_text' => [
+ 'label' => "Initial Amount Help Text",
+ ],
+ 'thankyou_title' => [
+ 'type' => "Text",
+ ],
+ 'thankyou_text' => [
+ 'type' => "RichTextEditor",
+ 'rows' => "8",
+ 'cols' => "60",
+ ],
+ 'thankyou_footer' => [
+ 'type' => "RichTextEditor",
+ 'rows' => "8",
+ 'cols' => "60",
+ ],
+ 'receipt_from_name' => [
+ 'type' => "Text",
+ ],
+ 'receipt_text' => [
+ 'type' => "TextArea",
+ 'rows' => "6",
+ 'cols' => "50",
+ ],
+ 'footer_text' => [
+ 'type' => "RichTextEditor",
+ 'rows' => "6",
+ 'cols' => "50",
+ ],
+ 'frontend_title' => [
+ 'type' => "Text",
+ ],
+ ],
+ 'civicrm_product' => [
+ 'name' => [
+ 'type' => "Text",
+ 'required' => "true",
+ ],
+ 'description' => [
+ 'type' => "Text",
+ ],
+ 'options' => [
+ 'type' => "Text",
+ ],
+ ],
+ 'civicrm_payment_processor' => [
+ 'title' => [
+ 'label' => "Backend Title",
+ 'type' => "Text",
+ 'required' => "true",
+ ],
+ 'frontend_title' => [
+ 'label' => "Frontend Title",
+ 'type' => "Text",
+ 'required' => "true",
+ ],
+ ],
+ 'civicrm_membership_type' => [
+ 'name' => [
+ 'type' => "Text",
+ 'label' => "Name",
+ 'required' => "true",
+ ],
+ 'description' => [
+ 'type' => "TextArea",
+ 'rows' => "6",
+ 'cols' => "50",
+ 'label' => "Description",
+ ],
+ ],
+ 'civicrm_membership_block' => [
+ 'new_title' => [
+ 'type' => "Text",
+ ],
+ 'new_text' => [
+ 'type' => "Text",
+ ],
+ 'renewal_title' => [
+ 'type' => "Text",
+ ],
+ 'renewal_text' => [
+ 'type' => "Text",
+ ],
+ ],
+ 'civicrm_price_set' => [
+ 'title' => [
+ 'type' => "Text",
+ 'required' => "true",
+ ],
+ 'help_pre' => [
+ 'type' => "TextArea",
+ 'rows' => "4",
+ 'cols' => "80",
+ ],
+ 'help_post' => [
+ 'type' => "TextArea",
+ 'rows' => "4",
+ 'cols' => "80",
+ ],
+ ],
+ 'civicrm_dashboard' => [
+ 'label' => [
+ 'type' => "Text",
+ ],
+ ],
+ 'civicrm_uf_group' => [
+ 'title' => [
+ 'type' => "Text",
+ 'required' => "true",
+ ],
+ 'frontend_title' => [
+ 'type' => "Text",
+ ],
+ 'help_pre' => [
+ 'type' => "TextArea",
+ 'rows' => "4",
+ 'cols' => "80",
+ 'label' => "Pre Help",
+ ],
+ 'help_post' => [
+ 'type' => "TextArea",
+ 'rows' => "4",
+ 'cols' => "80",
+ ],
+ 'cancel_button_text' => [
+ 'type' => "Text",
+ ],
+ 'submit_button_text' => [
+ 'type' => "Text",
+ ],
+ ],
+ 'civicrm_uf_field' => [
+ 'help_post' => [
+ 'type' => "Text",
+ ],
+ 'help_pre' => [
+ 'type' => "Text",
+ ],
+ 'label' => [
+ 'type' => "Text",
+ 'required' => "true",
+ ],
+ ],
+ 'civicrm_price_field' => [
+ 'label' => [
+ 'type' => "Text",
+ 'required' => "true",
+ ],
+ 'help_pre' => [
+ 'type' => "TextArea",
+ 'rows' => "4",
+ 'cols' => "80",
+ ],
+ 'help_post' => [
+ 'type' => "TextArea",
+ 'rows' => "4",
+ 'cols' => "80",
+ ],
+ ],
+ 'civicrm_price_field_value' => [
+ 'label' => [
+ 'type' => "Text",
+ ],
+ 'description' => [
+ 'type' => "TextArea",
+ 'rows' => "2",
+ 'cols' => "60",
+ 'label' => "Description",
+ ],
+ 'help_pre' => [
+ 'type' => "TextArea",
+ 'rows' => "2",
+ 'cols' => "60",
+ 'label' => "Pre Help",
+ ],
+ 'help_post' => [
+ 'type' => "TextArea",
+ 'rows' => "2",
+ 'cols' => "60",
+ 'label' => "Post Help",
+ ],
+ ],
+ 'civicrm_pcp_block' => [
+ 'link_text' => [
+ 'type' => "Text",
+ ],
+ ],
+ 'civicrm_event' => [
+ 'title' => [
+ 'label' => "Title",
+ 'type' => "Text",
+ ],
+ 'summary' => [
+ 'label' => "Summary",
+ 'type' => "TextArea",
+ 'rows' => "4",
+ 'cols' => "60",
+ ],
+ 'description' => [
+ 'label' => "Description",
+ 'type' => "RichTextEditor",
+ 'rows' => "8",
+ 'cols' => "60",
+ ],
+ 'registration_link_text' => [
+ 'type' => "Text",
+ ],
+ 'event_full_text' => [
+ 'label' => "Event Full Message",
+ 'type' => "TextArea",
+ 'rows' => "4",
+ 'cols' => "60",
+ ],
+ 'fee_label' => [
+ 'type' => "Text",
+ ],
+ 'intro_text' => [
+ 'type' => "RichTextEditor",
+ 'rows' => "6",
+ 'cols' => "50",
+ ],
+ 'footer_text' => [
+ 'type' => "RichTextEditor",
+ 'rows' => "6",
+ 'cols' => "50",
+ ],
+ 'confirm_title' => [
+ 'type' => "Text",
+ ],
+ 'confirm_text' => [
+ 'type' => "RichTextEditor",
+ 'rows' => "6",
+ 'cols' => "50",
+ ],
+ 'confirm_footer_text' => [
+ 'type' => "RichTextEditor",
+ 'rows' => "6",
+ 'cols' => "50",
+ ],
+ 'confirm_email_text' => [
+ 'type' => "TextArea",
+ 'rows' => "4",
+ 'cols' => "50",
+ ],
+ 'confirm_from_name' => [
+ 'type' => "Text",
+ ],
+ 'thankyou_title' => [
+ 'type' => "Text",
+ ],
+ 'thankyou_text' => [
+ 'type' => "RichTextEditor",
+ 'rows' => "6",
+ 'cols' => "50",
+ ],
+ 'thankyou_footer_text' => [
+ 'type' => "RichTextEditor",
+ 'rows' => "6",
+ 'cols' => "50",
+ ],
+ 'pay_later_text' => [
+ 'type' => "RichTextEditor",
+ ],
+ 'pay_later_receipt' => [
+ 'type' => "Text",
+ ],
+ 'initial_amount_label' => [
+ 'type' => "Text",
+ ],
+ 'initial_amount_help_text' => [
+ 'type' => "Text",
+ ],
+ 'waitlist_text' => [
+ 'type' => "TextArea",
+ 'rows' => "4",
+ 'cols' => "60",
+ 'label' => "Waitlist Text",
+ ],
+ 'approval_req_text' => [
+ 'type' => "TextArea",
+ 'rows' => "4",
+ 'cols' => "60",
+ 'label' => "Approval Required Text",
+ ],
+ 'template_title' => [
+ 'type' => "Text",
+ ],
+ ],
+ ];
+ }
+ return $result;
+ }
+
+}
public static $_defaultPaymentProcessor = NULL;
/**
- * Create Payment Processor.
+ * @deprecated
*
* @param array $params
- * Parameters for Processor entity.
*
* @return CRM_Financial_DAO_PaymentProcessor
- *
- * @throws \CRM_Core_Exception
*/
public static function create(array $params): CRM_Financial_DAO_PaymentProcessor {
- // If we are creating a new PaymentProcessor and have not specified the payment instrument to use, get the default from the Payment Processor Type.
- if (empty($params['id']) && empty($params['payment_instrument_id'])) {
- $params['payment_instrument_id'] = civicrm_api3('PaymentProcessorType', 'getvalue', [
- 'id' => $params['payment_processor_type_id'],
- 'return' => 'payment_instrument_id',
- ]);
- }
- $processor = new CRM_Financial_DAO_PaymentProcessor();
- $processor->copyValues($params);
-
- if (empty($params['id'])) {
- $ppTypeDAO = new CRM_Financial_DAO_PaymentProcessorType();
- $ppTypeDAO->id = $params['payment_processor_type_id'];
- if (!$ppTypeDAO->find(TRUE)) {
- throw new CRM_Core_Exception(ts('Could not find payment processor meta information'));
- }
-
- // also copy meta fields from the info DAO
- $processor->is_recur = $ppTypeDAO->is_recur;
- $processor->billing_mode = $ppTypeDAO->billing_mode;
- $processor->class_name = $ppTypeDAO->class_name;
- $processor->payment_type = $ppTypeDAO->payment_type;
- }
-
- $processor->save();
- // CRM-11826, add entry in civicrm_entity_financial_account
- // if financial_account_id is not NULL
- if (!empty($params['financial_account_id'])) {
- $relationTypeId = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE 'Asset Account is' "));
- $values = [
- 'entity_table' => 'civicrm_payment_processor',
- 'entity_id' => $processor->id,
- 'account_relationship' => $relationTypeId,
- 'financial_account_id' => $params['financial_account_id'],
- ];
- CRM_Financial_BAO_EntityFinancialAccount::add($values);
- }
-
- if (isset($params['id']) && isset($params['is_active']) && !isset($params['is_test'])) {
- // check if is_active has changed & if so update test instance is_active too.
- $test_id = self::getTestProcessorId($params['id']);
- $testDAO = new CRM_Financial_DAO_PaymentProcessor();
- $testDAO->id = $test_id;
- if ($testDAO->find(TRUE)) {
- $testDAO->is_active = $params['is_active'];
- $testDAO->save();
- }
- }
-
- Civi\Payment\System::singleton()->flushProcessors();
- return $processor;
+ return self::writeRecord($params);
}
/**
static::deleteRecord(['id' => $paymentProcessorID]);
}
+ /**
+ * Callback for hook_civicrm_pre().
+ * @param \Civi\Core\Event\PreEvent $event
+ */
+ public static function self_hook_civicrm_pre(\Civi\Core\Event\PreEvent $event) {
+ if ($event->action === 'create') {
+ // If we are creating a new PaymentProcessor and have not specified the payment instrument to use, get the default from the Payment Processor Type.
+ if (empty($event->params['payment_instrument_id'])) {
+ $event->params['payment_instrument_id'] = civicrm_api3('PaymentProcessorType', 'getvalue', [
+ 'id' => $event->params['payment_processor_type_id'],
+ 'return' => 'payment_instrument_id',
+ ]);
+ }
+ // Supply defaults for `title` and `frontend_title`
+ if (!isset($event->params['title'])) {
+ $event->params['title'] = $event->params['name'];
+ }
+ if (!isset($event->params['frontend_title'])) {
+ $event->params['frontend_title'] = $event->params['title'];
+ }
+
+ // also copy meta fields from the ppType DAO
+ $ppTypeDAO = new CRM_Financial_DAO_PaymentProcessorType();
+ $ppTypeDAO->id = $event->params['payment_processor_type_id'];
+ if (!$ppTypeDAO->find(TRUE)) {
+ throw new CRM_Core_Exception(ts('Could not find payment processor meta information'));
+ }
+ $event->params['is_recur'] = $ppTypeDAO->is_recur;
+ $event->params['billing_mode'] = $ppTypeDAO->billing_mode;
+ $event->params['class_name'] = $ppTypeDAO->class_name;
+ $event->params['payment_type'] = $ppTypeDAO->payment_type;
+ }
+ }
+
/**
* Callback for hook_civicrm_post().
* @param \Civi\Core\Event\PostEvent $event
*/
public static function self_hook_civicrm_post(\Civi\Core\Event\PostEvent $event) {
+ if ($event->action === 'create' || $event->action === 'edit') {
+ // CRM-11826, add entry in civicrm_entity_financial_account
+ // if financial_account_id is not NULL
+ if (!empty($event->params['financial_account_id'])) {
+ $relationTypeId = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE 'Asset Account is' "));
+ $values = [
+ 'entity_table' => 'civicrm_payment_processor',
+ 'entity_id' => $event->id,
+ 'account_relationship' => $relationTypeId,
+ 'financial_account_id' => $event->params['financial_account_id'],
+ ];
+ CRM_Financial_BAO_EntityFinancialAccount::add($values);
+ }
+ }
+ if ($event->action === 'edit') {
+ // check if is_active has changed & if so update test instance is_active too.
+ if (isset($event->object->is_active) && empty($event->object->is_test)) {
+ $test_id = self::getTestProcessorId($event->id);
+ $testDAO = new CRM_Financial_DAO_PaymentProcessor();
+ $testDAO->id = $test_id;
+ if ($testDAO->find(TRUE)) {
+ $testDAO->is_active = $event->object->is_active;
+ $testDAO->save();
+ }
+ }
+ }
if ($event->action === 'delete') {
// When a paymentProcessor is deleted, delete the associated test processor
$testDAO = new CRM_Financial_DAO_PaymentProcessor();
$testDAO->name = $event->object->name;
$testDAO->is_test = 1;
$testDAO->delete();
-
- Civi\Payment\System::singleton()->flushProcessors();
}
+ Civi\Payment\System::singleton()->flushProcessors();
}
/**
*
* Generated from xml/schema/CRM/Financial/PaymentProcessor.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:ab188763651019a650ed4e4a7d212efe)
+ * (GenCodeChecksum:beafb7d7c0f62e3e4ba0367d7b7f58af)
*/
/**
/**
* Payment Processor Name.
*
- * @var string|null
+ * @var string
* (SQL type: varchar(64))
* Note that values will be retrieved from the database as a string.
*/
public $name;
/**
- * Payment Processor Descriptive Name.
+ * Name of processor when shown to CiviCRM administrators.
*
- * @var string|null
- * (SQL type: varchar(127))
+ * @var string
+ * (SQL type: varchar(255))
* Note that values will be retrieved from the database as a string.
*/
public $title;
/**
- * Payment Processor Description.
+ * Name of processor when shown to users making a payment.
+ *
+ * @var string
+ * (SQL type: varchar(255))
+ * Note that values will be retrieved from the database as a string.
+ */
+ public $frontend_title;
+
+ /**
+ * Additional processor information shown to administrators.
*
* @var string|null
* (SQL type: varchar(255))
'name' => [
'name' => 'name',
'type' => CRM_Utils_Type::T_STRING,
- 'title' => ts('Payment Processor'),
+ 'title' => ts('Payment Processor Name'),
'description' => ts('Payment Processor Name.'),
+ 'required' => TRUE,
'maxlength' => 64,
'size' => CRM_Utils_Type::BIG,
'usage' => [
'localizable' => 0,
'html' => [
'type' => 'Text',
+ 'label' => ts("Machine Name"),
],
'add' => '1.8',
],
'name' => 'title',
'type' => CRM_Utils_Type::T_STRING,
'title' => ts('Payment Processor Title'),
- 'description' => ts('Payment Processor Descriptive Name.'),
- 'maxlength' => 127,
+ 'description' => ts('Name of processor when shown to CiviCRM administrators.'),
+ 'required' => TRUE,
+ 'maxlength' => 255,
'size' => CRM_Utils_Type::HUGE,
'usage' => [
'import' => FALSE,
'localizable' => 1,
'html' => [
'type' => 'Text',
+ 'label' => ts("Backend Title"),
],
'add' => '5.13',
],
+ 'frontend_title' => [
+ 'name' => 'frontend_title',
+ 'type' => CRM_Utils_Type::T_STRING,
+ 'title' => ts('Payment Processor Frontend Title'),
+ 'description' => ts('Name of processor when shown to users making a payment.'),
+ 'required' => TRUE,
+ 'maxlength' => 255,
+ 'size' => CRM_Utils_Type::HUGE,
+ 'usage' => [
+ 'import' => FALSE,
+ 'export' => FALSE,
+ 'duplicate_matching' => FALSE,
+ 'token' => FALSE,
+ ],
+ 'where' => 'civicrm_payment_processor.frontend_title',
+ 'table_name' => 'civicrm_payment_processor',
+ 'entity' => 'PaymentProcessor',
+ 'bao' => 'CRM_Financial_BAO_PaymentProcessor',
+ 'localizable' => 1,
+ 'html' => [
+ 'type' => 'Text',
+ 'label' => ts("Frontend Title"),
+ ],
+ 'add' => '5.61',
+ ],
'description' => [
'name' => 'description',
'type' => CRM_Utils_Type::T_STRING,
'title' => ts('Processor Description'),
- 'description' => ts('Payment Processor Description.'),
+ 'description' => ts('Additional processor information shown to administrators.'),
'maxlength' => 255,
'size' => CRM_Utils_Type::HUGE,
'usage' => [
'localizable' => 0,
'html' => [
'type' => 'Text',
+ 'label' => ts("Description"),
],
'add' => '1.8',
],
* The version number matching this function name
*/
public function upgrade_5_61_alpha1($rev): void {
+ // First add `frontend_title` column *without* NOT NULL constraint
+ $this->addTask('Add frontend_title to civicrm_payment_processor', 'addColumn',
+ 'civicrm_payment_processor', 'frontend_title', "varchar(255) COMMENT 'Name of processor when shown to users making a payment.'", TRUE, '5.61.alpha1'
+ );
+ // Sql contains updates to fill paymentProcessor title & frontend_title
$this->addTask(ts('Upgrade DB to %1: SQL', [1 => $rev]), 'runSql', $rev);
+ $this->addTask('Make PaymentProcessor.name required', 'alterColumn', 'civicrm_payment_processor', 'name', "varchar(64) NOT NULL COMMENT 'Payment Processor Name.'");
+ $this->addTask('Make PaymentProcessor.title required', 'alterColumn', 'civicrm_payment_processor', 'title', "varchar(255) NOT NULL COMMENT 'Name of processor when shown to CiviCRM administrators.'", TRUE);
+ $this->addTask('Make PaymentProcessor.frontend_title required', 'alterColumn', 'civicrm_payment_processor', 'frontend_title', "varchar(255) NOT NULL COMMENT 'Name of processor when shown to users making a payment.'", TRUE);
+
$this->addTask(ts('Dedupe cache table'), 'dedupeCache');
$this->addTask(ts('Drop index %1', [1 => 'civicrm_cache.UI_group_path_date']), 'dropIndex', 'civicrm_cache', 'UI_group_path_date');
$this->addTask(ts('Create index %1', [1 => 'civicrm_cache.UI_group_name_path']), 'addIndex', 'civicrm_cache', [['group_name', 'path']], 'UI');
{* file to handle db changes in 5.61.alpha1 during upgrade *}
+
+{* https://github.com/civicrm/civicrm-core/pull/25873 *}
+UPDATE civicrm_payment_processor
+ SET {localize field="frontend_title,title"}frontend_title = COALESCE(title, name){/localize};
+
+UPDATE civicrm_payment_processor
+ SET {localize field="title"}title = name{/localize};
* The unique identifier for the object.
* @param object $objectRef
* The reference to the object if available.
+ * @param array $params
+ * Original params used, if available
*
* @return mixed
* based on op. pre-hooks return a boolean or
* an error message which aborts the operation
*/
- public static function post($op, $objectName, $objectId, &$objectRef = NULL) {
- $event = new \Civi\Core\Event\PostEvent($op, $objectName, $objectId, $objectRef);
+ public static function post($op, $objectName, $objectId, &$objectRef = NULL, $params = NULL) {
+ $event = new \Civi\Core\Event\PostEvent($op, $objectName, $objectId, $objectRef, $params);
Civi::dispatcher()->dispatch('hook_civicrm_post', $event);
return $event->getReturnValues();
}
* @inheritDoc
*/
public function modifySpec(RequestSpec $spec) {
+ // Name is autogenerated from title if missing
+ $spec->getFieldByName('name')->setRequired(FALSE)->setRequiredIf('empty($values.title)');
+ // Title is supplied from name if missing
+ $spec->getFieldByName('title')->setRequired(FALSE)->setRequiredIf('empty($values.name)');
+ // Frontend_title is copied from title if missing
+ $spec->getFieldByName('frontend_title')->setRequired(FALSE);
+
// Billing mode is copied across from the payment processor type field in the BAO::create function.
$spec->getFieldByName('billing_mode')->setRequired(FALSE);
public $id;
/**
- * @var Object
+ * @var CRM_Core_DAO
*/
public $object;
+ /**
+ * @var array
+ */
+ public $params;
+
/**
* Class constructor
*
* @param string $entity
* @param int $id
* @param object $object
+ * @param array $params
*/
- public function __construct($action, $entity, $id, &$object) {
+ public function __construct($action, $entity, $id, &$object, $params = NULL) {
$this->action = $action;
$this->entity = $entity;
$this->id = $id;
$this->object = &$object;
+ $this->params = $params;
}
/**
* @inheritDoc
*/
public function getHookValues() {
- return [$this->action, $this->entity, $this->id, &$this->object];
+ return [$this->action, $this->entity, $this->id, &$this->object, $this->params];
}
}
function payment_processor_create_example() {
$params = [
'name' => 'API Test PP',
+ 'title' => 'API Test PP',
'payment_processor_type_id' => 1,
'class_name' => 'CRM_Core_Payment_APITest',
'is_recur' => 0,
*/
public function createPaymentProcessor(array $params = []): int {
$params = array_merge([
- 'name' => 'demo',
+ 'title' => $params['name'] ?? 'demo',
'domain_id' => CRM_Core_Config::domainID(),
'payment_processor_type_id' => 'PayPal',
'is_active' => 1,
public function setUpElavonProcessor(): void {
$params = [
'name' => 'demo',
+ 'title' => 'demo',
'domain_id' => CRM_Core_Config::domainID(),
'payment_processor_type_id' => 'Elavon',
'is_active' => 1,
public function setUpEwayProcessor(): void {
$params = [
'name' => 'demo',
+ 'title' => 'demo',
'domain_id' => CRM_Core_Config::domainID(),
'payment_processor_type_id' => 'eWAY',
'is_active' => 1,
$this->callAPISuccess('PaymentProcessorType', 'create', ['id' => $paymentProcessorType['id'], 'is_active' => 1]);
$params = [
'name' => 'demo',
+ 'title' => 'demo',
'domain_id' => CRM_Core_Config::domainID(),
'payment_processor_type_id' => 'PayflowPro',
'is_active' => 1,
SELECT @ppTypeID := id FROM civicrm_payment_processor_type WHERE name = 'PayPal';
-INSERT INTO `civicrm_payment_processor` (`id`, `name`, `description`, `payment_processor_type_id`, `is_active`, `is_default`, `is_test`, `user_name`, `password`, `signature`, `url_site`, `url_api`, `url_recur`, `url_button`, `subject`, `class_name`, `billing_mode`, `is_recur`, `domain_id`) VALUES (3, 'PP Pro', '', @ppTypeID, 1, 1, 0, 'xxx', 'yyy', 'zzz', 'https://www.paypal.com/', 'https://api-3t.paypal.com/', NULL, 'https://www.paypal.com/en_US/i/btn/btn_xpressCheckout.gif', NULL, 'Payment_PayPalImpl', 3, 1, 1);
-INSERT INTO `civicrm_payment_processor` (`id`, `name`, `description`, `payment_processor_type_id`, `is_active`, `is_default`, `is_test`, `user_name`, `password`, `signature`, `url_site`, `url_api`, `url_recur`, `url_button`, `subject`, `class_name`, `billing_mode`, `is_recur`, `domain_id`) VALUES (4, 'PP Pro', '', @ppTypeID, 1, 0, 1, 'dave_api1.northtower.com', 'S5YW42RS7WRWT9AD', 'AUsrQDMAfRs6zQSEYuw3M4QDuTBHAAvpXf7N0jYi8G1UCfKRI2NrvWVM', 'https://www.sandbox.paypal.com/', 'https://api-3t.sandbox.paypal.com/', NULL, 'https://www.paypal.com/en_US/i/btn/btn_xpressCheckout.gif', NULL, 'Payment_PayPalImpl', 3, 1, 1);
+INSERT INTO `civicrm_payment_processor` (`id`, `name`, `frontend_title`, `title`, `description`, `payment_processor_type_id`, `is_active`, `is_default`, `is_test`, `user_name`, `password`, `signature`, `url_site`, `url_api`, `url_recur`, `url_button`, `subject`, `class_name`, `billing_mode`, `is_recur`, `domain_id`) VALUES (3, 'PP Pro', 'PP Pro', 'PP Pro', '', @ppTypeID, 1, 1, 0, 'xxx', 'yyy', 'zzz', 'https://www.paypal.com/', 'https://api-3t.paypal.com/', NULL, 'https://www.paypal.com/en_US/i/btn/btn_xpressCheckout.gif', NULL, 'Payment_PayPalImpl', 3, 1, 1);
+INSERT INTO `civicrm_payment_processor` (`id`, `name`, `frontend_title`, `title`, `description`, `payment_processor_type_id`, `is_active`, `is_default`, `is_test`, `user_name`, `password`, `signature`, `url_site`, `url_api`, `url_recur`, `url_button`, `subject`, `class_name`, `billing_mode`, `is_recur`, `domain_id`) VALUES (4, 'PP Pro', 'PP Pro', 'PP Pro', '', @ppTypeID, 1, 0, 1, 'dave_api1.northtower.com', 'S5YW42RS7WRWT9AD', 'AUsrQDMAfRs6zQSEYuw3M4QDuTBHAAvpXf7N0jYi8G1UCfKRI2NrvWVM', 'https://www.sandbox.paypal.com/', 'https://api-3t.sandbox.paypal.com/', NULL, 'https://www.paypal.com/en_US/i/btn/btn_xpressCheckout.gif', NULL, 'Payment_PayPalImpl', 3, 1, 1);
SET @pp := LAST_INSERT_ID();
SELECT @domainId := MAX(id) FROM civicrm_domain;
INSERT INTO civicrm_payment_processor
- (domain_id, name, payment_processor_type, is_active, is_default, is_test, user_name, class_name, billing_mode) VALUES
- (@domainId, 'dummy', 'Dummy', 1, 1, 0, 'dummy', 'Payment_Dummy', 1),
- (@domainId, 'dummy', 'Dummy', 1, 0, 1, 'dummy', 'Payment_Dummy', 1);
+ (domain_id, name, title, frontend_title, payment_processor_type, is_active, is_default, is_test, user_name, class_name, billing_mode) VALUES
+ (@domainId, 'dummy', 'Dummy', 'Dummy', 'Dummy', 1, 1, 0, 'dummy', 'Payment_Dummy', 1),
+ (@domainId, 'dummy', 'Dummy', 'Dummy', 'Dummy', 1, 0, 1, 'dummy', 'Payment_Dummy', 1);
UPDATE civicrm_preferences SET mailing_backend = 'a:4:{s:15:\"outBound_option\";s:1:\"0\";s:10:\"smtpServer\";s:9:\"localhost\";s:8:\"smtpPort\";s:2:\"25\";s:8:\"smtpAuth\";s:1:\"0\";}';
SELECT @pptype := id FROM civicrm_payment_processor_type WHERE name='Dummy';
-INSERT INTO `civicrm_payment_processor` (`domain_id`, `name`, `description`, `payment_processor_type_id`, `is_active`, `is_default`, `is_test`, `user_name`, `password`, `signature`, `url_site`, `url_api`, `url_recur`, `url_button`, `subject`, `class_name`, `billing_mode`, `is_recur`, `payment_type`) VALUES (1, 'Test Processor', '', @pptype, 1, 1, 0, 'dummy', NULL, NULL, 'http://dummy.com', NULL, 'http://dummyrecur.com', NULL, NULL, 'Payment_Dummy', 1, 1, 1);
-INSERT INTO `civicrm_payment_processor` (`domain_id`, `name`, `description`, `payment_processor_type_id`, `is_active`, `is_default`, `is_test`, `user_name`, `password`, `signature`, `url_site`, `url_api`, `url_recur`, `url_button`, `subject`, `class_name`, `billing_mode`, `is_recur`, `payment_type`) VALUES (1, 'Test Processor', '', @pptype, 1, 1, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'Payment_Dummy', 1, 1, 1);
+INSERT INTO `civicrm_payment_processor` (`domain_id`, `name`, `title`, `frontend_title`, `description`, `payment_processor_type_id`, `is_active`, `is_default`, `is_test`, `user_name`, `password`, `signature`, `url_site`, `url_api`, `url_recur`, `url_button`, `subject`, `class_name`, `billing_mode`, `is_recur`, `payment_type`) VALUES (1, 'Test Processor', 'Test Processor', 'Test Processor', '', @pptype, 1, 1, 0, 'dummy', NULL, NULL, 'http://dummy.com', NULL, 'http://dummyrecur.com', NULL, NULL, 'Payment_Dummy', 1, 1, 1);
+INSERT INTO `civicrm_payment_processor` (`domain_id`, `name`, `title`, `frontend_title`, `description`, `payment_processor_type_id`, `is_active`, `is_default`, `is_test`, `user_name`, `password`, `signature`, `url_site`, `url_api`, `url_recur`, `url_button`, `subject`, `class_name`, `billing_mode`, `is_recur`, `payment_type`) VALUES (1, 'Test Processor', 'Test Processor', 'Test Processor', '', @pptype, 1, 1, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'Payment_Dummy', 1, 1, 1);
SELECT @dp := max(id) from civicrm_payment_processor where name = 'Test Processor' AND is_test = 0;
SELECT @dpTest := max(id) from civicrm_payment_processor where name = 'Test Processor' AND is_test = 1;
CREATE TABLE IF NOT EXISTS `civicrm_value_donor_information_3` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Default MySQL primary key', `entity_id` int(10) unsigned NOT NULL COMMENT 'Table that this extends', `known_areas_of_interest_5` text COLLATE utf8mb4_unicode_ci, `how_long_have_you_been_a_donor_6` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `unique_entity_id` (`entity_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC;
SELECT @pptype := id FROM civicrm_payment_processor_type WHERE name='Dummy';
-INSERT INTO `civicrm_payment_processor` (`domain_id`, `name`, `description`, `payment_processor_type_id`, `is_active`, `is_default`, `is_test`, `user_name`, `password`, `signature`, `url_site`, `url_api`, `url_recur`, `url_button`, `subject`, `class_name`, `billing_mode`, `is_recur`, `payment_type`) VALUES
- (1, 'Test Processor', '', @pptype, 1, 1, 0, 'dummy', NULL, NULL, 'http://dummy.com', NULL, 'http://dummyrecur.com', NULL, NULL, 'Payment_Dummy', 1, 1, 1);
-INSERT INTO `civicrm_payment_processor` (`domain_id`, `name`, `description`, `payment_processor_type_id`, `is_active`, `is_default`, `is_test`, `user_name`, `password`, `signature`, `url_site`, `url_api`, `url_recur`, `url_button`, `subject`, `class_name`, `billing_mode`, `is_recur`, `payment_type`) VALUES
- (1, 'Test Processor', '', @pptype, 1, 1, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'Payment_Dummy', 1, 1, 1);
+INSERT INTO `civicrm_payment_processor` (`domain_id`, `name`, `title`, `frontend_title`, `description`, `payment_processor_type_id`, `is_active`, `is_default`, `is_test`, `user_name`, `password`, `signature`, `url_site`, `url_api`, `url_recur`, `url_button`, `subject`, `class_name`, `billing_mode`, `is_recur`, `payment_type`) VALUES
+ (1, 'Test Processor', 'Test Processor', 'Test Processor', '', @pptype, 1, 1, 0, 'dummy', NULL, NULL, 'http://dummy.com', NULL, 'http://dummyrecur.com', NULL, NULL, 'Payment_Dummy', 1, 1, 1);
+INSERT INTO `civicrm_payment_processor` (`domain_id`, `name`, `title`, `frontend_title`, `description`, `payment_processor_type_id`, `is_active`, `is_default`, `is_test`, `user_name`, `password`, `signature`, `url_site`, `url_api`, `url_recur`, `url_button`, `subject`, `class_name`, `billing_mode`, `is_recur`, `payment_type`) VALUES
+ (1, 'Test Processor', 'Test Processor', 'Test Processor', '', @pptype, 1, 1, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'Payment_Dummy', 1, 1, 1);
SELECT @dp := max(id) from civicrm_payment_processor where name = 'Test Processor' AND is_test = 0;
SELECT @dpTest := max(id) from civicrm_payment_processor where name = 'Test Processor' AND is_test = 1;
'domain_id' => 1,
'payment_processor_type_id' => 'Dummy',
'name' => $pp_name,
+ 'title' => $pp_name,
'user_name' => $pp_name,
'class_name' => 'Payment_Dummy',
'url_site' => 'https://test.com/',
$this->assertDBQuery(1, 'SELECT count(*) FROM civicrm_payment_processor_type WHERE class_name = "test.extension.manager.paymenttest" AND is_active = 1');
$payment_processor_type_id = CRM_Core_DAO::singleValueQuery('SELECT id FROM civicrm_payment_processor_type WHERE class_name = "test.extension.manager.paymenttest"');
- $ppDAO = CRM_Financial_BAO_PaymentProcessor::create([
+ $ppDAO = CRM_Financial_BAO_PaymentProcessor::writeRecord([
+ 'title' => __FUNCTION__,
'payment_processor_type_id' => $payment_processor_type_id,
'domain_id' => CRM_Core_Config::domainID(),
]);
*/
public function paymentProcessorCreate($params = []) {
$params = array_merge([
- 'name' => 'demo',
+ 'title' => $params['name'] ?? 'demo',
'domain_id' => CRM_Core_Config::domainID(),
'payment_processor_type_id' => 'PayPal',
'is_active' => 1,
$this->_processorParams = [
'domain_id' => 1,
'name' => 'Dummy',
+ 'title' => 'Dummy',
'payment_processor_type_id' => CRM_Core_PseudoConstant::getKey('CRM_Financial_BAO_PaymentProcessor', 'payment_processor_type_id', 'Dummy'),
'financial_account_id' => 12,
'is_active' => 1,
$this->_paymentProcessorType = $result['id'];
$this->_params = [
'name' => 'API Test PP',
+ 'title' => 'API Test PP',
'payment_processor_type_id' => $this->_paymentProcessorType,
'class_name' => 'CRM_Core_Payment_APITest',
'is_recur' => 0,
'id' => $result['id'],
'domain_id' => $params['domain_id'],
'name' => $updateParams['name'],
+ 'title' => $params['title'],
+ 'frontend_title' => $params['title'],
'payment_processor_type_id' => $params['payment_processor_type_id'],
'is_default' => 0,
'is_test' => 0,
</foreignKey>
<field>
<name>name</name>
- <title>Payment Processor</title>
+ <title>Payment Processor Name</title>
+ <required>true</required>
<type>varchar</type>
<length>64</length>
<comment>Payment Processor Name.</comment>
<add>1.8</add>
<html>
+ <label>Machine Name</label>
<type>Text</type>
</html>
</field>
<field>
<name>title</name>
<title>Payment Processor Title</title>
+ <required>true</required>
<type>varchar</type>
- <length>127</length>
+ <length>255</length>
<localizable>true</localizable>
<html>
+ <label>Backend Title</label>
<type>Text</type>
</html>
- <comment>Payment Processor Descriptive Name.</comment>
+ <comment>Name of processor when shown to CiviCRM administrators.</comment>
<add>5.13</add>
</field>
+ <field>
+ <name>frontend_title</name>
+ <title>Payment Processor Frontend Title</title>
+ <required>true</required>
+ <type>varchar</type>
+ <length>255</length>
+ <localizable>true</localizable>
+ <html>
+ <label>Frontend Title</label>
+ <type>Text</type>
+ </html>
+ <comment>Name of processor when shown to users making a payment.</comment>
+ <add>5.61</add>
+ </field>
<field>
<name>description</name>
<title>Processor Description</title>
<type>varchar</type>
<length>255</length>
<html>
+ <label>Description</label>
<type>Text</type>
</html>
- <comment>Payment Processor Description.</comment>
+ <comment>Additional processor information shown to administrators.</comment>
<add>1.8</add>
</field>
<field>