Commit 96ca8376 authored by Matthew Wire's avatar Matthew Wire Committed by eileen
Browse files

CRM-20851 php notice (#10639)

 Fix php notice when is_primary is not set
parent 12608054
......@@ -287,11 +287,11 @@ class CRM_Contribute_Form_Task_Invoice extends CRM_Contribute_Form_Task {
// to get billing address if present
$billingAddress = array();
foreach ($addressDetails as $address) {
if ((isset($address['is_billing']) && $address['is_billing'] == 1) && (isset($address['is_primary']) && $address['is_primary'] == 1) && $address['contact_id'] == $contribution->contact_id) {
if (($address['is_billing'] == 1) && ($address['is_primary'] == 1) && ($address['contact_id'] == $contribution->contact_id)) {
$billingAddress[$address['contact_id']] = $address;
break;
}
elseif (($address['is_billing'] == 0 && $address['is_primary'] == 1) || (isset($address['is_billing']) && $address['is_billing'] == 1) && $address['contact_id'] == $contribution->contact_id) {
elseif (($address['is_billing'] == 0 && $address['is_primary'] == 1) || ($address['is_billing'] == 1) && ($address['contact_id'] == $contribution->contact_id)) {
$billingAddress[$address['contact_id']] = $address;
}
}
......
......@@ -542,10 +542,10 @@ class CRM_Core_BAO_Address extends CRM_Core_DAO_Address {
$addresses[$count] = $values;
//unset is_primary after first block. Due to some bug in earlier version
//there might be more than one primary blocks, hence unset is_primary other than first
//There should never be more than one primary blocks, hence set is_primary = 0 other than first
// Calling functions expect the key is_primary to be set, so do not unset it here!
if ($count > 1) {
unset($addresses[$count]['is_primary']);
$addresses[$count]['is_primary'] = 0;
}
$count++;
......
......@@ -182,7 +182,7 @@ class CRM_Member_Form_Membership extends CRM_Member_Form {
$contributionID = CRM_Member_BAO_Membership::getMembershipContributionId($this->_id);
// check delete permission for contribution
if ($this->_id && $contributionID && !CRM_Core_Permission::checkActionPermission('CiviContribute', $this->_action)) {
CRM_Core_Error::statusBounce(ts("This Membership is linked to a contribution. You must have 'delete in CiviContribute' permission in order to delete this record."));
CRM_Core_Error::fatal(ts("This Membership is linked to a contribution. You must have 'delete in CiviContribute' permission in order to delete this record."));
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment