本文整理匯總了PHP中CRM_Price_BAO_PriceSet::copy方法的典型用法代碼示例。如果您正苦於以下問題:PHP CRM_Price_BAO_PriceSet::copy方法的具體用法?PHP CRM_Price_BAO_PriceSet::copy怎麽用?PHP CRM_Price_BAO_PriceSet::copy使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類CRM_Price_BAO_PriceSet
的用法示例。
在下文中一共展示了CRM_Price_BAO_PriceSet::copy方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: copyPriceSet
/**
* Copy priceSet when event/contibution page is copied
*
* @param string $baoName
* BAO name.
* @param int $id
* Old event/contribution page id.
* @param int $newId
* Newly created event/contribution page id.
*/
public static function copyPriceSet($baoName, $id, $newId)
{
$priceSetId = CRM_Price_BAO_PriceSet::getFor($baoName, $id);
if ($priceSetId) {
$isQuickConfig = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', $priceSetId, 'is_quick_config');
if ($isQuickConfig) {
$copyPriceSet = CRM_Price_BAO_PriceSet::copy($priceSetId);
CRM_Price_BAO_PriceSet::addTo($baoName, $newId, $copyPriceSet->id);
} else {
$copyPriceSet =& CRM_Core_DAO::copyGeneric('CRM_Price_DAO_PriceSetEntity', array('entity_id' => $id, 'entity_table' => $baoName), array('entity_id' => $newId));
}
// copy event discount
if ($baoName == 'civicrm_event') {
$discount = CRM_Core_BAO_Discount::getOptionGroup($id, 'civicrm_event');
foreach ($discount as $discountId => $setId) {
$copyPriceSet =& CRM_Price_BAO_PriceSet::copy($setId);
CRM_Core_DAO::copyGeneric('CRM_Core_DAO_Discount', array('id' => $discountId), array('entity_id' => $newId, 'price_set_id' => $copyPriceSet->id));
}
}
}
}
示例2: copy
/**
* This function is to make a copy of a price set, including
* all the fields in the page
*
* @return void
* @access public
*/
function copy()
{
$id = CRM_Utils_Request::retrieve('sid', 'Positive', $this, TRUE, 0, 'GET');
CRM_Price_BAO_PriceSet::copy($id);
CRM_Utils_System::redirect(CRM_Utils_System::url(CRM_Utils_System::currentPath(), 'reset=1'));
}