本文整理汇总了PHP中CRM_Contribute_DAO_Contribution::get方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Contribute_DAO_Contribution::get方法的具体用法?PHP CRM_Contribute_DAO_Contribution::get怎么用?PHP CRM_Contribute_DAO_Contribution::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Contribute_DAO_Contribution
的用法示例。
在下文中一共展示了CRM_Contribute_DAO_Contribution::get方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: savePdf
function savePdf($pdfContent, $obj, $contributionID, $pdf_delete_flag)
{
// getting contribution contact id
require_once 'CRM/Contribute/DAO/Contribution.php';
$contribution = new CRM_Contribute_DAO_Contribution();
$contribution->get($contributionID);
$contactID = $contribution->contact_id;
// Set the path to save the PDFs
$pdf_path = PDF_FILE_PATH;
##############################################
// save pdf file
$fileName = "{$obj->invoice_no}.pdf";
$filePathName = "{$pdf_path}/{$fileName}";
$handle = fopen($filePathName, 'w');
file_put_contents($filePathName, $pdfContent);
fclose($handle);
## getting from email
$query = "SELECT v.label FROM civicrm_option_group g, civicrm_option_value v WHERE g.name = 'from_email_address' AND g.id = v.option_group_id AND v.is_default=1";
$dao = CRM_Core_DAO::executeQuery($query);
if (!$dao->fetch()) {
print "Not able to get FROM Email Address";
exit;
}
$fromEmail = $dao->label;
// send mail
sendInvoiceMail($obj->email_invoice_address, $obj->attention_of, $fromEmail, $fileName, $filePathName, $obj, $contactID, $contribution);
if ($pdf_delete_flag) {
//delete pdf
@unlink($filePathName);
}
}
示例2: match
/**
* Generate a set of suggestions for the given bank transaction
*
* @return array(match structures)
*/
public function match(CRM_Banking_BAO_BankTransaction $btx, CRM_Banking_Matcher_Context $context)
{
$config = $this->_plugin_config;
$threshold = $this->getThreshold();
$penalty = $this->getPenalty($btx);
$data_parsed = $btx->getDataParsed();
// first see if all the required values are there
if (!$this->requiredValuesPresent($btx)) {
return null;
}
// resolve accepted states
$accepted_status_ids = $this->getAcceptedContributionStatusIDs();
$contributions = array();
$contribution2contact = array();
$contribution2totalamount = array();
$contributions_identified = array();
// check if this is actually enabled
if ($config->contribution_search) {
// find contacts
$contacts_found = $context->findContacts($threshold, $data_parsed['name'], $config->lookup_contact_by_name);
// with the identified contacts, look up contributions
foreach ($contacts_found as $contact_id => $contact_probabiliy) {
if ($contact_probabiliy < $threshold) {
continue;
}
$potential_contributions = $this->getPotentialContributionsForContact($contact_id, $context);
foreach ($potential_contributions as $contribution) {
// check for expected status
if (!in_array($contribution['contribution_status_id'], $accepted_status_ids)) {
continue;
}
$contribution_probability = $this->rateContribution($contribution, $context);
// apply penalty
$contribution_probability -= $penalty;
if ($contribution_probability > $threshold) {
$contributions[$contribution['id']] = $contribution_probability;
$contribution2contact[$contribution['id']] = $contact_id;
$contribution2totalamount[$contribution['id']] = $contribution['total_amount'];
}
}
}
}
// add the contributions coming in from a list (if any)
if (!empty($config->contribution_list)) {
if (!empty($data_parsed[$config->contribution_list])) {
$id_list = explode(',', $data_parsed[$config->contribution_list]);
foreach ($id_list as $contribution_id_string) {
$contribution_id = (int) $contribution_id_string;
if ($contribution_id) {
$contribution_bao = new CRM_Contribute_DAO_Contribution();
if ($contribution_bao->get('id', $contribution_id)) {
$contribution = $contribution_bao->toArray();
// check for expected status
if (!in_array($contribution['contribution_status_id'], $accepted_status_ids)) {
continue;
}
$contribution_probability = $this->rateContribution($contribution, $context);
// apply penalty
$contribution_probability -= $penalty;
if ($contribution_probability > $threshold) {
$contributions[$contribution['id']] = $contribution_probability;
$contribution2contact[$contribution['id']] = $contribution['contact_id'];
$contribution2totalamount[$contribution['id']] = $contribution['total_amount'];
$contacts_found[$contribution['contact_id']] = 1.0;
$contributions_identified[] = $contribution['id'];
}
}
}
}
}
}
// transform all of the contributions found into suggestions
foreach ($contributions as $contribution_id => $contribution_probability) {
$contact_id = $contribution2contact[$contribution_id];
$suggestion = new CRM_Banking_Matcher_Suggestion($this, $btx);
if (!in_array($contribution_id, $contributions_identified)) {
if ($contacts_found[$contact_id] >= 1.0) {
$suggestion->addEvidence(1.0, ts("Contact was positively identified."));
} else {
$suggestion->addEvidence($contacts_found[$contact_id], ts("Contact was likely identified."));
}
}
if ($contribution_probability >= 1.0) {
$suggestion->setTitle(ts("Matching contribution found"));
if ($config->mode != "cancellation") {
$suggestion->addEvidence(1.0, ts("A pending contribution matching the transaction was found."));
} else {
$suggestion->addEvidence(1.0, ts("This transaction is the <b>cancellation</b> of the below contribution."));
}
} else {
$suggestion->setTitle(ts("Possible matching contribution found"));
if ($config->mode != "cancellation") {
$suggestion->addEvidence($contacts_found[$contact_id], ts("A pending contribution partially matching the transaction was found."));
} else {
$suggestion->addEvidence($contacts_found[$contact_id], ts("This transaction could be the <b>cancellation</b> of the below contribution."));
//.........这里部分代码省略.........