Commit 9bb0ecee authored by lobo's avatar lobo
Browse files

Fix missing require_once and improve delete discount flow

parent 3bb6ec24
......@@ -35,6 +35,7 @@
*/
require_once 'CRM/Admin/Form.php';
require_once 'CDM/BAO/Item.php';
/**
* This class generates form components for cividiscount administration.
......@@ -76,9 +77,8 @@ class CDM_Form_Discount_Admin extends CRM_Admin_Form {
'autodiscount' => null,
'memberships' => null,
'events' => null,
'pricesets' => null);
require_once 'CDM/BAO/Item.php';
'pricesets' => null
);
}
function setDefaultValues() {
......@@ -98,6 +98,9 @@ class CDM_Form_Discount_Admin extends CRM_Admin_Form {
}
$defaults['is_active'] = $origID ? CRM_Utils_Array::value('is_active', $defaults) : 1;
// assign the defaults to smarty so delete can use it
$this->assign('discountValue', $defaults);
foreach ($this->_multiValued as $mv => $info) {
if (! empty($defaults[$mv])) {
$v = substr($defaults[$mv], 1, -1);
......
......@@ -25,10 +25,9 @@
*}
{* this template is used for adding/editing discounts *}
<h3>
{if $action eq 1}{ts}New Discount{/ts}{elseif $action eq 2}{ts}Edit Discount{/ts}{else}{ts}Delete Discount{/ts}{/if}
{if $action eq 1}{ts}New Discount{/ts}{elseif $action eq 2}{ts}Edit Discount{/ts}{else}{ts}Delete Discount - {$discountValue.code}{/ts}{/if}
</h3>
<div class="crm-block crm-form-block crm-discount-item-form-block">
<div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="top"}</div>
{if $action eq 8}
<div class="messages status">
<dl>
......@@ -36,11 +35,12 @@
<div class="icon inform-icon"></div>
</dt>
<dd>
{ts}WARNING: Deleting this discount code will prevent users who have this code to avail of this discount.{/ts} {ts}Do you want to continue?{/ts}
{ts 1=$discountValue.code}WARNING: Deleting this discount code (%1) will prevent users who have this code to avail of this discount.{/ts} {ts}Do you want to continue?{/ts}
</dd>
</dl>
</div>
{else}
<div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="top"}</div>
<table class="form-layout-compressed">
<tr class="crm-discount-item-form-block-label">
<td class="label">{$form.code.label}</td>
......@@ -91,8 +91,11 @@
<tr class="crm-discount-item-form-block-events">
<td class="label">{$form.events.label} {help id="events" title=$form.events.label}</td>
<td>{$form.events.html}<br/>
{if $form.pricesets}
<span
class="description"><strong><em>{ts}If you use price sets for your events, you also need to select any discountable price sets below.{/ts}</em></strong>
</span>
{/if}
</td>
</tr>
{/if}
......
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