dev/core#4213 Make frontend_title required
authorEileen McNaughton <emcnaughton@wikimedia.org>
Mon, 3 Apr 2023 06:16:21 +0000 (18:16 +1200)
committerEileen McNaughton <emcnaughton@wikimedia.org>
Thu, 1 Jun 2023 22:32:50 +0000 (10:32 +1200)
21 files changed:
CRM/Contribute/BAO/ContributionPage.php
CRM/Contribute/DAO/Contribution.php
CRM/Contribute/DAO/ContributionPage.php
CRM/Contribute/Form/Contribution/Confirm.php
CRM/Contribute/Form/ContributionBase.php
CRM/Contribute/Form/ContributionPage/Settings.php
CRM/Core/DAO.php
CRM/Core/I18n/SchemaStructure.php
CRM/Upgrade/Incremental/Base.php
CRM/Upgrade/Incremental/php/FiveSixtyThree.php
CRM/Upgrade/Incremental/sql/5.63.alpha1.mysql.tpl
Civi/Api4/Service/Spec/Provider/PaymentProcessorCreationSpecProvider.php
Civi/Api4/Service/Spec/Provider/TitleFieldSpecProvider.php [new file with mode: 0644]
sql/civicrm_generated.mysql
templates/CRM/Contribute/Form/ContributionPage/Settings.tpl
tests/phpunit/CRM/Contribute/BAO/ContributionPageTest.php
tests/phpunit/CRM/Price/BAO/PriceSetTest.php
tests/phpunit/CRMTraits/Contribute/RecurFormsTrait.php
xml/schema/Contribute/Contribution.xml
xml/schema/Contribute/ContributionPage.xml
xml/templates/civicrm_sample.tpl

index 43a401bdf0afa01126a42be158e4e631352f4fff..94aeb0555658a47a0592f1f2858204d7d116060e 100644 (file)
 
 use Civi\Api4\Contribution;
 use Civi\Api4\LineItem;
+use Civi\Core\Event\PostEvent;
+use Civi\Core\HookInterface;
 
 /**
  * This class contains Contribution Page related functions.
  */
-class CRM_Contribute_BAO_ContributionPage extends CRM_Contribute_DAO_ContributionPage {
+class CRM_Contribute_BAO_ContributionPage extends CRM_Contribute_DAO_ContributionPage implements HookInterface {
 
   /**
    * Creates a contribution page.
@@ -31,25 +33,22 @@ class CRM_Contribute_BAO_ContributionPage extends CRM_Contribute_DAO_Contributio
    * @return CRM_Contribute_DAO_ContributionPage
    */
   public static function create($params) {
-    $financialTypeId = NULL;
-    if (!empty($params['id']) && !CRM_Price_BAO_PriceSet::getFor('civicrm_contribution_page', $params['id'], NULL, 1)) {
-      $financialTypeId = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_ContributionPage', $params['id'], 'financial_type_id');
-    }
-
+    // @todo  - this implode is probably handled by writeRecord - test & remove.
     if (isset($params['payment_processor']) && is_array($params['payment_processor'])) {
       $params['payment_processor'] = implode(CRM_Core_DAO::VALUE_SEPARATOR, $params['payment_processor']);
     }
-    $hook = empty($params['id']) ? 'create' : 'edit';
-    CRM_Utils_Hook::pre($hook, 'ContributionPage', CRM_Utils_Array::value('id', $params), $params);
-    $dao = new CRM_Contribute_DAO_ContributionPage();
-    $dao->copyValues($params);
-    $dao->save();
-    if ($financialTypeId && !empty($params['financial_type_id']) && $financialTypeId != $params['financial_type_id']) {
-      CRM_Price_BAO_PriceFieldValue::updateFinancialType($params['id'], 'civicrm_contribution_page', $params['financial_type_id']);
-    }
-    CRM_Utils_Hook::post($hook, 'ContributionPage', $dao->id, $dao);
+    return self::writeRecord($params);
+  }
+
+  /**
+   * Callback for hook_civicrm_post().
+   *
+   * @param \Civi\Core\Event\PostEvent $event
+   *
+   * @noinspection PhpUnusedParameterInspection
+   */
+  public static function self_hook_civicrm_post(PostEvent $event): void {
     CRM_Core_PseudoConstant::flush();
-    return $dao;
   }
 
   /**
index c6c9cb284a2af9bf9b1ae6bc38c14b83be356ff1..42014c57797b45862cd41fd9af9abd096bb92f3c 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Contribute/Contribution.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:9e60bb45bfa633f107c72cc1f3049b58)
+ * (GenCodeChecksum:c612cd79d620e91f7498a3883c635293)
  */
 
 /**
@@ -480,6 +480,7 @@ class CRM_Contribute_DAO_Contribution extends CRM_Core_DAO {
             'table' => 'civicrm_contribution_page',
             'keyColumn' => 'id',
             'labelColumn' => 'title',
+            'nameColumn' => 'name',
           ],
           'add' => '1.5',
         ],
index b8da3ff99e4cb402345e1f8ad071044ba7fbc49a..a5ca0ed500b0162dc0ddc62d3d3cec3da480e9c1 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Contribute/ContributionPage.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:075cce622b131127948be961f14fec2b)
+ * (GenCodeChecksum:fff705a45cbf2750018b57a05e5b1cb2)
  */
 
 /**
@@ -61,12 +61,30 @@ class CRM_Contribute_DAO_ContributionPage extends CRM_Core_DAO {
   /**
    * Contribution Page title. For top of page display
    *
-   * @var string|null
+   * @var string
    *   (SQL type: varchar(255))
    *   Note that values will be retrieved from the database as a string.
    */
   public $title;
 
+  /**
+   * Contribution Page Public title
+   *
+   * @var string
+   *   (SQL type: varchar(255))
+   *   Note that values will be retrieved from the database as a string.
+   */
+  public $frontend_title;
+
+  /**
+   * Unique name for identifying contribution page
+   *
+   * @var string
+   *   (SQL type: varchar(255))
+   *   Note that values will be retrieved from the database as a string.
+   */
+  public $name;
+
   /**
    * Text and html allowed. Displayed below title.
    *
@@ -454,15 +472,6 @@ class CRM_Contribute_DAO_ContributionPage extends CRM_Core_DAO {
    */
   public $is_billing_required;
 
-  /**
-   * Contribution Page Public title
-   *
-   * @var string|null
-   *   (SQL type: varchar(255))
-   *   Note that values will be retrieved from the database as a string.
-   */
-  public $frontend_title;
-
   /**
    * Class constructor.
    */
@@ -532,8 +541,9 @@ class CRM_Contribute_DAO_ContributionPage extends CRM_Core_DAO {
         'title' => [
           'name' => 'title',
           'type' => CRM_Utils_Type::T_STRING,
-          'title' => ts('Contribution Page Title'),
+          'title' => ts('Page Name'),
           'description' => ts('Contribution Page title. For top of page display'),
+          'required' => TRUE,
           'maxlength' => 255,
           'size' => CRM_Utils_Type::HUGE,
           'usage' => [
@@ -552,6 +562,54 @@ class CRM_Contribute_DAO_ContributionPage extends CRM_Core_DAO {
           ],
           'add' => '1.3',
         ],
+        'frontend_title' => [
+          'name' => 'frontend_title',
+          'type' => CRM_Utils_Type::T_STRING,
+          'title' => ts('Public Title'),
+          'description' => ts('Contribution Page Public title'),
+          'required' => TRUE,
+          'maxlength' => 255,
+          'size' => CRM_Utils_Type::HUGE,
+          'usage' => [
+            'import' => FALSE,
+            'export' => FALSE,
+            'duplicate_matching' => FALSE,
+            'token' => FALSE,
+          ],
+          'where' => 'civicrm_contribution_page.frontend_title',
+          'table_name' => 'civicrm_contribution_page',
+          'entity' => 'ContributionPage',
+          'bao' => 'CRM_Contribute_BAO_ContributionPage',
+          'localizable' => 1,
+          'html' => [
+            'type' => 'Text',
+          ],
+          'add' => '5.20',
+        ],
+        'name' => [
+          'name' => 'name',
+          'type' => CRM_Utils_Type::T_STRING,
+          'title' => ts('Unique Name'),
+          'description' => ts('Unique name for identifying contribution page'),
+          'required' => TRUE,
+          'maxlength' => 255,
+          'size' => CRM_Utils_Type::HUGE,
+          'usage' => [
+            'import' => FALSE,
+            'export' => FALSE,
+            'duplicate_matching' => FALSE,
+            'token' => FALSE,
+          ],
+          'where' => 'civicrm_contribution_page.name',
+          'table_name' => 'civicrm_contribution_page',
+          'entity' => 'ContributionPage',
+          'bao' => 'CRM_Contribute_BAO_ContributionPage',
+          'localizable' => 0,
+          'html' => [
+            'type' => 'Text',
+          ],
+          'add' => '5.63',
+        ],
         'intro_text' => [
           'name' => 'intro_text',
           'type' => CRM_Utils_Type::T_TEXT,
@@ -1488,30 +1546,6 @@ class CRM_Contribute_DAO_ContributionPage extends CRM_Core_DAO {
           'localizable' => 0,
           'add' => '4.6',
         ],
-        'contribution_page_frontend_title' => [
-          'name' => 'frontend_title',
-          'type' => CRM_Utils_Type::T_STRING,
-          'title' => ts('Public Title'),
-          'description' => ts('Contribution Page Public title'),
-          'maxlength' => 255,
-          'size' => CRM_Utils_Type::HUGE,
-          'usage' => [
-            'import' => FALSE,
-            'export' => FALSE,
-            'duplicate_matching' => FALSE,
-            'token' => FALSE,
-          ],
-          'where' => 'civicrm_contribution_page.frontend_title',
-          'default' => NULL,
-          'table_name' => 'civicrm_contribution_page',
-          'entity' => 'ContributionPage',
-          'bao' => 'CRM_Contribute_BAO_ContributionPage',
-          'localizable' => 1,
-          'html' => [
-            'type' => 'Text',
-          ],
-          'add' => '5.20',
-        ],
       ];
       CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
     }
@@ -1581,7 +1615,17 @@ class CRM_Contribute_DAO_ContributionPage extends CRM_Core_DAO {
    * @return array
    */
   public static function indices($localize = TRUE) {
-    $indices = [];
+    $indices = [
+      'UI_name' => [
+        'name' => 'UI_name',
+        'field' => [
+          0 => 'name',
+        ],
+        'localizable' => FALSE,
+        'unique' => TRUE,
+        'sig' => 'civicrm_contribution_page::1::name',
+      ],
+    ];
     return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
   }
 
index c4a8e2e8035088bb360a19a9a379608acb42dc93..5b28abd7af396682fd72bc4fe2fa0b43abfcadc3 100644 (file)
@@ -1592,7 +1592,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr
           $membershipSource = $form->_params['membership_source'];
         }
         elseif ((isset($form->_values['title']) && !empty($form->_values['title'])) || (isset($form->_values['frontend_title']) && !empty($form->_values['frontend_title']))) {
-          $title = !empty($form->_values['frontend_title']) ? $form->_values['frontend_title'] : $form->_values['title'];
+          $title = $form->_values['frontend_title'];
           $membershipSource = ts('Online Contribution:') . ' ' . $title;
         }
         $isPayLater = NULL;
@@ -2133,7 +2133,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr
       }
     }
     // add a description field at the very beginning
-    $title = !empty($this->_values['frontend_title']) ? $this->_values['frontend_title'] : $this->_values['title'];
+    $title = $this->_values['frontend_title'];
     $this->_params['description'] = ts('Online Contribution') . ': ' . (!empty($this->_pcpInfo['title']) ? $this->_pcpInfo['title'] : $title);
 
     $this->_params['accountingCode'] = $this->_values['accountingCode'] ?? NULL;
index fb6f61e3e719c77396cc32392cd14c70ce831216..0a02db1e1c44383d32048e83bb3d28ab65455f9a 100644 (file)
@@ -497,7 +497,7 @@ class CRM_Contribute_Form_ContributionBase extends CRM_Core_Form {
       CRM_Utils_Array::value('cancelSubscriptionUrl', $this->_values)
     );
 
-    $title = !empty($this->_values['frontend_title']) ? $this->_values['frontend_title'] : $this->_values['title'];
+    $title = $this->_values['frontend_title'];
 
     $this->setTitle(($this->_pcpId ? $this->_pcpInfo['title'] : $title));
     $this->_defaults = [];
index bad15a145c1e9a08ec65a3484559beef5d8ee7e1..7669084a27d7bf26a260871141e4d09308345b6a 100644 (file)
@@ -120,7 +120,7 @@ class CRM_Contribute_Form_ContributionPage_Settings extends CRM_Contribute_Form_
 
     // name
     $this->add('text', 'title', ts('Title'), $attributes['title'], TRUE);
-    $this->addField('contribution_page_frontend_title', ['entity' => 'ContributionPage']);
+    $this->addField('frontend_title', ['entity' => 'ContributionPage'], TRUE);
 
     //CRM-7362 --add campaigns.
     CRM_Campaign_BAO_Campaign::addCampaign($this, CRM_Utils_Array::value('campaign_id', $this->_values));
index ead9a4f45115a823d36a8924dfd827efc7483331..0cd22185722dc7670094d5a38203983f8c7ccb34 100644 (file)
@@ -944,6 +944,12 @@ class CRM_Core_DAO extends DB_DataObject {
     if (empty($values[$idField]) && array_key_exists('name', $fields) && empty($values['name'])) {
       $instance->makeNameFromLabel();
     }
+    if (empty($values[$idField]) && array_key_exists('frontend_title', $fields) && empty($values['frontend_title'])) {
+      $instance->frontend_title = $instance->title;
+    }
+    if (empty($values[$idField]) && array_key_exists('title', $fields) && empty($values['title']) && !empty($values['frontend_title'])) {
+      $instance->title = $instance->frontend_title;
+    }
     $instance->save();
 
     if (!empty($record['custom']) && is_array($record['custom'])) {
@@ -1866,7 +1872,7 @@ LIKE %1
 
       $localizableFields = FALSE;
       foreach ($fields as $name => $value) {
-        if ($name == 'id' || $value['name'] == 'id') {
+        if ($name === 'id' || $value['name'] === 'id') {
           // copy everything but the id!
           continue;
         }
@@ -1884,7 +1890,7 @@ LIKE %1
           $newObject->$dbName = $fieldsToReplace[$dbName];
         }
 
-        if ($type == 'Timestamp' || $type == 'Date') {
+        if ($type === 'Timestamp' || $type === 'Date') {
           $newObject->$dbName = CRM_Utils_Date::isoToMysql($newObject->$dbName);
         }
 
@@ -1896,6 +1902,9 @@ LIKE %1
           $newObject->copyValues($newData);
         }
       }
+      if (!empty($fields['name'])) {
+        $newObject->makeNameFromLabel();
+      }
       $newObject->save();
 
       // ensure we copy all localized fields as well
index 765a8efd8351dd254bd0b4651cd33d8dd9b0fc17..efd06caa5bfd55e426fe7b8b3c15671eba1b60b6 100644 (file)
@@ -97,7 +97,8 @@ class CRM_Core_I18n_SchemaStructure {
           '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'",
+          'title' => "varchar(255) NOT NULL COMMENT 'Contribution Page title. For top of page display'",
+          'frontend_title' => "varchar(255) NOT NULL COMMENT 'Contribution Page Public title'",
           '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'",
@@ -109,7 +110,6 @@ class CRM_Core_I18n_SchemaStructure {
           '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'",
@@ -429,6 +429,11 @@ class CRM_Core_I18n_SchemaStructure {
         'civicrm_contribution_page' => [
           'title' => [
             'type' => "Text",
+            'required' => "true",
+          ],
+          'frontend_title' => [
+            'type' => "Text",
+            'required' => "true",
           ],
           'intro_text' => [
             'type' => "RichTextEditor",
@@ -473,9 +478,6 @@ class CRM_Core_I18n_SchemaStructure {
             'rows' => "6",
             'cols' => "50",
           ],
-          'frontend_title' => [
-            'type' => "Text",
-          ],
         ],
         'civicrm_product' => [
           'name' => [
index acdceee880454dcc1e6929bf8d7a2cc5cdfc867b..81214edd06f7ebe3a2e0af3a4c79e68ba1cd2559 100644 (file)
@@ -9,6 +9,7 @@
  +--------------------------------------------------------------------+
  */
 
+use Civi\Core\Exception\DBQueryException;
 use Civi\Core\SettingsBag;
 
 /**
@@ -609,7 +610,12 @@ class CRM_Upgrade_Incremental_Base {
       $queries[] = "ALTER TABLE `$table` CHANGE `$column` `$column` $properties";
     }
     foreach ($queries as $query) {
-      CRM_Core_DAO::executeQuery($query, [], TRUE, NULL, FALSE, FALSE);
+      try {
+        CRM_Core_DAO::executeQuery($query, [], TRUE, NULL, FALSE, FALSE);
+      }
+      catch (DBQueryException $e) {
+        throw new CRM_Core_Exception($e->getSQLErrorCode() . "\n" . $e->getDebugInfo());
+      }
     }
     $schema = new CRM_Logging_Schema();
     if ($schema->isEnabled()) {
index 95835f1dfd47b3727973d93ab94577e474221d9d..583146387cc9ac00ded52daf49b46af0c62a7ae5 100644 (file)
@@ -26,13 +26,21 @@ class CRM_Upgrade_Incremental_php_FiveSixtyThree extends CRM_Upgrade_Incremental
    *
    * @param string $rev
    *   The version number matching this function name
+   *
+   * @throws \Civi\Core\Exception\DBQueryException
    */
-  public function upgrade_5_63_alpha1($rev): void {
+  public function upgrade_5_63_alpha1(string $rev): void {
+    $this->addTask('Add name column  to civicrm_contribution_page', 'addColumn', 'civicrm_contribution_page',
+      'name', "varchar(255) NULL COMMENT 'Unique name for identifying contribution page'");
     $this->addTask(ts('Upgrade DB to %1: SQL', [1 => $rev]), 'runSql', $rev);
 
     $enabledComponents = Civi::settings()->get('enable_components');
     $extensions = array_map(['CRM_Utils_String', 'convertStringToSnakeCase'], $enabledComponents);
     $this->addExtensionTask('Enable component extensions', $extensions);
+
+    $this->addTask('Make ContributionPage.name required', 'alterColumn', 'civicrm_contribution_page', 'name', "varchar(255) NOT NULL COMMENT 'Unique name for identifying contribution page'");
+    $this->addTask('Make ContributionPage.title required', 'alterColumn', 'civicrm_contribution_page', 'title', "varchar(255) NOT NULL COMMENT 'Contribution Page title. For top of page display'", TRUE);
+    $this->addTask('Make ContributionPage.frontend_title required', 'alterColumn', 'civicrm_contribution_page', 'frontend_title', "varchar(255) NOT NULL COMMENT 'Contribution Page Public title'", TRUE);
   }
 
 }
index 6fb9a85cf3ce4f704a665b8723cf5d9a9af9cd9b..d96fd227a11f247e015cd5c636beb89f8fef1a83 100644 (file)
@@ -14,3 +14,19 @@ VALUES
     ( {$domainID}, 'https://civicrm.org/help?src=iam',       '{ts escape="sql" skip="true"}Get Help{/ts}',   'Get Help',   NULL, 'AND', @adminHelplastID, '1', NULL, 2 );
 
 UPDATE IGNORE `civicrm_navigation` SET `name` = 'Register Your Site', `label` = '{ts escape="sql" skip="true"}Register Your Site{/ts}' WHERE `name` = 'Register your site';
+
+-- Ensure new name field is not null/unique. Setting to ID is a bit lazy - but sql localisation is painful.
+UPDATE civicrm_contribution_page SET `name` = `id`;
+
+-- Add name field, make frontend_title required (in conjunction with php function)
+{if $multilingual}
+  {foreach from=$locales item=locale}
+    UPDATE `civicrm_contribution_page`
+    SET `frontend_title_{$locale}` = `title_{$locale}`
+    WHERE `frontend_title_{$locale}` IS NULL OR `frontend_title_{$locale}` = '';
+  {/foreach}
+{else}
+  UPDATE `civicrm_contribution_page`
+  SET `frontend_title` = `title`
+  WHERE `frontend_title` IS NULL OR `frontend_title` = '';
+{/if}
index 5a592e5f7a90a14d646528e47cbff4733699dc15..9e11858ce02a890cfb1e10e86b9a855d59303612 100644 (file)
@@ -25,13 +25,6 @@ class PaymentProcessorCreationSpecProvider extends \Civi\Core\Service\AutoServic
    * @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);
 
diff --git a/Civi/Api4/Service/Spec/Provider/TitleFieldSpecProvider.php b/Civi/Api4/Service/Spec/Provider/TitleFieldSpecProvider.php
new file mode 100644 (file)
index 0000000..4b5810e
--- /dev/null
@@ -0,0 +1,50 @@
+<?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
+ */
+
+
+namespace Civi\Api4\Service\Spec\Provider;
+
+use Civi\Api4\Service\Spec\RequestSpec;
+use Civi\Core\Service\AutoService;
+
+/**
+ * @service
+ * @internal
+ */
+class TitleFieldSpecProvider extends AutoService implements Generic\SpecProviderInterface {
+
+  /**
+   * @param \Civi\Api4\Service\Spec\RequestSpec $spec
+   */
+  public function modifySpec(RequestSpec $spec): void {
+    // 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);
+  }
+
+  /**
+   * @inheritDoc
+   */
+  public function applies($entity, $action): bool {
+    return in_array($entity, ['PaymentProcessor', 'ContributionPage']) && $action === 'create';
+  }
+
+}
index 7b88752ba6f7f3afa08398fa4e21462e4d8e15a6..1473deeeba0b9a1303d196339d56cc0ef6842a45 100644 (file)
@@ -2397,10 +2397,10 @@ UNLOCK TABLES;
 
 LOCK TABLES `civicrm_contribution_page` WRITE;
 /*!40000 ALTER TABLE `civicrm_contribution_page` DISABLE KEYS */;
-INSERT INTO `civicrm_contribution_page` (`id`, `title`, `intro_text`, `financial_type_id`, `payment_processor`, `is_credit_card_only`, `is_monetary`, `is_recur`, `is_confirm_enabled`, `recur_frequency_unit`, `is_recur_interval`, `is_recur_installments`, `adjust_recur_start_date`, `is_pay_later`, `pay_later_text`, `pay_later_receipt`, `is_partial_payment`, `initial_amount_label`, `initial_amount_help_text`, `min_initial_amount`, `is_allow_other_amount`, `default_amount_id`, `min_amount`, `max_amount`, `goal_amount`, `thankyou_title`, `thankyou_text`, `thankyou_footer`, `is_email_receipt`, `receipt_from_name`, `receipt_from_email`, `cc_receipt`, `bcc_receipt`, `receipt_text`, `is_active`, `footer_text`, `amount_block_is_active`, `start_date`, `end_date`, `created_id`, `created_date`, `currency`, `campaign_id`, `is_share`, `is_billing_required`, `frontend_title`) VALUES
- (1,'Help Support CiviCRM!','Do you love CiviCRM? Do you use CiviCRM? Then please support CiviCRM and Contribute NOW by trying out our new online contribution features!',1,NULL,0,1,0,1,NULL,0,0,0,0,NULL,NULL,0,NULL,NULL,NULL,1,137,10.00,10000.00,100000.00,'Thanks for Your Support!','<p>Thank you for your support. Your contribution will help us build even better tools.</p><p>Please tell your friends and colleagues about CiviCRM!</p>','<p><a href=https://civicrm.org>Back to CiviCRM Home Page</a></p>',1,'CiviCRM Fundraising Dept.','donationFake@civicrm.org','receipt@example.com','bcc@example.com','Your donation is tax deductible under IRS 501(c)(3) regulation. Our tax identification number is: 93-123-4567',1,NULL,1,NULL,NULL,NULL,NULL,'USD',NULL,1,0,NULL),
- (2,'Member Signup and Renewal','Members are the life-blood of our organization. If you\'re not already a member - please consider signing up today. You can select the membership level the fits your budget and needs below.',2,NULL,0,1,0,1,NULL,0,0,0,0,NULL,NULL,0,NULL,NULL,NULL,0,NULL,NULL,NULL,NULL,'Thanks for Your Support!','Thanks for supporting our organization with your membership. You can learn more about membership benefits from our members only page.',NULL,1,'Membership Department','memberships@civicrm.org',NULL,NULL,'Thanks for supporting our organization with your membership. You can learn more about membership benefits from our members only page.\r\n\r\nKeep this receipt for your records.',1,NULL,0,NULL,NULL,NULL,NULL,'USD',NULL,1,0,NULL),
- (3,'Pledge for CiviCRM!','Do you love CiviCRM? Do you use CiviCRM? Then please support CiviCRM and Pledge NOW by trying out our online contribution features!',1,NULL,0,1,0,1,NULL,0,0,0,0,NULL,NULL,0,NULL,NULL,NULL,1,NULL,10.00,10000.00,100000.00,'Thanks for Your Support!','<p>Thank you for your support. Your contribution will help us build even better tools like Pledge.</p><p>Please tell your friends and colleagues about CiviPledge!</p>','<p><a href=https://civicrm.org>Back to CiviCRM Home Page</a></p>',1,'CiviCRM Fundraising Dept.','donationFake@civicrm.org','receipt@example.com','bcc@example.com','Your donation is tax deductible under IRS 501(c)(3) regulation. Our tax identification number is: 93-123-4567',1,NULL,1,NULL,NULL,NULL,NULL,'USD',NULL,1,0,NULL);
+INSERT INTO `civicrm_contribution_page` (`id`, `title`, `name`, `intro_text`, `financial_type_id`, `payment_processor`, `is_credit_card_only`, `is_monetary`, `is_recur`, `is_confirm_enabled`, `recur_frequency_unit`, `is_recur_interval`, `is_recur_installments`, `adjust_recur_start_date`, `is_pay_later`, `pay_later_text`, `pay_later_receipt`, `is_partial_payment`, `initial_amount_label`, `initial_amount_help_text`, `min_initial_amount`, `is_allow_other_amount`, `default_amount_id`, `min_amount`, `max_amount`, `goal_amount`, `thankyou_title`, `thankyou_text`, `thankyou_footer`, `is_email_receipt`, `receipt_from_name`, `receipt_from_email`, `cc_receipt`, `bcc_receipt`, `receipt_text`, `is_active`, `footer_text`, `amount_block_is_active`, `start_date`, `end_date`, `created_id`, `created_date`, `currency`, `campaign_id`, `is_share`, `is_billing_required`, `frontend_title`) VALUES
+ (1,'Help Support CiviCRM!','donate','Do you love CiviCRM? Do you use CiviCRM? Then please support CiviCRM and Contribute NOW by trying out our new online contribution features!',1,NULL,0,1,0,1,NULL,0,0,0,0,NULL,NULL,0,NULL,NULL,NULL,1,137,10.00,10000.00,100000.00,'Thanks for Your Support!','<p>Thank you for your support. Your contribution will help us build even better tools.</p><p>Please tell your friends and colleagues about CiviCRM!</p>','<p><a href=https://civicrm.org>Back to CiviCRM Home Page</a></p>',1,'CiviCRM Fundraising Dept.','donationFake@civicrm.org','receipt@example.com','bcc@example.com','Your donation is tax deductible under IRS 501(c)(3) regulation. Our tax identification number is: 93-123-4567',1,NULL,1,NULL,NULL,NULL,NULL,'USD',NULL,1,0,NULL),
+ (2,'Member Signup and Renewal','membership','Members are the life-blood of our organization. If you\'re not already a member - please consider signing up today. You can select the membership level the fits your budget and needs below.',2,NULL,0,1,0,1,NULL,0,0,0,0,NULL,NULL,0,NULL,NULL,NULL,0,NULL,NULL,NULL,NULL,'Thanks for Your Support!','Thanks for supporting our organization with your membership. You can learn more about membership benefits from our members only page.',NULL,1,'Membership Department','memberships@civicrm.org',NULL,NULL,'Thanks for supporting our organization with your membership. You can learn more about membership benefits from our members only page.\r\n\r\nKeep this receipt for your records.',1,NULL,0,NULL,NULL,NULL,NULL,'USD',NULL,1,0,NULL),
+ (3,'Pledge for CiviCRM!','pledge','Do you love CiviCRM? Do you use CiviCRM? Then please support CiviCRM and Pledge NOW by trying out our online contribution features!',1,NULL,0,1,0,1,NULL,0,0,0,0,NULL,NULL,0,NULL,NULL,NULL,1,NULL,10.00,10000.00,100000.00,'Thanks for Your Support!','<p>Thank you for your support. Your contribution will help us build even better tools like Pledge.</p><p>Please tell your friends and colleagues about CiviPledge!</p>','<p><a href=https://civicrm.org>Back to CiviCRM Home Page</a></p>',1,'CiviCRM Fundraising Dept.','donationFake@civicrm.org','receipt@example.com','bcc@example.com','Your donation is tax deductible under IRS 501(c)(3) regulation. Our tax identification number is: 93-123-4567',1,NULL,1,NULL,NULL,NULL,NULL,'USD',NULL,1,0,NULL);
 /*!40000 ALTER TABLE `civicrm_contribution_page` ENABLE KEYS */;
 UNLOCK TABLES;
 
index ed2d4f78d57468a7c9282cc4a835f1cb919f2df7..4645a9de51750773ea85c7d7a642faf5510c5458 100644 (file)
 <div class="crm-block crm-form-block crm-contribution-contributionpage-settings-form-block">
     <div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="top"}</div>
     <table class="form-layout-compressed">
-        <tr class="crm-contribution-contributionpage-settings-form-block-title">
-            <td class="label">{$form.title.label} {if $action == 2}{include file='CRM/Core/I18n/Dialog.tpl' table='civicrm_contribution_page' field='title' id=$contributionPageID}{/if}</td>
-            <td>{$form.title.html}</td>
-        </tr>
-        <tr class="crm-contribution-contributionpage-settings-form-block-frontend-title">
-            <td class="label">{$form.contribution_page_frontend_title.label} {if $action == 2}{include file='CRM/Core/I18n/Dialog.tpl' table='civicrm_contribution_page' field='frontend_title' id=$contributionPageID}{/if}</td>
-            <td>{$form.contribution_page_frontend_title.html}</td>
-        </tr>
+      <tr class="crm-contribution-contributionpage-settings-form-block-frontend-title">
+        <td class="label">{$form.frontend_title.label} {if $action == 2}{include file='CRM/Core/I18n/Dialog.tpl' table='civicrm_contribution_page' field='frontend_title' id=$contributionPageID}{/if}</td>
+        <td>{$form.frontend_title.html}</td>
+      </tr>
+      <tr class="crm-contribution-contributionpage-settings-form-block-title">
+        <td class="label">{$form.title.label} {if $action == 2}{include file='CRM/Core/I18n/Dialog.tpl' table='civicrm_contribution_page' field='title' id=$contributionPageID}{/if}</td>
+        <td>{$form.title.html}</td>
+      </tr>
         <tr class="crm-contribution-contributionpage-settings-form-block-financial_type_id">
             <td class="label">{$form.financial_type_id.label} {help id="id-financial_type"}</td>
             <td>{$form.financial_type_id.html}</td>
index da86515a93697de43d21a7e6acf9672bc9906431..b9d20497ac6d9d89c0f0f87246226239b5870349 100644 (file)
  */
 class CRM_Contribute_BAO_ContributionPageTest extends CiviUnitTestCase {
 
-  const FINANCIAL_TYPE_ID = 1;
-
-  public function setUp(): void {
-    parent::setUp();
-  }
-
   /**
    * Create() method (create Contribution Page)
    */
-  public function testCreate() {
+  public function testCreate(): void {
 
     $params = [
       'qfkey' => '9a3ef3c08879ad4c8c109b21c583400e',
       'title' => 'Test Contribution Page',
-      'financial_type_id' => self::FINANCIAL_TYPE_ID,
+      'financial_type_id' => 1,
       'intro_text' => '',
       'footer_text' => 'Thanks',
       'is_for_organization' => 0,
@@ -45,21 +39,19 @@ class CRM_Contribute_BAO_ContributionPageTest extends CiviUnitTestCase {
       'is_credit_card_only' => '',
     ];
 
-    $contributionpage = CRM_Contribute_BAO_ContributionPage::create($params);
-
-    $this->assertNotNull($contributionpage->id);
-    $this->assertIsInt($contributionpage->id);
-    $this->callAPISuccess('ContributionPage', 'delete', ['id' => $contributionpage->id]);
+    $contributionPageID = CRM_Contribute_BAO_ContributionPage::create($params)->id;
+    $this->assertIsInt($contributionPageID);
+    $this->callAPISuccess('ContributionPage', 'delete', ['id' => $contributionPageID]);
   }
 
   /**
    * Test setValues() method
    */
-  public function testSetValues() {
+  public function testSetValues(): void {
 
     $params = [
       'title' => 'Test Contribution Page',
-      'financial_type_id' => self::FINANCIAL_TYPE_ID,
+      'financial_type_id' => 1,
       'is_active' => 1,
     ];
 
@@ -70,7 +62,7 @@ class CRM_Contribute_BAO_ContributionPageTest extends CiviUnitTestCase {
     CRM_Contribute_BAO_ContributionPage::setValues($id, $values);
 
     $this->assertEquals($params['title'], $values['title'], 'Verify contribution title.');
-    $this->assertEquals(self::FINANCIAL_TYPE_ID, $values['financial_type_id'], 'Verify financial types id.');
+    $this->assertEquals(1, $values['financial_type_id'], 'Verify financial types id.');
     $this->assertEquals(1, $values['is_active'], 'Verify contribution is_active value.');
     $this->callAPISuccess('ContributionPage', 'delete', ['id' => $contributionPage->id]);
   }
@@ -78,11 +70,11 @@ class CRM_Contribute_BAO_ContributionPageTest extends CiviUnitTestCase {
   /**
    * Test copy() method
    */
-  public function testcopy() {
+  public function testcopy(): void {
     $params = [
       'qfkey' => '9a3ef3c08879ad4c8c109b21c583400e',
       'title' => 'Test Contribution Page',
-      'financial_type_id' => self::FINANCIAL_TYPE_ID,
+      'financial_type_id' => 1,
       'intro_text' => '',
       'footer_text' => 'Thanks',
       'is_for_organization' => 0,
@@ -100,8 +92,8 @@ class CRM_Contribute_BAO_ContributionPageTest extends CiviUnitTestCase {
 
     $contributionPage = CRM_Contribute_BAO_ContributionPage::create($params);
     $copyContributionPage = CRM_Contribute_BAO_ContributionPage::copy($contributionPage->id);
-    $this->assertEquals($copyContributionPage->financial_type_id, self::FINANCIAL_TYPE_ID, 'Check for Financial type id.');
-    $this->assertEquals($copyContributionPage->goal_amount, 400, 'Check for goal amount.');
+    $this->assertEquals(1, $copyContributionPage->financial_type_id, 'Check for Financial type id.');
+    $this->assertEquals(400, $copyContributionPage->goal_amount, 'Check for goal amount.');
     $this->callAPISuccess('ContributionPage', 'delete', ['id' => $contributionPage->id]);
     $this->callAPISuccess('ContributionPage', 'delete', ['id' => $copyContributionPage->id]);
   }
index 05fd017999f8e79e98a537f936f47f0fbcb4f33e..0b54d72b63f73d7a942b4049992d7aff5fea273f 100644 (file)
@@ -20,10 +20,8 @@ class CRM_Price_BAO_PriceSetTest extends CiviUnitTestCase {
    *
    * (these are denoted as 'quickConfig' in the code - but quickConfig is only supposed to refer to the
    * configuration interface - there should be no different post process.
-   *
-   * @throws \CRM_Core_Exception
    */
-  public function testGetAmountLevelTextAmount() {
+  public function testGetAmountLevelTextAmount(): void {
     $priceSetID = $this->eventPriceSetCreate(9);
     $priceSet = CRM_Price_BAO_PriceSet::getCachedPriceSetDetail($priceSetID);
     $field = reset($priceSet['fields']);
@@ -37,21 +35,19 @@ class CRM_Price_BAO_PriceSetTest extends CiviUnitTestCase {
   }
 
   /**
-   * CRM-20237 Test that Copied price set does not generate long name and unneded information
-   *
-   * @throws \CRM_Core_Exception
+   * CRM-20237 Test that Copied price set does not generate long name and unnecessary information
    */
-  public function testCopyPriceSet() {
+  public function testCopyPriceSet(): void {
     $priceSetID = $this->eventPriceSetCreate(9);
     $oldPriceSetInfo = $this->callAPISuccess('PriceSet', 'getsingle', ['id' => $priceSetID]);
     $newPriceSet = CRM_Price_BAO_PriceSet::copy($priceSetID);
-    $this->assertEquals(substr($oldPriceSetInfo['name'], 0, 20) . 'price_set_' . $newPriceSet->id, $newPriceSet->name);
+    $this->assertEquals('Price_Set_Copy_id_' . $newPriceSet->id . '_', $newPriceSet->name);
     $this->assertEquals($oldPriceSetInfo['title'] . ' [Copy id ' . $newPriceSet->id . ']', $newPriceSet->title);
     $new2PriceSet = CRM_Price_BAO_PriceSet::copy($newPriceSet->id);
-    $this->assertEquals(substr($newPriceSet->name, 0, 20) . 'price_set_' . $new2PriceSet->id, $new2PriceSet->name);
+    $this->assertEquals('Price_Set_Copy_id_' . $new2PriceSet->id . '_', $new2PriceSet->name);
     $this->assertEquals($oldPriceSetInfo['title'] . ' [Copy id ' . $new2PriceSet->id . ']', $new2PriceSet->title);
-    $oldPriceField = $this->callAPISuccess('priceField', 'getsingle', ['price_set_id' => $priceSetID]);
-    $oldPriceFieldValue = $this->callAPISuccess('priceFieldValue', 'getsingle', ['price_field_id' => $oldPriceField['id']]);
+    $oldPriceField = $this->callAPISuccess('PriceField', 'getsingle', ['price_set_id' => $priceSetID]);
+    $oldPriceFieldValue = $this->callAPISuccess('PriceFieldValue', 'getsingle', ['price_field_id' => $oldPriceField['id']]);
     $this->callAPISuccess('PriceFieldValue', 'delete', ['id' => $oldPriceFieldValue['id']]);
     $this->callAPISuccess('PriceField', 'delete', ['id' => $oldPriceField['id']]);
     $this->callAPISuccess('PriceSet', 'delete', ['id' => $priceSetID]);
@@ -73,7 +69,7 @@ class CRM_Price_BAO_PriceSetTest extends CiviUnitTestCase {
    *
    * @throws \CRM_Core_Exception
    */
-  public function testGetMembershipCount() {
+  public function testGetMembershipCount(): void {
     // create two organisations
     $organization1 = $this->organizationCreate();
     $organization2 = $this->organizationCreate();
index 7c4c0dd753c91492ff958fcfd9cce68e47de389f..88ddc42d78e0f1b1f23339c91055dffaac82d81a 100644 (file)
@@ -98,6 +98,7 @@ trait CRMTraits_Contribute_RecurFormsTrait {
         'receipt_from_name' => 'Bob',
         'receipt_from_email' => 'bob@example.org',
         'financial_type_id' => 'Donation',
+        'title' => 'page',
       ])['id'];
     }
     return $this->ids['ContributionPage'][0];
index 440969da492c0f8dcd7e64386419f8887aa92de2..99089cd2fd2c8988cb9c08a4f707eaed54d3f22f 100644 (file)
@@ -88,6 +88,7 @@
     <pseudoconstant>
       <table>civicrm_contribution_page</table>
       <keyColumn>id</keyColumn>
+      <nameColumn>name</nameColumn>
       <labelColumn>title</labelColumn>
     </pseudoconstant>
     <html>
index 56519fefbc11bf06f758a21062f30dfb298a2042..d1067e82653ab4d766f0eb8a333cc8550fe40e12 100644 (file)
   </primaryKey>
   <field>
     <name>title</name>
-    <title>Contribution Page Title</title>
+    <title>Page Name</title>
     <type>varchar</type>
     <length>255</length>
     <localizable>true</localizable>
+    <required>true</required>
     <comment>Contribution Page title. For top of page display</comment>
     <add>1.3</add>
     <html>
       <type>Text</type>
     </html>
   </field>
+  <field>
+    <name>frontend_title</name>
+    <title>Public Title</title>
+    <type>varchar</type>
+    <length>255</length>
+    <localizable>true</localizable>
+    <required>true</required>
+    <comment>Contribution Page Public title</comment>
+    <html>
+      <type>Text</type>
+    </html>
+    <add>5.20</add>
+  </field>
+  <field>
+    <name>name</name>
+    <title>Unique Name</title>
+    <comment>Unique name for identifying contribution page</comment>
+    <required>true</required>
+    <type>varchar</type>
+    <length>255</length>
+    <html>
+      <type>Text</type>
+    </html>
+    <add>5.63</add>
+  </field>
   <field>
     <name>intro_text</name>
     <title>Contribution Page Introduction Text</title>
     <comment>if true - billing block is required for online contribution page</comment>
     <add>4.6</add>
   </field>
-  <field>
-    <name>frontend_title</name>
-    <title>Public Title</title>
-    <type>varchar</type>
-    <length>255</length>
-    <localizable>true</localizable>
-    <default>NULL</default>
-    <comment>Contribution Page Public title</comment>
-    <html>
-      <type>Text</type>
-    </html>
-    <add>5.20</add>
-    <uniqueName>contribution_page_frontend_title</uniqueName>
-  </field>
+  <index>
+    <name>UI_name</name>
+    <fieldName>name</fieldName>
+    <unique>true</unique>
+    <add>2.1</add>
+  </index>
 </table>
index 266052884f92563d8a5aa65e51d6581e3b24b586..412e770b51dffa83aa4de8279010771061ea5dc4 100644 (file)
@@ -44,11 +44,11 @@ VALUES
      (@priceFieldID, 'other_amount', 'Other Amount', 1, 3, 1, 0, 1);
 
 INSERT INTO civicrm_contribution_page
-  (title,intro_text,financial_type_id,is_monetary,is_allow_other_amount,default_amount_id,min_amount,max_amount,goal_amount,thankyou_title,thankyou_text,thankyou_footer,receipt_from_name,receipt_from_email,cc_receipt,bcc_receipt,receipt_text,is_active,footer_text,amount_block_is_active,currency,is_email_receipt)
+  (title,frontend_title, name,intro_text,financial_type_id,is_monetary,is_allow_other_amount,default_amount_id,min_amount,max_amount,goal_amount,thankyou_title,thankyou_text,thankyou_footer,receipt_from_name,receipt_from_email,cc_receipt,bcc_receipt,receipt_text,is_active,footer_text,amount_block_is_active,currency,is_email_receipt)
 VALUES
-  ('Help Support CiviCRM!','Do you love CiviCRM? Do you use CiviCRM? Then please support CiviCRM and Contribute NOW by trying out our new online contribution features!',1,1,1,137,'10.00','10000.00','100000.00','Thanks for Your Support!','<p>Thank you for your support. Your contribution will help us build even better tools.</p><p>Please tell your friends and colleagues about CiviCRM!</p>','<p><a href=https://civicrm.org>Back to CiviCRM Home Page</a></p>','CiviCRM Fundraising Dept.','donationFake@civicrm.org','receipt@example.com','bcc@example.com','Your donation is tax deductible under IRS 501(c)(3) regulation. Our tax identification number is: 93-123-4567',1, NULL, 1, 'USD', 1),
-  ('Member Signup and Renewal', 'Members are the life-blood of our organization. If you''re not already a member - please consider signing up today. You can select the membership level the fits your budget and needs below.', 2, 1, 0, NULL, NULL, NULL, NULL, 'Thanks for Your Support!', 'Thanks for supporting our organization with your membership. You can learn more about membership benefits from our members only page.', NULL, 'Membership Department', 'memberships@civicrm.org', NULL, NULL, 'Thanks for supporting our organization with your membership. You can learn more about membership benefits from our members only page.\r\n\r\nKeep this receipt for your records.', 1, NULL, 0, 'USD', 1),
-  ('Pledge for CiviCRM!','Do you love CiviCRM? Do you use CiviCRM? Then please support CiviCRM and Pledge NOW by trying out our online contribution features!',1,1,1,NULL,'10.00','10000.00','100000.00','Thanks for Your Support!','<p>Thank you for your support. Your contribution will help us build even better tools like Pledge.</p><p>Please tell your friends and colleagues about CiviPledge!</p>','<p><a href=https://civicrm.org>Back to CiviCRM Home Page</a></p>','CiviCRM Fundraising Dept.','donationFake@civicrm.org','receipt@example.com','bcc@example.com','Your donation is tax deductible under IRS 501(c)(3) regulation. Our tax identification number is: 93-123-4567',1, NULL, 1, 'USD', 1);
+  ('Donate page', 'Help Support CiviCRM!','donate', 'Do you love CiviCRM? Do you use CiviCRM? Then please support CiviCRM and Contribute NOW by trying out our new online contribution features!',1,1,1,137,'10.00','10000.00','100000.00','Thanks for Your Support!','<p>Thank you for your support. Your contribution will help us build even better tools.</p><p>Please tell your friends and colleagues about CiviCRM!</p>','<p><a href=https://civicrm.org>Back to CiviCRM Home Page</a></p>','CiviCRM Fundraising Dept.','donationFake@civicrm.org','receipt@example.com','bcc@example.com','Your donation is tax deductible under IRS 501(c)(3) regulation. Our tax identification number is: 93-123-4567',1, NULL, 1, 'USD', 1),
+  ('Membership page','Member Signup and Renewal', 'membership','Members are the life-blood of our organization. If you''re not already a member - please consider signing up today. You can select the membership level the fits your budget and needs below.', 2, 1, 0, NULL, NULL, NULL, NULL, 'Thanks for Your Support!', 'Thanks for supporting our organization with your membership. You can learn more about membership benefits from our members only page.', NULL, 'Membership Department', 'memberships@civicrm.org', NULL, NULL, 'Thanks for supporting our organization with your membership. You can learn more about membership benefits from our members only page.\r\n\r\nKeep this receipt for your records.', 1, NULL, 0, 'USD', 1),
+  ('Pledge page', 'Pledge for CiviCRM!','pledge', 'Do you love CiviCRM? Do you use CiviCRM? Then please support CiviCRM and Pledge NOW by trying out our online contribution features!',1,1,1,NULL,'10.00','10000.00','100000.00','Thanks for Your Support!','<p>Thank you for your support. Your contribution will help us build even better tools like Pledge.</p><p>Please tell your friends and colleagues about CiviPledge!</p>','<p><a href=https://civicrm.org>Back to CiviCRM Home Page</a></p>','CiviCRM Fundraising Dept.','donationFake@civicrm.org','receipt@example.com','bcc@example.com','Your donation is tax deductible under IRS 501(c)(3) regulation. Our tax identification number is: 93-123-4567',1, NULL, 1, 'USD', 1);
 
 INSERT INTO `civicrm_tell_friend`
     (`entity_table`, `entity_id`, `title`, `intro`, `suggested_message`, `general_link`, `thankyou_title`, `thankyou_text`, `is_active`)