예제 #1
0
파일: accountsync.php 프로젝트: kidaa30/yes
/**
 * Check if entity is valid for this connector.
 *
 * If we are dealing with a Contribution AND the connector has a contact_id
 * then we will check that the line items in the invoice related to this contact ID.
 *
 * @param int $connector_id
 * @param int $financial_type_id
 *
 * @return bool
 */
function _accountsync_validate_for_connector($connector_id, $financial_type_id)
{
    if ($connector_id == 0) {
        return TRUE;
    }
    $accounts_contact_id = _accountsync_get_account_contact_id($connector_id);
    static $connector_financial_types = array();
    if (!in_array($financial_type_id, $connector_financial_types)) {
        $connector_financial_types[$financial_type_id] = CRM_Accountsync_BAO_AccountInvoice::getAccountsContact($financial_type_id);
    }
    if ($accounts_contact_id == CRM_Utils_Array::value($financial_type_id, $connector_financial_types)) {
        return TRUE;
    } else {
        return FALSE;
    }
}