本文整理汇总了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'));
}