From 71066a01791ad8b11421deee9b57e97759b33350 Mon Sep 17 00:00:00 2001 From: Nick Galbraith Date: Tue, 30 Jun 2015 11:01:14 -0600 Subject: [PATCH] Completely fix birthday/anniversary issue --- src/Ctct/Components/Activities/AddContacts.php | 12 +++++++++--- src/Ctct/Components/Contacts/Contact.php | 7 ------- src/Ctct/Util/Config.php | 4 +++- test/Json/Contacts/get_contact.json | 1 - test/Json/Contacts/get_contacts.json | 2 -- test/Json/Contacts/get_contacts_modified_since.json | 2 -- test/Json/Contacts/get_contacts_no_next.json | 2 -- test/Services/ContactServiceUnitTest.php | 6 ------ test/Services/ListServiceUnitTest.php | 1 - 9 files changed, 12 insertions(+), 25 deletions(-) diff --git a/src/Ctct/Components/Activities/AddContacts.php b/src/Ctct/Components/Activities/AddContacts.php index c15704b..585ca28 100644 --- a/src/Ctct/Components/Activities/AddContacts.php +++ b/src/Ctct/Components/Activities/AddContacts.php @@ -38,12 +38,18 @@ public function __construct(Array $contacts, Array $lists, Array $columnNames = if (isset($contact->first_name)) { $usedColumns[] = Config::get('activities_columns.first_name'); } - if (isset($contact->middle_name)) { - $usedColumns[] = Config::get('activities_columns.middle_name'); - } if (isset($contact->last_name)) { $usedColumns[] = Config::get('activities_columns.last_name'); } + if (isset($contact->birthday_day)) { + $usedColumns[] = Config::get('activities_columns.birthday_day'); + } + if (isset($contact->birthday_month)) { + $usedColumns[] = Config::get('activities_columns.birthday_month'); + } + if (isset($contact->anniversary)) { + $usedColumns[] = Config::get('activities_columns.anniversary'); + } if (isset($contact->job_title)) { $usedColumns[] = Config::get('activities_columns.job_title'); } diff --git a/src/Ctct/Components/Contacts/Contact.php b/src/Ctct/Components/Contacts/Contact.php index c6a3f68..552efbf 100755 --- a/src/Ctct/Components/Contacts/Contact.php +++ b/src/Ctct/Components/Contacts/Contact.php @@ -31,12 +31,6 @@ class Contact extends Component */ public $first_name; - /** - * Middle name of the contact - * @var string - */ - public $middle_name; - /** * Last name of the contact * @var string @@ -156,7 +150,6 @@ public static function create(array $props) $contact->id = parent::getValue($props, "id"); $contact->status = parent::getValue($props, "status"); $contact->first_name = parent::getValue($props, "first_name"); - $contact->middle_name = parent::getValue($props, "middle_name"); $contact->last_name = parent::getValue($props, "last_name"); $contact->confirmed = parent::getValue($props, "confirmed"); $contact->source = parent::getValue($props, "source"); diff --git a/src/Ctct/Util/Config.php b/src/Ctct/Util/Config.php index b8ffac9..1e97f99 100755 --- a/src/Ctct/Util/Config.php +++ b/src/Ctct/Util/Config.php @@ -69,8 +69,10 @@ class Config 'activities_columns' => array( 'email' => 'EMAIL', 'first_name' => 'FIRST NAME', - 'middle_name' => 'MIDDLE NAME', 'last_name' => 'LAST NAME', + 'birthday_day' => 'BIRTHDAY_DAY', + 'birthday_month' => 'BIRTHDAY_MONTH', + 'anniversary' => 'ANNIVERSARY', 'job_title' => 'JOB TITLE', 'company_name' => 'COMPANY NAME', 'work_phone' => 'WORK PHONE', diff --git a/test/Json/Contacts/get_contact.json b/test/Json/Contacts/get_contact.json index d5fcf1a..ecd132b 100755 --- a/test/Json/Contacts/get_contact.json +++ b/test/Json/Contacts/get_contact.json @@ -42,7 +42,6 @@ ], "prefix_name": "Mr.", "first_name": "John", - "middle_name": "S", "last_name": "Smith", "job_title": "Software Engineer", "company_name": "Constant Contact", diff --git a/test/Json/Contacts/get_contacts.json b/test/Json/Contacts/get_contacts.json index d0a1988..f49915f 100755 --- a/test/Json/Contacts/get_contacts.json +++ b/test/Json/Contacts/get_contacts.json @@ -49,7 +49,6 @@ ], "prefix_name": "", "first_name": "", - "middle_name": "", "last_name": "", "job_title": "", "department_name": "", @@ -96,7 +95,6 @@ ], "prefix_name": "", "first_name": "Jimmy", - "middle_name": "", "last_name": "Roving", "job_title": "Bear Tamer", "department_name": "Animals", diff --git a/test/Json/Contacts/get_contacts_modified_since.json b/test/Json/Contacts/get_contacts_modified_since.json index e263704..98b4474 100644 --- a/test/Json/Contacts/get_contacts_modified_since.json +++ b/test/Json/Contacts/get_contacts_modified_since.json @@ -51,7 +51,6 @@ ], "prefix_name": "", "first_name": "John", - "middle_name": "", "last_name": "Doe", "job_title": "", "company_name": "", @@ -94,7 +93,6 @@ ], "prefix_name": "", "first_name": "", - "middle_name": "", "last_name": "", "job_title": "", "company_name": "", diff --git a/test/Json/Contacts/get_contacts_no_next.json b/test/Json/Contacts/get_contacts_no_next.json index 71fd55e..5c06864 100644 --- a/test/Json/Contacts/get_contacts_no_next.json +++ b/test/Json/Contacts/get_contacts_no_next.json @@ -47,7 +47,6 @@ ], "prefix_name": "", "first_name": "", - "middle_name": "", "last_name": "", "job_title": "", "department_name": "", @@ -93,7 +92,6 @@ ], "prefix_name": "", "first_name": "Jimmy", - "middle_name": "", "last_name": "Roving", "job_title": "Bear Tamer", "department_name": "Animals", diff --git a/test/Services/ContactServiceUnitTest.php b/test/Services/ContactServiceUnitTest.php index 4ae56d8..f12600b 100755 --- a/test/Services/ContactServiceUnitTest.php +++ b/test/Services/ContactServiceUnitTest.php @@ -36,7 +36,6 @@ public function testGetContacts() $this->assertEquals("", $contact->fax); $this->assertEquals("", $contact->prefix_name); $this->assertEquals("Jimmy", $contact->first_name); - $this->assertEquals("", $contact->middle_name); $this->assertEquals("Roving", $contact->last_name); $this->assertEquals("Bear Tamer", $contact->job_title); $this->assertEquals("Animal Trainer Pro", $contact->company_name); @@ -120,7 +119,6 @@ public function testGetContactsNoNextLink() $this->assertEquals("", $contact->fax); $this->assertEquals("", $contact->prefix_name); $this->assertEquals("Jimmy", $contact->first_name); - $this->assertEquals("", $contact->middle_name); $this->assertEquals("Roving", $contact->last_name); $this->assertEquals("Bear Tamer", $contact->job_title); $this->assertEquals("Animal Trainer Pro", $contact->company_name); @@ -179,7 +177,6 @@ public function testGetContact() $this->assertEquals("555-1212", $contact->fax); $this->assertEquals("Mr.", $contact->prefix_name); $this->assertEquals("John", $contact->first_name); - $this->assertEquals("S", $contact->middle_name); $this->assertEquals("Smith", $contact->last_name); $this->assertEquals("Software Engineer", $contact->job_title); $this->assertEquals("Constant Contact", $contact->company_name); @@ -250,7 +247,6 @@ public function testGetContactByEmail() $this->assertEquals("", $contact->fax); $this->assertEquals("", $contact->prefix_name); $this->assertEquals("Jimmy", $contact->first_name); - $this->assertEquals("", $contact->middle_name); $this->assertEquals("Roving", $contact->last_name); $this->assertEquals("Bear Tamer", $contact->job_title); $this->assertEquals("Animal Trainer Pro", $contact->company_name); @@ -308,7 +304,6 @@ public function testAddContact() $this->assertEquals("555-1212", $contact->fax); $this->assertEquals("Mr.", $contact->prefix_name); $this->assertEquals("John", $contact->first_name); - $this->assertEquals("S", $contact->middle_name); $this->assertEquals("Smith", $contact->last_name); $this->assertEquals("Software Engineer", $contact->job_title); $this->assertEquals("Constant Contact", $contact->company_name); @@ -448,7 +443,6 @@ public function testUpdateContact() $this->assertEquals("555-1212", $contact->fax); $this->assertEquals("Mr.", $contact->prefix_name); $this->assertEquals("John", $contact->first_name); - $this->assertEquals("S", $contact->middle_name); $this->assertEquals("Smith", $contact->last_name); $this->assertEquals("Software Engineer", $contact->job_title); $this->assertEquals("Constant Contact", $contact->company_name); diff --git a/test/Services/ListServiceUnitTest.php b/test/Services/ListServiceUnitTest.php index 0d69655..4ef7378 100755 --- a/test/Services/ListServiceUnitTest.php +++ b/test/Services/ListServiceUnitTest.php @@ -126,7 +126,6 @@ public function testGetContactsFromList() $this->assertEquals("", $contact->fax); $this->assertEquals("", $contact->prefix_name); $this->assertEquals("Jimmy", $contact->first_name); - $this->assertEquals("", $contact->middle_name); $this->assertEquals("Roving", $contact->last_name); $this->assertEquals("Bear Tamer", $contact->job_title); $this->assertEquals("Animal Trainer Pro", $contact->company_name);