Commit e97099e5 authored by monishdeb's avatar monishdeb
Browse files

CiviDiscount transformation into civix type module along with other fix

parent de3e8d21
......@@ -34,9 +34,9 @@
*
*/
require_once 'CDM/DAO/Item.php';
require_once 'CRM/CiviDiscount/DAO/Item.php';
class CDM_BAO_Item extends CDM_DAO_Item {
class CRM_CiviDiscount_BAO_Item extends CRM_CiviDiscount_DAO_Item {
/**
* class constructor
......@@ -54,19 +54,20 @@ class CDM_BAO_Item extends CDM_DAO_Item {
*
* @param array $params (reference ) an assoc array of name/value pairs
*
* @return object CDM_BAO_Item object
* @return object CRM_CiviDiscount_BAO_Item object
* @access public
* @static
*/
static function &add(&$params) {
require_once 'CRM/Utils/Date.php';
$item = new CDM_DAO_Item();
$item = new CRM_CiviDiscount_DAO_Item();
$item->code = $params['code'];
$item->description = $params['description'];
$item->amount = $params['amount'];
$item->amount_type = $params['amount_type'];
$item->count_max = $params['count_max'];
$item->discount_msg = $params['discount_msg'];
foreach ($params['multi_valued'] as $mv => $dontCare) {
if (!empty($params[$mv])) {
......@@ -85,6 +86,7 @@ class CDM_BAO_Item extends CDM_DAO_Item {
}
$item->is_active = CRM_Utils_Array::value('is_active', $params) ? 1 : 0;
$item->discount_msg_enabled = CRM_Utils_Array::value('discount_msg_enabled', $params) ? 1 : 0;
if (! empty($params['active_on'])) {
$item->active_on = CRM_Utils_Date::processDate($params['active_on']);
......@@ -126,12 +128,12 @@ class CDM_BAO_Item extends CDM_DAO_Item {
* @param array $params (reference) an assoc array of name/value pairs
* @param array $defaults (reference) an assoc array to hold the flattened values
*
* @return object CDM_BAO_Item object on success, null otherwise
* @return object CRM_CiviDiscount_BAO_Item object on success, null otherwise
* @access public
* @static
*/
static function retrieve(&$params, &$defaults) {
$item = new CDM_DAO_Item();
$item = new CRM_CiviDiscount_DAO_Item();
$item->copyValues($params);
if ($item->find(true)) {
CRM_Core_DAO::storeValues($item, $defaults);
......@@ -156,6 +158,8 @@ SELECT id,
expire_on,
active_on,
is_active,
discount_msg_enabled,
discount_msg,
count_use,
count_max
FROM cividiscount_item
......@@ -163,7 +167,7 @@ FROM cividiscount_item
$dao =& CRM_Core_DAO::executeQuery($sql, array());
while ($dao->fetch()) {
$a = (array) $dao;
if (CDM_BAO_Item::isValid($a)) {
if (CRM_CiviDiscount_BAO_Item::isValid($a)) {
$discounts[$a['code']] = $a;
}
}
......@@ -192,7 +196,7 @@ FROM cividiscount_item
* @static
*/
static function setIsActive($id, $is_active) {
return CRM_Core_DAO::setFieldValue('CDM_DAO_Item', $id, 'is_active', $is_active);
return CRM_Core_DAO::setFieldValue('CRM_CiviDiscount_DAO_Item', $id, 'is_active', $is_active);
}
......@@ -207,9 +211,9 @@ FROM cividiscount_item
}
static function isValid($code) {
if (!CDM_BAO_Item::isExpired($code) &&
CDM_BAO_Item::isActive($code) &&
CDM_BAO_Item::isEnabled($code) &&
if (!CRM_CiviDiscount_BAO_Item::isExpired($code) &&
CRM_CiviDiscount_BAO_Item::isActive($code) &&
CRM_CiviDiscount_BAO_Item::isEnabled($code) &&
($code['count_max'] == 0 || $code['count_max'] > $code['count_use'])
) {
return TRUE;
......@@ -266,7 +270,7 @@ FROM cividiscount_item
* @return true on success else false
*/
static function del($itemID) {
$item = new CDM_DAO_Item();
$item = new CRM_CiviDiscount_DAO_Item();
$item->id = $itemID;
if ($item->find(TRUE)) {
......@@ -279,4 +283,31 @@ FROM cividiscount_item
return FALSE;
}
/**
* Function to copy discount codes
*
* @param int $itemID ID of the discount code to be copied.
*
* @access public
* @static
* @return true on success else false
*/
static function copy($itemID, $params, $newCode) {
$item = new CRM_CiviDiscount_DAO_Item();
$item->id = $itemID;
if ($item->find(TRUE)) {
unset($item->id);
$item->count_use = 0;
$item->code = $newCode;
CRM_Utils_Hook::pre('create', 'CiviDiscount', null, $params);
$item->save();
CRM_Utils_Hook::post('create', 'CiviDiscount', $item->id, $item);
return TRUE;
}
return FALSE;
}
}
......@@ -34,10 +34,10 @@
*
*/
require_once 'CDM/DAO/Track.php';
require_once 'CRM/CiviDiscount/DAO/Track.php';
class CDM_BAO_Track extends CDM_DAO_Track {
class CRM_CiviDiscount_BAO_Track extends CRM_CiviDiscount_DAO_Track {
/**
* class constructor
......@@ -56,12 +56,12 @@ class CDM_BAO_Track extends CDM_DAO_Track {
* @param array $params (reference) an assoc array of name/value pairs
* @param array $defaults (reference) an assoc array to hold the flattened values
*
* @return object CDM_BAO_Item object on success, null otherwise
* @return object CRM_CiviDiscount_BAO_Item object on success, null otherwise
* @access public
* @static
*/
static function retrieve(&$params, &$defaults) {
$item = new CDM_DAO_Track();
$item = new CRM_CiviDiscount_DAO_Track();
$item->copyValues($params);
if ($item->find(true)) {
CRM_Core_DAO::storeValues($item, $defaults);
......@@ -71,19 +71,19 @@ class CDM_BAO_Track extends CDM_DAO_Track {
}
static function getUsageByContact($id) {
return CDM_BAO_Track::getUsage(NULL, $id, NULL);
return CRM_CiviDiscount_BAO_Track::getUsage(NULL, $id, NULL);
}
static function getUsageByOrg($id) {
return CDM_BAO_Track::getUsage(NULL, NULL, $id);
return CRM_CiviDiscount_BAO_Track::getUsage(NULL, NULL, $id);
}
static function getUsageByCode($id) {
return CDM_BAO_Track::getUsage($id, NULL, NULL);
return CRM_CiviDiscount_BAO_Track::getUsage($id, NULL, NULL);
}
static function getUsage($id = NULL, $cid = NULL, $orgid = NULL) {
require_once 'CDM/Utils.php';
require_once 'CRM/CiviDiscount/Utils.php';
require_once 'CRM/Member/BAO/Membership.php';
require_once 'CRM/Contact/BAO/Contact.php';
......@@ -133,7 +133,7 @@ SELECT t.item_id as item_id,
}
if ($row['entity_table'] == 'civicrm_participant') {
$event_id = self::_get_participant_event($dao->entity_id);
$events = CDM_Utils::getEvents();
$events = CRM_CiviDiscount_Utils::getEvents();
if (array_key_exists($event_id, $events)) {
$row['event_title'] = $events[$event_id];
}
......@@ -180,8 +180,8 @@ SELECT t.item_id as item_id,
return false;
}
require_once 'CDM/DAO/Track.php';
$item = new CDM_DAO_Track();
require_once 'CRM/CiviDiscount/DAO/Track.php';
$item = new CRM_CiviDiscount_DAO_Track();
$item->id = $trackID;
$item->delete();
......
......@@ -33,7 +33,7 @@
*/
require_once 'CRM/Core/DAO.php';
require_once 'CRM/Utils/Type.php';
class CDM_DAO_Item extends CRM_Core_DAO {
class CRM_CiviDiscount_DAO_Item extends CRM_Core_DAO {
/**
* static instance to hold the table name
*
......@@ -169,6 +169,18 @@ class CDM_DAO_Item extends CRM_Core_DAO {
* @var boolean
*/
public $is_active;
/**
* Is there a message to users not eligible for a discount?
*
* @var boolean
*/
public $discount_msg_enabled;
/**
* Discount message.
*
* @var string
*/
public $discount_msg;
/**
* class constructor
*
......@@ -290,6 +302,17 @@ class CDM_DAO_Item extends CRM_Core_DAO {
'name' => 'is_active',
'type' => CRM_Utils_Type::T_BOOLEAN,
),
'discount_msg_enabled' => array(
'name' => 'discount_msg_enabled',
'type' => CRM_Utils_Type::T_BOOLEAN,
),
'discount_msg' => array(
'name' => 'discount_msg',
'type' => CRM_Utils_Type::T_STRING,
'title' => ts('Discount Message'),
'maxlength' => 255,
'size' => CRM_Utils_Type::HUGE,
),
);
}
return self::$_fields;
......
......@@ -33,7 +33,7 @@
*/
require_once 'CRM/Core/DAO.php';
require_once 'CRM/Utils/Type.php';
class CDM_DAO_Track extends CRM_Core_DAO {
class CRM_CiviDiscount_DAO_Track extends CRM_Core_DAO {
/**
* static instance to hold the table name
*
......@@ -170,7 +170,7 @@ class CDM_DAO_Track extends CRM_Core_DAO {
'item_id' => array(
'name' => 'item_id',
'type' => CRM_Utils_Type::T_INT,
'FKClassName' => 'CDM_DAO_Item',
'FKClassName' => 'CRM_CiviDiscount_DAO_Item',
),
'contact_id' => array(
'name' => 'contact_id',
......
......@@ -35,13 +35,13 @@
*/
require_once 'CRM/Admin/Form.php';
require_once 'CDM/BAO/Item.php';
require_once 'CRM/CiviDiscount/BAO/Item.php';
/**
* This class generates form components for cividiscount administration.
*
*/
class CDM_Form_Discount_Admin extends CRM_Admin_Form {
class CRM_CiviDiscount_Form_Admin extends CRM_Admin_Form {
protected $_multiValued = null;
protected $_orgID = null;
protected $_cloneID = null;
......@@ -49,7 +49,8 @@ class CDM_Form_Discount_Admin extends CRM_Admin_Form {
function preProcess() {
$this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this, false, 0);
$this->_cloneID = CRM_Utils_Request::retrieve('cloneID', 'Positive', $this, false, 0);
$this->set('BAOName', 'CDM_BAO_Item');
require_once 'CRM/CiviDiscount/BAO/Item.php';
$this->set('BAOName', 'CRM_CiviDiscount_BAO_Item');
parent::preProcess();
......@@ -94,9 +95,10 @@ class CDM_Form_Discount_Admin extends CRM_Admin_Form {
if ($origID) {
$params = array('id' => $origID);
CDM_BAO_Item::retrieve($params, $defaults);
CRM_CiviDiscount_BAO_Item::retrieve($params, $defaults);
}
$defaults['is_active'] = $origID ? CRM_Utils_Array::value('is_active', $defaults) : 1;
$defaults['discount_msg_enabled'] = $origID ? CRM_Utils_Array::value('discount_msg_enabled', $defaults) : 1;
// assign the defaults to smarty so delete can use it
$this->assign('discountValue', $defaults);
......@@ -126,6 +128,10 @@ class CDM_Form_Discount_Admin extends CRM_Admin_Form {
$this->_orgID = $defaults['organization_id'];
$this->assign('currentOrganization', $defaults['organization_id']);
}
// Convert if using html
if (!empty($defaults['discount_msg'])) {
$defaults['discount_msg'] = html_entity_decode($defaults['discount_msg']);
}
return $defaults;
}
......@@ -138,7 +144,7 @@ class CDM_Form_Discount_Admin extends CRM_Admin_Form {
public function buildQuickForm() {
parent::buildQuickForm();
if ($this->_action & CRM_Core_Action::DELETE) {
if ($this->_action & (CRM_Core_Action::DELETE | CRM_Core_Action::COPY)) {
return;
}
......@@ -146,12 +152,12 @@ class CDM_Form_Discount_Admin extends CRM_Admin_Form {
$element =& $this->add('text',
'code',
ts('Code'),
CRM_Core_DAO::getAttribute('CDM_DAO_Item', 'code'),
CRM_Core_DAO::getAttribute('CRM_CiviDiscount_DAO_Item', 'code'),
true);
$this->addRule('code',
ts('Code already exists in Database.'),
'objectExists',
array('CDM_DAO_Item', $this->_id, 'code'));
array('CRM_CiviDiscount_DAO_Item', $this->_id, 'code'));
$this->addRule('code',
ts('Code can only consist of alpha-numeric characters'),
'variable');
......@@ -159,9 +165,9 @@ class CDM_Form_Discount_Admin extends CRM_Admin_Form {
$element->freeze();
}
$this->add('text', 'description', ts('Description'), CRM_Core_DAO::getAttribute('CDM_DAO_Item', 'description'));
$this->add('text', 'description', ts('Description'), CRM_Core_DAO::getAttribute('CRM_CiviDiscount_DAO_Item', 'description'));
$this->addMoney('amount', ts('Discount'), true, CRM_Core_DAO::getAttribute('CDM_DAO_Item', 'amount'), false);
$this->addMoney('amount', ts('Discount'), true, CRM_Core_DAO::getAttribute('CRM_CiviDiscount_DAO_Item', 'amount'), false);
$this->add('select', 'amount_type', ts('Amount Type'),
array(
......@@ -169,7 +175,7 @@ class CDM_Form_Discount_Admin extends CRM_Admin_Form {
2 => ts('Monetary')),
true);
$this->add('text', 'count_max', ts('Usage'), CRM_Core_DAO::getAttribute('CDM_DAO_Item', 'count_max'), true);
$this->add('text', 'count_max', ts('Usage'), CRM_Core_DAO::getAttribute('CRM_CiviDiscount_DAO_Item', 'count_max'), true);
$this->addRule('count_max', ts('Must be an integer'), 'integer');
$this->addDate('active_on', ts('Activation Date'), false);
......@@ -184,6 +190,9 @@ class CDM_Form_Discount_Admin extends CRM_Admin_Form {
// is this discount active ?
$this->addElement('checkbox', 'is_active', ts('Is this discount active?'));
$this->addElement('checkbox', 'discount_msg_enabled', ts('Display a message to users not eligible for this discount?'));
$this->add('text', 'discount_msg', ts('Message to users not eligible for discount'), CRM_Core_DAO::getAttribute('CRM_CiviDiscount_DAO_Item', 'discount_msg'));
// add memberships, events, pricesets
require_once 'CRM/Member/BAO/MembershipType.php';
$membershipTypes = CRM_Member_BAO_MembershipType::getMembershipTypes(false);
......@@ -211,8 +220,8 @@ class CDM_Form_Discount_Admin extends CRM_Admin_Form {
);
}
require_once 'CDM/Utils.php';
$events = CDM_Utils::getEvents();
require_once 'CRM/CiviDiscount/Utils.php';
$events = CRM_CiviDiscount_Utils::getEvents();
if (! empty($events)) {
$this->_multiValued['events'] = $events;
$this->addElement('advmultiselect',
......@@ -225,7 +234,7 @@ class CDM_Form_Discount_Admin extends CRM_Admin_Form {
);
}
$pricesets = CDM_Utils::getPriceSets();
$pricesets = CRM_CiviDiscount_Utils::getPriceSets();
if (! empty($pricesets)) {
$this->_multiValued['pricesets'] = $pricesets;
$this->addElement('advmultiselect',
......@@ -247,11 +256,20 @@ class CDM_Form_Discount_Admin extends CRM_Admin_Form {
*/
public function postProcess() {
if ($this->_action & CRM_Core_Action::DELETE) {
CDM_BAO_Item::del($this->_id);
CRM_CiviDiscount_BAO_Item::del($this->_id);
CRM_Core_Session::setStatus(ts('Selected Discount has been deleted.'));
return;
}
if ($this->_action & CRM_Core_Action::COPY) {
$params = $this->exportValues();
require_once 'CRM/CiviDiscount/Utils.php';
$newCode = CRM_CiviDiscount_Utils::randomString('abcdefghjklmnpqrstwxyz23456789', 8);
CRM_CiviDiscount_BAO_Item::copy($this->_cloneID, $params, $newCode);
CRM_Core_Session::setStatus(ts('Selected Discount has been duplicated.'));
return;
}
$params = $this->exportValues();
if ($this->_action & CRM_Core_Action::UPDATE) {
......@@ -259,7 +277,7 @@ class CDM_Form_Discount_Admin extends CRM_Admin_Form {
}
$params['multi_valued'] = $this->_multiValued;
$item = CDM_BAO_Item::add($params);
$item = CRM_CiviDiscount_BAO_Item::add($params);
CRM_Core_Session::setStatus(ts('The discount \'%1\' has been saved.',
array(1 => $item->description ? $item->description : $item->code)));
......
......@@ -35,12 +35,12 @@
*/
require_once 'CRM/Core/Page/Basic.php';
require_once 'CDM/DAO/Item.php';
require_once 'CRM/CiviDiscount/DAO/Item.php';
/**
* Page for displaying list of discount codes
*/
class CDM_Page_Discount_List extends CRM_Core_Page_Basic {
class CRM_CiviDiscount_Page_List extends CRM_Core_Page_Basic {
/**
* The action links that we need to display for the browse screen
*
......@@ -55,7 +55,7 @@ class CDM_Page_Discount_List extends CRM_Core_Page_Basic {
* @return string Classname of BAO.
*/
function getBAOName() {
return 'CDM_BAO_Item';
return 'CRM_CiviDiscount_BAO_Item';
}
/**
......@@ -78,16 +78,22 @@ class CDM_Page_Discount_List extends CRM_Core_Page_Basic {
'qs' => '&id=%%id%%&reset=1',
'title' => ts('Edit Discount Code')
),
CRM_Core_Action::COPY => array(
'name' => ts('Copy'),
'url' => 'civicrm/cividiscount/discount/copy',
'qs' => '&cloneID=%%id%%&reset=1',
'title' => ts('Clone Discount Code')
),
CRM_Core_Action::DISABLE => array(
'name' => ts('Disable'),
'extra' => 'onclick = "enableDisable(%%id%%, \'' . 'CDM_BAO_Item' . '\', \'' . 'enable-disable' . '\', 0, \'CiviDiscount_Item\');"',
'extra' => 'onclick = "enableDisable(%%id%%, \'' . 'CRM_CiviDiscount_BAO_Item' . '\', \'' . 'enable-disable' . '\', 0, \'CiviDiscount_Item\');"',
'ref' => 'disable-action',
'title' => ts('Disable Discount Code')
),
CRM_Core_Action::ENABLE => array(
'name' => ts('Enable'),
'extra' => 'onclick = "enableDisable(%%id%%, \'' . 'CDM_BAO_Item' . '\' ,\'' . 'disable-enable' . '\', 0, \'CiviDiscount_Item\');"',
'extra' => 'onclick = "enableDisable(%%id%%, \'' . 'CRM_CiviDiscount_BAO_Item' . '\' ,\'' . 'disable-enable' . '\', 0, \'CiviDiscount_Item\');"',
'ref' => 'enable-action',
'title' => ts('Enable Discount Code')
),
......@@ -108,7 +114,7 @@ class CDM_Page_Discount_List extends CRM_Core_Page_Basic {
* @return string Classname of edit form.
*/
function editForm() {
return 'CDM_Form_Item';
return 'CRM_CiviDiscount_Form_Item';
}
/**
......
......@@ -35,12 +35,12 @@
*/
require_once 'CRM/Core/Page.php';
require_once 'CDM/DAO/Item.php';
require_once 'CRM/CiviDiscount/DAO/Item.php';
/**
* Page for displaying discount code details
*/
class CDM_Page_Discount_Report extends CRM_Core_Page {
class CRM_CiviDiscount_Page_Report extends CRM_Core_Page {
/**
* The id of the discount code
*
......@@ -64,7 +64,7 @@ class CDM_Page_Discount_Report extends CRM_Core_Page {
* @return string Classname of BAO.
*/
function getBAOName() {
return 'CDM_BAO_Item';
return 'CRM_CiviDiscount_BAO_Item';
}
/**
......@@ -83,14 +83,14 @@ class CDM_Page_Discount_Report extends CRM_Core_Page {
),
CRM_Core_Action::DISABLE => array(
'name' => ts('Disable'),
'extra' => 'onclick = "enableDisable(%%id%%,\''. 'CDM_BAO_Item' . '\',\'' . 'enable-disable' . '\');"',
'extra' => 'onclick = "enableDisable(%%id%%,\''. 'CRM_CiviDiscount_BAO_Item' . '\',\'' . 'enable-disable' . '\');"',
'ref' => 'disable-action',
'title' => ts('Disable Discount')
),
CRM_Core_Action::ENABLE => array(
'name' => ts('Enable'),
'extra' => 'onclick = "enableDisable(%%id%%,\''. 'CDM_BAO_Item' . '\',\'' . 'enable-disable' . '\');"',
'extra' => 'onclick = "enableDisable(%%id%%,\''. 'CRM_CiviDiscount_BAO_Item' . '\',\'' . 'enable-disable' . '\');"',
'ref' => 'enable-action',
'title' => ts('Enable Discount')
),
......@@ -112,7 +112,7 @@ class CDM_Page_Discount_Report extends CRM_Core_Page {
* @return string Classname of edit form.
*/
function editForm() {
return 'CDM_Form_Item';
return 'CRM_CiviDiscount_Form_Item';
}
/**
......@@ -145,11 +145,11 @@ class CDM_Page_Discount_Report extends CRM_Core_Page {
$defaults = array();
$params = array('id' => $this->_id);
require_once 'CDM/BAO/Item.php';
CDM_BAO_Item::retrieve($params, $defaults);
require_once 'CRM/CiviDiscount/BAO/Item.php';
CRM_CiviDiscount_BAO_Item::retrieve($params, $defaults);
require_once 'CDM/BAO/Track.php';
$rows = CDM_BAO_Track::getUsageByCode($this->_id);
require_once 'CRM/CiviDiscount/BAO/Track.php';
$rows = CRM_CiviDiscount_BAO_Track::getUsageByCode($this->_id);
$this->assign('rows', $rows);
$this->assign('code_details', $defaults);
......
......@@ -35,12 +35,12 @@
*/
require_once 'CRM/Core/Page.php';
require_once 'CDM/DAO/Item.php';
require_once 'CRM/CiviDiscount/DAO/Item.php';
/**
* Page for displaying discount code details
*/
class CDM_Page_Discount_Usage extends CRM_Core_Page {
class CRM_CiviDiscount_Page_Usage extends CRM_Core_Page {
/**
* The id of the discount code
*
......@@ -70,15 +70,15 @@ class CDM_Page_Discount_Usage extends CRM_Core_Page {
$defaults = array();
$params = array('id' => $this->_id);
require_once 'CDM/BAO/Item.php';
CDM_BAO_Item::retrieve($params, $defaults);
require_once 'CRM/CiviDiscount/BAO/Item.php';
CRM_CiviDiscount_BAO_Item::retrieve($params, $defaults);
require_once 'CDM/BAO/Track.php';
require_once 'CRM/CiviDiscount/BAO/Track.php';
if ($cid) {
$rows = CDM_BAO_Track::getUsageByContact($this->_id);
$rows = CRM_CiviDiscount_BAO_Track::getUsageByContact($this->_id);
}
else {
$rows = CDM_BAO_Track::getUsageByOrg($this->_id);
$rows = CRM_CiviDiscount_BAO_Track::getUsageByOrg($this->_id);
}
$this->assign('rows', $rows);
......
......@@ -35,12 +35,12 @@
*/
require_once 'CRM/Core/Page.php';
require_once 'CDM/DAO/Item.php';
require_once 'CRM/CiviDiscount/DAO/Item.php';
/**
* Page for displaying discount code details
*/
class CDM_Page_Discount_View extends CRM_Core_Page {
class CRM_CiviDiscount_Page_View extends CRM_Core_Page {
/**
* The id of the discount code
*
......@@ -64,7 +64,7 @@ class CDM_Page_Discount_View extends CRM_Core_Page {
* @return string Classname of BAO.
*/
function getBAOName() {
return 'CDM_BAO_Item';
return 'CRM_CiviDiscount_BAO_Item';
}
/**
......@@ -83,14 +83,14 @@ class CDM_Page_Discount_View extends CRM_Core_Page {
),
CRM_Core_Action::DISABLE => array(
'name' => ts('Disable'),
'extra' => 'onclick = "enableDisable(%%id%%,\''. 'CDM_BAO_Item' . '\',\'' . 'enable-disable' . '\');"',
'extra' => 'onclick = "enableDisable(%%id%%,\''. 'CRM_CiviDiscount_BAO_Item' . '\',\'' . 'enable-disable' . '\');"',
'ref' => 'disable-action',
'title' => ts('Disable Discount')
),
CRM_Core_Action::ENABLE => array(
'name' => ts('Enable'),
'extra' => 'onclick = "enableDisable(%%id%%,\''. 'CDM_BAO_Item' . '\',\'' . 'enable-disable' . '\');"',
'extra' => 'onclick = "enableDisable(%%id%%,\''. 'CRM_CiviDiscount_BAO_Item' . '\',\'' . 'enable-disable' . '\');"',
'ref' => 'enable-action',
'title' => ts('Enable Discount')
),
......@@ -112,7 +112,7 @@ class CDM_Page_Discount_View extends CRM_Core_Page {
* @return string Classname of edit form.