From b78b8ba1eeea86e78e75291da5992b5c664c44d4 Mon Sep 17 00:00:00 2001 From: kurund Date: Mon, 25 Nov 2013 20:25:29 +0530 Subject: [PATCH] fixes for CRM-13824 ---------------------------------------- * CRM-13824: Fatal error on contribution page http://issues.civicrm.org/jira/browse/CRM-13824 --- CRM/Contact/Form/Edit/Address.php | 42 +++++++++++++++---------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/CRM/Contact/Form/Edit/Address.php b/CRM/Contact/Form/Edit/Address.php index 6039e193bf..e8a944f589 100644 --- a/CRM/Contact/Form/Edit/Address.php +++ b/CRM/Contact/Form/Edit/Address.php @@ -450,28 +450,28 @@ class CRM_Contact_Form_Edit_Address { $stateID = CRM_Utils_Array::value(0, $form->getElementValue($stateElementName)); } } - if ($countryID && - isset($form->_elementIndex[$stateElementName]) - ) { - $stateSelect = &$form->addElement('select', - $stateElementName, - $stateTitle, - array( - '' => ts('- select -')) + - CRM_Core_PseudoConstant::stateProvinceForCountry($countryID) - ); + + if (isset($form->_elementIndex[$stateElementName])) { + if ($countryID) { + $stateProvinces = CRM_Core_PseudoConstant::stateProvinceForCountry($countryID); + } + else { + $stateProvinces = CRM_Core_PseudoConstant::stateProvince(); + } + + $stateSelect = & $form->addElement('select', $stateElementName, $stateTitle, + array('' => ts('- select -')) + $stateProvinces); } - if ($stateID && - isset($form->_elementIndex[$stateElementName]) && - isset($form->_elementIndex[$countyElementName]) - ) { - $form->addElement('select', - $countyElementName, - ts('County'), - array( - '' => ts('- select -')) + - CRM_Core_PseudoConstant::countyForState($stateID) - ); + + if (isset($form->_elementIndex[$stateElementName]) && isset($form->_elementIndex[$countyElementName])) { + if ($stateID) { + $counties = CRM_Core_PseudoConstant::countyForState($stateID); + } + else { + $counties = CRM_Core_PseudoConstant::country(); + } + + $form->addElement('select', $countyElementName, ts('County'), array('' => ts('- select -')) + $counties); } // CRM-7296 freeze the select for state if address is shared with household -- 2.25.1