本文整理汇总了PHP中CRM_Pledge_BAO_PledgePayment类的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Pledge_BAO_PledgePayment类的具体用法?PHP CRM_Pledge_BAO_PledgePayment怎么用?PHP CRM_Pledge_BAO_PledgePayment使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CRM_Pledge_BAO_PledgePayment类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: run
/**
* This function is the main function that is called when the page loads, it decides the which action has to be taken for the page.
*
* return null
* @access public
*/
function run()
{
$this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'browse');
$this->_context = CRM_Utils_Request::retrieve('context', 'String', $this);
$this->assign('action', $this->_action);
$this->assign('context', $this->_context);
$this->_contactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this);
CRM_Pledge_Page_Tab::setContext($this);
if ($this->_action & CRM_Core_Action::UPDATE) {
$this->edit();
} else {
$pledgeId = CRM_Utils_Request::retrieve('pledgeId', 'Positive', $this);
$paymentDetails = CRM_Pledge_BAO_PledgePayment::getPledgePayments($pledgeId);
$this->assign('rows', $paymentDetails);
$this->assign('pledgeId', $pledgeId);
$this->assign('contactId', $this->_contactId);
// check if we can process credit card contribs
$this->assign('newCredit', CRM_Core_Config::isEnabledBackOfficeCreditCardPayments());
// check is the user has view/edit signer permission
$permission = 'view';
if (CRM_Core_Permission::check('edit pledges')) {
$permission = 'edit';
}
$this->assign('permission', $permission);
}
return parent::run();
}
开发者ID:prashantgajare,项目名称:civicrm-core,代码行数:33,代码来源:Payment.php
示例2: run
/**
* This function is the main function that is called when the page loads, it decides the which action has to be taken for the page.
*
* return null
* @access public
*/
function run()
{
$this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'browse');
$this->_context = CRM_Utils_Request::retrieve('context', 'String', $this);
$this->assign('action', $this->_action);
$this->assign('context', $this->_context);
$this->_contactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this);
CRM_Pledge_Page_Tab::setContext();
if ($this->_action & CRM_Core_Action::UPDATE) {
$this->edit();
// set page title
CRM_Contact_Page_View::setTitle($this->_contactId);
} else {
$pledgeId = CRM_Utils_Request::retrieve('pledgeId', 'Positive', $this);
$paymentDetails = CRM_Pledge_BAO_PledgePayment::getPledgePayments($pledgeId);
$this->assign('rows', $paymentDetails);
$this->assign('pledgeId', $pledgeId);
$this->assign('contactId', $this->_contactId);
// check if we can process credit card contribs
$processors = CRM_Core_PseudoConstant::paymentProcessor(FALSE, FALSE, "billing_mode IN ( 1, 3 )");
if (count($processors) > 0) {
$this->assign('newCredit', TRUE);
} else {
$this->assign('newCredit', FALSE);
}
// check is the user has view/edit signer permission
$permission = 'view';
if (CRM_Core_Permission::check('edit pledges')) {
$permission = 'edit';
}
$this->assign('permission', $permission);
}
return parent::run();
}
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:40,代码来源:Payment.php
示例3: getPledgeDefaults
/**
* Function to setDefaults according to Pledge Id
* for batch entry pledges
*/
public function getPledgeDefaults()
{
$details = array();
if (!empty($_POST['pid'])) {
$pledgeID = CRM_Utils_Type::escape($_POST['pid'], 'Integer');
$details = CRM_Pledge_BAO_PledgePayment::getOldestPledgePayment($pledgeID);
}
CRM_Utils_JSON::output($details);
}
开发者ID:rajeshrhino,项目名称:civicrm-core,代码行数:13,代码来源:AJAX.php
示例4: getPledgeDefaults
/**
* Function to setDefaults according to Pledge Id
* for batch entry pledges
*/
public function getPledgeDefaults()
{
$details = array();
if (!empty($_POST['pid'])) {
$pledgeID = CRM_Utils_Type::escape($_POST['pid'], 'Integer');
$details = CRM_Pledge_BAO_PledgePayment::getOldestPledgePayment($pledgeID);
}
echo json_encode($details);
CRM_Utils_System::civiExit();
}
开发者ID:kidaa30,项目名称:yes,代码行数:14,代码来源:AJAX.php
示例5: processContribution
//.........这里部分代码省略.........
// if its due to pcp
if (!empty($params['pcp_made_through_id'])) {
$contribSoftContactId = CRM_Core_DAO::getFieldValue('CRM_PCP_DAO_PCP', $params['pcp_made_through_id'], 'contact_id');
} else {
$contribSoftContactId = CRM_Utils_Array::value('soft_credit_to', $params);
}
// Pass these details onto with the contribution to make them
// available at hook_post_process, CRM-8908
$contribParams['soft_credit_to'] = $params['soft_credit_to'] = $contribSoftContactId;
}
if (isset($params['amount'])) {
$contribParams['line_item'] = $form->_lineItem;
//add contribution record
$contribution = CRM_Contribute_BAO_Contribution::add($contribParams, $ids);
if (is_a($contribution, 'CRM_Core_Error')) {
$message = CRM_Core_Error::getMessages($contribution);
CRM_Core_Error::fatal($message);
}
// lets store it in the form variable so postProcess hook can get to this and use it
$form->_contributionID = $contribution->id;
}
//CRM-13981, processing honor contact into soft-credit contribution
CRM_Contact_Form_ProfileContact::postProcess($form);
// process soft credit / pcp pages
CRM_Contribute_Form_Contribution_Confirm::processPcpSoft($params, $contribution);
//handle pledge stuff.
if (empty($form->_params['separate_membership_payment']) && !empty($form->_values['pledge_block_id']) && (!empty($form->_params['is_pledge']) || !empty($form->_values['pledge_id']))) {
if (!empty($form->_values['pledge_id'])) {
//when user doing pledge payments.
//update the schedule when payment(s) are made
foreach ($form->_params['pledge_amount'] as $paymentId => $dontCare) {
$scheduledAmount = CRM_Core_DAO::getFieldValue('CRM_Pledge_DAO_PledgePayment', $paymentId, 'scheduled_amount', 'id');
$pledgePaymentParams = array('id' => $paymentId, 'contribution_id' => $contribution->id, 'status_id' => $contribution->contribution_status_id, 'actual_amount' => $scheduledAmount);
CRM_Pledge_BAO_PledgePayment::add($pledgePaymentParams);
}
//update pledge status according to the new payment statuses
CRM_Pledge_BAO_PledgePayment::updatePledgePaymentStatus($form->_values['pledge_id']);
} else {
//when user creating pledge record.
$pledgeParams = array();
$pledgeParams['contact_id'] = $contribution->contact_id;
$pledgeParams['installment_amount'] = $pledgeParams['actual_amount'] = $contribution->total_amount;
$pledgeParams['contribution_id'] = $contribution->id;
$pledgeParams['contribution_page_id'] = $contribution->contribution_page_id;
$pledgeParams['financial_type_id'] = $contribution->financial_type_id;
$pledgeParams['frequency_interval'] = $params['pledge_frequency_interval'];
$pledgeParams['installments'] = $params['pledge_installments'];
$pledgeParams['frequency_unit'] = $params['pledge_frequency_unit'];
if ($pledgeParams['frequency_unit'] == 'month') {
$pledgeParams['frequency_day'] = intval(date("d"));
} else {
$pledgeParams['frequency_day'] = 1;
}
$pledgeParams['create_date'] = $pledgeParams['start_date'] = $pledgeParams['scheduled_date'] = date("Ymd");
$pledgeParams['status_id'] = $contribution->contribution_status_id;
$pledgeParams['max_reminders'] = $form->_values['max_reminders'];
$pledgeParams['initial_reminder_day'] = $form->_values['initial_reminder_day'];
$pledgeParams['additional_reminder_day'] = $form->_values['additional_reminder_day'];
$pledgeParams['is_test'] = $contribution->is_test;
$pledgeParams['acknowledge_date'] = date('Ymd');
$pledgeParams['original_installment_amount'] = $pledgeParams['installment_amount'];
//inherit campaign from contirb page.
$pledgeParams['campaign_id'] = $campaignId;
$pledge = CRM_Pledge_BAO_Pledge::create($pledgeParams);
$form->_params['pledge_id'] = $pledge->id;
//send acknowledgment email. only when pledge is created
开发者ID:archcidburnziso,项目名称:civicrm-core,代码行数:67,代码来源:Confirm.php
示例6: processPledgePayments
/**
* Process pledge payments.
*
* @param array $formatted
*
* @return int
*/
public function processPledgePayments(&$formatted)
{
if (!empty($formatted['pledge_payment_id']) && !empty($formatted['pledge_id'])) {
//get completed status
$completeStatusID = CRM_Core_OptionGroup::getValue('contribution_status', 'Completed', 'name');
//need to update payment record to map contribution_id
CRM_Core_DAO::setFieldValue('CRM_Pledge_DAO_PledgePayment', $formatted['pledge_payment_id'], 'contribution_id', $formatted['contribution_id']);
CRM_Pledge_BAO_PledgePayment::updatePledgePaymentStatus($formatted['pledge_id'], array($formatted['pledge_payment_id']), $completeStatusID, NULL, $formatted['total_amount']);
return CRM_Contribute_Import_Parser::PLEDGE_PAYMENT;
}
}
开发者ID:nielosz,项目名称:civicrm-core,代码行数:18,代码来源:Contribution.php
示例7: postProcess
/**
* Process the form submission.
*
*
* @return void
*/
public function postProcess()
{
//get the submitted form values.
$formValues = $this->controller->exportValues($this->_name);
$params = array();
$formValues['scheduled_date'] = CRM_Utils_Date::processDate($formValues['scheduled_date']);
$params['scheduled_date'] = CRM_Utils_Date::format($formValues['scheduled_date']);
$params['currency'] = CRM_Utils_Array::value('currency', $formValues);
$now = date('Ymd');
$contributionStatus = CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'name');
if (CRM_Utils_Date::overdue(CRM_Utils_Date::customFormat($params['scheduled_date'], '%Y%m%d'), $now)) {
$params['status_id'] = array_search('Overdue', $contributionStatus);
} else {
$params['status_id'] = array_search('Pending', $contributionStatus);
}
$params['id'] = $this->_id;
$pledgeId = CRM_Core_DAO::getFieldValue('CRM_Pledge_DAO_PledgePayment', $params['id'], 'pledge_id');
CRM_Pledge_BAO_PledgePayment::add($params);
$adjustTotalAmount = FALSE;
if (CRM_Utils_Array::value('option_type', $formValues) == 2) {
$adjustTotalAmount = TRUE;
}
$pledgeScheduledAmount = CRM_Core_DAO::getFieldValue('CRM_Pledge_DAO_PledgePayment', $params['id'], 'scheduled_amount', 'id');
$oldestPaymentAmount = CRM_Pledge_BAO_PledgePayment::getOldestPledgePayment($pledgeId, 2);
if ($oldestPaymentAmount['count'] != 1 && $oldestPaymentAmount['id'] == $params['id']) {
$oldestPaymentAmount = CRM_Pledge_BAO_PledgePayment::getOldestPledgePayment($pledgeId);
}
if ($formValues['scheduled_amount'] - $pledgeScheduledAmount >= $oldestPaymentAmount['amount']) {
$adjustTotalAmount = TRUE;
}
//update pledge status
CRM_Pledge_BAO_PledgePayment::updatePledgePaymentStatus($pledgeId, array($params['id']), $params['status_id'], NULL, $formValues['scheduled_amount'], $adjustTotalAmount);
$statusMsg = ts('Pledge Payment Schedule has been updated.');
CRM_Core_Session::setStatus($statusMsg, ts('Saved'), 'success');
}
开发者ID:kidaa30,项目名称:yes,代码行数:41,代码来源:Payment.php
示例8: updateRelatedPledge
/**
* Update related pledge payment payments.
*
* This function has been refactored out of the back office contribution form and may
* still overlap with other functions.
*
* @param string $action
* @param int $pledgePaymentID
* @param int $contributionID
* @param bool $adjustTotalAmount
* @param float $total_amount
* @param float $original_total_amount
* @param int $contribution_status_id
* @param int $original_contribution_status_id
*/
public static function updateRelatedPledge($action, $pledgePaymentID, $contributionID, $adjustTotalAmount, $total_amount, $original_total_amount, $contribution_status_id, $original_contribution_status_id)
{
if (!$pledgePaymentID || $action & CRM_Core_Action::ADD && !$contributionID) {
return;
}
if ($pledgePaymentID) {
//store contribution id in payment record.
CRM_Core_DAO::setFieldValue('CRM_Pledge_DAO_PledgePayment', $pledgePaymentID, 'contribution_id', $contributionID);
} else {
$pledgePaymentID = CRM_Core_DAO::getFieldValue('CRM_Pledge_DAO_PledgePayment', $contributionID, 'id', 'contribution_id');
}
$pledgeID = CRM_Core_DAO::getFieldValue('CRM_Pledge_DAO_PledgePayment', $contributionID, 'pledge_id', 'contribution_id');
$updatePledgePaymentStatus = FALSE;
// If either the status or the amount has changed we update the pledge status.
if ($action & CRM_Core_Action::ADD) {
$updatePledgePaymentStatus = TRUE;
} elseif ($action & CRM_Core_Action::UPDATE && ($original_contribution_status_id != $contribution_status_id || $original_total_amount != $total_amount)) {
$updatePledgePaymentStatus = TRUE;
}
if ($updatePledgePaymentStatus) {
CRM_Pledge_BAO_PledgePayment::updatePledgePaymentStatus($pledgeID, array($pledgePaymentID), $contribution_status_id, NULL, $total_amount, $adjustTotalAmount);
}
}
开发者ID:nganivet,项目名称:civicrm-core,代码行数:38,代码来源:Contribution.php
示例9: updatePledgeStatus
public function updatePledgeStatus($sendReminders = FALSE)
{
// *** Uncomment the next line if you want automated reminders to be sent
// $sendReminders = true;
require_once 'CRM/Contribute/PseudoConstant.php';
$allStatus = CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'name');
//unset statues that we never use for pledges
foreach (array('Completed', 'Cancelled', 'Failed') as $statusKey) {
if ($key = CRM_Utils_Array::key($statusKey, $allStatus)) {
unset($allStatus[$key]);
}
}
$statusIds = implode(',', array_keys($allStatus));
$updateCnt = 0;
$query = "\nSELECT pledge.contact_id as contact_id,\n pledge.id as pledge_id,\n pledge.amount as amount,\n payment.scheduled_date as scheduled_date,\n pledge.create_date as create_date,\n payment.id as payment_id,\n pledge.contribution_page_id as contribution_page_id,\n payment.reminder_count as reminder_count,\n pledge.max_reminders as max_reminders,\n payment.reminder_date as reminder_date,\n pledge.initial_reminder_day as initial_reminder_day,\n pledge.additional_reminder_day as additional_reminder_day,\n pledge.status_id as pledge_status,\n payment.status_id as payment_status,\n pledge.is_test as is_test,\n pledge.campaign_id as campaign_id,\n SUM(payment.scheduled_amount) as amount_due,\n ( SELECT sum(civicrm_pledge_payment.actual_amount)\n FROM civicrm_pledge_payment\n WHERE civicrm_pledge_payment.status_id = 1\n AND civicrm_pledge_payment.pledge_id = pledge.id\n ) as amount_paid\n FROM civicrm_pledge pledge, civicrm_pledge_payment payment\n WHERE pledge.id = payment.pledge_id\n AND payment.status_id IN ( {$statusIds} ) AND pledge.status_id IN ( {$statusIds} )\n GROUP By payment.id\n ";
$dao = CRM_Core_DAO::executeQuery($query);
require_once 'CRM/Contact/BAO/Contact/Utils.php';
require_once 'CRM/Utils/Date.php';
$now = date('Ymd');
$pledgeDetails = $contactIds = $pledgePayments = $pledgeStatus = array();
while ($dao->fetch()) {
$checksumValue = CRM_Contact_BAO_Contact_Utils::generateChecksum($dao->contact_id);
$pledgeDetails[$dao->payment_id] = array('scheduled_date' => $dao->scheduled_date, 'amount_due' => $dao->amount_due, 'amount' => $dao->amount, 'amount_paid' => $dao->amount_paid, 'create_date' => $dao->create_date, 'contact_id' => $dao->contact_id, 'pledge_id' => $dao->pledge_id, 'checksumValue' => $checksumValue, 'contribution_page_id' => $dao->contribution_page_id, 'reminder_count' => $dao->reminder_count, 'max_reminders' => $dao->max_reminders, 'reminder_date' => $dao->reminder_date, 'initial_reminder_day' => $dao->initial_reminder_day, 'additional_reminder_day' => $dao->additional_reminder_day, 'pledge_status' => $dao->pledge_status, 'payment_status' => $dao->payment_status, 'is_test' => $dao->is_test, 'campaign_id' => $dao->campaign_id);
$contactIds[$dao->contact_id] = $dao->contact_id;
$pledgeStatus[$dao->pledge_id] = $dao->pledge_status;
if (CRM_Utils_Date::overdue(CRM_Utils_Date::customFormat($dao->scheduled_date, '%Y%m%d'), $now) && $dao->payment_status != array_search('Overdue', $allStatus)) {
$pledgePayments[$dao->pledge_id][$dao->payment_id] = $dao->payment_id;
}
}
require_once 'CRM/Pledge/BAO/PledgePayment.php';
// process the updating script...
foreach ($pledgePayments as $pledgeId => $paymentIds) {
// 1. update the pledge /pledge payment status. returns new status when an update happens
echo "<br />Checking if status update is needed for Pledge Id: {$pledgeId} (current status is {$allStatus[$pledgeStatus[$pledgeId]]})";
$newStatus = CRM_Pledge_BAO_PledgePayment::updatePledgePaymentStatus($pledgeId, $paymentIds, array_search('Overdue', $allStatus), NULL, 0, FALSE, TRUE);
if ($newStatus != $pledgeStatus[$pledgeId]) {
echo "<br />- status updated to: {$allStatus[$newStatus]}";
$updateCnt += 1;
}
}
if ($sendReminders) {
// retrieve domain tokens
require_once 'CRM/Core/BAO/Domain.php';
require_once 'CRM/Core/SelectValues.php';
$domain = CRM_Core_BAO_Domain::getDomain();
$tokens = array('domain' => array('name', 'phone', 'address', 'email'), 'contact' => CRM_Core_SelectValues::contactTokens());
require_once 'CRM/Utils/Token.php';
$domainValues = array();
foreach ($tokens['domain'] as $token) {
$domainValues[$token] = CRM_Utils_Token::getDomainTokenReplacement($token, $domain);
}
//get the domain email address, since we don't carry w/ object.
require_once 'CRM/Core/BAO/Domain.php';
$domainValue = CRM_Core_BAO_Domain::getNameAndEmail();
$domainValues['email'] = $domainValue[1];
// retrieve contact tokens
// this function does NOT return Deceased contacts since we don't want to send them email
require_once 'CRM/Utils/Token.php';
list($contactDetails) = CRM_Utils_Token::getTokenDetails($contactIds, NULL, FALSE, FALSE, NULL, $tokens, 'CRM_UpdatePledgeRecord');
// assign domain values to template
$template = CRM_Core_Smarty::singleton();
$template->assign('domain', $domainValues);
//set receipt from
$receiptFrom = '"' . $domainValues['name'] . '" <' . $domainValues['email'] . '>';
foreach ($pledgeDetails as $paymentId => $details) {
if (array_key_exists($details['contact_id'], $contactDetails)) {
$contactId = $details['contact_id'];
$pledgerName = $contactDetails[$contactId]['display_name'];
} else {
continue;
}
if (empty($details['reminder_date'])) {
$nextReminderDate = new DateTime($details['scheduled_date']);
$nextReminderDate->modify("-" . $details['initial_reminder_day'] . "day");
$nextReminderDate = $nextReminderDate->format("Ymd");
} else {
$nextReminderDate = new DateTime($details['reminder_date']);
$nextReminderDate->modify("+" . $details['additional_reminder_day'] . "day");
$nextReminderDate = $nextReminderDate->format("Ymd");
}
if ($details['reminder_count'] < $details['max_reminders'] && $nextReminderDate <= $now) {
$toEmail = $doNotEmail = $onHold = NULL;
if (!empty($contactDetails[$contactId]['email'])) {
$toEmail = $contactDetails[$contactId]['email'];
}
if (!empty($contactDetails[$contactId]['do_not_email'])) {
$doNotEmail = $contactDetails[$contactId]['do_not_email'];
}
if (!empty($contactDetails[$contactId]['on_hold'])) {
$onHold = $contactDetails[$contactId]['on_hold'];
}
// 2. send acknowledgement mail
if ($toEmail && !($doNotEmail || $onHold)) {
//assign value to template
$template->assign('amount_paid', $details['amount_paid'] ? $details['amount_paid'] : 0);
$template->assign('contact', $contactDetails[$contactId]);
$template->assign('next_payment', $details['scheduled_date']);
$template->assign('amount_due', $details['amount_due']);
$template->assign('checksumValue', $details['checksumValue']);
$template->assign('contribution_page_id', $details['contribution_page_id']);
//.........这里部分代码省略.........
开发者ID:hguru,项目名称:224Civi,代码行数:101,代码来源:UpdatePledgeRecord.php
示例10: preProcessPledge
public function preProcessPledge()
{
//get the payment values associated with given pledge payment id OR check for payments due.
$this->_pledgeValues = array();
if ($this->_ppID) {
$payParams = array('id' => $this->_ppID);
CRM_Pledge_BAO_PledgePayment::retrieve($payParams, $this->_pledgeValues['pledgePayment']);
$this->_pledgeID = CRM_Utils_Array::value('pledge_id', $this->_pledgeValues['pledgePayment']);
$paymentStatusID = CRM_Utils_Array::value('status_id', $this->_pledgeValues['pledgePayment']);
$this->_id = CRM_Utils_Array::value('contribution_id', $this->_pledgeValues['pledgePayment']);
//get all status
$allStatus = CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'name');
if (!($paymentStatusID == array_search('Pending', $allStatus) || $paymentStatusID == array_search('Overdue', $allStatus))) {
CRM_Core_Error::fatal(ts("Pledge payment status should be 'Pending' or 'Overdue'."));
}
//get the pledge values associated with given pledge payment.
$ids = array();
$pledgeParams = array('id' => $this->_pledgeID);
CRM_Pledge_BAO_Pledge::getValues($pledgeParams, $this->_pledgeValues, $ids);
$this->assign('ppID', $this->_ppID);
} else {
// Not making a pledge payment, so if adding a new contribution we should check if pledge payment(s) are due for this contact so we can alert the user. CRM-5206
if (isset($this->_contactID)) {
$contactPledges = CRM_Pledge_BAO_Pledge::getContactPledges($this->_contactID);
if (!empty($contactPledges)) {
$payments = $paymentsDue = NULL;
$multipleDue = FALSE;
foreach ($contactPledges as $key => $pledgeId) {
$payments = CRM_Pledge_BAO_PledgePayment::getOldestPledgePayment($pledgeId);
if ($payments) {
if ($paymentsDue) {
$multipleDue = TRUE;
break;
} else {
$paymentsDue = $payments;
}
}
}
if ($multipleDue) {
// Show link to pledge tab since more than one pledge has a payment due
$pledgeTab = CRM_Utils_System::url('civicrm/contact/view', "reset=1&force=1&cid={$this->_contactID}&selectedChild=pledge");
CRM_Core_Session::setStatus(ts('This contact has pending or overdue pledge payments. <a href="%1">Click here to view their Pledges tab</a> and verify whether this contribution should be applied as a pledge payment.', array(1 => $pledgeTab)), ts('Notice'), 'alert');
} elseif ($paymentsDue) {
// Show user link to oldest Pending or Overdue pledge payment
$ppAmountDue = CRM_Utils_Money::format($payments['amount'], $payments['currency']);
$ppSchedDate = CRM_Utils_Date::customFormat(CRM_Core_DAO::getFieldValue('CRM_Pledge_DAO_PledgePayment', $payments['id'], 'scheduled_date'));
if ($this->_mode) {
$ppUrl = CRM_Utils_System::url('civicrm/contact/view/contribution', "reset=1&action=add&cid={$this->_contactID}&ppid={$payments['id']}&context=pledge&mode=live");
} else {
$ppUrl = CRM_Utils_System::url('civicrm/contact/view/contribution', "reset=1&action=add&cid={$this->_contactID}&ppid={$payments['id']}&context=pledge");
}
CRM_Core_Session::setStatus(ts('This contact has a pending or overdue pledge payment of %2 which is scheduled for %3. <a href="%1">Click here to enter a pledge payment</a>.', array(1 => $ppUrl, 2 => $ppAmountDue, 3 => $ppSchedDate)), ts('Notice'), 'alert');
}
}
}
}
}
开发者ID:riyadennis,项目名称:my_civicrm,代码行数:57,代码来源:AbstractEditPayment.php
示例11: postProcess
//.........这里部分代码省略.........
$customFieldsContributionType = CRM_Core_BAO_CustomField::getFields('Contribution', FALSE, FALSE, CRM_Utils_Array::value('contribution_type_id', $params));
$customFields = CRM_Utils_Array::crmArrayMerge($customFieldsContributionType, CRM_Core_BAO_CustomField::getFields('Contribution', FALSE, FALSE, NULL, NULL, TRUE));
$params['custom'] = CRM_Core_BAO_CustomField::postProcess($params, $customFields, $this->_id, 'Contribution');
if (!CRM_Utils_Array::value('is_recur', $paymentParams)) {
$contribution = CRM_Contribute_Form_Contribution_Confirm::processContribution($this, $this->_params, $result, $this->_contactID, $contributionType, FALSE, FALSE, FALSE);
}
if ($this->_context != 'participant' && !$pId) {
$entityID = $contribution->id;
$entityTable = 'contribution';
}
// process line items, until no previous line items.
if (empty($this->_lineItems) && $entityID && !empty($lineItem)) {
CRM_Contribute_Form_AdditionalInfo::processPriceSet($entityID, $lineItem, 'civicrm_' . $entityTable);
}
//send receipt mail.
if ($contribution->id && CRM_Utils_Array::value('is_email_receipt', $this->_params)) {
$this->_params['trxn_id'] = CRM_Utils_Array::value('trxn_id', $result);
$this->_params['contact_id'] = $this->_contactID;
$this->_params['contribution_id'] = $contribution->id;
$sendReceipt = CRM_Contribute_Form_AdditionalInfo::emailReceipt($this, $this->_params, TRUE);
}
//process the note
if ($contribution->id && isset($params['note'])) {
CRM_Contribute_Form_AdditionalInfo::processNote($params, $contactID, $contribution->id, NULL);
}
//process premium
if ($contribution->id && isset($params['product_name'][0])) {
CRM_Contribute_Form_AdditionalInfo::processPremium($params, $contribution->id, NULL, $this->_options);
}
//update pledge payment status.
if ($this->_ppID && $contribution->id) {
//store contribution id in payment record.
CRM_Core_DAO::setFieldValue('CRM_Pledge_DAO_PledgePayment', $this->_ppID, 'contribution_id', $contribution->id);
CRM_Pledge_BAO_PledgePayment::updatePledgePaymentStatus($this->_pledgeID, array($this->_ppID), $contribution->contribution_status_id, NULL, $contribution->total_amount);
}
if ($contribution->id) {
$statusMsg = ts('The contribution record has been processed.');
if (CRM_Utils_Array::value('is_email_receipt', $this->_params) && $sendReceipt) {
$statusMsg .= ' ' . ts('A receipt has been emailed to the contributor.');
}
CRM_Core_Session::setStatus($statusMsg);
}
//submit credit card contribution ends.
} else {
//Offline Contribution.
$unsetParams = array('payment_processor_id', "email-{$this->_bltID}", 'hidden_buildCreditCard', 'hidden_buildDirectDebit', 'billing_first_name', 'billing_middle_name', 'billing_last_name', 'street_address-5', "city-{$this->_bltID}", "state_province_id-{$this->_bltID}", "postal_code-{$this->_bltID}", "country_id-{$this->_bltID}", 'credit_card_number', 'cvv2', 'credit_card_exp_date', 'credit_card_type');
foreach ($unsetParams as $key) {
if (isset($submittedValues[$key])) {
unset($submittedValues[$key]);
}
}
// get the required field value only.
$formValues = $submittedValues;
$params = $ids = array();
$params['contact_id'] = $this->_contactID;
// get current currency from DB or use default currency
$currentCurrency = CRM_Utils_Array::value('currency', $this->_values, $config->defaultCurrency);
// use submitted currency if present else use current currency
$params['currency'] = CRM_Utils_Array::value('currency', $submittedValues, $currentCurrency);
$fields = array('contribution_type_id', 'contribution_status_id', 'payment_instrument_id', 'cancel_reason', 'source', 'check_number', 'soft_credit_to', 'pcp_made_through_id', 'pcp_display_in_roll', 'pcp_roll_nickname', 'pcp_personal_note');
foreach ($fields as $f) {
$params[$f] = CRM_Utils_Array::value($f, $formValues);
}
if ($softID = CRM_Utils_Array::value('softID', $this->_values)) {
$params['softID'] = $softID;
}
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:67,代码来源:Contribution.php
示例12: testcalculateNextScheduledDateYearDateProvided
/**
* Test calculateNextScheduledDate - no date provided
*/
function testcalculateNextScheduledDateYearDateProvided()
{
$params = array('scheduled_date' => '20110510', 'frequency_unit' => 'year', 'frequency_day' => 15, 'frequency_interval' => 2);
$date = CRM_Pledge_BAO_PledgePayment::calculateNextScheduledDate($params, 3, '20080510');
$this->assertEquals('20140510000000', $date);
}
开发者ID:archcidburnziso,项目名称:civicrm-core,代码行数:9,代码来源:PaymentTest.php
示例13: loadRelatedObjects
function loadRelatedObjects(&$input, &$ids, $required = FALSE, $loadAll = false)
{
if ($loadAll) {
$ids = array_merge($this->getComponentDetails($this->id), $ids);
if (empty($ids['contact']) && isset($this->contact_id)) {
$ids['contact'] = $this->contact_id;
}
}
if (empty($this->_component)) {
if (!empty($ids['event'])) {
$this->_component = 'event';
} else {
$this->_component = strtolower(CRM_Utils_Array::value('component', $input, 'contribute'));
}
}
$paymentProcessorID = CRM_Utils_Array::value('paymentProcessor', $ids);
$contributionType = new CRM_Financial_BAO_FinancialType();
$contributionType->id = $this->financial_type_id;
if (!$contributionType->find(TRUE)) {
throw new Exception("Could not find financial type record: " . $this->financial_type_id);
}
if (!empty($ids['contact'])) {
$this->_relatedObjects['contact'] = new CRM_Contact_BAO_Contact();
$this->_relatedObjects['contact']->id = $ids['contact'];
$this->_relatedObjects['contact']->find(TRUE);
}
$this->_relatedObjects['contributionType'] = $contributionType;
if ($this->_component == 'contribute') {
// retrieve the other optional objects first so
// stuff down the line can use this info and do things
// CRM-6056
//in any case get the memberships associated with the contribution
//because we now support multiple memberships w/ price set
// see if there are any other memberships to be considered for same contribution.
$query = "\n SELECT membership_id\n FROM civicrm_membership_payment\nWHERE contribution_id = %1 ";
$params = array(1 => array($this->id, 'Integer'));
$dao = CRM_Core_DAO::executeQuery($query, $params);
while ($dao->fetch()) {
if ($dao->membership_id) {
if (!is_array($ids['membership'])) {
$ids['membership'] = array();
}
$ids['membership'][] = $dao->membership_id;
}
}
if (array_key_exists('membership', $ids) && is_array($ids['membership'])) {
foreach ($ids['membership'] as $id) {
if (!empty($id)) {
$membership = new CRM_Member_BAO_Membership();
$membership->id = $id;
if (!$membership->find(TRUE)) {
throw new Exception("Could not find membership record: {$id}");
}
$membership->join_date = CRM_Utils_Date::isoToMysql($membership->join_date);
$membership->start_date = CRM_Utils_Date::isoToMysql($membership->start_date);
$membership->end_date = CRM_Utils_Date::isoToMysql($membership->end_date);
$this->_relatedObjects['membership'][$membership->membership_type_id] = $membership;
$membership->free();
}
}
}
if (!empty($ids['pledge_payment'])) {
foreach ($ids['pledge_payment'] as $key => $paymentID) {
if (empty($paymentID)) {
continue;
}
$payment = new CRM_Pledge_BAO_PledgePayment();
$payment->id = $paymentID;
if (!$payment->find(TRUE)) {
throw new Exception("Could not find pledge payment record: " . $paymentID);
}
$this->_relatedObjects['pledge_payment'][] = $payment;
}
}
if (!empty($ids['contributionRecur'])) {
$recur = new CRM_Contribute_BAO_ContributionRecur();
$recur->id = $ids['contributionRecur'];
if (!$recur->find(TRUE)) {
throw new Exception("Could not find recur record: " . $ids['contributionRecur']);
}
$this->_relatedObjects['contributionRecur'] =& $recur;
//get payment processor id from recur object.
$paymentProcessorID = $recur->payment_processor_id;
}
//for normal contribution get the payment processor id.
if (!$paymentProcessorID) {
if ($this->contribution_page_id) {
// get the payment processor id from contribution page
$paymentProcessorID = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_ContributionPage', $this->contribution_page_id, 'payment_processor');
} elseif (!CRM_Utils_Array::value('pledge_payment', $ids)) {
$loadObjectSuccess = TRUE;
if ($required) {
throw new Exception("Could not find contribution page for contribution record: " . $this->id);
}
return $loadObjectSuccess;
}
}
} else {
// we are in event mode
// make sure event exists and is valid
//.........这里部分代码省略.........
开发者ID:TheCraftyCanvas,项目名称:aegir-platforms,代码行数:101,代码来源:Contribution.php
示例14: processFormContribution
//.........这里部分代码省略.........
foreach ($lineItemValue 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);
}
}
}
}
$smarty = CRM_Core_Smarty::singleton();
$smarty->assign('dataArray', $dataArray);
$smarty->assign('totalTaxAmount', $params['tax_amount']);
}
if (is_a($contribution, 'CRM_Core_Error')) {
$message = CRM_Core_Error::getMessages($contribution);
CRM_Core_Error::fatal($message);
}
// lets store it in the form variable so postProcess hook can get to this and use it
$form->_contributionID = $contribution->id;
}
//CRM-13981, processing honor contact into soft-credit contribution
CRM_Contact_Form_ProfileContact::postProcess($form);
// process soft credit / pcp pages
CRM_Contribute_Form_Contribution_Confirm::processPcpSoft($params, $contribution);
//handle pledge stuff.
if ($isPledge) {
if ($pledgeID) {
//when user doing pledge payments.
//update the schedule when payment(s) are made
foreach ($form->_params['pledge_amount'] as $paymentId => $dontCare) {
$scheduledAmount = CRM_Core_DAO::getFieldValue('CRM_Pledge_DAO_PledgePayment', $paymentId, 'scheduled_amount', 'id');
$pledgePaymentParams = array('id' => $paymentId, 'contribution_id' => $contribution->id, 'status_id' => $contribution->contribution_status_id, 'actual_amount' => $scheduledAmount);
CRM_Pledge_BAO_PledgePayment::add($pledgePaymentParams);
}
//update pledge status according to the new payment statuses
CRM_Pledge_BAO_PledgePayment::updatePledgePaymentStatus($pledgeID);
} else {
//when user creating pledge record.
$pledgeParams = array();
$pledgeParams['contact_id'] = $contribution->contact_id;
$pledgeParams['installment_amount'] = $pledgeParams['actual_amount'] = $contribution->total_amount;
$pledgeParams['contribution_id'] = $contribution->id;
$pledgeParams['contribution_page_id'] = $contribution->contribution_page_id;
$pledgeParams['financial_type_id'] = $contribution->financial_type_id;
$pledgeParams['frequency_interval'] = $params['pledge_frequency_interval'];
$pledgeParams['installments'] = $params['pledge_installments'];
$pledgeParams['frequency_unit'] = $params['pledge_frequency_unit'];
if ($pledgeParams['frequency_unit'] == 'month') {
$pledgeParams['frequency_day'] = intval(date("d"));
} else {
$pledgeParams['frequency_day'] = 1;
}
$pledgeParams['create_date'] = $pledgeParams['start_date'] = $pledgeParams['scheduled_date'] = date("Ymd");
$pledgeParams['status_id'] = $contribution->contribution_status_id;
$pledgeParams['max_reminders'] = $form->_values['max_reminders'];
$pledgeParams['initial_reminder_day'] = $form->_values['initial_reminder_day'];
$pledgeParams['additional_reminder_day'] = $form->_values['additional_reminder_day'];
$pledgeParams['is_test'] = $contribution->is_test;
$pledgeParams['acknowledge_date'] = date('Ymd');
$pledgeParams['original_installment_amount'] = $pledgeParams['installment_amount'];
//inherit campaign from contirb page.
$pledgeParams['campaign_id'] = $campaignId;
$pledge = CRM_Pledge_BAO_Pledge::create($pledgeParams);
$form->_params['pledge_id'] = $pledge->id;
//send acknowledgment email. only when pledge is created
开发者ID:vakeesan26,项目名称:civicrm-core,代码行数:67,代码来源:Confirm.php
示例15: buildQuickForm
/**
* Function used to build form element for soft credit block.
*
* @param CRM_Core_Form $form
*
* @return void
*/
public static function buildQuickForm(&$form)
{
if (!empty($form->_honor_block_is_active)) {
$ufJoinDAO = new CRM_Core_DAO_UFJoin();
$ufJoinDAO->module = 'soft_credit';
$ufJoinDAO->entity_id = $form->_id;
if ($ufJoinDAO->find(TRUE)) {
$jsonData = CRM_Contribute_BAO_ContributionPage::formatMultilingualHonorParams($ufJoinDAO->module_data, TRUE);
if ($jsonData) {
foreach (array('honor_block_title', 'honor_block_text') as $name) {
$form->assign($name, $jsonData[$name]);
}
$softCreditTypes = CRM_Core_OptionGroup::values("soft_credit_type", FALSE);
// radio button for Honor Type
foreach ($jsonData['soft_credit_types'] as $value) {
$honorTypes[$value] = $form->createElement('radio', NULL, NULL, $softCreditTypes[$value], $value);
}
$form->addGroup($honorTypes, 'soft_credit_type_id', NULL)->setAttribute('allowClear', TRUE);
}
}
return $form;
}
// by default generate 10 blocks
$item_count = 11;
$showSoftCreditRow = 2;
if ($form->getAction() & CRM_Core_Action::UPDATE) {
$form->_softCreditInfo = CRM_Contribute_BAO_ContributionSoft::getSoftContribution($form->_id, TRUE);
} elseif (!empty($form->_pledgeID)) {
//Check and select most recent completed contrubtion and use it to retrieve
//soft-credit information to use as default for current pledge payment, CRM-13981
$pledgePayments = CRM_Pledge_BAO_PledgePayment::getPledgePayments($form->_pledgeID);
foreach ($pledgePayments as $id => $record) {
if ($record['contribution_id']) {
$softCredits = CRM_Contribute_BAO_ContributionSoft::getSoftContribution($record['contribut
|
请发表评论