本文整理汇总了PHP中CRM_Contribute_BAO_Contribution::getContributionDetails方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Contribute_BAO_Contribution::getContributionDetails方法的具体用法?PHP CRM_Contribute_BAO_Contribution::getContributionDetails怎么用?PHP CRM_Contribute_BAO_Contribution::getContributionDetails使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Contribute_BAO_Contribution
的用法示例。
在下文中一共展示了CRM_Contribute_BAO_Contribution::getContributionDetails方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: exportComponents
//.........这里部分代码省略.........
$groupBy = 'GROUP BY contribution_search_scredit_combined.id, contribution_search_scredit_combined.scredit_id';
}
break;
case CRM_Export_Form_Select::EVENT_EXPORT:
$groupBy = 'GROUP BY civicrm_participant.id';
break;
case CRM_Export_Form_Select::MEMBER_EXPORT:
$groupBy = " GROUP BY civicrm_membership.id";
break;
}
if ($queryMode & CRM_Contact_BAO_Query::MODE_ACTIVITY) {
$groupBy = " GROUP BY civicrm_activity.id ";
}
$queryString .= $groupBy;
// always add contact_a.id to the ORDER clause
// so the order is deterministic
//CRM-15301
if (strpos('contact_a.id', $order) === FALSE) {
$order .= ", contact_a.id";
}
if ($order) {
list($field, $dir) = explode(' ', $order, 2);
$field = trim($field);
if (!empty($returnProperties[$field])) {
//CRM-15301
$queryString .= " ORDER BY {$order}";
}
}
$multipleSelectFields = array('preferred_communication_method' => 1);
$addPaymentHeader = FALSE;
$paymentDetails = array();
if ($paymentFields || $selectedPaymentFields) {
// get payment related in for event and members
$paymentDetails = CRM_Contribute_BAO_Contribution::getContributionDetails($exportMode, $ids);
//get all payment headers.
// If we haven't selected specific payment fields, load in all the
// payment headers.
if (!$selectedPaymentFields) {
$paymentHeaders = self::componentPaymentFields();
if (!empty($paymentDetails)) {
$addPaymentHeader = TRUE;
}
} else {
$paymentHeaders = array();
}
$nullContributionDetails = array_fill_keys(array_keys($paymentHeaders), NULL);
}
$componentDetails = $headerRows = $sqlColumns = array();
$setHeader = TRUE;
$rowCount = self::EXPORT_ROW_COUNT;
$offset = 0;
// we write to temp table often to avoid using too much memory
$tempRowCount = 100;
$count = -1;
// for CRM-3157 purposes
$i18n = CRM_Core_I18n::singleton();
$outputColumns = array();
//@todo - it would be clearer to start defining output columns earlier in this function rather than stick with return properties until this point
// as the array is not actually 'returnProperties' after the sql query is formed - making the alterations to it confusing
foreach ($returnProperties as $key => $value) {
$outputColumns[$key] = $value;
}
while (1) {
$limitQuery = "{$queryString} LIMIT {$offset}, {$rowCount}";
$dao = CRM_Core_DAO::executeQuery($limitQuery);
if ($dao->N <= 0) {
示例2: postProcess
//.........这里部分代码省略.........
}
if (!empty($lineItem[$priceSetId])) {
$invoiceSettings = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME, 'contribution_invoice_settings');
$invoicing = CRM_Utils_Array::value('invoicing', $invoiceSettings);
$taxAmount = FALSE;
$totalTaxAmount = 0;
foreach ($lineItem[$priceSetId] as &$priceFieldOp) {
if (!empty($priceFieldOp['membership_type_id'])) {
$priceFieldOp['start_date'] = $membershipTypeValues[$priceFieldOp['membership_type_id']]['start_date'] ? CRM_Utils_Date::customFormat($membershipTypeValues[$priceFieldOp['membership_type_id']]['start_date'], '%B %E%f, %Y') : '-';
$priceFieldOp['end_date'] = $membershipTypeValues[$priceFieldOp['membership_type_id']]['end_date'] ? CRM_Utils_Date::customFormat($membershipTypeValues[$priceFieldOp['membership_type_id']]['end_date'], '%B %E%f, %Y') : '-';
} else {
$priceFieldOp['start_date'] = $priceFieldOp['end_date'] = 'N/A';
}
if ($invoicing && isset($priceFieldOp['tax_amount'])) {
$taxAmount = TRUE;
$totalTaxAmount += $priceFieldOp['tax_amount'];
}
}
if ($invoicing) {
$dataArray = array();
foreach ($lineItem[$priceSetId] as $key => $value) {
if (isset($value['tax_amount']) && isset($value['tax_rate'])) {
if (isset($dataArray[$value['tax_rate']])) {
$dataArray[$value['tax_rate']] = $dataArray[$value['tax_rate']] + CRM_Utils_Array::value('tax_amount', $value);
} else {
$dataArray[$value['tax_rate']] = CRM_Utils_Array::value('tax_amount', $value);
}
}
}
if ($taxAmount) {
$this->assign('totalTaxAmount', $totalTaxAmount);
$this->assign('taxTerm', CRM_Utils_Array::value('tax_term', $invoiceSettings));
}
$this->assign('dataArray', $dataArray);
}
}
$this->assign('lineItem', !empty($lineItem) && !$isQuickConfig ? $lineItem : FALSE);
$receiptSend = FALSE;
$contributionId = CRM_Member_BAO_Membership::getMembershipContributionId($membership->id);
$membershipIds = $this->_membershipIDs;
if ($contributionId && !empty($membershipIds)) {
$contributionDetails = CRM_Contribute_BAO_Contribution::getContributionDetails(CRM_Export_Form_Select::MEMBER_EXPORT, $this->_membershipIDs);
if ($contributionDetails[$membership->id]['contribution_status'] == 'Completed') {
$receiptSend = TRUE;
}
}
if (!empty($formValues['send_receipt']) && $receiptSend) {
$formValues['contact_id'] = $this->_contactID;
$formValues['contribution_id'] = $contributionId;
// send email receipt
$mailSend = self::emailReceipt($this, $formValues, $membership);
}
if ($this->_action & CRM_Core_Action::UPDATE) {
//end date can be modified by hooks, so if end date is set then use it.
$endDate = $membership->end_date ? $membership->end_date : $endDate;
$statusMsg = ts('Membership for %1 has been updated.', array(1 => $this->_memberDisplayName));
if ($endDate && $endDate !== 'null') {
$endDate = CRM_Utils_Date::customFormat($endDate);
$statusMsg .= ' ' . ts('The membership End Date is %1.', array(1 => $endDate));
}
if ($receiptSend) {
$statusMsg .= ' ' . ts('A confirmation and receipt has been sent to %1.', array(1 => $this->_contributorEmail));
}
} elseif ($this->_action & CRM_Core_Action::ADD) {
// FIX ME: fix status messages
$statusMsg = array();
foreach ($membershipTypes as $memType => $membershipType) {
$statusMsg[$memType] = ts('%1 membership for %2 has been added.', array(1 => $membershipType, 2 => $this->_memberDisplayName));
$membership = $createdMemberships[$memType];
$memEndDate = $membership->end_date ? $membership->end_date : $endDate;
//get the end date from calculated dates.
if (!$memEndDate && empty($params['is_recur'])) {
$memEndDate = CRM_Utils_Array::value('end_date', $calcDates[$memType]);
}
if ($memEndDate && $memEndDate !== 'null') {
$memEndDate = CRM_Utils_Date::customFormat($memEndDate);
$statusMsg[$memType] .= ' ' . ts('The new membership End Date is %1.', array(1 => $memEndDate));
}
}
$statusMsg = implode('<br/>', $statusMsg);
if ($receiptSend && !empty($mailSend)) {
$statusMsg .= ' ' . ts('A membership confirmation and receipt has been sent to %1.', array(1 => $this->_contributorEmail));
}
}
// finally set membership id if already not set
if (!$this->_id) {
$this->_id = $membership->id;
}
CRM_Core_Session::setStatus($statusMsg, ts('Complete'), 'success');
$buttonName = $this->controller->getButtonName();
if ($this->_context == 'standalone') {
if ($buttonName == $this->getButtonName('upload', 'new')) {
$session->replaceUserContext(CRM_Utils_System::url('civicrm/member/add', 'reset=1&action=add&context=standalone'));
} else {
$session->replaceUserContext(CRM_Utils_System::url('civicrm/contact/view', "reset=1&cid={$this->_contactID}&selectedChild=member"));
}
} elseif ($buttonName == $this->getButtonName('upload', 'new')) {
$session->replaceUserContext(CRM_Utils_System::url('civicrm/contact/view/membership', "reset=1&action=add&context=membership&cid={$this->_contactID}"));
}
}
示例3: exportComponents
//.........这里部分代码省略.........
} else {
$where .= " AND {$componentClause}";
}
}
$queryString = "{$select} {$from} {$where}";
if (CRM_Utils_Array::value('tags', $returnProperties) || CRM_Utils_Array::value('groups', $returnProperties) || CRM_Utils_Array::value('notes', $returnProperties) || $query->_useGroupBy) {
$queryString .= " GROUP BY contact_a.id";
}
if ($order) {
list($field, $dir) = explode(' ', $order, 2);
$field = trim($field);
if (CRM_Utils_Array::value($field, $returnProperties)) {
$queryString .= " ORDER BY {$order}";
}
}
//hack for student data
require_once 'CRM/Core/OptionGroup.php';
$multipleSelectFields = array('preferred_communication_method' => 1);
if (CRM_Core_Permission::access('Quest')) {
require_once 'CRM/Quest/BAO/Student.php';
$studentFields = array();
$studentFields = CRM_Quest_BAO_Student::$multipleSelectFields;
$multipleSelectFields = array_merge($multipleSelectFields, $studentFields);
}
$dao =& CRM_Core_DAO::executeQuery($queryString, CRM_Core_DAO::$_nullArray);
$header = false;
$addPaymentHeader = false;
if ($paymentFields) {
$addPaymentHeader = true;
//special return properties for event and members
$paymentHeaders = array(ts('Total Amount'), ts('Contribution Status'), ts('Received Date'), ts('Payment Instrument'), ts('Transaction ID'));
// get payment related in for event and members
require_once 'CRM/Contribute/BAO/Contribution.php';
$paymentDetails = CRM_Contribute_BAO_Contribution::getContributionDetails($exportMode, $ids);
}
$componentDetails = $headerRows = array();
$setHeader = true;
while ($dao->fetch()) {
$row = array();
//first loop through returnproperties so that we return what is required, and in same order.
$relationshipField = 0;
foreach ($returnProperties as $field => $value) {
//we should set header only once
if ($setHeader) {
if (isset($query->_fields[$field]['title'])) {
$headerRows[] = $query->_fields[$field]['title'];
} else {
if ($field == 'phone_type_id') {
$headerRows[] = 'Phone Type';
} else {
if ($field == 'provider_id') {
$headerRows[] = 'Im Service Provider';
} else {
if (is_array($value) && $field == 'location') {
// fix header for location type case
foreach ($value as $ltype => $val) {
foreach (array_keys($val) as $fld) {
$type = explode('-', $fld);
$hdr = "{$ltype}-" . $query->_fields[$type[0]]['title'];
if (CRM_Utils_Array::value(1, $type)) {
if (CRM_Utils_Array::value(0, $type) == 'phone') {
$hdr .= "-" . CRM_Utils_Array::value($type[1], $phoneTypes);
} else {
if (CRM_Utils_Array::value(0, $type) == 'im') {
$hdr .= "-" . CRM_Utils_Array::value($type[1], $imProviders);
}
示例4: submit
//.........这里部分代码省略.........
//display end date w/ status message.
$endDate = $membership->end_date;
if (!in_array($membership->status_id, array(array_search('Cancelled', CRM_Member_PseudoConstant::membershipStatus(NULL, " name = 'Cancelled' ", 'name', FALSE, TRUE)), array_search('Expired', CRM_Member_PseudoConstant::membershipStatus())))) {
$cancelled = FALSE;
}
}
// suppress form values in template.
$this->assign('cancelled', $cancelled);
$createdMemberships[] = $membership;
} else {
$count = 0;
foreach ($this->_memTypeSelected as $memType) {
if ($count && !empty($formValues['record_contribution']) && ($relateContribution = CRM_Member_BAO_Membership::getMembershipContributionId($membership->id))) {
$membershipTypeValues[$memType]['relate_contribution_id'] = $relateContribution;
}
$membershipParams = array_merge($params, $membershipTypeValues[$memType]);
if (!empty($formValues['int_amount'])) {
$init_amount = array();
foreach ($formValues as $key => $value) {
if (strstr($key, 'txt-price')) {
$init_amount[$key] = $value;
}
}
$membershipParams['init_amount'] = $init_amount;
}
if (!empty($softParams)) {
$membershipParams['soft_credit'] = $softParams;
}
$membership = CRM_Member_BAO_Membership::create($membershipParams, $ids);
$params['contribution'] = CRM_Utils_Array::value('contribution', $membershipParams);
unset($params['lineItems']);
$this->_membershipIDs[] = $membership->id;
$createdMemberships[$memType] = $membership;
$count++;
}
}
}
if (!empty($lineItem[$this->_priceSetId])) {
$invoiceSettings = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME, 'contribution_invoice_settings');
$invoicing = CRM_Utils_Array::value('invoicing', $invoiceSettings);
$taxAmount = FALSE;
$totalTaxAmount = 0;
foreach ($lineItem[$this->_priceSetId] as &$priceFieldOp) {
if (!empty($priceFieldOp['membership_type_id'])) {
$priceFieldOp['start_date'] = $membershipTypeValues[$priceFieldOp['membership_type_id']]['start_date'] ? CRM_Utils_Date::customFormat($membershipTypeValues[$priceFieldOp['membership_type_id']]['start_date'], '%B %E%f, %Y') : '-';
$priceFieldOp['end_date'] = $membershipTypeValues[$priceFieldOp['membership_type_id']]['end_date'] ? CRM_Utils_Date::customFormat($membershipTypeValues[$priceFieldOp['membership_type_id']]['end_date'], '%B %E%f, %Y') : '-';
} else {
$priceFieldOp['start_date'] = $priceFieldOp['end_date'] = 'N/A';
}
if ($invoicing && isset($priceFieldOp['tax_amount'])) {
$taxAmount = TRUE;
$totalTaxAmount += $priceFieldOp['tax_amount'];
}
}
if ($invoicing) {
$dataArray = array();
foreach ($lineItem[$this->_priceSetId] as $key => $value) {
if (isset($value['tax_amount']) && isset($value['tax_rate'])) {
if (isset($dataArray[$value['tax_rate']])) {
$dataArray[$value['tax_rate']] = $dataArray[$value['tax_rate']] + CRM_Utils_Array::value('tax_amount', $value);
} else {
$dataArray[$value['tax_rate']] = CRM_Utils_Array::value('tax_amount', $value);
}
}
}
if ($taxAmount) {
$this->assign('totalTaxAmount', $totalTaxAmount);
$this->assign('taxTerm', CRM_Utils_Array::value('tax_term', $invoiceSettings));
}
$this->assign('dataArray', $dataArray);
}
}
$this->assign('lineItem', !empty($lineItem) && !$isQuickConfig ? $lineItem : FALSE);
$receiptSend = FALSE;
$contributionId = CRM_Member_BAO_Membership::getMembershipContributionId($membership->id);
$membershipIds = $this->_membershipIDs;
if ($contributionId && !empty($membershipIds)) {
$contributionDetails = CRM_Contribute_BAO_Contribution::getContributionDetails(CRM_Export_Form_Select::MEMBER_EXPORT, $this->_membershipIDs);
if ($contributionDetails[$membership->id]['contribution_status'] == 'Completed') {
$receiptSend = TRUE;
}
}
if (!empty($formValues['send_receipt']) && $receiptSend) {
$formValues['contact_id'] = $this->_contactID;
$formValues['contribution_id'] = $contributionId;
// We really don't need a distinct receipt_text_signup vs receipt_text_renewal as they are
// handled in the receipt. But by setting one we avoid breaking templates for now
// although at some point we should switch in the templates.
$formValues['receipt_text_signup'] = $formValues['receipt_text'];
// send email receipt
$mailSend = self::emailReceipt($this, $formValues, $membership);
}
// finally set membership id if already not set
if (!$this->_id) {
$this->_id = $membership->id;
}
$isRecur = CRM_Utils_Array::value('is_recur', $params);
$this->setStatusMessage($membership, $endDate, $receiptSend, $membershipTypes, $createdMemberships, $isRecur, $calcDates, $mailSend);
return $createdMemberships;
}
示例5: exportComponents
//.........这里部分代码省略.........
} else {
$where .= " AND {$componentClause}";
}
}
$queryString = "{$select} {$from} {$where}";
if (CRM_Utils_Array::value('tags', $returnProperties) || CRM_Utils_Array::value('groups', $returnProperties) || CRM_Utils_Array::value('notes', $returnProperties) || $query->_useGroupBy) {
$queryString .= " GROUP BY contact_a.id";
}
if ($order) {
list($field, $dir) = explode(' ', $order, 2);
$field = trim($field);
if (CRM_Utils_Array::value($field, $returnProperties)) {
$queryString .= " ORDER BY {$order}";
}
}
//hack for student data
require_once 'CRM/Core/OptionGroup.php';
$multipleSelectFields = array('preferred_communication_method' => 1);
if (CRM_Core_Permission::access('Quest')) {
require_once 'CRM/Quest/BAO/Student.php';
$studentFields = array();
$studentFields = CRM_Quest_BAO_Student::$multipleSelectFields;
$multipleSelectFields = array_merge($multipleSelectFields, $studentFields);
}
$dao =& CRM_Core_DAO::executeQuery($queryString, CRM_Core_DAO::$_nullArray);
$header = false;
$addPaymentHeader = false;
if ($paymentFields) {
$addPaymentHeader = true;
//special return properties for event and members
$paymentHeaders = array(ts('Total Amount'), ts('Contribution Status'), ts('Received Date'), ts('Payment Instrument'), ts('Transaction ID'));
// get payment related in for event and members
require_once 'CRM/Contribute/BAO/Contribution.php';
$paymentDetails = CRM_Contribute_BAO_Contribution::getContributionDetails($exportMode, $ids);
}
$componentDetails = $headerRows = array();
$setHeader = true;
while ($dao->fetch()) {
$row = array();
//first loop through returnproperties so that we return what is required, and in same order.
$relationshipField = 0;
foreach ($returnProperties as $field => $value) {
//we should set header only once
if ($setHeader) {
if (isset($query->_fields[$field]['title'])) {
$headerRows[] = $query->_fields[$field]['title'];
} else {
if ($field == 'phone_type_id') {
$headerRows[] = 'Phone Type';
} else {
if ($field == 'provider_id') {
$headerRows[] = 'Im Service Provider';
} else {
if (is_array($value) && $field == 'location') {
// fix header for location type case
foreach ($value as $ltype => $val) {
foreach (array_keys($val) as $fld) {
$type = explode('-', $fld);
$hdr = "{$ltype}-" . $query->_fields[$type[0]]['title'];
if (CRM_Utils_Array::value(1, $type)) {
if (CRM_Utils_Array::value(0, $type) == 'phone') {
$hdr .= "-" . CRM_Utils_Array::value($type[1], $phoneTypes);
} else {
if (CRM_Utils_Array::value(0, $type) == 'im') {
$hdr .= "-" . CRM_Utils_Array::value($type[1], $imProviders);
}
示例6: exportComponents
//.........这里部分代码省略.........
}
}
$queryString = "{$select} {$from} {$where}";
$groupBy = "";
if (CRM_Utils_Array::value('tags', $returnProperties) || CRM_Utils_Array::value('groups', $returnProperties) || CRM_Utils_Array::value('notes', $returnProperties) || $query->_useGroupBy) {
$groupBy = " GROUP BY contact_a.id";
}
if ($queryMode & CRM_Contact_BAO_Query::MODE_ACTIVITY) {
$groupBy = " GROUP BY civicrm_activity.id ";
}
$queryString .= $groupBy;
if ($order) {
list($field, $dir) = explode(' ', $order, 2);
$field = trim($field);
if (CRM_Utils_Array::value($field, $returnProperties)) {
// $queryString .= " ORDER BY $order";
}
}
//hack for student data
require_once 'CRM/Core/OptionGroup.php';
$multipleSelectFields = array('preferred_communication_method' => 1);
if (CRM_Core_Permission::access('Quest')) {
require_once 'CRM/Quest/BAO/Student.php';
$studentFields = array();
$studentFields = CRM_Quest_BAO_Student::$multipleSelectFields;
$multipleSelectFields = array_merge($multipleSelectFields, $studentFields);
}
$header = $addPaymentHeader = false;
if ($paymentFields) {
//special return properties for event and members
$paymentHeaders = array('total_amount' => ts('Total Amount'), 'contribution_status' => ts('Contribution Status'), 'received_date' => ts('Received Date'), 'payment_instrument' => ts('Payment Instrument'), 'transaction_id' => ts('Transaction ID'));
// get payment related in for event and members
require_once 'CRM/Contribute/BAO/Contribution.php';
$paymentDetails = CRM_Contribute_BAO_Contribution::getContributionDetails($exportMode, $ids);
if (!empty($paymentDetails)) {
$addPaymentHeader = true;
}
$nullContributionDetails = array_fill_keys($paymentHeaders, null);
}
$componentDetails = $headerRows = $sqlColumns = array();
$setHeader = true;
$rowCount = self::EXPORT_ROW_COUNT;
$offset = 0;
$count = -1;
// for CRM-3157 purposes
require_once 'CRM/Core/I18n.php';
$i18n =& CRM_Core_I18n::singleton();
while (1) {
$limitQuery = "{$queryString} LIMIT {$offset}, {$rowCount}";
$dao = CRM_Core_DAO::executeQuery($limitQuery);
if ($dao->N <= 0) {
break;
}
while ($dao->fetch()) {
$count++;
$row = array();
//first loop through returnproperties so that we return what is required, and in same order.
$relationshipField = 0;
foreach ($returnProperties as $field => $value) {
//we should set header only once
if ($setHeader) {
$sqlDone = false;
if (isset($query->_fields[$field]['title'])) {
$headerRows[] = $query->_fields[$field]['title'];
} else {
if ($field == 'phone_type_id') {