From 151db577deeee3cbe86e8d3df9dd7c53ad91597e Mon Sep 17 00:00:00 2001 From: David Barratt Date: Fri, 30 Aug 2013 10:28:55 -0400 Subject: [PATCH] Only throw error when employers are involved. --- CRM/Contribute/Form/ContributionBase.php | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/CRM/Contribute/Form/ContributionBase.php b/CRM/Contribute/Form/ContributionBase.php index 03c81cbc88..d2d853e532 100644 --- a/CRM/Contribute/Form/ContributionBase.php +++ b/CRM/Contribute/Form/ContributionBase.php @@ -226,13 +226,18 @@ class CRM_Contribute_Form_ContributionBase extends CRM_Core_Form { $this->_defaultMemTypeId = $membership->membership_type_id; if ($membership->contact_id != $this->_contactID) { $employers = CRM_Contact_BAO_Relationship::getPermissionedEmployer($this->_userID); - if (array_key_exists($membership->contact_id, $employers)) { - $this->_membershipContactID = $membership->contact_id; - $this->assign('membershipContactID', $this->_membershipContactID); - $this->assign('membershipContactName', $employers[$this->_membershipContactID]['name']); + if (!empty($employers)) { + if (array_key_exists($membership->contact_id, $employers)) { + $this->_membershipContactID = $membership->contact_id; + $this->assign('membershipContactID', $this->_membershipContactID); + $this->assign('membershipContactName', $employers[$this->_membershipContactID]['name']); + } + else { + CRM_Core_Session::setStatus(ts("Oops. The membership you're trying to renew appears to be invalid. Contact your site administrator if you need assistance. If you continue, you will be issued a new membership."), ts('Membership Invalid'), 'alert'); + } } else { - CRM_Core_Session::setStatus(ts("Oops. The membership you're trying to renew appears to be invalid. Contact your site administrator if you need assistance. If you continue, you will be issued a new membership."), ts('Membership Invalid'), 'alert'); + $this->_membershipContactID = $membership->contact_id; } } } -- 2.25.1