Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Pledge XML to support date picker conversion #15180

Merged
merged 1 commit into from
Sep 1, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CRM/Pledge/BAO/Query.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,12 @@ public static function select(&$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;
Expand Down
10 changes: 7 additions & 3 deletions CRM/Pledge/DAO/Pledge.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*
* Generated from xml/schema/CRM/Pledge/Pledge.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
* (GenCodeChecksum:5e5bb725caa46ae10f0c5d039a03c675)
* (GenCodeChecksum:a25cc68d8392b1d60d7179ca484b604a)
*/

/**
Expand Down Expand Up @@ -420,17 +420,19 @@ public static function &fields() {
'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',
],
Expand Down Expand Up @@ -491,16 +493,18 @@ public static function &fields() {
'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',
],
Expand Down
4 changes: 2 additions & 2 deletions tests/phpunit/CRM/Export/BAO/ExportTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2348,7 +2348,7 @@ protected function getPledgeHeaderDefinition() {
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',
Expand Down Expand Up @@ -2694,7 +2694,7 @@ public function getPledgeSqlColumns() {
'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)',
Expand Down
29 changes: 18 additions & 11 deletions xml/schema/Pledge/Pledge.xml
Original file line number Diff line number Diff line change
Expand Up @@ -196,11 +196,14 @@
<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>
Expand All @@ -209,6 +212,7 @@
<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>
Expand All @@ -222,7 +226,7 @@
<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>
Expand All @@ -239,18 +243,21 @@
<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>
Expand All @@ -259,8 +266,8 @@
<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>
Expand All @@ -271,8 +278,8 @@
<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>
Expand All @@ -282,8 +289,8 @@
<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>
Expand Down
1 change: 1 addition & 0 deletions xml/schema/Pledge/PledgePayment.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down