From 518e6d1da9cb78cfb0518987453d41a6e2e10fec Mon Sep 17 00:00:00 2001 From: heathdutton Date: Wed, 13 Jun 2018 02:17:12 -0400 Subject: [PATCH 1/2] Slightly more discerning age calculation. --- Integration/AgeFromBirthdateIntegration.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Integration/AgeFromBirthdateIntegration.php b/Integration/AgeFromBirthdateIntegration.php index 2687b76..42e1fd8 100644 --- a/Integration/AgeFromBirthdateIntegration.php +++ b/Integration/AgeFromBirthdateIntegration.php @@ -94,13 +94,13 @@ public function doEnhancement(Lead &$lead) $month = intval($lead->getFieldValue('dob_month')); $day = intval($lead->getFieldValue('dob_day')); - if ($year && $month && $day) { + if ($year && $month && $month <= 12 && $day && $day <= 31) { $birthdate = sprintf('%04d-%02d-%02d 00:00:00', $year, $month, $day); $dob = new DateTime($birthdate); $today = new DateTime(); $age = (int) $today->diff($dob)->y; $prevAge = (int) $lead->getFieldValue('afb_age'); - if ($age !== $prevAge) { + if ($age !== $prevAge && $age < 120) { $this->logger->info("calculated age is $age"); $lead->addUpdatedField('afb_age', $age, $prevAge); From adc6370a4c7ca8028071c5c413739bf79bceaa01 Mon Sep 17 00:00:00 2001 From: heathdutton Date: Wed, 13 Jun 2018 02:28:10 -0400 Subject: [PATCH 2/2] Revert ptp_area_code field name. --- Integration/PhoneToPartsIntegration.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Integration/PhoneToPartsIntegration.php b/Integration/PhoneToPartsIntegration.php index 1f814ba..13c9bb1 100644 --- a/Integration/PhoneToPartsIntegration.php +++ b/Integration/PhoneToPartsIntegration.php @@ -28,7 +28,7 @@ public function getDisplayName() protected function getEnhancerFieldArray() { return [ - 'ptp_areacode' => [ + 'ptp_area_code' => [ 'label' => 'Area Code', ], 'ptp_prefix' => [ @@ -54,7 +54,7 @@ public function doEnhancement(Lead &$lead) } if (10 === strlen($phone)) { - $lead->addUpdatedField('ptp_areacode', substr($phone, 0, 3)); + $lead->addUpdatedField('ptp_area_code', substr($phone, 0, 3)); $lead->addUpdatedField('ptp_prefix', substr($phone, 3, 3)); $lead->addUpdatedField('ptp_line_number', substr($phone, 6, 4));