Commit fdb6e628 authored by bgm's avatar bgm Committed by Aegir user

Update cividiscount to 3.7

parent bffaa990
......@@ -84,6 +84,7 @@ function cividiscount_civicrm_tabset($path, &$tabs, $context) {
'count' => _cividiscount_get_tracking_count_by_org($cid),
'title' => E::ts('Codes Assigned'),
'weight' => 115,
'icon' => 'crm-i fa-qrcode',
'url' => CRM_Utils_System::url('civicrm/cividiscount/usage', "reset=1&oid={$cid}", FALSE, NULL, FALSE),
);
}
......@@ -93,6 +94,7 @@ function cividiscount_civicrm_tabset($path, &$tabs, $context) {
'count' => _cividiscount_get_tracking_count($cid),
'title' => E::ts('Codes Redeemed'),
'weight' => 116,
'icon' => 'crm-i fa-qrcode',
'url' => CRM_Utils_System::url('civicrm/cividiscount/usage', "reset=1&cid={$cid}", FALSE, NULL, FALSE),
);
}
......@@ -404,7 +406,7 @@ function cividiscount_civicrm_buildAmount($pageType, &$form, &$amounts) {
foreach ($fee['options'] as $option_id => &$option) {
if (!empty($applyToAllLineItems) || CRM_Utils_Array::value($option['id'], $priceFields)) {
$originalLabel = $originalAmounts[$fee_id]['options'][$option_id]['label'];
$originalAmount = CRM_Utils_Rule::cleanMoney($originalAmounts[$fee_id]['options'][$option_id]['amount']);
$originalAmount = (float) $originalAmounts[$fee_id]['options'][$option_id]['amount'];
list($amount, $label) =
_cividiscount_calc_discount($originalAmount, $originalLabel, $discount, $autodiscount, $currency);
$discountAmount = $originalAmounts[$fee_id]['options'][$option_id]['amount'] - $amount;
......@@ -594,6 +596,14 @@ function cividiscount_civicrm_membershipTypeValues(&$form, &$membershipTypeValue
list($value, $label) = _cividiscount_calc_discount($values['minimum_fee'], $values['name'], $discount, $discountCalculator->isAutoDiscount());
$values['minimum_fee'] = $value;
$values['name'] = $label;
// set total amount to be same as the calculated discount
// this will overwrite the submitted total amount
if (!empty($form->_submitValues['membership_type_id'])) {
if ($values['member_of_contact_id'] == $form->_submitValues['membership_type_id'][0] && $values['id'] == $form->_submitValues['membership_type_id'][1]) {
$form->_submitValues['total_amount'] = $value;
}
}
}
}
......@@ -1135,10 +1145,14 @@ function _cividiscount_version_at_least($version) {
*/
function cividiscount_civicrm_navigationMenu( &$params ) {
// get the id of Administer Menu
$administerMenuId = CRM_Core_DAO::getFieldValue('CRM_Core_BAO_Navigation', 'Administer', 'id', 'name');
foreach($params as $key => $item) {
if (isset($item['attributes']['name']) && $item['attributes']['name'] === 'Administer') {
$administerMenuId = $item['attributes']['navID'];
}
}
// skip adding menu if there is no administer menu
if ($administerMenuId) {
if (!empty($administerMenuId)) {
// get the maximum key under adminster menu
$maxKey = max( array_keys($params[$administerMenuId]['child']));
$params[$administerMenuId]['child'][$maxKey+1] = array (
......
......@@ -18,10 +18,10 @@
<author>CiviCRM LLC</author>
<email>info@civicrm.org</email>
</maintainer>
<releaseDate>2018-10-21</releaseDate>
<version>3.6</version>
<releaseDate>2018-12-17</releaseDate>
<version>3.7</version>
<compatibility>
<ver>5.3</ver>
<ver>5.8</ver>
</compatibility>
<comments>
For support, please ask on chat.civicrm.org
......
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