本文整理汇总了PHP中CRM_Contribute_BAO_ContributionPage::create方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Contribute_BAO_ContributionPage::create方法的具体用法?PHP CRM_Contribute_BAO_ContributionPage::create怎么用?PHP CRM_Contribute_BAO_ContributionPage::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Contribute_BAO_ContributionPage
的用法示例。
在下文中一共展示了CRM_Contribute_BAO_ContributionPage::create方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: create
function create($id = null)
{
require_once "CRM/Contribute/BAO/ContributionPage.php";
$params = array('title' => 'Help Test CiviCRM!', 'intro_text' => 'Created for Test Coverage Online Contribution Page', 'contribution_type_id' => 1, 'payment_processor_id' => $id, 'is_monetary' => 1, 'is_allow_other_amount' => 1, 'min_amount' => 10, 'max_amount' => 10000, 'goal_amount' => 100000, 'thankyou_title' => 'Thanks for Your Support!', 'thankyou_text' => 'Thank you for your support.', 'is_email_receipt' => 1, 'receipt_from_name' => 'From TEST', 'receipt_from_email' => 'donations@civicrm.org', 'cc_receipt' => 'receipt@example.com', 'bcc_receipt' => 'bcc@example.com', 'is_active' => 1);
$contributionPage = CRM_Contribute_BAO_ContributionPage::create($params);
return $contributionPage->id;
}
示例2: postProcess
/**
* Process the form
*
* @return void
* @access public
*/
function postProcess()
{
// get the submitted form values.
$params = $this->controller->exportValues($this->_name);
// we do this in case the user has hit the forward/back button
if ($this->_id) {
$params['id'] = $this->_id;
}
$params['domain_id'] = CRM_Core_Config::domainID();
$params['is_active'] = CRM_Utils_Array::value('is_active', $params, false);
$params['is_credit_card_only'] = CRM_Utils_Array::value('is_credit_card_only', $params, false);
require_once 'CRM/Contribute/BAO/ContributionPage.php';
$dao =& CRM_Contribute_BAO_ContributionPage::create($params);
$this->set('id', $dao->id);
}
示例3: _civicrm_initialize
/**
* create a contribution page
*
* @param array $params (reference ) input parameters - need id and contribution_type_id
*
* @return array (reference ) contributionType id and other fields
* @static void
* @access public
*/
function &civicrm_contributionpage_create( &$params ) {
_civicrm_initialize( );
$values = array( );
require_once 'CRM/Contribute/BAO/ContributionPage.php';
$ids = array( );
if ( CRM_Utils_Array::value( 'id', $params ) ) {
}
$contributionPage = CRM_Contribute_BAO_ContributionPage::create( $params );
if ( is_a( $contributionPage, 'CRM_Core_Error' ) ) {
return civicrm_create_error( ts( 'Failed to create contributionPage' ) );
}
_civicrm_object_to_array($contributionPage, $contributeArray);
return $contributeArray;
}
示例4: postProcess
/**
* Process the form
*
* @return void
* @access public
*/
public function postProcess()
{
// get the submitted form values.
$params = $this->controller->exportValues($this->_name);
if (CRM_Utils_Array::value('payment_processor_id', $params) == CRM_Core_DAO::getFieldValue('CRM_Core_DAO_PaymentProcessor', 'AuthNet', 'id', 'payment_processor_type')) {
CRM_Core_Session::setStatus(ts(' Please note that the Authorize.net payment processor only allows recurring contributions and auto-renew memberships with payment intervals from 7-365 days or 1-12 months (i.e. not greater than 1 year).'));
}
// check for price set.
$priceSetID = CRM_Utils_Array::value('price_set_id', $params);
// get required fields.
$fields = array('id' => $this->_id, 'is_recur' => false, 'min_amount' => "null", 'max_amount' => "null", 'is_monetary' => false, 'is_pay_later' => false, 'is_recur_interval' => false, 'recur_frequency_unit' => "null", 'default_amount_id' => "null", 'is_allow_other_amount' => false, 'amount_block_is_active' => false);
$resetFields = array();
if ($priceSetID) {
$resetFields = array('min_amount', 'max_amount', 'is_allow_other_amount');
}
if (!CRM_Utils_Array::value('is_recur', $params)) {
$resetFields = array_merge($resetFields, array('is_recur_interval', 'recur_frequency_unit'));
}
foreach ($fields as $field => $defaultVal) {
$val = CRM_Utils_Array::value($field, $params, $defaultVal);
if (in_array($field, $resetFields)) {
$val = $defaultVal;
}
if (in_array($field, array('min_amount', 'max_amount'))) {
$val = CRM_Utils_Rule::cleanMoney($val);
}
$params[$field] = $val;
}
if ($params['is_recur']) {
require_once 'CRM/Core/BAO/CustomOption.php';
$params['recur_frequency_unit'] = implode(CRM_Core_BAO_CustomOption::VALUE_SEPERATOR, array_keys($params['recur_frequency_unit']));
$params['is_recur_interval'] = CRM_Utils_Array::value('is_recur_interval', $params, false);
}
require_once 'CRM/Contribute/BAO/ContributionPage.php';
$contributionPage = CRM_Contribute_BAO_ContributionPage::create($params);
$contributionPageID = $contributionPage->id;
// prepare for data cleanup.
$deleteAmountBlk = $deletePledgeBlk = $deletePriceSet = false;
if ($this->_priceSetID) {
$deletePriceSet = true;
}
if ($this->_pledgeBlockID) {
$deletePledgeBlk = true;
}
if (!empty($this->_amountBlock)) {
$deleteAmountBlk = true;
}
if ($contributionPageID) {
require_once 'CRM/Price/BAO/Set.php';
require_once 'CRM/Core/OptionGroup.php';
require_once 'CRM/Pledge/BAO/PledgeBlock.php';
if (CRM_Utils_Array::value('amount_block_is_active', $params)) {
// handle price set.
if ($priceSetID) {
// add/update price set.
$deletePriceSet = false;
CRM_Price_BAO_Set::addTo('civicrm_contribution_page', $contributionPageID, $priceSetID);
} else {
// process contribution amount block
$deleteAmountBlk = false;
$labels = CRM_Utils_Array::value('label', $params);
$values = CRM_Utils_Array::value('value', $params);
$default = CRM_Utils_Array::value('default', $params);
$options = array();
for ($i = 1; $i < self::NUM_OPTION; $i++) {
if (isset($values[$i]) && strlen(trim($values[$i])) > 0) {
$options[] = array('label' => trim($labels[$i]), 'value' => CRM_Utils_Rule::cleanMoney(trim($values[$i])), 'weight' => $i, 'is_active' => 1, 'is_default' => $default == $i);
}
}
CRM_Core_OptionGroup::createAssoc("civicrm_contribution_page.amount.{$contributionPageID}", $options, $params['default_amount_id']);
if ($params['default_amount_id']) {
CRM_Core_DAO::setFieldValue('CRM_Contribute_DAO_ContributionPage', $contributionPageID, 'default_amount_id', $params['default_amount_id']);
}
if (CRM_Utils_Array::value('is_pledge_active', $params)) {
$deletePledgeBlk = false;
$pledgeBlockParams = array('entity_id' => $contributionPageID, 'entity_table' => ts('civicrm_contribution_page'));
if ($this->_pledgeBlockID) {
$pledgeBlockParams['id'] = $this->_pledgeBlockID;
}
$pledgeBlock = array('pledge_frequency_unit', 'max_reminders', 'initial_reminder_day', 'additional_reminder_day');
foreach ($pledgeBlock as $key) {
$pledgeBlockParams[$key] = CRM_Utils_Array::value($key, $params);
}
$pledgeBlockParams['is_pledge_interval'] = CRM_Utils_Array::value('is_pledge_interval', $params, false);
// create pledge block.
require_once 'CRM/Pledge/BAO/PledgeBlock.php';
CRM_Pledge_BAO_PledgeBlock::create($pledgeBlockParams);
}
}
}
// delete pledge block.
if ($deletePledgeBlk) {
CRM_Pledge_BAO_PledgeBlock::deletePledgeBlock($this->_pledgeBlockID);
}
//.........这里部分代码省略.........
示例5: postProcess
/**
* Process the form
*
* @return void
* @access public
*/
public function postProcess()
{
// get the submitted form values.
$params = $this->controller->exportValues($this->_name);
$params['id'] = $this->_id;
$params['is_email_receipt'] = CRM_Utils_Array::value('is_email_receipt', $params, FALSE);
if (!$params['is_email_receipt']) {
$params['receipt_from_name'] = NULL;
$params['receipt_from_email'] = NULL;
$params['receipt_text'] = NULL;
$params['cc_receipt'] = NULL;
$params['bcc_receipt'] = NULL;
}
$dao = CRM_Contribute_BAO_ContributionPage::create($params);
parent::endPostProcess();
}
示例6: postProcess
/**
* Process the form
*
* @return void
* @access public
*/
public function postProcess()
{
// get the submitted form values.
$params = $this->controller->exportValues($this->_name);
if (array_key_exists('payment_processor', $params)) {
if (array_key_exists(CRM_Core_DAO::getFieldValue('CRM_Core_DAO_PaymentProcessor', 'AuthNet', 'id', 'payment_processor_type'), CRM_Utils_Array::value('payment_processor', $params))) {
CRM_Core_Session::setStatus(ts(' Please note that the Authorize.net payment processor only allows recurring contributions and auto-renew memberships with payment intervals from 7-365 days or 1-12 months (i.e. not greater than 1 year).'));
}
}
// check for price set.
$priceSetID = CRM_Utils_Array::value('price_set_id', $params);
// get required fields.
$fields = array('id' => $this->_id, 'is_recur' => FALSE, 'min_amount' => "null", 'max_amount' => "null", 'is_monetary' => FALSE, 'is_pay_later' => FALSE, 'is_recur_interval' => FALSE, 'recur_frequency_unit' => "null", 'default_amount_id' => "null", 'is_allow_other_amount' => FALSE, 'amount_block_is_active' => FALSE);
$resetFields = array();
if ($priceSetID) {
$resetFields = array('min_amount', 'max_amount', 'is_allow_other_amount');
}
if (!CRM_Utils_Array::value('is_recur', $params)) {
$resetFields = array_merge($resetFields, array('is_recur_interval', 'recur_frequency_unit'));
}
foreach ($fields as $field => $defaultVal) {
$val = CRM_Utils_Array::value($field, $params, $defaultVal);
if (in_array($field, $resetFields)) {
$val = $defaultVal;
}
if (in_array($field, array('min_amount', 'max_amount'))) {
$val = CRM_Utils_Rule::cleanMoney($val);
}
$params[$field] = $val;
}
if ($params['is_recur']) {
$params['recur_frequency_unit'] = implode(CRM_Core_DAO::VALUE_SEPARATOR, array_keys($params['recur_frequency_unit']));
$params['is_recur_interval'] = CRM_Utils_Array::value('is_recur_interval', $params, FALSE);
}
if (array_key_exists('payment_processor', $params) && !CRM_Utils_System::isNull($params['payment_processor'])) {
$params['payment_processor'] = implode(CRM_Core_DAO::VALUE_SEPARATOR, array_keys($params['payment_processor']));
} else {
$params['payment_processor'] = 'null';
}
$contributionPage = CRM_Contribute_BAO_ContributionPage::create($params);
$contributionPageID = $contributionPage->id;
// prepare for data cleanup.
$deleteAmountBlk = $deletePledgeBlk = $deletePriceSet = FALSE;
if ($this->_priceSetID) {
$deletePriceSet = TRUE;
}
if ($this->_pledgeBlockID) {
$deletePledgeBlk = TRUE;
}
if (!empty($this->_amountBlock)) {
$deleteAmountBlk = TRUE;
}
if ($contributionPageID) {
if (CRM_Utils_Array::value('amount_block_is_active', $params)) {
// handle price set.
if ($priceSetID) {
// add/update price set.
$deletePriceSet = FALSE;
if (CRM_Utils_Array::value('price_field_id', $params) || CRM_Utils_Array::value('price_field_other', $params)) {
$deleteAmountBlk = TRUE;
}
CRM_Price_BAO_Set::addTo('civicrm_contribution_page', $contributionPageID, $priceSetID);
} else {
$deletePriceSet = FALSE;
// process contribution amount block
$deleteAmountBlk = FALSE;
$labels = CRM_Utils_Array::value('label', $params);
$values = CRM_Utils_Array::value('value', $params);
$default = CRM_Utils_Array::value('default', $params);
$options = array();
for ($i = 1; $i < self::NUM_OPTION; $i++) {
if (isset($values[$i]) && strlen(trim($values[$i])) > 0) {
$options[] = array('label' => trim($labels[$i]), 'value' => CRM_Utils_Rule::cleanMoney(trim($values[$i])), 'weight' => $i, 'is_active' => 1, 'is_default' => $default == $i);
}
}
/* || CRM_Utils_Array::value( 'price_field_value', $params )|| CRM_Utils_Array::value( 'price_field_other', $params )*/
if (!empty($options) || CRM_Utils_Array::value('is_allow_other_amount', $params)) {
$fieldParams['is_quick_config'] = 1;
$noContriAmount = NULL;
$usedPriceSetId = CRM_Price_BAO_Set::getFor('civicrm_contribution_page', $this->_id, 3);
if (!(CRM_Utils_Array::value('price_field_id', $params) || CRM_Utils_Array::value('price_field_other', $params)) && !$usedPriceSetId) {
$pageTitle = strtolower(CRM_Utils_String::munge($this->_values['title'], '_', 245));
$setParams['title'] = $this->_values['title'];
if (!CRM_Core_DAO::getFieldValue('CRM_Price_BAO_Set', $pageTitle, 'id', 'name')) {
$setParams['name'] = $pageTitle;
} elseif (!CRM_Core_DAO::getFieldValue('CRM_Price_BAO_Set', $pageTitle . '_' . $this->_id, 'id', 'name')) {
$setParams['name'] = $pageTitle . '_' . $this->_id;
} else {
$timeSec = explode(".", microtime(true));
$setParams['name'] = $pageTitle . '_' . date('is', $timeSec[0]) . $timeSec[1];
}
$setParams['is_quick_config'] = 1;
$setParams['extends'] = CRM_Core_Component::getComponentID('CiviContribute');
$priceSet = CRM_Price_BAO_Set::create($setParams);
//.........这里部分代码省略.........
示例7: testcopy
/**
* Test copy() method
*/
public function testcopy()
{
$params = array('qfkey' => '9a3ef3c08879ad4c8c109b21c583400e', 'title' => 'Test Contribution Page', 'financial_type_id' => $this->_financialTypeID, 'intro_text' => '', 'footer_text' => 'Thanks', 'is_for_organization' => 0, 'for_organization' => ' I am contributing on behalf of an organization', 'goal_amount' => '400', 'is_active' => 1, 'honor_block_title' => '', 'honor_block_text' => '', 'start_date' => '20091022105900', 'start_date_time' => '10:59AM', 'end_date' => '19700101000000', 'end_date_time' => '', 'is_credit_card_only' => '');
$contributionpage = CRM_Contribute_BAO_ContributionPage::create($params);
$copycontributionpage = CRM_Contribute_BAO_ContributionPage::copy($contributionpage->id);
$this->assertEquals($copycontributionpage->financial_type_id, $this->_financialTypeID, 'Check for Financial type id.');
$this->assertEquals($copycontributionpage->goal_amount, 400, 'Check for goal amount.');
ContributionPage::delete($contributionpage->id);
ContributionPage::delete($copycontributionpage->id);
}
示例8: postProcess
/**
* Process the form.
*/
public function postProcess()
{
// get the submitted form values.
$params = $this->controller->exportValues($this->_name);
// we do this in case the user has hit the forward/back button
if ($this->_id) {
$params['id'] = $this->_id;
} else {
$session = CRM_Core_Session::singleton();
$params['created_id'] = $session->get('userID');
$params['created_date'] = date('YmdHis');
$config = CRM_Core_Config::singleton();
$params['currency'] = $config->defaultCurrency;
}
$params['is_confirm_enabled'] = CRM_Utils_Array::value('is_confirm_enabled', $params, FALSE);
$params['is_share'] = CRM_Utils_Array::value('is_share', $params, FALSE);
$params['is_active'] = CRM_Utils_Array::value('is_active', $params, FALSE);
$params['is_credit_card_only'] = CRM_Utils_Array::value('is_credit_card_only', $params, FALSE);
$params['honor_block_is_active'] = CRM_Utils_Array::value('honor_block_is_active', $params, FALSE);
$params['is_for_organization'] = !empty($params['is_organization']) ? CRM_Utils_Array::value('is_for_organization', $params, FALSE) : 0;
$params['start_date'] = CRM_Utils_Date::processDate($params['start_date'], $params['start_date_time'], TRUE);
$params['end_date'] = CRM_Utils_Date::processDate($params['end_date'], $params['end_date_time'], TRUE);
$params['goal_amount'] = CRM_Utils_Rule::cleanMoney($params['goal_amount']);
if (!$params['honor_block_is_active']) {
$params['honor_block_title'] = NULL;
$params['honor_block_text'] = NULL;
}
$dao = CRM_Contribute_BAO_ContributionPage::create($params);
$ufJoinParams = array('is_organization' => array('module' => 'on_behalf', 'entity_table' => 'civicrm_contribution_page', 'entity_id' => $dao->id), 'honor_block_is_active' => array('module' => 'soft_credit', 'entity_table' => 'civicrm_contribution_page', 'entity_id' => $dao->id));
foreach ($ufJoinParams as $index => $ufJoinParam) {
if (!empty($params[$index])) {
// first delete all past entries
CRM_Core_BAO_UFJoin::deleteAll($ufJoinParam);
$ufJoinParam['uf_group_id'] = $params[$index];
$ufJoinParam['weight'] = 1;
$ufJoinParam['is_active'] = 1;
if ($index == 'honor_block_is_active') {
$ufJoinParam['uf_group_id'] = $params['honoree_profile'];
$ufJoinParam['module_data'] = CRM_Contribute_BAO_ContributionPage::formatModuleData($params, FALSE, 'soft_credit');
} else {
$ufJoinParam['uf_group_id'] = $params['onbehalf_profile_id'];
$ufJoinParam['module_data'] = CRM_Contribute_BAO_ContributionPage::formatModuleData($params, FALSE, 'on_behalf');
}
CRM_Core_BAO_UFJoin::create($ufJoinParam);
} else {
if ($index == 'honor_block_is_active') {
$params['honor_block_title'] = NULL;
$params['honor_block_text'] = NULL;
} else {
$params['for_organization'] = NULL;
}
//On subsequent honor_block_is_active uncheck, disable(don't delete)
//that particular honoree profile entry in UFjoin table, CRM-13981
$ufId = CRM_Core_BAO_UFJoin::findJoinEntryId($ufJoinParam);
if ($ufId) {
$ufJoinParam['uf_group_id'] = CRM_Core_BAO_UFJoin::findUFGroupId($ufJoinParam);
$ufJoinParam['is_active'] = 0;
CRM_Core_BAO_UFJoin::create($ufJoinParam);
}
}
}
$this->set('id', $dao->id);
if ($this->_action & CRM_Core_Action::ADD) {
$url = 'civicrm/admin/contribute/amount';
$urlParams = "action=update&reset=1&id={$dao->id}";
// special case for 'Save and Done' consistency.
if ($this->controller->getButtonName('submit') == '_qf_Amount_upload_done') {
$url = 'civicrm/admin/contribute';
$urlParams = 'reset=1';
CRM_Core_Session::setStatus(ts("'%1' information has been saved.", array(1 => $this->getTitle())), ts('Saved'), 'success');
}
CRM_Utils_System::redirect(CRM_Utils_System::url($url, $urlParams));
}
parent::endPostProcess();
}
示例9: postProcess
/**
* Process the form
*
* @return void
* @access public
*/
public function postProcess()
{
// get the submitted form values.
$params = $this->controller->exportValues($this->_name);
$params['id'] = $this->_id;
$params['is_email_receipt'] = CRM_Utils_Array::value('is_email_receipt', $params, false);
if (!$params['is_email_receipt']) {
$params['receipt_from_name'] = null;
$params['receipt_from_email'] = null;
$params['receipt_text'] = null;
$params['cc_receipt'] = null;
$params['bcc_receipt'] = null;
}
require_once 'CRM/Contribute/BAO/ContributionPage.php';
$dao = CRM_Contribute_BAO_ContributionPage::create($params);
}
示例10: postProcess
/**
* Process the form
*
* @return void
* @access public
*/
public function postProcess()
{
// get the submitted form values.
$params = $this->controller->exportValues($this->_name);
// we do this in case the user has hit the forward/back button
if ($this->_id) {
$params['id'] = $this->_id;
} else {
$session = CRM_Core_Session::singleton();
$params['created_id'] = $session->get('userID');
$params['created_date'] = date('YmdHis');
$config = CRM_Core_Config::singleton();
$params['currency'] = $config->defaultCurrency;
}
$params['is_active'] = CRM_Utils_Array::value('is_active', $params, false);
$params['is_credit_card_only'] = CRM_Utils_Array::value('is_credit_card_only', $params, false);
$params['honor_block_is_active'] = CRM_Utils_Array::value('honor_block_is_active', $params, false);
$params['is_for_organization'] = CRM_Utils_Array::value('is_organization', $params) ? CRM_Utils_Array::value('is_for_organization', $params, false) : 0;
$params['start_date'] = CRM_Utils_Date::processDate($params['start_date'], $params['start_date_time'], true);
$params['end_date'] = CRM_Utils_Date::processDate($params['end_date'], $params['end_date_time'], true);
$params['goal_amount'] = CRM_Utils_Rule::cleanMoney($params['goal_amount']);
if (!$params['honor_block_is_active']) {
$params['honor_block_title'] = null;
$params['honor_block_text'] = null;
}
require_once 'CRM/Contribute/BAO/ContributionPage.php';
$dao =& CRM_Contribute_BAO_ContributionPage::create($params);
$this->set('id', $dao->id);
parent::postProcess();
}
示例11: postProcess
/**
* Process the form
*
* @return void
* @access public
*/
public function postProcess()
{
// get the submitted form values.
$params = $this->controller->exportValues($this->_name);
// we do this in case the user has hit the forward/back button
if ($this->_id) {
$params['id'] = $this->_id;
} else {
$session = CRM_Core_Session::singleton();
$params['created_id'] = $session->get('userID');
$params['created_date'] = date('YmdHis');
$config = CRM_Core_Config::singleton();
$params['currency'] = $config->defaultCurrency;
}
$params['is_confirm_enabled'] = CRM_Utils_Array::value('is_confirm_enabled', $params, FALSE);
$params['is_share'] = CRM_Utils_Array::value('is_share', $params, FALSE);
$params['is_active'] = CRM_Utils_Array::value('is_active', $params, FALSE);
$params['is_credit_card_only'] = CRM_Utils_Array::value('is_credit_card_only', $params, FALSE);
$params['honor_block_is_active'] = CRM_Utils_Array::value('honor_block_is_active', $params, FALSE);
$params['is_for_organization'] = CRM_Utils_Array::value('is_organization', $params) ? CRM_Utils_Array::value('is_for_organization', $params, FALSE) : 0;
$params['start_date'] = CRM_Utils_Date::processDate($params['start_date'], $params['start_date_time'], TRUE);
$params['end_date'] = CRM_Utils_Date::processDate($params['end_date'], $params['end_date_time'], TRUE);
$params['goal_amount'] = CRM_Utils_Rule::cleanMoney($params['goal_amount']);
if (!$params['honor_block_is_active']) {
$params['honor_block_title'] = NULL;
$params['honor_block_text'] = NULL;
}
$dao = CRM_Contribute_BAO_ContributionPage::create($params);
// make entry in UF join table for onbehalf of org profile
$ufJoinParams = array('is_active' => 1, 'module' => 'OnBehalf', 'entity_table' => 'civicrm_contribution_page', 'entity_id' => $dao->id);
// first delete all past entries
CRM_Core_BAO_UFJoin::deleteAll($ufJoinParams);
if (CRM_Utils_Array::value('onbehalf_profile_id', $params)) {
$ufJoinParams['weight'] = 1;
$ufJoinParams['uf_group_id'] = $params['onbehalf_profile_id'];
CRM_Core_BAO_UFJoin::create($ufJoinParams);
}
$this->set('id', $dao->id);
if ($this->_action & CRM_Core_Action::ADD) {
$url = 'civicrm/admin/contribute/amount';
$urlParams = "action=update&reset=1&id={$dao->id}";
// special case for 'Save and Done' consistency.
if ($this->controller->getButtonName('submit') == '_qf_Amount_upload_done') {
$url = 'civicrm/admin/contribute';
$urlParams = 'reset=1';
CRM_Core_Session::setStatus(ts("'%1' information has been saved.", array(1 => $this->getTitle())));
}
CRM_Utils_System::redirect(CRM_Utils_System::url($url, $urlParams));
}
parent::endPostProcess();
}
示例12: testcheckRecurPaymentProcessor
/**
* test checkRecurPaymentProcessor() method
*/
function testcheckRecurPaymentProcessor()
{
$paymentProcessor = PaypalPro::create();
$params = array('title' => 'Test Cotribution Page', 'contribution_type_id' => $this->_contributionTypeID, 'is_active' => 1, 'payment_processor_id' => $paymentProcessor);
require_once 'CRM/Contribute/BAO/ContributionPage.php';
$contributionpage = CRM_Contribute_BAO_ContributionPage::create($params, $ids);
$id = $contributionpage->id;
$checkRecurring = CRM_Contribute_BAO_ContributionPage::checkRecurPaymentProcessor($id);
$this->assertEquals($checkRecurring, false, 'Check for false return.');
}
示例13: testcheckRecurPaymentProcessor
/**
* test checkRecurPaymentProcessor() method
*/
function testcheckRecurPaymentProcessor()
{
//@todo paypalpro create seems to fail silently without causing this class to fail
// $this->paymentProcessorCreate may be a better option
$paymentProcessor = PaypalPro::create();
$params = array('title' => 'Test Contribution Page', 'financial_type_id' => $this->_financialTypeID, 'is_active' => 1, 'payment_processor_id' => $paymentProcessor);
$contributionpage = CRM_Contribute_BAO_ContributionPage::create($params);
$id = $contributionpage->id;
$checkRecurring = CRM_Contribute_BAO_ContributionPage::checkRecurPaymentProcessor($id);
$this->assertEquals($checkRecurring, FALSE, 'Check for false return.');
ContributionPage::delete($contributionpage->id);
}
示例14: postProcess
/**
* Process the form
*
* @return void
* @access public
*/
function postProcess()
{
// get the submitted form values.
$params = $this->controller->exportValues($this->_name);
$params['id'] = $this->_id;
$params['domain_id'] = CRM_Core_Config::domainID();
$params['is_allow_other_amount'] = CRM_Utils_Array::value('is_allow_other_amount', $params, false);
require_once 'CRM/Core/DAO/CustomOption.php';
// delete all the prior label values in the custom options table
$dao =& new CRM_Core_DAO_CustomOption();
$dao->entity_table = 'civicrm_contribution_page';
$dao->entity_id = $this->_id;
$dao->delete();
// if there are label / values, create custom options for them
$labels = CRM_Utils_Array::value('label', $params);
$values = CRM_Utils_Array::value('value', $params);
$default = CRM_Utils_Array::value('default', $params);
if (!CRM_Utils_System::isNull($labels) && !CRM_Utils_System::isNull($values)) {
for ($i = 1; $i < CRM_CONTRIBUTE_FORM_CONTRIBUTIONPAGE_AMOUNT_NUM_OPTION; $i++) {
if (!empty($labels[$i]) && !empty($values[$i])) {
$dao =& new CRM_Core_DAO_CustomOption();
$dao->label = trim($labels[$i]);
$dao->value = trim($values[$i]);
$dao->entity_table = 'civicrm_contribution_page';
$dao->entity_id = $this->_id;
$dao->weight = $i;
$dao->is_active = 1;
$dao->save();
if ($default == $i) {
$params['default_amount'] = $values[$i];
}
}
}
}
require_once 'CRM/Contribute/BAO/ContributionPage.php';
$dao = CRM_Contribute_BAO_ContributionPage::create($params);
}
示例15: postProcess
/**
* Process the form
*
* @return void
* @access public
*/
function postProcess()
{
// get the submitted form values.
$params = $this->controller->exportValues($this->_name);
$params['id'] = $this->_id;
$params['domain_id'] = CRM_Core_Config::domainID();
$params['is_email_receipt'] = CRM_Utils_Array::value('is_email_receipt', $params, false);
require_once 'CRM/Contribute/BAO/ContributionPage.php';
$dao = CRM_Contribute_BAO_ContributionPage::create($params);
}