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


PHP CRM_Contribute_DAO_Contribution类代码示例

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


在下文中一共展示了CRM_Contribute_DAO_Contribution类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
    }
}
开发者ID:rajeshrhino,项目名称:Civicrm-PDF-Invoice,代码行数:31,代码来源:send_invoice_email.php

示例2: validateData

 function validateData(&$input, &$ids, &$objects, $required = true)
 {
     // make sure contact exists and is valid
     require_once 'CRM/Contact/DAO/Contact.php';
     $contact = new CRM_Contact_DAO_Contact();
     $contact->id = $ids['contact'];
     if (!$contact->find(true)) {
         CRM_Core_Error::debug_log_message("Could not find contact record: {$ids['contact']}");
         echo "Failure: Could not find contact record: {$ids['contact']}<p>";
         return false;
     }
     // make sure contribution exists and is valid
     require_once 'CRM/Contribute/DAO/Contribution.php';
     $contribution = new CRM_Contribute_DAO_Contribution();
     $contribution->id = $ids['contribution'];
     if (!$contribution->find(true)) {
         CRM_Core_Error::debug_log_message("Could not find contribution record: {$contributionID}");
         echo "Failure: Could not find contribution record for {$contributionID}<p>";
         return false;
     }
     $contribution->receive_date = CRM_Utils_Date::isoToMysql($contribution->receive_date);
     $objects['contact'] =& $contact;
     $objects['contribution'] =& $contribution;
     if (!$this->loadObjects($input, $ids, $objects, $required)) {
         return false;
     }
     return true;
 }
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:28,代码来源:BaseIPN.php

示例3: preProcess

 /**
  * Set variables up before form is built.
  *
  * @param CRM_Core_Form $form
  *
  * @return void
  */
 public static function preProcess(&$form)
 {
     $contriDAO = new CRM_Contribute_DAO_Contribution();
     $contriDAO->id = $form->_id;
     $contriDAO->find(TRUE);
     if ($contriDAO->contribution_page_id) {
         $ufJoinParams = array('module' => 'soft_credit', 'entity_table' => 'civicrm_contribution_page', 'entity_id' => $contriDAO->contribution_page_id);
         $profileId = CRM_Core_BAO_UFJoin::getUFGroupIds($ufJoinParams);
         //check if any honree profile is enabled if yes then assign its profile type to $_honoreeProfileType
         // which will be used to constraint soft-credit contact type in formRule, CRM-13981
         if ($profileId[0]) {
             $form->_honoreeProfileType = CRM_Core_BAO_UFGroup::getContactType($profileId[0]);
         }
     }
 }
开发者ID:rajeshrhino,项目名称:civicrm-core,代码行数:22,代码来源:SoftCredit.php

示例4: preProcess

 /**
  * Function to set variables up before form is built
  *
  * @return void
  * @access public
  */
 public function preProcess()
 {
     //Check if there are contributions related to Contribution Page
     parent::preProcess();
     //check for delete
     if (!CRM_Core_Permission::checkActionPermission('CiviContribute', $this->_action)) {
         CRM_Core_Error::fatal(ts('You do not have permission to access this page'));
     }
     $dao = new CRM_Contribute_DAO_Contribution();
     $dao->contribution_page_id = $this->_id;
     if ($dao->find(TRUE)) {
         $this->_relatedContributions = TRUE;
         $this->assign('relatedContributions', TRUE);
     }
 }
开发者ID:archcidburnziso,项目名称:civicrm-core,代码行数:21,代码来源:Delete.php

示例5: alterActionScheduleQuery

 public function alterActionScheduleQuery(\Civi\ActionSchedule\Event\MailingQueryEvent $e)
 {
     if ($e->mapping->getEntity() !== 'civicrm_contribution') {
         return;
     }
     $fields = CRM_Contribute_DAO_Contribution::fields();
     foreach ($this->getPassthruTokens() as $token) {
         $e->query->select("e." . $fields[$token]['name'] . " AS contrib_{$token}");
     }
     foreach ($this->getAliasTokens() as $alias => $orig) {
         $e->query->select("e." . $fields[$orig]['name'] . " AS contrib_{$alias}");
     }
 }
开发者ID:rameshrr99,项目名称:civicrm-core,代码行数:13,代码来源:Tokens.php

示例6: _civicrm_api3_deprecated_formatted_param

/**
 * take the input parameter list as specified in the data model and
 * convert it into the same format that we use in QF and BAO object
 *
 * @param array $params
 *   Associative array of property name/value.
 *                             pairs to insert in new contact.
 * @param array $values
 *   The reformatted properties that we can use internally.
 *                            '
 *
 * @param bool $create
 * @param null $onDuplicate
 *
 * @return array|CRM_Error
 */
function _civicrm_api3_deprecated_formatted_param($params, &$values, $create = FALSE, $onDuplicate = NULL)
{
    // copy all the contribution fields as is
    $fields = CRM_Contribute_DAO_Contribution::fields();
    _civicrm_api3_store_values($fields, $params, $values);
    require_once 'CRM/Core/OptionGroup.php';
    $customFields = CRM_Core_BAO_CustomField::getFields('Contribution', FALSE, FALSE, NULL, NULL, FALSE, FALSE, FALSE);
    foreach ($params as $key => $value) {
        // ignore empty values or empty arrays etc
        if (CRM_Utils_System::isNull($value)) {
            continue;
        }
        // Handling Custom Data
        if ($customFieldID = CRM_Core_BAO_CustomField::getKeyID($key)) {
            $values[$key] = $value;
            $type = $customFields[$customFieldID]['html_type'];
            if ($type == 'CheckBox' || $type == 'Multi-Select') {
                $mulValues = explode(',', $value);
                $customOption = CRM_Core_BAO_CustomOption::getCustomOption($customFieldID, TRUE);
                $values[$key] = array();
                foreach ($mulValues as $v1) {
                    foreach ($customOption as $customValueID => $customLabel) {
                        $customValue = $customLabel['value'];
                        if (strtolower($customLabel['label']) == strtolower(trim($v1)) || strtolower($customValue) == strtolower(trim($v1))) {
                            if ($type == 'CheckBox') {
                                $values[$key][$customValue] = 1;
                            } else {
                                $values[$key][] = $customValue;
                            }
                        }
                    }
                }
            } elseif ($type == 'Select' || $type == 'Radio' || $type == 'Autocomplete-Select' && $customFields[$customFieldID]['data_type'] == 'String') {
                $customOption = CRM_Core_BAO_CustomOption::getCustomOption($customFieldID, TRUE);
                foreach ($customOption as $customFldID => $customValue) {
                    $val = CRM_Utils_Array::value('value', $customValue);
                    $label = CRM_Utils_Array::value('label', $customValue);
                    $label = strtolower($label);
                    $value = strtolower(trim($value));
                    if ($value == $label || $value == strtolower($val)) {
                        $values[$key] = $val;
                    }
                }
            }
        }
        switch ($key) {
            case 'contribution_contact_id':
                if (!CRM_Utils_Rule::integer($value)) {
                    return civicrm_api3_create_error("contact_id not valid: {$value}");
                }
                $dao = new CRM_Core_DAO();
                $qParams = array();
                $svq = $dao->singleValueQuery("SELECT is_deleted FROM civicrm_contact WHERE id = {$value}", $qParams);
                if (!isset($svq)) {
                    return civicrm_api3_create_error("Invalid Contact ID: There is no contact record with contact_id = {$value}.");
                } elseif ($svq == 1) {
                    return civicrm_api3_create_error("Invalid Contact ID: contact_id {$value} is a soft-deleted contact.");
                }
                $values['contact_id'] = $values['contribution_contact_id'];
                unset($values['contribution_contact_id']);
                break;
            case 'contact_type':
                // import contribution record according to select contact type
                require_once 'CRM/Contact/DAO/Contact.php';
                $contactType = new CRM_Contact_DAO_Contact();
                // when insert mode check contact id or external identifier
                if (!empty($params['contribution_contact_id']) || !empty($params['external_identifier'])) {
                    if (!empty($params['contribution_contact_id'])) {
                        $contactType->id = CRM_Utils_Array::value('contribution_contact_id', $params);
                    } elseif (!empty($params['external_identifier'])) {
                        $contactType->external_identifier = $params['external_identifier'];
                    }
                    if ($contactType->find(TRUE)) {
                        if ($params['contact_type'] != $contactType->contact_type) {
                            return civicrm_api3_create_error("Contact Type is wrong: {$contactType->contact_type}");
                        }
                    }
                } elseif (!empty($params['contribution_id']) || !empty($params['trxn_id']) || !empty($params['invoice_id'])) {
                    // when update mode check contribution id or trxn id or
                    // invoice id
                    $contactId = new CRM_Contribute_DAO_Contribution();
                    if (!empty($params['contribution_id'])) {
                        $contactId->id = $params['contribution_id'];
                    } elseif (!empty($params['trxn_id'])) {
//.........这里部分代码省略.........
开发者ID:rameshrr99,项目名称:civicrm-core,代码行数:101,代码来源:DeprecatedUtils.php

示例7: getContext

 /**
  *
  * /**
  * The function returns the component(Event/Contribute..)and whether it is Test or not
  *
  * @param array $privateData
  *   Contains the name-value pairs of transaction related data.
  * @param int $orderNo
  *   <order-total> send by google.
  *
  * @return array
  *   context of this call (test, component, payment processor id)
  */
 public static function getContext($privateData, $orderNo)
 {
     $component = NULL;
     $isTest = NULL;
     $contributionID = $privateData['contributionID'];
     $contribution = new CRM_Contribute_DAO_Contribution();
     $contribution->id = $contributionID;
     if (!$contribution->find(TRUE)) {
         CRM_Core_Error::debug_log_message("Could not find contribution record: {$contributionID}");
         echo "Failure: Could not find contribution record for {$contributionID}<p>";
         exit;
     }
     if (stristr($contribution->source, 'Online Contribution')) {
         $component = 'contribute';
     } elseif (stristr($contribution->source, 'Online Event Registration')) {
         $component = 'event';
     }
     $isTest = $contribution->is_test;
     $duplicateTransaction = 0;
     if ($contribution->contribution_status_id == 1) {
         //contribution already handled. (some processors do two notifications so this could be valid)
         $duplicateTransaction = 1;
     }
     if ($component == 'contribute') {
         if (!$contribution->contribution_page_id) {
             CRM_Core_Error::debug_log_message("Could not find contribution page for contribution record: {$contributionID}");
             echo "Failure: Could not find contribution page for contribution record: {$contributionID}<p>";
             exit;
         }
     } else {
         $eventID = $privateData['eventID'];
         if (!$eventID) {
             CRM_Core_Error::debug_log_message("Could not find event ID");
             echo "Failure: Could not find eventID<p>";
             exit;
         }
         // we are in event mode
         // make sure event exists and is valid
         $event = new CRM_Event_DAO_Event();
         $event->id = $eventID;
         if (!$event->find(TRUE)) {
             CRM_Core_Error::debug_log_message("Could not find event: {$eventID}");
             echo "Failure: Could not find event: {$eventID}<p>";
             exit;
         }
     }
     return array($isTest, $component, $duplicateTransaction);
 }
开发者ID:nganivet,项目名称:civicrm-core,代码行数:61,代码来源:PaymentExpressIPN.php

示例8: import

 /**
  * handle the values in import mode
  *
  * @param int $onDuplicate the code for what action to take on duplicates
  * @param array $values the array of values belonging to this line
  *
  * @return boolean      the result of this processing
  * @access public
  */
 function import($onDuplicate, &$values)
 {
     // first make sure this is a valid line
     $response = $this->summary($values);
     if ($response != CRM_CONTRIBUTE_IMPORT_PARSER_VALID) {
         return $response;
     }
     $params =& $this->getActiveFieldParams();
     //for date-Formats
     $session =& CRM_Core_Session::singleton();
     $dateType = $session->get("dateTypes");
     foreach ($params as $key => $val) {
         if ($val) {
             switch ($key) {
                 case 'receive_date':
                     CRM_Utils_Date::convertToDefaultDate($params, $dateType, $key);
                     break;
                 case 'cancel_date':
                     CRM_Utils_Date::convertToDefaultDate($params, $dateType, $key);
                     break;
                 case 'receipt_date':
                     CRM_Utils_Date::convertToDefaultDate($params, $dateType, $key);
                     break;
                 case 'thankyou_date':
                     CRM_Utils_Date::convertToDefaultDate($params, $dateType, $key);
                     break;
             }
         }
     }
     //date-Format part ends
     $formatted = array();
     if ($GLOBALS['_CRM_CONTRIBUTE_IMPORT_PARSER_CONTRIBUTION']['indieFields'] == null) {
         require_once 'CRM/Contribute/DAO/Contribution.php';
         $tempIndieFields =& CRM_Contribute_DAO_Contribution::import();
         $GLOBALS['_CRM_CONTRIBUTE_IMPORT_PARSER_CONTRIBUTION']['indieFields'] = $tempIndieFields;
     }
     foreach ($params as $key => $field) {
         if ($field == null || $field === '') {
             continue;
         }
         $value = array($key => $field);
         _crm_add_formatted_contrib_param($value, $formatted);
     }
     if ($this->_contactIdIndex < 0) {
         if ($GLOBALS['_CRM_CONTRIBUTE_IMPORT_PARSER_CONTRIBUTION']['cIndieFields'] == null) {
             require_once 'CRM/Contact/BAO/Contact.php';
             $cTempIndieFields = CRM_Contact_BAO_Contact::importableFields('Individual', null);
             $GLOBALS['_CRM_CONTRIBUTE_IMPORT_PARSER_CONTRIBUTION']['cIndieFields'] = $cTempIndieFields;
         }
         foreach ($params as $key => $field) {
             if ($field == null || $field === '') {
                 continue;
             }
             if (is_array($field)) {
                 foreach ($field as $value) {
                     $break = false;
                     if (is_array($value)) {
                         foreach ($value as $name => $testForEmpty) {
                             if ($name !== 'phone_type' && ($testForEmpty === '' || $testForEmpty == null)) {
                                 $break = true;
                                 break;
                             }
                         }
                     } else {
                         $break = true;
                     }
                     if (!$break) {
                         _crm_add_formatted_param($value, $contactFormatted);
                     }
                 }
                 continue;
             }
             $value = array($key => $field);
             if (array_key_exists($key, $GLOBALS['_CRM_CONTRIBUTE_IMPORT_PARSER_CONTRIBUTION']['cIndieFields'])) {
                 $value['contact_type'] = 'Individual';
             }
             _crm_add_formatted_param($value, $contactFormatted);
         }
         $contactFormatted['contact_type'] = 'Individual';
         $error = _crm_duplicate_formatted_contact($contactFormatted);
         $matchedIDs = explode(',', $error->_errors[0]['params'][0]);
         if (CRM_Contribute_Import_Parser_Contribution::isDuplicate($error)) {
             if (count($matchedIDs) > 1) {
                 array_unshift($values, "Multiple matching contact records detected for this row. The contribution was not imported");
                 return CRM_CONTRIBUTE_IMPORT_PARSER_ERROR;
             } else {
                 $cid = $matchedIDs[0];
                 $formatted['contact_id'] = $cid;
                 $newContribution = crm_create_contribution_formatted($formatted, $onDuplicate);
                 if (is_a($newContribution, CRM_Core_Error)) {
                     array_unshift($values, $newContribution->_errors[0]['message']);
//.........这里部分代码省略.........
开发者ID:bhirsch,项目名称:voipdrupal-4.7-1.0,代码行数:101,代码来源:Contribution.php

示例9: checkDuplicateIds

 /**
  * Check if there is a contribution with the params passed in.
  * Used for trxn_id,invoice_id and contribution_id
  *
  * @param array  $params (reference ) an assoc array of name/value pairs
  *
  * @return array contribution id if success else NULL
  * @access public
  * static
  */
 static function checkDuplicateIds($params)
 {
     $dao = new CRM_Contribute_DAO_Contribution();
     $clause = array();
     $input = array();
     foreach ($params as $k => $v) {
         if ($v) {
             $clause[] = "{$k} = '{$v}'";
         }
     }
     $clause = implode(' AND ', $clause);
     $query = "SELECT id FROM civicrm_contribution WHERE {$clause}";
     $dao =& CRM_Core_DAO::executeQuery($query, $input);
     while ($dao->fetch()) {
         $result = $dao->id;
         return $result;
     }
     return NULL;
 }
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:29,代码来源:Contribution.php

示例10: getContributionTokenDetails

 /**
  * Gives required details of contribuion in an indexed array format so we
  * can iterate in a nice loop and do token evaluation
  *
  * @param array $contributionIDs
  * @param array $returnProperties
  *   Of required properties.
  * @param array $extraParams
  *   Extra params.
  * @param array $tokens
  *   The list of tokens we've extracted from the content.
  * @param string $className
  *
  * @return array
  */
 public static function getContributionTokenDetails($contributionIDs, $returnProperties = NULL, $extraParams = NULL, $tokens = array(), $className = NULL)
 {
     // @todo this function basically replicates calling
     // civicrm_api3('contribution', 'get', array('id' => array('IN' => array())
     if (empty($contributionIDs)) {
         // putting a fatal here so we can track if/when this happens
         CRM_Core_Error::fatal();
     }
     $details = array();
     // no apiQuery helper yet, so do a loop and find contribution by id
     foreach ($contributionIDs as $contributionID) {
         $dao = new CRM_Contribute_DAO_Contribution();
         $dao->id = $contributionID;
         if ($dao->find(TRUE)) {
             $details[$dao->id] = array();
             CRM_Core_DAO::storeValues($dao, $details[$dao->id]);
             // do the necessary transformation
             if (!empty($details[$dao->id]['payment_instrument_id'])) {
                 $piId = $details[$dao->id]['payment_instrument_id'];
                 $pis = CRM_Contribute_PseudoConstant::paymentInstrument();
                 $details[$dao->id]['payment_instrument'] = $pis[$piId];
             }
             if (!empty($details[$dao->id]['campaign_id'])) {
                 $campaignId = $details[$dao->id]['campaign_id'];
                 $campaigns = CRM_Campaign_BAO_Campaign::getCampaigns($campaignId);
                 $details[$dao->id]['campaign'] = $campaigns[$campaignId];
             }
             if (!empty($details[$dao->id]['financial_type_id'])) {
                 $financialtypeId = $details[$dao->id]['financial_type_id'];
                 $ftis = CRM_Contribute_PseudoConstant::financialType();
                 $details[$dao->id]['financial_type'] = $ftis[$financialtypeId];
             }
             // @todo call a hook to get token contribution details
         }
     }
     return $details;
 }
开发者ID:rameshrr99,项目名称:civicrm-core,代码行数:52,代码来源:Token.php

示例11: postProcess

 /**
  * @param $form
  * @param array $params Parameters from the form.
  */
 public static function postProcess($form, $params)
 {
     if (!empty($form->_honor_block_is_active) && !empty($params['soft_credit_type_id'])) {
         $honorId = NULL;
         //check if there is any duplicate contact
         $profileContactType = CRM_Core_BAO_UFGroup::getContactType($params['honoree_profile_id']);
         $dedupeParams = CRM_Dedupe_Finder::formatParams($params['honor'], $profileContactType);
         $dedupeParams['check_permission'] = FALSE;
         $ids = CRM_Dedupe_Finder::dupesByParams($dedupeParams, $profileContactType);
         if (count($ids)) {
             $honorId = CRM_Utils_Array::value(0, $ids);
         }
         $honorId = CRM_Contact_BAO_Contact::createProfileContact($params['honor'], CRM_Core_DAO::$_nullArray, $honorId, NULL, $params['honoree_profile_id']);
         $softParams = array();
         $softParams['contribution_id'] = $form->_contributionID;
         $softParams['contact_id'] = $honorId;
         $softParams['soft_credit_type_id'] = $params['soft_credit_type_id'];
         $contribution = new CRM_Contribute_DAO_Contribution();
         $contribution->id = $form->_contributionID;
         $contribution->find();
         while ($contribution->fetch()) {
             $softParams['currency'] = $contribution->currency;
             $softParams['amount'] = $contribution->total_amount;
         }
         CRM_Contribute_BAO_ContributionSoft::add($softParams);
         if (CRM_Utils_Array::value('is_email_receipt', $form->_values)) {
             $form->_values['honor'] = array('soft_credit_type' => CRM_Utils_Array::value($params['soft_credit_type_id'], CRM_Core_OptionGroup::values("soft_credit_type")), 'honor_id' => $honorId, 'honor_profile_id' => $params['honoree_profile_id'], 'honor_profile_values' => $params['honor']);
         }
     }
 }
开发者ID:nganivet,项目名称:civicrm-core,代码行数:34,代码来源:ProfileContact.php

示例12: _fillCommonParams

 static function _fillCommonParams(&$params, $type = 'paypal')
 {
     if (array_key_exists('transaction', $params)) {
         $transaction =& $params['transaction'];
     } else {
         $transaction =& $params;
     }
     $params['contact_type'] = 'Individual';
     $billingLocTypeId = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_LocationType', 'Billing', 'id', 'name');
     if (!$billingLocTypeId) {
         $billingLocTypeId = 1;
     }
     if (!CRM_Utils_System::isNull($params['address'])) {
         $params['address'][1]['is_primary'] = 1;
         $params['address'][1]['location_type_id'] = $billingLocTypeId;
     }
     if (!CRM_Utils_System::isNull($params['email'])) {
         $params['email'] = array(1 => array('email' => $params['email'], 'location_type_id' => $billingLocTypeId));
     }
     if (isset($transaction['trxn_id'])) {
         // set error message if transaction has already been processed.
         require_once 'CRM/Contribute/DAO/Contribution.php';
         $contribution = new CRM_Contribute_DAO_Contribution();
         $contribution->trxn_id = $transaction['trxn_id'];
         if ($contribution->find(true)) {
             $params['error'][] = ts('transaction already processed.');
         }
     } else {
         // generate a new transaction id, if not already exist
         $transaction['trxn_id'] = md5(uniqid(rand(), true));
     }
     if (!isset($transaction['contribution_type_id'])) {
         require_once 'CRM/Contribute/PseudoConstant.php';
         $contributionTypes = array_keys(CRM_Contribute_PseudoConstant::contributionType());
         $transaction['contribution_type_id'] = $contributionTypes[0];
     }
     if ($type == 'paypal' && !isset($transaction['net_amount'])) {
         $transaction['net_amount'] = $transaction['total_amount'] - CRM_Utils_Array::value('fee_amount', $transaction, 0);
     }
     if (!isset($transaction['invoice_id'])) {
         $transaction['invoice_id'] = $transaction['trxn_id'];
     }
     $source = ts('ContributionProcessor: %1 API', array(1 => ucfirst($type)));
     if (isset($transaction['source'])) {
         $transaction['source'] = $source . ':: ' . $transaction['source'];
     } else {
         $transaction['source'] = $source;
     }
     return true;
 }
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:50,代码来源:Utils.php

示例13: _crm_add_formatted_contrib_param

/**
 * This function adds the contribution variable in $values to the
 * parameter list $params.  For most cases, $values should have length 1.
 *
 * @param array  $values    The variable(s) to be added
 * @param array  $params    The structured parameter list
 * 
 * @return bool|CRM_Utils_Error
 * @access public
 */
function _crm_add_formatted_contrib_param(&$values, &$params)
{
    /* Cache the various object fields */
    static $fields = null;
    if ($fields == null) {
        $fields = array();
    }
    //print_r($values);
    //print_r($params);
    if (isset($values['contribution_type'])) {
        $params['contribution_type'] = $values['contribution_type'];
        return true;
    }
    if (isset($values['payment_instrument'])) {
        $params['payment_instrument'] = $values['payment_instrument'];
        return true;
    }
    /* Check for custom field values */
    if ($fields['custom'] == null) {
        $fields['custom'] =& CRM_Core_BAO_CustomField::getFields('Contribution');
    }
    foreach ($values as $key => $value) {
        if ($customFieldID = CRM_Core_BAO_CustomField::getKeyID($key)) {
            /* check if it's a valid custom field id */
            if (!array_key_exists($customFieldID, $fields['custom'])) {
                return _crm_error('Invalid custom field ID');
            }
            if (!isset($params['custom'])) {
                $params['custom'] = array();
            }
            // fixed for Import
            $newMulValues = array();
            if ($fields['custom'][$customFieldID][3] == 'CheckBox' || $fields['custom'][$customFieldID][3] == 'Multi-Select') {
                $value = str_replace("|", ",", $value);
                $mulValues = explode(',', $value);
                $custuomOption = CRM_Core_BAO_CustomOption::getCustomOption($customFieldID, true);
                foreach ($mulValues as $v1) {
                    foreach ($custuomOption as $v2) {
                        if (strtolower($v2['label']) == strtolower(trim($v1))) {
                            $newMulValues[] = $v2['value'];
                        }
                    }
                }
                $value = implode(CRM_CORE_BAO_CUSTOMOPTION_VALUE_SEPERATOR, $newMulValues);
            } else {
                if ($fields['custom'][$customFieldID][3] == 'Select' || $fields['custom'][$customFieldID][3] == 'Radio') {
                    $custuomOption = CRM_Core_BAO_CustomOption::getCustomOption($customFieldID, true);
                    foreach ($custuomOption as $v2) {
                        if (strtolower($v2['label']) == strtolower(trim($value))) {
                            $value = $v2['value'];
                            break;
                        }
                    }
                }
            }
            $customBlock = count($params['custom']) + 1;
            $params['custom'][$customBlock] = array('custom_field_id' => $customFieldID, 'value' => $value, 'type' => $fields['custom'][$customFieldID][2], 'name' => $fields['custom'][$customFieldID][0]);
        }
    }
    /* Finally, check for contribution fields */
    if (!isset($fields['Contribution'])) {
        $fields['Contribution'] =& CRM_Contribute_DAO_Contribution::fields();
    }
    _crm_store_values($fields['Contribution'], $values, $params);
}
开发者ID:bhirsch,项目名称:voipdrupal-4.7-1.0,代码行数:75,代码来源:utils.php

示例14: getContributionFields

 /**
  * Function to get list of contribution fields for profile
  * For now we only allow custom contribution fields to be in
  * profile
  *
  * @return return the list of contribution fields
  * @static
  * @access public
  */
 function getContributionFields()
 {
     $contributionFields =& CRM_Contribute_DAO_Contribution::export();
     foreach ($contributionFields as $key => $var) {
         if ($key == 'contact_id') {
             continue;
         }
         $fields[$key] = $var;
     }
     // $fields = array_merge($fields, CRM_Core_BAO_CustomField::getFieldsForImport('Contribution'));
     $fields = CRM_Core_BAO_CustomField::getFieldsForImport('Contribution');
     return $fields;
 }
开发者ID:bhirsch,项目名称:voipdrupal-4.7-1.0,代码行数:22,代码来源:Contribution.php

示例15: getContext

 /**
  * The function returns whether this transaction has already been handled.
  *
  * @param string @component
  *   event/contribute
  * @param array $post_data_exp
  *   Contains the name-value pairs of transaction response data.
  * @param string $dt_trxn_id
  *   Transaction ID from DT response.
  *
  * @return boolean
  *   Has this transaction been handled?  TRUE/FALSE.
  * @static
  */
 static function getContext($component, $post_data_exp, $dt_trxn_id)
 {
     require_once 'CRM/Contribute/DAO/Contribution.php';
     $contributionID = $post_data_exp['contributionID'];
     $contribution = new CRM_Contribute_DAO_Contribution();
     $contribution->id = $contributionID;
     /*
      * @TODO For recurring?
      * if(new contrib)
      * $contribution->invoice_id = $dt_trxn_id;
      */
     if (!$contribution->find(TRUE)) {
         CRM_Core_Error::debug_log_message("Could not find contribution record: {$contributionID}");
         print "Failure: Could not find contribution record for {$contributionID}<p>";
         exit;
     }
     $duplicate_transaction = FALSE;
     if ($contribution->contribution_status_id == 1) {
         //  Contribution already handled.
         $duplicate_transaction = TRUE;
     }
     if ($component == 'contribute') {
         if (empty($contribution->contribution_page_id)) {
             CRM_Core_Error::debug_log_message("Could not find contribution page for contribution record: {$contributionID}");
             print "Failure: Could not find contribution page for contribution record: {$contributionID}<p>";
             exit;
         }
     } else {
         if (!empty($post_data_exp['eventID'])) {
             require_once 'CRM/Event/DAO/Event.php';
             $eventID = $post_data_exp['eventID'];
             // Make sure event exists and is valid.
             $event = new CRM_Event_DAO_Event();
             $event->id = $eventID;
             if (!$event->find(TRUE)) {
                 CRM_Core_Error::debug_log_message("Could not find event: {$eventID}");
                 print "Failure: Could not find event: {$eventID}<p>";
                 exit;
             }
         } else {
             CRM_Core_Error::debug_log_message("Could not find event ID");
             print "Failure: Could not find eventID<p>";
             exit;
         }
     }
     return $duplicate_transaction;
 }
开发者ID:rdamjanov,项目名称:com.drastikbydesign.datatrans-4.1,代码行数:61,代码来源:DataTransIPN.php


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