本文整理匯總了PHP中CRM_Price_BAO_Set::deleteSet方法的典型用法代碼示例。如果您正苦於以下問題:PHP CRM_Price_BAO_Set::deleteSet方法的具體用法?PHP CRM_Price_BAO_Set::deleteSet怎麽用?PHP CRM_Price_BAO_Set::deleteSet使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類CRM_Price_BAO_Set
的用法示例。
在下文中一共展示了CRM_Price_BAO_Set::deleteSet方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: postProcess
/**
* Process the form when submitted
*
* @return void
* @access public
*/
public function postProcess()
{
if (CRM_Price_BAO_Set::deleteSet($this->_sid)) {
CRM_Core_Session::setStatus(ts('The Price Set \'%1\' has been deleted.', array(1 => $this->_title)));
} else {
CRM_Core_Session::setStatus(ts('The Price Set \'%1\' has not been deleted! You must delete all price fields in this set prior to deleting the set.', array(1 => $this->_title)));
}
}
示例2: testfixEventLevel
/**
* fixEventLevel() method (Setting ',' values), resolveDefaults(assinging value to array) method
*/
function testfixEventLevel()
{
require_once 'CRM/Utils/String.php';
require_once 'CRM/Utils/Array.php';
$paramsSet['title'] = 'Price Set';
$paramsSet['name'] = CRM_Utils_String::titleToVar('Price Set');
$paramsSet['is_active'] = CRM_Utils_Array::value('is_active', $params, false);
require_once 'CRM/Price/BAO/Set.php';
$priceset = CRM_Price_BAO_Set::create($paramsSet);
//Checking for priceset added in the table.
$this->assertDBCompareValue('CRM_Price_BAO_Set', $priceset->id, 'title', 'id', $paramsSet['title'], 'Check DB for created priceset');
$paramsField = array('label' => 'Price Field', 'name' => CRM_Utils_String::titleToVar('Price Field'), 'html_type' => 'Text', 'price' => 10, 'option_label' => array('1' => 'Price Field'), 'option_value' => array('1' => 10), 'is_display_amounts' => 1, 'weight' => 1, 'options_per_line' => 1, 'is_active' => array('1' => 1), 'price_set_id' => $priceset->id, 'is_enter_qty' => 1);
$ids = array();
require_once 'CRM/Price/BAO/Field.php';
$pricefield = CRM_Price_BAO_Field::create($paramsField, $ids);
//Checking for priceset added in the table.
$this->assertDBCompareValue('CRM_Price_BAO_Field', $pricefield->id, 'label', 'id', $paramsField['label'], 'Check DB for created pricefield');
$eventId = $this->_eventId;
$participantParams = array('send_receipt' => 1, 'is_test' => 0, 'is_pay_later' => 0, 'event_id' => $eventId, 'register_date' => date('Y-m-d') . " 00:00:00", 'role_id' => 1, 'status_id' => 1, 'source' => 'Event_' . $eventId, 'contact_id' => $this->_contactId, 'note' => 'Note added for Event_' . $eventId, 'fee_level' => 'Price_Field - 55');
$participant = CRM_Event_BAO_Participant::add($participantParams);
//Checking for participant added in the table.
$this->assertDBCompareValue('CRM_Event_BAO_Participant', $this->_contactId, 'id', 'contact_id', $participant->id, 'Check DB for created participant');
$values = array();
$ids = array();
$params = array('id' => $participant->id);
CRM_Event_BAO_Participant::getValues($params, $values, $ids);
$this->assertNotEquals(count($values), 0, 'Checking for empty array.');
CRM_Event_BAO_Participant::resolveDefaults($values[$participant->id]);
if ($values[$participant->id]['fee_level']) {
CRM_Event_BAO_Participant::fixEventLevel($values[$participant->id]['fee_level']);
}
$deletePricefield = CRM_Price_BAO_Field::deleteField($pricefield->id);
$this->assertDBNull('CRM_Price_BAO_Field', $pricefield->id, 'name', 'id', 'Check DB for non-existence of Price Field.');
$deletePriceset = CRM_Price_BAO_Set::deleteSet($priceset->id);
$this->assertDBNull('CRM_Price_BAO_Set', $priceset->id, 'title', 'id', 'Check DB for non-existence of Price Set.');
Participant::delete($participant->id);
Contact::delete($this->_contactId);
Event::delete($eventId);
}