From 797a4d41dec35538872617a487228a4e4f274f20 Mon Sep 17 00:00:00 2001 From: RenCurs <34103666+RenCurs@users.noreply.github.com> Date: Tue, 22 Dec 2020 13:03:32 +0300 Subject: [PATCH] Check email field length (#163) --- .../classes/general/order/RetailCrmOrder_v4.php | 2 ++ .../classes/general/order/RetailCrmOrder_v5.php | 2 ++ intaro.retailcrm/classes/general/user/RetailCrmUser.php | 8 ++++++++ 3 files changed, 12 insertions(+) diff --git a/intaro.retailcrm/classes/general/order/RetailCrmOrder_v4.php b/intaro.retailcrm/classes/general/order/RetailCrmOrder_v4.php index 7bcdac26..47206a48 100644 --- a/intaro.retailcrm/classes/general/order/RetailCrmOrder_v4.php +++ b/intaro.retailcrm/classes/general/order/RetailCrmOrder_v4.php @@ -87,6 +87,8 @@ class RetailCrmOrder if (in_array($search, array('fio', 'phone', 'email'))) {//fio, phone, email if ($search == 'fio') { $order = array_merge($order, RCrmActions::explodeFIO($prop['VALUE'][0]));//add fio fields + } elseif ($search == 'email' && mb_strlen($prop['VALUE'][0]) > 100) { + continue; } else { $order[$search] = $prop['VALUE'][0];//phone, email } diff --git a/intaro.retailcrm/classes/general/order/RetailCrmOrder_v5.php b/intaro.retailcrm/classes/general/order/RetailCrmOrder_v5.php index 57b87465..436000fd 100644 --- a/intaro.retailcrm/classes/general/order/RetailCrmOrder_v5.php +++ b/intaro.retailcrm/classes/general/order/RetailCrmOrder_v5.php @@ -91,6 +91,8 @@ class RetailCrmOrder if (in_array($search, array('fio', 'phone', 'email'))) {//fio, phone, email if ($search == 'fio') { $order = array_merge($order, RCrmActions::explodeFIO($prop['VALUE'][0]));//add fio fields + } elseif ($search == 'email' && mb_strlen($prop['VALUE'][0]) > 100) { + continue; } else { // ignoring a property with a non-set group if the field value is already set if (!empty($order[$search]) && $prop['PROPS_GROUP_ID'] == 0) { diff --git a/intaro.retailcrm/classes/general/user/RetailCrmUser.php b/intaro.retailcrm/classes/general/user/RetailCrmUser.php index 765684fc..4867945a 100644 --- a/intaro.retailcrm/classes/general/user/RetailCrmUser.php +++ b/intaro.retailcrm/classes/general/user/RetailCrmUser.php @@ -49,6 +49,10 @@ class RetailCrmUser $customer['address']['index'] = $arFields['PERSONAL_ZIP']; } + if (mb_strlen($arFields['EMAIL']) > 100 ) { + unset($customer['email']); + } + if ($send && isset($_COOKIE['_rc']) && $_COOKIE['_rc'] != '') { $customer['browserId'] = $_COOKIE['_rc']; } @@ -99,6 +103,10 @@ class RetailCrmUser $customer['patronymic'] = $arFields['SECOND_NAME']; } + if ( mb_strlen($arFields['EMAIL']) > 100) { + unset($customer['email']); + } + if (!empty($arFields['PERSONAL_PHONE'])) { $customer['phones'][]['number'] = $arFields['PERSONAL_PHONE']; }