From cc1b27ee6c5d6cff097a7688885df8473afb0aee Mon Sep 17 00:00:00 2001 From: eileen Date: Mon, 28 Oct 2019 17:23:06 +1300 Subject: [PATCH] Add unique name for relationship start & end dates Preliminary to fixing for datepicker --- CRM/Contact/DAO/Relationship.php | 6 +++--- tests/phpunit/api/v3/UtilsTest.php | 12 +++++++++--- xml/schema/Contact/Relationship.xml | 2 ++ 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/CRM/Contact/DAO/Relationship.php b/CRM/Contact/DAO/Relationship.php index 2849aead67..658f16663a 100644 --- a/CRM/Contact/DAO/Relationship.php +++ b/CRM/Contact/DAO/Relationship.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Contact/Relationship.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:089830b385d7fd32704aa11332e37254) + * (GenCodeChecksum:38f9835d4c6a217b4550124bd39cbbf1) */ /** @@ -196,7 +196,7 @@ class CRM_Contact_DAO_Relationship extends CRM_Core_DAO { 'type' => 'Select', ], ], - 'start_date' => [ + 'relationship_start_date' => [ 'name' => 'start_date', 'type' => CRM_Utils_Type::T_DATE, 'title' => ts('Relationship Start Date'), @@ -211,7 +211,7 @@ class CRM_Contact_DAO_Relationship extends CRM_Core_DAO { 'formatType' => 'activityDate', ], ], - 'end_date' => [ + 'relationship_end_date' => [ 'name' => 'end_date', 'type' => CRM_Utils_Type::T_DATE, 'title' => ts('Relationship End Date'), diff --git a/tests/phpunit/api/v3/UtilsTest.php b/tests/phpunit/api/v3/UtilsTest.php index 14a7710f48..8b0333b482 100644 --- a/tests/phpunit/api/v3/UtilsTest.php +++ b/tests/phpunit/api/v3/UtilsTest.php @@ -241,12 +241,18 @@ class api_v3_UtilsTest extends CiviUnitTestCase { } } + /** + * Test the validate function transforms dates. + * + * @throws \CiviCRM_API3_Exception + * @throws \Exception + */ public function test_civicrm_api3_validate_fields() { - $params = ['start_date' => '2010-12-20', 'end_date' => '']; + $params = ['relationship_start_date' => '2010-12-20', 'relationship_end_date' => '']; $fields = civicrm_api3('relationship', 'getfields', ['action' => 'get']); _civicrm_api3_validate_fields('relationship', 'get', $params, $fields['values']); - $this->assertEquals('20101220000000', $params['start_date']); - $this->assertEquals('', $params['end_date']); + $this->assertEquals('20101220000000', $params['relationship_start_date']); + $this->assertEquals('', $params['relationship_end_date']); } public function test_civicrm_api3_validate_fields_membership() { diff --git a/xml/schema/Contact/Relationship.xml b/xml/schema/Contact/Relationship.xml index ea4daaa03f..3228534dcd 100644 --- a/xml/schema/Contact/Relationship.xml +++ b/xml/schema/Contact/Relationship.xml @@ -72,6 +72,7 @@ start_date + relationship_start_date date Relationship Start Date date when the relationship started @@ -83,6 +84,7 @@ end_date + relationship_end_date date Relationship End Date date when the relationship ended -- 2.25.1