本文整理汇总了PHP中CRM_Core_BAO_CustomGroup::updateCustomData方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_BAO_CustomGroup::updateCustomData方法的具体用法?PHP CRM_Core_BAO_CustomGroup::updateCustomData怎么用?PHP CRM_Core_BAO_CustomGroup::updateCustomData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Core_BAO_CustomGroup
的用法示例。
在下文中一共展示了CRM_Core_BAO_CustomGroup::updateCustomData方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: postProcess
/**
* Function to process the form
*
* @access public
* @return None
*/
function postProcess()
{
if ($this->_action & CRM_CORE_ACTION_DELETE) {
require_once 'CRM/Contribute/BAO/Contribution.php';
CRM_Contribute_BAO_Contribution::deleteContribution($this->_id);
return;
}
// get the submitted form values.
$formValues = $this->controller->exportValues($this->_name);
//print_r($formValues);
$config =& CRM_Core_Config::singleton();
$params = array();
$ids = array();
$params['contact_id'] = $this->_contactID;
$params['currency'] = $config->defaultCurrency;
$fields = array('contribution_type_id', 'payment_instrument_id', 'non_deductible_amount', 'total_amount', 'fee_amount', 'net_amount', 'trxn_id', 'invoice_id', 'cancel_reason', 'source', 'note');
foreach ($fields as $f) {
$params[$f] = CRM_Utils_Array::value($f, $formValues);
}
$dates = array('receive_date', 'receipt_date', 'thankyou_date', 'cancel_date');
$currentTime = getDate();
foreach ($dates as $d) {
if (!CRM_Utils_System::isNull($formValues[$d])) {
$formValues[$d]['H'] = $currentTime['hours'];
$formValues[$d]['i'] = $currentTime['minutes'];
$formValues[$d]['s'] = '00';
$params[$d] = CRM_Utils_Date::format($formValues[$d]);
}
}
$ids['contribution'] = $params['id'] = $this->_id;
$contribution =& CRM_Contribute_BAO_Contribution::create($params, $ids);
// do the updates/inserts
CRM_Core_BAO_CustomGroup::postProcess($this->_groupTree, $formValues);
//process premium
if ($formValues['product_name'][0]) {
require_once 'CRM/Contribute/DAO/ContributionProduct.php';
$dao =& new CRM_Contribute_DAO_ContributionProduct();
$dao->contribution_id = $contribution->id;
$dao->product_id = $formValues['product_name'][0];
$dao->fulfilled_date = CRM_Utils_Date::format($formValues['fulfilled_date']);
$dao->product_option = $this->_options[$formValues['product_name'][0]][$formValues['product_name'][1]];
if ($this->_premiumId) {
$premoumDAO =& new CRM_Contribute_DAO_ContributionProduct();
$premoumDAO->id = $this->_premiumId;
$premoumDAO->find(true);
if ($premoumDAO->product_id == $formValues['product_name'][0]) {
$dao->id = $this->_premiumId;
$premium = $dao->save();
} else {
$premoumDAO->delete();
$premium = $dao->save();
}
} else {
$premium = $dao->save();
}
}
CRM_Core_BAO_CustomGroup::updateCustomData($this->_groupTree, 'Contribution', $contribution->id);
}
示例2: postProcess
/**
* Function to process the form
*
* @access public
* @return None
*/
function postProcess()
{
if ($this->_action & CRM_CORE_ACTION_VIEW) {
return;
}
if ($this->_action & CRM_CORE_ACTION_DELETE) {
CRM_Core_BAO_Meeting::del($this->_id);
CRM_Core_Session::setStatus(ts("Selected Meeting is deleted sucessfully."));
return;
}
// store the submitted values in an array
$params = $this->controller->exportValues($this->_name);
$ids = array();
$dateTime = $params['scheduled_date_time'];
$dateTime = CRM_Utils_Date::format($dateTime);
// store the date with proper format
$params['scheduled_date_time'] = $dateTime;
// store the contact id and current drupal user id
$params['source_contact_id'] = $this->_userId;
$params['target_entity_id'] = $this->_contactId;
$params['target_entity_table'] = 'civicrm_contact';
//set parent id if exists for follow up activities
if ($this->_pid) {
$params['parent_id'] = $this->_pid;
}
if ($this->_action & CRM_CORE_ACTION_UPDATE) {
$ids['meeting'] = $this->_id;
}
$meeting = CRM_Core_BAO_Meeting::add($params, $ids);
CRM_Core_BAO_CustomGroup::postProcess($this->_groupTree, $params);
// do the updates/inserts
CRM_Core_BAO_CustomGroup::updateCustomData($this->_groupTree, 'Meeting', $meeting->id);
if ($meeting->status == 'Completed') {
// we need to insert an activity history record here
$params = array('entity_table' => 'civicrm_contact', 'entity_id' => $this->_contactId, 'activity_type' => ts('Meeting'), 'module' => 'CiviCRM', 'callback' => 'CRM_Activity_Form_Meeting::showMeetingDetails', 'activity_id' => $meeting->id, 'activity_summary' => $meeting->subject, 'activity_date' => $meeting->scheduled_date_time);
if (is_a(crm_create_activity_history($params), 'CRM_Core_Error')) {
return false;
}
}
if ($meeting->status == 'Completed') {
CRM_Core_Session::setStatus(ts('Meeting "%1" has been logged to Activity History.', array(1 => $meeting->subject)));
} else {
CRM_Core_Session::setStatus(ts('Meeting "%1" has been saved.', array(1 => $meeting->subject)));
}
}
示例3: postProcess
/**
* Form submission of new/edit contact is processed.
*
* @access public
* @return None
*/
function postProcess()
{
// check if dedupe button, if so return.
$buttonName = $this->controller->getButtonName();
if ($buttonName == $this->_dedupeButtonName) {
return;
}
// store the submitted values in an array
$params = $this->controller->exportValues($this->_name);
// action is taken depending upon the mode
$ids = array();
if ($this->_action & CRM_CORE_ACTION_UPDATE) {
// if update get all the valid database ids
// from the session
$ids = $this->get('ids');
}
$params['contact_type'] = $this->_contactType;
$contact = CRM_Contact_BAO_Contact::create($params, $ids, CRM_CONTACT_FORM_EDIT_LOCATION_BLOCKS);
//add contact to gruoup
CRM_Contact_BAO_GroupContact::create($params['group'], $params['contact_id']);
//add contact to tags
CRM_Core_BAO_EntityTag::create($params['tag'], $params['contact_id']);
// here we replace the user context with the url to view this contact
$config =& CRM_Core_Config::singleton();
$session =& CRM_Core_Session::singleton();
CRM_Core_Session::setStatus(ts('Your %1 contact record has been saved.', array(1 => $contact->contact_type_display)));
$buttonName = $this->controller->getButtonName();
if ($buttonName == $this->getButtonName('next', 'new')) {
// add the recently viewed contact
list($displayName, $contactImage) = CRM_Contact_BAO_Contact::getDisplayAndImage($contact->id);
CRM_Utils_Recent::add($displayName, CRM_Utils_System::url('civicrm/contact/view', 'reset=1&cid=' . $contact->id), $contactImage, $contact->id);
$session->replaceUserContext(CRM_Utils_System::url('civicrm/contact/add' . $contact->contact_type[0], 'reset=1&c_type=' . $contact->contact_type));
} else {
$session->replaceUserContext(CRM_Utils_System::url('civicrm/contact/view', 'reset=1&cid=' . $contact->id));
}
CRM_Core_BAO_CustomGroup::postProcess($this->_groupTree, $params);
// do the updates/inserts
CRM_Core_BAO_CustomGroup::updateCustomData($this->_groupTree, $this->_contactType, $contact->id);
}
示例4: postProcess
//.........这里部分代码省略.........
$month = substr($fixed_period_start_day, 0, strlen($fixed_period_start_day) - 2);
$day = substr($fixed_period_start_day, -2) . "<br>";
$year = $date[0];
$startDate = $year . '-' . $month . '-' . $day;
} else {
$startDate = date('Y-m-d');
}
}
}
$date = explode('-', $startDate);
$year = $date[0];
$month = $date[1];
$day = $date[2];
switch ($duration_unit) {
case 'year':
$year = $year + $duration_interval;
break;
case 'month':
$month = $month + $duration_interval;
break;
case 'day':
$day = $day + $duration_interval;
break;
case 'week':
$day = $day + $duration_interval * 7;
}
$endDate = date('Y-m-d H:i:s', mktime($hour, $minute, $second, $month, $day, $year));
$this->assign('start_date', $startDate);
$this->assign('end_date', $endDate);
}
require_once 'CRM/Contribute/DAO/Premium.php';
$dao =& new CRM_Contribute_DAO_Premium();
$dao->entity_table = 'civicrm_contribution_page';
$dao->entity_id = $this->_id;
$dao->find(true);
$this->assign('contact_phone', $dao->premiums_contact_phone);
$this->assign('contact_email', $dao->premiums_contact_email);
}
CRM_Core_DAO::transaction('BEGIN');
$nonDeductibleAmount = $result['gross_amount'];
if ($contributionType->is_deductible) {
if ($premiumParams['selectProduct'] != 'no_thanks') {
require_once 'CRM/Contribute/DAO/Product.php';
$productDAO =& new CRM_Contribute_DAO_Product();
$productDAO->id = $premiumParams['selectProduct'];
$productDAO->find(true);
if ($result['gross_amount'] < $productDAO->price) {
$nonDeductibleAmount = $result['gross_amount'];
} else {
$nonDeductibleAmount = $productDAO->price;
}
} else {
$nonDeductibleAmount = '0.00';
}
}
// check contribution Type
// first create the contribution record
$params = array('contact_id' => $contactID, 'contribution_type_id' => $contributionType->id, 'payment_instrument_id' => 1, 'receive_date' => $now, 'non_deductible_amount' => $nonDeductibleAmount, 'total_amount' => $result['gross_amount'], 'fee_amount' => CRM_Utils_Array::value('fee_amount', $result), 'net_amount' => CRM_Utils_Array::value('net_amount', $result, $result['gross_amount']), 'trxn_id' => $result['trxn_id'], 'invoice_id' => $this->_params['invoiceID'], 'currency' => $this->_params['currencyID'], 'receipt_date' => $receiptDate, 'source' => ts('Online Contribution:') . ' ' . $this->_values['title']);
$ids = array();
$contribution =& CRM_Contribute_BAO_Contribution::add($params, $ids);
//create Premium record
if ($premiumParams['selectProduct'] && $premiumParams['selectProduct'] != 'no_thanks') {
require_once 'CRM/Contribute/DAO/Product.php';
$productDAO =& new CRM_Contribute_DAO_Product();
$productDAO->id = $premiumParams['selectProduct'];
$productDAO->find(true);
$periodType = $productDAO->period_type;
require_once 'CRM/Utils/Date.php';
$params = array('product_id' => $premiumParams['selectProduct'], 'contribution_id' => $contribution->id, 'product_option' => $premiumParams['options_' . $premiumParams['selectProduct']], 'quantity' => 1, 'start_date' => CRM_Utils_Date::customFormat($startDate, '%Y%m%d'), 'end_date' => CRM_Utils_Date::customFormat($endDate, '%Y%m%d'));
CRM_Contribute_BAO_Contribution::addPremium($params);
}
// process the custom data that is submitted or that came via the url
$groupTree = $this->get('groupTree');
$customValues = $this->get('customGetValues');
$customValues = array_merge($this->_params, $customValues);
require_once 'CRM/Core/BAO/CustomGroup.php';
CRM_Core_BAO_CustomGroup::postProcess($groupTree, $customValues);
CRM_Core_BAO_CustomGroup::updateCustomData($groupTree, 'Contribution', $contribution->id);
// next create the transaction record
$params = array('entity_table' => 'civicrm_contribution', 'entity_id' => $contribution->id, 'trxn_date' => $now, 'trxn_type' => 'Debit', 'total_amount' => $result['gross_amount'], 'fee_amount' => CRM_Utils_Array::value('fee_amount', $result), 'net_amount' => CRM_Utils_Array::value('net_amount', $result, $result['gross_amount']), 'currency' => $this->_params['currencyID'], 'payment_processor' => $config->paymentProcessor, 'trxn_id' => $result['trxn_id']);
require_once 'CRM/Contribute/BAO/FinancialTrxn.php';
$trxn =& CRM_Contribute_BAO_FinancialTrxn::create($params);
// also create an activity history record
require_once 'CRM/Utils/Money.php';
$params = array('entity_table' => 'civicrm_contact', 'entity_id' => $contactID, 'activity_type' => $contributionType->name, 'module' => 'CiviContribute', 'callback' => 'CRM_Contribute_Page_Contribution::details', 'activity_id' => $contribution->id, 'activity_summary' => 'Online - ' . CRM_Utils_Money::format($this->_params['amount']), 'activity_date' => $now);
if (is_a(crm_create_activity_history($params), 'CRM_Core_Error')) {
CRM_Core_Error::fatal("Could not create a system record");
}
CRM_Core_DAO::transaction('COMMIT');
// finally send an email receipt
if ($this->_values['is_email_receipt']) {
list($displayName, $email) = CRM_Contact_BAO_Contact::getEmailDetails($contactID);
$template =& CRM_Core_Smarty::singleton();
$subject = trim($template->fetch('CRM/Contribute/Form/Contribution/ReceiptSubject.tpl'));
$message = $template->fetch('CRM/Contribute/Form/Contribution/ReceiptMessage.tpl');
$receiptFrom = '"' . $this->_values['receipt_from_name'] . '" <' . $this->_values['receipt_from_email'] . '>';
require_once 'CRM/Utils/Mail.php';
CRM_Utils_Mail::send($receiptFrom, $displayName, $email, $subject, $message, $this->_values['cc_receipt'], $this->_values['bcc_receipt']);
}
}
示例5: postProcess
/**
* Process the form when submitted
*
* @return void
* @access public
*/
function postProcess()
{
if ($this->_action & CRM_CORE_ACTION_DELETE) {
CRM_Contact_BAO_Group::discard($this->_id);
CRM_Core_Session::setStatus(ts('The Group "%1" has been deleted.', array(1 => $this->_title)));
} else {
// store the submitted values in an array
$params = $this->exportValues();
$params['domain_id'] = CRM_Core_Config::domainID();
$params['is_active'] = 1;
if ($this->_action & CRM_CORE_ACTION_UPDATE) {
$params['id'] = $this->_id;
}
$group =& CRM_Contact_BAO_Group::create($params);
// do the updates/inserts
CRM_Core_BAO_CustomGroup::postProcess($this->_groupTree, $params);
CRM_Core_BAO_CustomGroup::updateCustomData($this->_groupTree, 'Group', $group->id);
CRM_Core_Session::setStatus(ts('The Group "%1" has been saved.', array(1 => $group->title)));
/*
* Add context to the session, in case we are adding members to the group
*/
if ($this->_action & CRM_CORE_ACTION_ADD) {
$this->set('context', 'amtg');
$this->set('amtgID', $group->id);
$session =& CRM_Core_Session::singleton();
$session->pushUserContext(CRM_Utils_System::url('civicrm/group/search', 'reset=1&force=1&context=smog&gid=' . $group->id));
}
}
}
示例6: postProcess
/**
* Process the user submitted custom data values.
*
* @access public
* @return void
*/
function postProcess()
{
// Get the form values and groupTree
$fv = $this->controller->exportValues($this->_name);
CRM_Core_BAO_CustomGroup::postProcess($this->_groupTree, $fv);
// do the updates/inserts
CRM_Core_BAO_CustomGroup::updateCustomData($this->_groupTree, $this->_entityType, $this->_tableId);
}