• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP CRM_Contribute_DAO_Contribution类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



在下文中一共展示了CRM_Contribute_DAO_Contribution类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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


示例16: postProcess

 /**
  * process the form after the input has been submitted and validated
  *
  * @access public
  *
  * @return None
  */
 function postProcess()
 {
     // lets get around the time limit issue if possible
     if (!ini_get('safe_mode')) {
         set_time_limit(0);
     }
     // Issue 1895204: Turn off geocoding to avoid hitting Google API limits
     $config =& CRM_Core_Config::singleton();
     $oldGeocode = $config->geocodeMethod;
     unset($config->geocodeMethod);
     $params = $this->controller->exportValues($this->_name);
     $originalOnly = FALSE;
     if ($params['receipt_option'] == 'original_only') {
         $originalOnly = TRUE;
     }
     $previewMode = FALSE;
     if (isset($params['is_preview']) && $params['is_preview'] == 1) {
         $previewMode = TRUE;
     }
     /**
      * Drupal module include
      */
     //module_load_include('.inc','civicrm_cdntaxreceipts','civicrm_cdntaxreceipts');
     //module_load_include('.module','civicrm_cdntaxreceipts','civicrm_cdntaxreceipts');
     // start a PDF to collect receipts that cannot be emailed
     $receiptsForPrinting = cdntaxreceipts_openCollectedPDF();
     $emailCount = 0;
     $printCount = 0;
     $failCount = 0;
     foreach ($this->_contributionIds as $item => $contributionId) {
         if ($emailCount + $printCount + $failCount >= self::MAX_RECEIPT_COUNT) {
             $status = ts('Maximum of %1 tax receipt(s) were sent. Please repeat to continue processing.', array(1 => self::MAX_RECEIPT_COUNT, 'domain' => 'org.civicrm.cdntaxreceipts'));
             CRM_Core_Session::setStatus($status, '', 'info');
             break;
         }
         // 1. Load Contribution information
         $contribution = new CRM_Contribute_DAO_Contribution();
         $contribution->id = $contributionId;
         if (!$contribution->find(TRUE)) {
             CRM_Core_Error::fatal("CDNTaxReceipts: Could not find corresponding contribution id.");
         }
         // 2. If Contribution is eligible for receipting, issue the tax receipt.  Otherwise ignore.
         if (cdntaxreceipts_eligibleForReceipt($contribution->id)) {
             list($issued_on, $receipt_id) = cdntaxreceipts_issued_on($contribution->id);
             if (empty($issued_on) || !$originalOnly) {
                 list($ret, $method) = cdntaxreceipts_issueTaxReceipt($contribution, $receiptsForPrinting, $previewMode);
                 if ($ret == 0) {
                     $failCount++;
                 } elseif ($method == 'email') {
                     $emailCount++;
                 } else {
                     $printCount++;
                 }
             }
         }
     }
     // 3. Set session status
     if ($previewMode) {
         $status = ts('%1 tax receipt(s) have been previewed.  No receipts have been issued.', array(1 => $printCount, 'domain' => 'org.civicrm.cdntaxreceipts'));
         CRM_Core_Session::setStatus($status, '', 'success');
     } else {
         $status = ts('%1 tax receipt(s) were sent by email.', array(1 => $emailCount, 'domain' => 'org.civicrm.cdntaxreceipts'));
         CRM_Core_Session::setStatus($status, '', 'success');
         $status = ts('%1 tax receipt(s) need to be printed.', array(1 => $printCount, 'domain' => 'org.civicrm.cdntaxreceipts'));
         CRM_Core_Session::setStatus($status, '', 'success');
     }
     if ($failCount > 0) {
         $status = ts('%1 tax receipt(s) failed to process.', array(1 => $failCount, 'domain' => 'org.civicrm.cdntaxreceipts'));
         CRM_Core_Session::setStatus($status, '', 'error');
     }
     // Issue 1895204: Reset geocoding
     $config->geocodeMethod = $oldGeocode;
     // 4. send the collected PDF for download
     // NB: This exits if a file is sent.
     cdntaxreceipts_sendCollectedPDF($receiptsForPrinting, 'Receipts-To-Print-' . (int) $_SERVER['REQUEST_TIME'] . '.pdf');
     // EXITS.
 }
开发者ID:carriercomm,项目名称:CDNTaxReceipts,代码行数:84,代码来源:IssueSingleTaxReceipts.php


示例17: 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 bool
  *   the result of this processing
  */
 public function import($onDuplicate, &$values)
 {
     // first make sure this is a valid line
     $response = $this->summary($values);
     if ($response != CRM_Import_Parser::VALID) {
         return $response;
     }
     $params =& $this->getActiveFieldParams();
     $formatted = array('version' => 3);
     // don't add to recent items, CRM-4399
     $formatted['skipRecentView'] = TRUE;
     //for date-Formats
     $session = CRM_Core_Session::singleton();
     $dateType = $session->get('dateTypes');
     $customDataType = !empty($params['contact_type']) ? $params['contact_type'] : 'Contribution';
     $customFields = CRM_Core_BAO_CustomField::getFields($customDataType);
     //CRM-10994
     if (isset($params['total_amount']) && $params['total_amount'] == 0) {
         $params['total_amount'] = '0.00';
     }
     foreach ($params as $key => $val) {
         if ($val) {
             switch ($key) {
                 case 'receive_date':
                 case 'cancel_date':
                 case 'receipt_date':
                 case 'thankyou_date':
                     $params[$key] = CRM_Utils_Date::formatDate($params[$key], $dateType);
                     break;
                 case 'pledge_payment':
                     $params[$key] = CRM_Utils_String::strtobool($val);
                     break;
             }
             if ($customFieldID = CRM_Core_BAO_CustomField::getKeyID($key)) {
                 if ($customFields[$customFieldID]['data_type'] == 'Date') {
                     CRM_Contact_Import_Parser_Contact::formatCustomDate($params, $formatted, $dateType, $key);
                     unset($params[$key]);
                 } elseif ($customFields[$customFieldID]['data_type'] == 'Boolean') {
                     $params[$key] = CRM_Utils_String::strtoboolstr($val);
                 }
             }
         }
     }
     //date-Format part ends
     static $indieFields = NULL;
     if ($indieFields == NULL) {
         $tempIndieFields = CRM_Contribute_DAO_Contribution::import();
         $indieFields = $tempIndieFields;
     }
     $paramValues = array();
     foreach ($params as $key => $field) {
         if ($field == NULL || $field === '') {
             continue;
         }
         $paramValues[$key] = $field;
     }
     //import contribution record according to select contact type
     if ($onDuplicate == CRM_Import_Parser::DUPLICATE_SKIP && (!empty($paramValues['contribution_contact_id']) || !empty($paramValues['external_identifier']))) {
         $paramValues['contact_type'] = $this->_contactType;
     } elseif ($onDuplicate == CRM_Import_Parser::DUPLICATE_UPDATE && (!empty($paramValues['contribution_id']) || !empty($values['trxn_id']) || !empty($paramValues['invoice_id']))) {
         $paramValues['contact_type'] = $this->_contactType;
     } elseif (!empty($params['soft_credit'])) {
         $paramValues['contact_type'] = $this->_contactType;
     } elseif (!empty($paramValues['pledge_payment'])) {
         $paramValues['contact_type'] = $this->_contactType;
     }
     //need to pass $onDuplicate to check import mode.
     if (!empty($paramValues['pledge_payment'])) {
         $paramValues['onDuplicate'] = $onDuplicate;
     }
     require_once 'CRM/Utils/DeprecatedUtils.php';
     $formatError = _civicrm_api3_deprecated_formatted_param($paramValues, $formatted, TRUE, $onDuplicate);
     if ($formatError) {
         array_unshift($values, $formatError['error_message']);
         if (CRM_Utils_Array::value('error_data', $formatError) == 'soft_credit') {
             return CRM_Contribute_Import_Parser::SOFT_CREDIT_ERROR;
         } elseif (CRM_Utils_Array::value('error_data', $formatError) == 'pledge_payment') {
             return CRM_Contribute_Import_Parser::PLEDGE_PAYMENT_ERROR;
         }
         return CRM_Import_Parser::ERROR;
     }
     if ($onDuplicate != CRM_Import_Parser::DUPLICATE_UPDATE) {
         $formatted['custom'] = CRM_Core_BAO_CustomField::postProcess($formatted, NULL, 'Contribution');
     } else {
         //fix for CRM-2219 - Update Contribution
         // onDuplicate == CRM_Import_Parser::DUPLICATE_UPDATE
         if (!empty($paramValues['invoice_id']) || !empty($paramValues['trxn_id']) || !empty($paramValues['contribution_id'])) {
             $dupeIds = array('id' => CRM_Utils_Array::value('contribution_id', $paramValues), 'trxn_id' => CRM_Utils_Array::value('trxn_id', $paramValues), 'invoice_id' => CRM_Utils_Array::value('invoice_ 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP CRM_Contribute_DAO_Product类代码示例发布时间:2022-05-20
下一篇:
PHP CRM_Contribute_BAO_Query类代码示例发布时间:2022-05-20
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap