本文整理汇总了PHP中CRM_Contribute_DAO_Contribution::fetch方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Contribute_DAO_Contribution::fetch方法的具体用法?PHP CRM_Contribute_DAO_Contribution::fetch怎么用?PHP CRM_Contribute_DAO_Contribution::fetch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Contribute_DAO_Contribution
的用法示例。
在下文中一共展示了CRM_Contribute_DAO_Contribution::fetch方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateRecurLinkedPledge
function updateRecurLinkedPledge(&$contribution)
{
$returnProperties = array('id', 'pledge_id');
$paymentDetails = $paymentIDs = array();
if (CRM_Core_DAO::commonRetrieveAll('CRM_Pledge_DAO_PledgePayment', 'contribution_id', $contribution->id, $paymentDetails, $returnProperties)) {
foreach ($paymentDetails as $key => $value) {
$paymentIDs[] = $value['id'];
$pledgeId = $value['pledge_id'];
}
} else {
//payment is not already linked - if it is linked with a pledge we need to create a link.
// return if it is not recurring contribution
if (!$contribution->contribution_recur_id) {
return;
}
$relatedContributions = new CRM_Contribute_DAO_Contribution();
$relatedContributions->contribution_recur_id = $contribution->contribution_recur_id;
$relatedContributions->find();
while ($relatedContributions->fetch()) {
CRM_Core_DAO::commonRetrieveAll('CRM_Pledge_DAO_PledgePayment', 'contribution_id', $relatedContributions->id, $paymentDetails, $returnProperties);
}
if (empty($paymentDetails)) {
// payment is not linked with a pledge and neither are any other contributions on this
return;
}
foreach ($paymentDetails as $key => $value) {
$pledgeId = $value['pledge_id'];
}
// we have a pledge now we need to get the oldest unpaid payment
$paymentDetails = CRM_Pledge_BAO_PledgePayment::getOldestPledgePayment($pledgeId);
if (empty($paymentDetails['id'])) {
// we can assume this pledge is now completed
// return now so we don't create a core error & roll back
return;
}
$paymentDetails['contribution_id'] = $contribution->id;
$paymentDetails['status_id'] = $contribution->contribution_status_id;
$paymentDetails['actual_amount'] = $contribution->total_amount;
// put contribution against it
$payment = CRM_Pledge_BAO_PledgePayment::add($paymentDetails);
$paymentIDs[] = $payment->id;
}
// update pledge and corresponding payment statuses
CRM_Pledge_BAO_PledgePayment::updatePledgePaymentStatus($pledgeId, $paymentIDs, $contribution->contribution_status_id, NULL, $contribution->total_amount);
}
示例2: updateRecords
/**
* Updates contacts affected by the option value passed.
*
* @param int $optionValueId
* The option value id.
* @param int $action
* The action describing whether prefix/suffix was UPDATED or DELETED.
*
* @return bool
*/
public static function updateRecords(&$optionValueId, $action)
{
//finding group name
$optionValue = new CRM_Core_DAO_OptionValue();
$optionValue->id = $optionValueId;
$optionValue->find(TRUE);
$optionGroup = new CRM_Core_DAO_OptionGroup();
$optionGroup->id = $optionValue->option_group_id;
$optionGroup->find(TRUE);
// group name
$gName = $optionGroup->name;
// value
$value = $optionValue->value;
// get the proper group name & affected field name
// todo: this may no longer be needed for individuals - check inputs
$individuals = array('gender' => 'gender_id', 'individual_prefix' => 'prefix_id', 'individual_suffix' => 'suffix_id', 'communication_style' => 'communication_style_id');
$contributions = array('payment_instrument' => 'payment_instrument_id');
$activities = array('activity_type' => 'activity_type_id');
$participant = array('participant_role' => 'role_id');
$eventType = array('event_type' => 'event_type_id');
$aclRole = array('acl_role' => 'acl_role_id');
$all = array_merge($individuals, $contributions, $activities, $participant, $eventType, $aclRole);
$fieldName = '';
foreach ($all as $name => $id) {
if ($gName == $name) {
$fieldName = $id;
}
}
if ($fieldName == '') {
return TRUE;
}
if (array_key_exists($gName, $individuals)) {
$contactDAO = new CRM_Contact_DAO_Contact();
$contactDAO->{$fieldName} = $value;
$contactDAO->find();
while ($contactDAO->fetch()) {
if ($action == CRM_Core_Action::DELETE) {
$contact = new CRM_Contact_DAO_Contact();
$contact->id = $contactDAO->id;
$contact->find(TRUE);
// make sure dates doesn't get reset
$contact->birth_date = CRM_Utils_Date::isoToMysql($contact->birth_date);
$contact->deceased_date = CRM_Utils_Date::isoToMysql($contact->deceased_date);
$contact->{$fieldName} = 'NULL';
$contact->save();
}
}
return TRUE;
}
if (array_key_exists($gName, $contributions)) {
$contribution = new CRM_Contribute_DAO_Contribution();
$contribution->{$fieldName} = $value;
$contribution->find();
while ($contribution->fetch()) {
if ($action == CRM_Core_Action::DELETE) {
$contribution->{$fieldName} = 'NULL';
$contribution->save();
}
}
return TRUE;
}
if (array_key_exists($gName, $activities)) {
$activity = new CRM_Activity_DAO_Activity();
$activity->{$fieldName} = $value;
$activity->find();
while ($activity->fetch()) {
$activity->delete();
}
return TRUE;
}
//delete participant role, type and event type option value
if (array_key_exists($gName, $participant)) {
$participantValue = new CRM_Event_DAO_Participant();
$participantValue->{$fieldName} = $value;
if ($participantValue->find(TRUE)) {
return FALSE;
}
return TRUE;
}
//delete event type option value
if (array_key_exists($gName, $eventType)) {
$event = new CRM_Event_DAO_Event();
$event->{$fieldName} = $value;
if ($event->find(TRUE)) {
return FALSE;
}
return TRUE;
}
//delete acl_role option value
if (array_key_exists($gName, $aclRole)) {
//.........这里部分代码省略.........
示例3: checkDuplicateIds
/**
* Check if there is a contribution with the params passed in.
* Used for trxn_id,invoice_id and contribution_id
*
* @param array $params (reference ) an assoc array of name/value pairs
*
* @return array contribution id if success else NULL
* @access public
* static
*/
static function checkDuplicateIds($params)
{
$dao = new CRM_Contribute_DAO_Contribution();
$clause = array();
$input = array();
foreach ($params as $k => $v) {
if ($v) {
$clause[] = "{$k} = '{$v}'";
}
}
$clause = implode(' AND ', $clause);
$query = "SELECT id FROM civicrm_contribution WHERE {$clause}";
$dao =& CRM_Core_DAO::executeQuery($query, $input);
while ($dao->fetch()) {
$result = $dao->id;
return $result;
}
return NULL;
}
示例4: deleteContactContribution
/**
* Delete contribution of contact.
*
* CRM-12155
*
* @param int $contactId
* Contact id.
*
*/
public static function deleteContactContribution($contactId)
{
$contribution = new CRM_Contribute_DAO_Contribution();
$contribution->contact_id = $contactId;
$contribution->find();
while ($contribution->fetch()) {
self::deleteContribution($contribution->id);
}
}
示例5: postProcess
/**
* @param $form
* @param array $params Parameters from the form.
*/
public static function postProcess($form, $params)
{
if (!empty($form->_honor_block_is_active) && !empty($params['soft_credit_type_id'])) {
$honorId = NULL;
//check if there is any duplicate contact
$profileContactType = CRM_Core_BAO_UFGroup::getContactType($params['honoree_profile_id']);
$dedupeParams = CRM_Dedupe_Finder::formatParams($params['honor'], $profileContactType);
$dedupeParams['check_permission'] = FALSE;
$ids = CRM_Dedupe_Finder::dupesByParams($dedupeParams, $profileContactType);
if (count($ids)) {
$honorId = CRM_Utils_Array::value(0, $ids);
}
$honorId = CRM_Contact_BAO_Contact::createProfileContact($params['honor'], CRM_Core_DAO::$_nullArray, $honorId, NULL, $params['honoree_profile_id']);
$softParams = array();
$softParams['contribution_id'] = $form->_contributionID;
$softParams['contact_id'] = $honorId;
$softParams['soft_credit_type_id'] = $params['soft_credit_type_id'];
$contribution = new CRM_Contribute_DAO_Contribution();
$contribution->id = $form->_contributionID;
$contribution->find();
while ($contribution->fetch()) {
$softParams['currency'] = $contribution->currency;
$softParams['amount'] = $contribution->total_amount;
}
CRM_Contribute_BAO_ContributionSoft::add($softParams);
if (CRM_Utils_Array::value('is_email_receipt', $form->_values)) {
$form->_values['honor'] = array('soft_credit_type' => CRM_Utils_Array::value($params['soft_credit_type_id'], CRM_Core_OptionGroup::values("soft_credit_type")), 'honor_id' => $honorId, 'honor_profile_id' => $params['honoree_profile_id'], 'honor_profile_values' => $params['honor']);
}
}
}
示例6: postProcess
//.........这里部分代码省略.........
$membershipParams = array_merge($membershipTypeValues[$memType], $params);
$membership = CRM_Member_BAO_Membership::create($membershipParams, $ids);
$this->_membershipIDs[] = $membership->id;
$createdMemberships[$memType] = $membership;
$count++;
}
} else {
$params['action'] = $this->_action;
if ($this->_onlinePendingContributionId && !empty($formValues['record_contribution'])) {
// update membership as well as contribution object, CRM-4395
$params['contribution_id'] = $this->_onlinePendingContributionId;
$params['componentId'] = $params['id'];
$params['componentName'] = 'contribute';
$result = CRM_Contribute_BAO_Contribution::transitionComponents($params, TRUE);
if (!empty($result) && !empty($params['contribution_id'])) {
$lineItem = array();
$lineItems = CRM_Price_BAO_LineItem::getLineItems($params['contribution_id'], 'contribution');
$itemId = key($lineItems);
$priceSetId = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceField', $lineItems[$itemId]['price_field_id'], 'price_set_id');
$fieldType = NULL;
if ($itemId && !empty($lineItems[$itemId]['price_field_id'])) {
$fieldType = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceField', $lineItems[$itemId]['price_field_id'], 'html_type');
}
$lineItems[$itemId]['unit_price'] = $params['total_amount'];
$lineItems[$itemId]['line_total'] = $params['total_amount'];
$lineItems[$itemId]['id'] = $itemId;
$lineItem[$priceSetId] = $lineItems;
CRM_Price_BAO_LineItem::processPriceSet($params['contribution_id'], $lineItem);
//create new soft-credit record, CRM-13981
$softParams['contribution_id'] = $params['contribution_id'];
$dao = new CRM_Contribute_DAO_Contribution();
$dao->id = $params['contribution_id'];
$dao->find();
while ($dao->fetch()) {
$softParams['currency'] = $dao->currency;
$softParams['amount'] = $dao->total_amount;
}
CRM_Contribute_BAO_ContributionSoft::add($softParams);
}
//carry updated membership object.
$membership = new CRM_Member_DAO_Membership();
$membership->id = $this->_id;
$membership->find(TRUE);
$cancelled = TRUE;
if ($membership->end_date) {
//display end date w/ status message.
$endDate = $membership->end_date;
$membershipStatues = CRM_Member_PseudoConstant::membershipStatus();
if (!in_array($membership->status_id, array(array_search('Cancelled', $membershipStatues), array_search('Expired', $membershipStatues)))) {
$cancelled = FALSE;
}
}
// suppress form values in template.
$this->assign('cancelled', $cancelled);
// FIX ME: need to recheck this
// here we might updated dates, so get from object.
foreach ($calcDates[$membership->membership_type_id] as $date => &$val) {
if ($membership->{$date}) {
$val = $membership->{$date};
}
}
$createdMemberships[] = $membership;
} else {
$count = 0;
foreach ($this->_memTypeSelected as $memType) {
if ($count && !empty($formValues['record_contribution']) && ($relateContribution = CRM_Member_BAO_Membership::getMembershipContributionId($membership->id))) {
示例7: moveRecurringRecord
public function moveRecurringRecord($submittedValues)
{
// Move recurring record to another contact
if (!empty($submittedValues['contact_id']) && $submittedValues['contact_id'] != $this->_contactID) {
$selected_cid = $submittedValues['contact_id'];
// FIXME: Not getting the below value in $submittedValues
// So taking the value from $_POST
if (isset($_POST['membership_record'])) {
$membership_record = $_POST['membership_record'];
}
// Update contact id in civicrm_contribution_recur table
$recurring = new CRM_Contribute_BAO_ContributionRecur();
$recurring->id = $this->_id;
if ($recurring->find(TRUE)) {
$recurParams = (array) $recurring;
$recurParams['contact_id'] = $selected_cid;
CRM_Contribute_BAO_ContributionRecur::create($recurParams);
}
// Update contact id in civicrm_contribution table, if 'Move Existing Contributions?' is ticked
if (isset($submittedValues['move_existing_contributions']) && $submittedValues['move_existing_contributions'] == 1) {
$contribution = new CRM_Contribute_DAO_Contribution();
$contribution->contribution_recur_id = $this->_id;
$contribution->find();
while ($contribution->fetch()) {
$contributionParams = (array) $contribution;
$contributionParams['contact_id'] = $selected_cid;
// Update contact_id of contributions
// related to the recurring contribution
CRM_Contribute_BAO_Contribution::create($contributionParams);
}
}
}
if (!empty($membership_record)) {
// Remove the contribution_recur_id from existing membership
if (!empty($this->_membershipID)) {
$membership = new CRM_Member_DAO_Membership();
$membership->id = $this->_membershipID;
if ($membership->find(TRUE)) {
$membershipParams = (array) $membership;
$membershipParams['contribution_recur_id'] = 'NULL';
CRM_Member_BAO_Membership::add($membershipParams);
}
}
// Update contribution_recur_id to the new membership
$membership = new CRM_Member_DAO_Membership();
$membership->id = $membership_record;
if ($membership->find(TRUE)) {
$membershipParams = (array) $membership;
$membershipParams['contribution_recur_id'] = $this->_id;
CRM_Member_BAO_Membership::add($membershipParams);
}
}
}
开发者ID:Kajakaran,项目名称:uk.co.vedaconsulting.offlinerecurringcontributions,代码行数:53,代码来源:ContributionRecur.php
示例8: getHonorContacts
/**
* Function to get list of contribution In Honor of contact Ids
*
* @param int $honorId In Honor of Contact ID
*
* @return return the list of contribution fields
*
* @access public
* @static
*/
static function getHonorContacts($honorId)
{
$params = array();
$honorDAO = new CRM_Contribute_DAO_Contribution();
$honorDAO->honor_contact_id = $honorId;
$honorDAO->find();
$status = CRM_Contribute_PseudoConstant::contributionStatus($honorDAO->contribution_status_id);
$type = CRM_Contribute_PseudoConstant::contributionType();
while ($honorDAO->fetch()) {
$params[$honorDAO->id]['honorId'] = $honorDAO->contact_id;
$params[$honorDAO->id]['display_name'] = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $honorDAO->contact_id, 'display_name');
$params[$honorDAO->id]['type'] = $type[$honorDAO->contribution_type_id];
$params[$honorDAO->id]['type_id'] = $honorDAO->contribution_type_id;
$params[$honorDAO->id]['amount'] = CRM_Utils_Money::format($honorDAO->total_amount, $honorDAO->currency);
$params[$honorDAO->id]['source'] = $honorDAO->source;
$params[$honorDAO->id]['receive_date'] = $honorDAO->receive_date;
$params[$honorDAO->id]['contribution_status'] = CRM_Utils_Array::value($honorDAO->contribution_status_id, $status);
}
return $params;
}