[NFC] Update Pledge XML to support date picker conversion
authorSeamus Lee <seamuslee001@gmail.com>
Sun, 1 Sep 2019 02:20:23 +0000 (12:20 +1000)
committerSeamus Lee <seamuslee001@gmail.com>
Sun, 1 Sep 2019 04:02:44 +0000 (14:02 +1000)
Update unit tests to match new schema

CRM/Pledge/BAO/Query.php
CRM/Pledge/DAO/Pledge.php
tests/phpunit/CRM/Export/BAO/ExportTest.php
xml/schema/Pledge/Pledge.xml
xml/schema/Pledge/PledgePayment.xml

index 1b3779060efd029774b8d3ff0df36b2f2467cc7b..0e0ff052c21538f54a1a5869c5c51b602a659950 100644 (file)
@@ -82,6 +82,12 @@ class CRM_Pledge_BAO_Query extends CRM_Core_BAO_Query {
       $query->_tables['civicrm_pledge'] = $query->_whereTables['civicrm_pledge'] = 1;
     }
 
+    if (!empty($query->_returnProperties['pledge_end_date'])) {
+      $query->_select['pledge_end_date'] = 'civicrm_pledge.end_date as pledge_end_date';
+      $query->_element['pledge_end_date'] = 1;
+      $query->_tables['civicrm_pledge'] = $query->_whereTables['civicrm_pledge'] = 1;
+    }
+
     if (!empty($query->_returnProperties['pledge_start_date'])) {
       $query->_select['pledge_start_date'] = 'civicrm_pledge.start_date as pledge_start_date';
       $query->_element['pledge_start_date'] = 1;
index fe6abc9014b7a22588b9981699c21be87d56fc3f..76d0e11dd292c4cd7cc87d086ab06d9984de46a0 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Pledge/Pledge.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:5e5bb725caa46ae10f0c5d039a03c675)
+ * (GenCodeChecksum:a25cc68d8392b1d60d7179ca484b604a)
  */
 
 /**
@@ -420,17 +420,19 @@ class CRM_Pledge_DAO_Pledge extends CRM_Core_DAO {
             'type' => 'Text',
           ],
         ],
-        'start_date' => [
+        'pledge_start_date' => [
           'name' => 'start_date',
           'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
           'title' => ts('Pledge Start Date'),
           'description' => ts('The date the first scheduled pledge occurs.'),
           'required' => TRUE,
           'where' => 'civicrm_pledge.start_date',
+          'export' => TRUE,
           'table_name' => 'civicrm_pledge',
           'entity' => 'Pledge',
           'bao' => 'CRM_Pledge_BAO_Pledge',
           'localizable' => 0,
+          'unique_title' => ts('Payments Start Date'),
           'html' => [
             'type' => 'Select Date',
           ],
@@ -491,16 +493,18 @@ class CRM_Pledge_DAO_Pledge extends CRM_Core_DAO {
             'type' => 'Select Date',
           ],
         ],
-        'end_date' => [
+        'pledge_end_date' => [
           'name' => 'end_date',
           'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
           'title' => ts('Pledge End Date'),
           'description' => ts('Date this pledge finished successfully (total pledge payments equal to or greater than pledged amount).'),
           'where' => 'civicrm_pledge.end_date',
+          'export' => TRUE,
           'table_name' => 'civicrm_pledge',
           'entity' => 'Pledge',
           'bao' => 'CRM_Pledge_BAO_Pledge',
           'localizable' => 0,
+          'unique_title' => ts('Payments Ended Date'),
           'html' => [
             'type' => 'Select Date',
           ],
index 71f8d5b068d50bcedc9abbfc991489e1f82c8f97..51add793559995467b583982167eb45e365b9df6 100644 (file)
@@ -2348,7 +2348,7 @@ class CRM_Export_BAO_ExportTest extends CiviUnitTestCase {
       82 => 'Total Pledged',
       83 => 'Total Paid',
       84 => 'Pledge Made',
-      85 => 'pledge_start_date',
+      85 => 'Pledge Start Date',
       86 => 'Next Payment Date',
       87 => 'Next Payment Amount',
       88 => 'Pledge Status',
@@ -2694,7 +2694,7 @@ class CRM_Export_BAO_ExportTest extends CiviUnitTestCase {
       'pledge_amount' => 'pledge_amount varchar(32)',
       'pledge_total_paid' => 'pledge_total_paid text',
       'pledge_create_date' => 'pledge_create_date varchar(32)',
-      'pledge_start_date' => 'pledge_start_date text',
+      'pledge_start_date' => 'pledge_start_date varchar(32)',
       'pledge_next_pay_date' => 'pledge_next_pay_date text',
       'pledge_next_pay_amount' => 'pledge_next_pay_amount text',
       'pledge_status' => 'pledge_status varchar(255)',
index 50ecd9c2261b391c4ae8f46a650cb85368b180d2..7fd1cf35cc2c5c8e74100cafb2d7f1d0c11de829 100644 (file)
     <type>datetime</type>
     <title>Pledge Start Date</title>
     <required>true</required>
+    <export>true</export>
     <comment>The date the first scheduled pledge occurs.</comment>
     <add>2.1</add>
     <html>
-        <type>Select Date</type>
-      </html>
+      <type>Select Date</type>
+    </html>
+    <uniqueName>pledge_start_date</uniqueName>
+    <uniqueTitle>Payments Start Date</uniqueTitle>
   </field>
   <field>
     <name>create_date</name>
     <title>Pledge Made</title>
     <required>true</required>
     <import>true</import>
+    <export>true</export>
     <comment>When this pledge record was created.</comment>
     <add>2.1</add>
     <html>
     <comment>When a pledge acknowledgement message was sent to the contributor.</comment>
     <add>2.1</add>
     <html>
-        <type>Select Date</type>
+      <type>Select Date</type>
     </html>
   </field>
   <field>
     <comment>Date this pledge was cancelled by contributor.</comment>
     <add>2.1</add>
     <html>
-        <type>Select Date</type>
+      <type>Select Date</type>
     </html>
   </field>
   <field>
     <name>end_date</name>
     <type>datetime</type>
     <title>Pledge End Date</title>
+    <export>true</export>
     <comment>Date this pledge finished successfully (total pledge payments equal to or greater than pledged amount).</comment>
     <add>2.1</add>
     <html>
-        <type>Select Date</type>
+      <type>Select Date</type>
     </html>
+    <uniqueName>pledge_end_date</uniqueName>
+    <uniqueTitle>Payments Ended Date</uniqueTitle>
   </field>
   <field>
     <name>max_reminders</name>
     <default>1</default>
     <comment>The maximum number of payment reminders to send for any given payment.</comment>
     <html>
-         <type>Text</type>
-       </html>
+       <type>Text</type>
+     </html>
     <add>2.1</add>
   </field>
   <field>
     <comment>Send initial reminder this many days prior to the payment due date.</comment>
     <add>2.1</add>
     <html>
-          <type>Select</type>
-        </html>
+      <type>Select</type>
+    </html>
   </field>
   <field>
     <name>additional_reminder_day</name>
     <comment>Send additional reminder this many days after last one sent, up to maximum number of reminders.</comment>
     <add>2.1</add>
     <html>
-         <type>Text</type>
-       </html>
+      <type>Text</type>
+    </html>
   </field>
   <field>
     <name>status_id</name>
index e13eb9e16b7d5466ce3a1c61ad1c2124494d2d31..711204820b109ad50bf6f096792a526cd51f6239 100644 (file)
@@ -98,6 +98,7 @@
     <uniqueName>pledge_payment_scheduled_date</uniqueName>
     <title>Scheduled Date</title>
     <import>true</import>
+    <export>true</export>
     <type>datetime</type>
     <required>true</required>
     <comment>The date the pledge payment is supposed to happen.</comment>