X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FBatch%2FForm%2FEntry.php;h=688fa27c08df88781b34cd91c29f0d294f4106df;hb=9ff5b7f061760c8125a8b6166897a615ba586227;hp=186b69b605604dda1d8302c658010e8756c0aed7;hpb=991466ed3caa6bc4ee96b4d8a2e0b4b6b1efcd93;p=civicrm-core.git diff --git a/CRM/Batch/Form/Entry.php b/CRM/Batch/Form/Entry.php index 186b69b605..688fa27c08 100755 --- a/CRM/Batch/Form/Entry.php +++ b/CRM/Batch/Form/Entry.php @@ -64,7 +64,6 @@ class CRM_Batch_Form_Entry extends CRM_Core_Form { public $_params; - public $_membershipId = NULL; /** * When not to reset sort_name. */ @@ -323,8 +322,10 @@ class CRM_Batch_Form_Entry extends CRM_Core_Form { } if ($self->_batchInfo['type_id'] == $batchTypes['Pledge Payment']) { foreach (array_unique($params["open_pledges"]) as $value) { - $duplicateRows = array_keys($params["open_pledges"], $value); - if (count($duplicateRows) > 1) { + if (!empty($value)) { + $duplicateRows = array_keys($params["open_pledges"], $value); + } + if (!empty($duplicateRows) && count($duplicateRows) > 1) { foreach ($duplicateRows as $key) { $errors["open_pledges[$key]"] = ts('You can not record two payments for the same pledge in a single batch.'); } @@ -621,7 +622,7 @@ class CRM_Batch_Form_Entry extends CRM_Core_Form { 'reminder_date', ); - // get the price set associated with offline memebership + // get the price set associated with offline membership $priceSetId = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', 'default_membership_type_amount', 'id', 'name'); $this->_priceSet = $priceSets = current(CRM_Price_BAO_PriceSet::getSetDetail($priceSetId)); @@ -785,13 +786,23 @@ class CRM_Batch_Form_Entry extends CRM_Core_Form { $value['is_renew'] = FALSE; if (!empty($params['member_option']) && CRM_Utils_Array::value($key, $params['member_option']) == 2) { + + // The following parameter setting may be obsolete. $this->_params = $params; $value['is_renew'] = TRUE; - $membership = CRM_Member_BAO_Membership::renewMembershipFormWrapper( - $value['contact_id'], - $value['membership_type_id'], - FALSE, $this, NULL, NULL, - $value['custom'] + $isPayLater = CRM_Utils_Array::value('is_pay_later', $params); + $campaignId = NULL; + if (isset($this->_values) && is_array($this->_values) && !empty($this->_values)) { + $campaignId = CRM_Utils_Array::value('campaign_id', $this->_params); + if (!array_key_exists('campaign_id', $this->_params)) { + $campaignId = CRM_Utils_Array::value('campaign_id', $this->_values); + } + } + + list($membership) = CRM_Member_BAO_Membership::renewMembership( + $value['contact_id'], $value['membership_type_id'], FALSE, + NULL, NULL, $value['custom'], NULL, NULL, FALSE, + NULL, NULL, $isPayLater, $campaignId ); // make contribution entry