From 233e62856f16b30d175f4ee6cfd8e96eb6053778 Mon Sep 17 00:00:00 2001 From: Pratik Joshi Date: Wed, 23 Oct 2013 12:08:17 +0530 Subject: [PATCH] CRM-13490 : fix for warning mentioned by dgg in issue comment (CRM-13490?#comment-53786), also code some improvement ---------------------------------------- * CRM-13490: Addresses with required custom fields can't be deleted from the Edit screen http://issues.civicrm.org/jira/browse/CRM-13490 --- CRM/Contact/Form/Domain.php | 6 +++++- CRM/Contact/Form/Edit/Address.php | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CRM/Contact/Form/Domain.php b/CRM/Contact/Form/Domain.php index 1e1671122b..8454e744a9 100644 --- a/CRM/Contact/Form/Domain.php +++ b/CRM/Contact/Form/Domain.php @@ -205,9 +205,13 @@ class CRM_Contact_Form_Domain extends CRM_Core_Form { * @access public */ static function formRule($fields) { - $errors = array(); // check for state/country mapping $errors = CRM_Contact_Form_Edit_Address::formRule($fields, CRM_Core_DAO::$_nullArray, CRM_Core_DAO::$_nullObject); + // $errors === TRUE means no errors from above formRule excution, + // so declaring $errors to array for futher processing + if ($errors === TRUE) { + $errors = array(); + } //fix for CRM-3552, //as we use "fromName" format for domain email. diff --git a/CRM/Contact/Form/Edit/Address.php b/CRM/Contact/Form/Edit/Address.php index 95b95fb254..6039e193bf 100644 --- a/CRM/Contact/Form/Edit/Address.php +++ b/CRM/Contact/Form/Edit/Address.php @@ -323,7 +323,7 @@ class CRM_Contact_Form_Edit_Address { $errors = array(); $customDataRequiredFields = array(); - if (property_exists($self, '_addressRequireOmission')) { + if ($self && property_exists($self, '_addressRequireOmission')) { $customDataRequiredFields = explode(',', $self->_addressRequireOmission); } -- 2.25.1