Commit f5637cd5 authored by lobo's avatar lobo
Browse files

Merge pull request #36 from rajeshrhino/master

Fix for issue: Discount code which is only set to apply to certain price...
parents 515d3161 d4d1b35e
......@@ -393,6 +393,7 @@ function cividiscount_civicrm_buildAmount($pagetype, &$form, &$amounts) {
// as $discounts[$key]['pricesets'] from _cividiscount_get_candidate_discounts(); above
}
else {
if (empty($discounts[$key]['pricesets'])) {
$discounts[$key]['pricesets'] = array();
// filter only valid membership types that have discount
foreach( $priceSetInfo as $pfID => $priceFieldValues ) {
......@@ -402,10 +403,11 @@ function cividiscount_civicrm_buildAmount($pagetype, &$form, &$amounts) {
}
}
}
}
$discount = array_shift($discounts);
//$discount = array_shift($discounts);
foreach ($discounts as $done_care => $discount) {
// we need a extra check to make sure discount is valid for additional participants
// check the max usage and existing usage of discount code
if ($pagetype == 'event' && _cividiscount_allow_multiple()) {
......@@ -422,7 +424,6 @@ function cividiscount_civicrm_buildAmount($pagetype, &$form, &$amounts) {
return;
}
}
}
foreach ($amounts as &$fee) {
......@@ -438,6 +439,7 @@ function cividiscount_civicrm_buildAmount($pagetype, &$form, &$amounts) {
}
}
}
}
$form->set('_discountInfo', array(
'discount' => $discount,
......
Supports Markdown
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