当前位置: 首页>>代码示例>>PHP>>正文


PHP CRM_Contribute_BAO_ContributionRecur::whereAdd方法代码示例

本文整理汇总了PHP中CRM_Contribute_BAO_ContributionRecur::whereAdd方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Contribute_BAO_ContributionRecur::whereAdd方法的具体用法?PHP CRM_Contribute_BAO_ContributionRecur::whereAdd怎么用?PHP CRM_Contribute_BAO_ContributionRecur::whereAdd使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CRM_Contribute_BAO_ContributionRecur的用法示例。


在下文中一共展示了CRM_Contribute_BAO_ContributionRecur::whereAdd方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: get_scheduled_contributions

/**
 * Gets recurring contributions that are scheduled to be processed today.
 *
 * @param $eway_token_clients
 *
 * @return array
 *   An array of contribution_recur objects.
 */
function get_scheduled_contributions($eway_token_clients)
{
    if (empty($eway_token_clients)) {
        return array();
    }
    $contributionStatus = CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'name');
    // Get Recurring Contributions that are In Progress and are due to be processed by the eWAY Recurring processor
    $scheduled_today = new CRM_Contribute_BAO_ContributionRecur();
    if (_versionAtLeast(4.4)) {
        $scheduled_today->whereAdd("`next_sched_contribution_date` <= '" . date('Y-m-d 00:00:00') . "'");
    } else {
        $scheduled_today->whereAdd("`next_sched_contribution` <= '" . date('Y-m-d 00:00:00') . "'");
    }
    $scheduled_today->whereAdd("`contribution_status_id` = " . array_search('In Progress', $contributionStatus));
    $scheduled_today->whereAdd("`payment_processor_id` in (" . implode(', ', array_keys($eway_token_clients)) . ")");
    $scheduled_today->find();
    $result = array();
    while ($scheduled_today->fetch()) {
        $past_contribution = get_first_contribution_from_recurring($scheduled_today->id);
        $new_contribution_record = new CRM_Contribute_BAO_Contribution();
        $new_contribution_record->contact_id = $scheduled_today->contact_id;
        $new_contribution_record->receive_date = CRM_Utils_Date::isoToMysql(date('Y-m-d H:i:s'));
        $new_contribution_record->total_amount = $scheduled_today->amount;
        $new_contribution_record->non_deductible_amount = $scheduled_today->amount;
        $new_contribution_record->net_amount = $scheduled_today->amount;
        $new_contribution_record->invoice_id = md5(uniqid(rand(), TRUE));
        $new_contribution_record->contribution_recur_id = $scheduled_today->id;
        $new_contribution_record->contribution_status_id = array_search('Pending', $contributionStatus);
        if (_versionAtLeast(4.4)) {
            $new_contribution_record->financial_type_id = $scheduled_today->financial_type_id;
        } else {
            $new_contribution_record->contribution_type_id = $scheduled_today->contribution_type_id;
        }
        $new_contribution_record->currency = $scheduled_today->currency;
        // copy info from previous contribution belonging to the same recurring contribution
        if ($past_contribution != NULL) {
            $new_contribution_record->contribution_page_id = $past_contribution->contribution_page_id;
            $new_contribution_record->payment_instrument_id = $past_contribution->payment_instrument_id;
            $new_contribution_record->source = $past_contribution->source;
            $new_contribution_record->address_id = $past_contribution->address_id;
        }
        $result[] = array('type' => 'Scheduled', 'contribution' => clone $new_contribution_record, 'contribution_recur' => clone $scheduled_today);
    }
    return $result;
}
开发者ID:xurizaemon,项目名称:com.chrischinchilla.ewayrecurring,代码行数:53,代码来源:Eway.php


注:本文中的CRM_Contribute_BAO_ContributionRecur::whereAdd方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。