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

PHP CRM_Core_BAO_CustomValueTable类代码示例

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

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



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

示例1: getFieldValue

 /**
  * Returns the value of the field for the condition
  * For example: I want to check if age > 50, this function would return the 50
  *
  * @param object CRM_Civirules_TriggerData_TriggerData $triggerData
  * @return
  * @access protected
  * @abstract
  */
 protected function getFieldValue(CRM_Civirules_TriggerData_TriggerData $triggerData)
 {
     $entity = $this->conditionParams['entity'];
     $field = $this->conditionParams['field'];
     $data = $triggerData->getEntityData($entity);
     if (isset($data[$field])) {
         return $this->normalizeValue($data[$field]);
     }
     if (strpos($field, 'custom_') === 0) {
         $custom_field_id = str_replace("custom_", "", $field);
         try {
             $params['entityID'] = $data['id'];
             $params[$field] = 1;
             $values = CRM_Core_BAO_CustomValueTable::getValues($params);
             if (!empty($values[$field])) {
                 return $this->normalizeValue($values[$field]);
             } elseif (!empty($values['error_message'])) {
                 $custom_values = $triggerData->getCustomFieldValues($custom_field_id);
                 if (!empty($custom_values)) {
                     return $this->normalizeValue(reset($custom_values));
                 }
             }
         } catch (Exception $e) {
             //do nothing
         }
     }
     return null;
 }
开发者ID:alejandro-ixiam,项目名称:org.civicoop.civirules,代码行数:37,代码来源:FieldValueComparison.php


示例2: testCustomGroupMultipleOldFormat

 public function testCustomGroupMultipleOldFormat()
 {
     $contactID = $this->individualCreate();
     $customGroup = $this->customGroupCreate(array('is_multiple' => 1));
     $fields = array('custom_group_id' => $customGroup['id'], 'dataType' => 'String', 'htmlType' => 'Text');
     $customField = $this->customFieldCreate($fields);
     $params = array('entityID' => $contactID, "custom_{$customField['id']}" => 'First String');
     CRM_Core_BAO_CustomValueTable::setValues($params);
     $newParams = array('entityID' => $contactID, "custom_{$customField['id']}" => 1);
     $result = CRM_Core_BAO_CustomValueTable::getValues($newParams);
     $this->assertEquals($params["custom_{$customField['id']}"], $result["custom_{$customField['id']}_1"]);
     $this->assertEquals($params['entityID'], $result['entityID']);
     $this->customFieldDelete($customField['id']);
     $this->customGroupDelete($customGroup['id']);
     $this->contactDelete($contactID);
 }
开发者ID:kcristiano,项目名称:civicrm-core,代码行数:16,代码来源:CustomValueTableMultipleTest.php


示例3: testCustomGroupMultipleOldFormate

 public function testCustomGroupMultipleOldFormate()
 {
     $params = array();
     $contactID = Contact::createIndividual();
     $customGroup = Custom::createGroup($params, 'Individual', TRUE);
     $fields = array('groupId' => $customGroup->id, 'dataType' => 'String', 'htmlType' => 'Text');
     $customField = Custom::createField($params, $fields);
     $params = array('entityID' => $contactID, "custom_{$customField->id}" => 'First String');
     $error = CRM_Core_BAO_CustomValueTable::setValues($params);
     $newParams = array('entityID' => $contactID, "custom_{$customField->id}" => 1);
     $result = CRM_Core_BAO_CustomValueTable::getValues($newParams);
     $this->assertEquals($params["custom_{$customField->id}"], $result["custom_{$customField->id}_1"]);
     $this->assertEquals($params['entityID'], $result['entityID']);
     Custom::deleteField($customField);
     Custom::deleteGroup($customGroup);
     Contact::delete($contactID);
 }
开发者ID:sdekok,项目名称:civicrm-core,代码行数:17,代码来源:CustomValueTableMultipleTest.php


示例4: civicrm_api3_pcpteams_create

/**
 * File for the CiviCRM APIv3 group functions
 *
 * @package CiviCRM_APIv3
 * @subpackage API_pcpteams
 * @copyright CiviCRM LLC (c) 2004-2014
 */
function civicrm_api3_pcpteams_create($params)
{
    // since we are allowing html input from the user
    // we also need to purify it, so lets clean it up
    // $params['pcp_title']      = $pcp['title'];
    // $params['pcp_contact_id'] = $pcp['contact_id'];
    $htmlFields = array('intro_text', 'page_text', 'title');
    foreach ($htmlFields as $field) {
        if (!empty($params[$field])) {
            $params[$field] = CRM_Utils_String::purifyHTML($params[$field]);
        }
    }
    $entity_table = CRM_PCP_BAO_PCP::getPcpEntityTable($params['page_type']);
    $pcpBlock = new CRM_PCP_DAO_PCPBlock();
    $pcpBlock->entity_table = $entity_table;
    $pcpBlock->entity_id = $params['page_id'];
    $pcpBlock->find(TRUE);
    $params['pcp_block_id'] = $pcpBlock->id;
    $params['goal_amount'] = CRM_Utils_Rule::cleanMoney($params['goal_amount']);
    // 1 -> waiting review
    // 2 -> active / approved (default for now)
    $params['status_id'] = CRM_Utils_Array::value('status_id', $params, 2);
    // active by default for now
    $params['is_active'] = CRM_Utils_Array::value('is_active', $params, 1);
    $pcp = CRM_Pcpteams_BAO_PCP::create($params, FALSE);
    //Custom Set
    $customFields = CRM_Core_BAO_CustomField::getFields('PCP', FALSE, FALSE, NULL, NULL, TRUE);
    $isCustomValueSet = FALSE;
    foreach ($customFields as $fieldID => $fieldValue) {
        list($tableName, $columnName, $cgId) = CRM_Core_BAO_CustomField::getTableColumnGroup($fieldID);
        if (!empty($params[$columnName]) || !empty($params["custom_{$fieldID}"])) {
            $isCustomValueSet = TRUE;
            //FIXME: to find out the custom value exists, set -1 as default now
            $params["custom_{$fieldID}_-1"] = !empty($params[$columnName]) ? $params[$columnName] : $params["custom_{$fieldID}"];
        }
    }
    if ($isCustomValueSet) {
        $params['custom'] = CRM_Core_BAO_CustomField::postProcess($params, $customFields, $pcp->id, 'PCP');
        CRM_Core_BAO_CustomValueTable::store($params['custom'], 'civicrm_pcp', $pcp->id);
    }
    //end custom set
    $values = array();
    @_civicrm_api3_object_to_array_unique_fields($pcp, $values[$pcp->id]);
    return civicrm_api3_create_success($values, $params, 'Pcpteams', 'create');
}
开发者ID:eruraindil,项目名称:uk.co.vedaconsulting.pcpteams,代码行数:52,代码来源:Pcpteams.php


示例5: retreiveContactFieldValue

 /**
  *Retrieve Name, Type and Id of record contain government value from customvalue table
  */
 static function retreiveContactFieldValue($contactID)
 {
     $govInfo = array();
     $govFieldId = self::retreiveContactFieldId('Identify');
     if (!empty($govFieldId) && $contactID) {
         $govValues = CRM_Core_BAO_CustomValueTable::getEntityValues($contactID, NULL, $govFieldId, TRUE);
         foreach ($govValues as $key => $val) {
             if ($val[$govFieldId['is_government']] == 1) {
                 $govInfo['type'] = $val[$govFieldId['Type']];
                 $govInfo['typeNumber'] = $val[$govFieldId['Number']];
                 $govInfo['key'] = $val[$govFieldId['is_government']];
                 $govInfo['id'] = ":{$key}";
                 break;
             }
         }
     }
     return $govInfo;
 }
开发者ID:JoeMurray,项目名称:civihr,代码行数:21,代码来源:HRIdent.php


示例6: testCreateWithCustomData

 /**
  * Create() method with custom data.
  */
 public function testCreateWithCustomData()
 {
     $contactId = $this->individualCreate();
     //create custom data
     $customGroup = $this->customGroupCreate(array('extends' => 'Contribution'));
     $customGroupID = $customGroup['id'];
     $customGroup = $customGroup['values'][$customGroupID];
     $fields = array('label' => 'testFld', 'data_type' => 'String', 'html_type' => 'Text', 'is_active' => 1, 'custom_group_id' => $customGroupID);
     $customField = CRM_Core_BAO_CustomField::create($fields);
     $params = array('contact_id' => $contactId, 'currency' => 'USD', 'financial_type_id' => 1, 'contribution_status_id' => 1, 'payment_instrument_id' => 1, 'source' => 'STUDENT', 'receive_date' => '20080522000000', 'receipt_date' => '20080522000000', 'id' => NULL, 'non_deductible_amount' => 0.0, 'total_amount' => 200.0, 'fee_amount' => 5, 'net_amount' => 195, 'trxn_id' => '22ereerwww322323', 'invoice_id' => '22ed39c9e9ee6ef6031621ce0eafe6da70', 'thankyou_date' => '20080522');
     $params['custom'] = array($customField->id => array(-1 => array('value' => 'Test custom value', 'type' => 'String', 'custom_field_id' => $customField->id, 'custom_group_id' => $customGroupID, 'table_name' => $customGroup['table_name'], 'column_name' => $customField->column_name, 'file_id' => NULL)));
     $contribution = CRM_Contribute_BAO_Contribution::create($params);
     // Check that the custom field value is saved
     $customValueParams = array('entityID' => $contribution->id, 'custom_' . $customField->id => 1);
     $values = CRM_Core_BAO_CustomValueTable::getValues($customValueParams);
     $this->assertEquals('Test custom value', $values['custom_' . $customField->id], 'Check the custom field value');
     $this->assertEquals($params['trxn_id'], $contribution->trxn_id, 'Check for transcation id creation.');
     $this->assertEquals($contactId, $contribution->contact_id, 'Check for contact id for Conribution.');
 }
开发者ID:nielosz,项目名称:civicrm-core,代码行数:22,代码来源:ContributionTest.php


示例7: getFieldValue

 /**
  * Returns the value of the field for the condition
  * For example: I want to check if age > 50, this function would return the 50
  *
  * @param object CRM_Civirules_TriggerData_TriggerData $triggerData
  * @return
  * @access protected
  * @abstract
  */
 protected function getFieldValue(CRM_Civirules_TriggerData_TriggerData $triggerData)
 {
     $entity = $this->conditionParams['entity'];
     $field = $this->conditionParams['field'];
     $data = $triggerData->getEntityData($entity);
     if (isset($data[$field])) {
         return $this->normalizeValue($data[$field]);
     }
     if ($this->isRelativeDate($field)) {
         $relativeDate = $this->parseRelativeDate($field);
         $field = $relativeDate['field'];
         $interval = $relativeDate['interval'];
         if (isset($data[$field])) {
             $date = new DateTime($data[$field]);
             $today = new DateTime("now");
             $diff = $date->diff($today);
             return $this->normalizeValue($diff->format('%' . $interval));
         }
     }
     if (strpos($field, 'custom_') === 0) {
         $custom_field_id = str_replace("custom_", "", $field);
         try {
             $params['entityID'] = $data['id'];
             $params[$field] = 1;
             $values = CRM_Core_BAO_CustomValueTable::getValues($params);
             $value = null;
             if (!empty($values[$field])) {
                 $value = $this->normalizeValue($values[$field]);
             } elseif (!empty($values['error_message'])) {
                 $value = $triggerData->getCustomFieldValue($custom_field_id);
             }
             if ($value !== null) {
                 $value = $this->convertMultiselectCustomfieldToArray($custom_field_id, $value);
                 return $this->normalizeValue($value);
             }
         } catch (Exception $e) {
             //do nothing
         }
     }
     return null;
 }
开发者ID:elcapo,项目名称:org.civicoop.civirules,代码行数:50,代码来源:FieldValueComparison.php


示例8: create

 /**
  * takes an associative array and creates a campaign object
  *
  * the function extract all the params it needs to initialize the create a
  * contact object. the params array could contain additional unused name/value
  * pairs
  *
  * @param array  $params (reference ) an assoc array of name/value pairs
  *
  * @return object CRM_Campaign_DAO_Campaign object
  * @access public
  * @static
  */
 static function create(&$params)
 {
     if (empty($params)) {
         return;
     }
     if (!CRM_Utils_Array::value('id', $params)) {
         if (!CRM_Utils_Array::value('created_id', $params)) {
             $session = CRM_Core_Session::singleton();
             $params['created_id'] = $session->get('userID');
         }
         if (!CRM_Utils_Array::value('created_date', $params)) {
             $params['created_date'] = date('YmdHis');
         }
         if (!CRM_Utils_Array::value('name', $params)) {
             $params['name'] = CRM_Utils_String::titleToVar($params['title'], 64);
         }
     }
     $campaign = new CRM_Campaign_DAO_Campaign();
     $campaign->copyValues($params);
     $campaign->save();
     /* Create the campaign group record */
     $groupTableName = CRM_Contact_BAO_Group::getTableName();
     if (isset($params['groups']) && !empty($params['groups']['include']) && is_array($params['groups']['include'])) {
         foreach ($params['groups']['include'] as $entityId) {
             $dao = new CRM_Campaign_DAO_CampaignGroup();
             $dao->campaign_id = $campaign->id;
             $dao->entity_table = $groupTableName;
             $dao->entity_id = $entityId;
             $dao->group_type = 'Include';
             $dao->save();
             $dao->free();
         }
     }
     //store custom data
     if (!empty($params['custom']) && is_array($params['custom'])) {
         CRM_Core_BAO_CustomValueTable::store($params['custom'], 'civicrm_campaign', $campaign->id);
     }
     return $campaign;
 }
开发者ID:archcidburnziso,项目名称:civicrm-core,代码行数:52,代码来源:Campaign.php


示例9: create

 /**
  * Takes an associative array and creates a participant object.
  *
  * @param array $params
  *   (reference ) an assoc array of name/value pairs.
  *
  * @return CRM_Event_BAO_Participant
  */
 public static function create(&$params)
 {
     $transaction = new CRM_Core_Transaction();
     $status = NULL;
     if (!empty($params['id'])) {
         $status = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Participant', $params['id'], 'status_id');
     }
     $participant = self::add($params);
     if (is_a($participant, 'CRM_Core_Error')) {
         $transaction->rollback();
         return $participant;
     }
     if (!CRM_Utils_Array::value('id', $params) || isset($params['status_id']) && $params['status_id'] != $status) {
         CRM_Activity_BAO_Activity::addActivity($participant);
     }
     //CRM-5403
     //for update mode
     if (self::isPrimaryParticipant($participant->id) && $status) {
         self::updateParticipantStatus($participant->id, $status, $participant->status_id);
     }
     $session = CRM_Core_Session::singleton();
     $id = $session->get('userID');
     if (!$id) {
         $id = CRM_Utils_Array::value('contact_id', $params);
     }
     // add custom field values
     if (!empty($params['custom']) && is_array($params['custom'])) {
         CRM_Core_BAO_CustomValueTable::store($params['custom'], 'civicrm_participant', $participant->id);
     }
     //process note, CRM-7634
     $noteId = NULL;
     if (!empty($params['id'])) {
         $note = CRM_Core_BAO_Note::getNote($params['id'], 'civicrm_participant');
         $noteId = key($note);
     }
     $noteValue = NULL;
     $hasNoteField = FALSE;
     foreach (array('note', 'participant_note') as $noteFld) {
         if (array_key_exists($noteFld, $params)) {
             $noteValue = $params[$noteFld];
             $hasNoteField = TRUE;
             break;
         }
     }
     if ($noteId || $noteValue) {
         if ($noteValue) {
             $noteParams = array('entity_table' => 'civicrm_participant', 'note' => $noteValue, 'entity_id' => $participant->id, 'contact_id' => $id, 'modified_date' => date('Ymd'));
             $noteIDs = array();
             if ($noteId) {
                 $noteIDs['id'] = $noteId;
             }
             CRM_Core_BAO_Note::add($noteParams, $noteIDs);
         } elseif ($noteId && $hasNoteField) {
             CRM_Core_BAO_Note::del($noteId, FALSE);
         }
     }
     // Log the information on successful add/edit of Participant data.
     $logParams = array('entity_table' => 'civicrm_participant', 'entity_id' => $participant->id, 'data' => CRM_Event_PseudoConstant::participantStatus($participant->status_id), 'modified_id' => $id, 'modified_date' => date('Ymd'));
     CRM_Core_BAO_Log::add($logParams);
     $params['participant_id'] = $participant->id;
     $transaction->commit();
     // do not add to recent items for import, CRM-4399
     if (empty($params['skipRecentView'])) {
         $url = CRM_Utils_System::url('civicrm/contact/view/participant', "action=view&reset=1&id={$participant->id}&cid={$participant->contact_id}&context=home");
         $recentOther = array();
         if (CRM_Core_Permission::check('edit event participants')) {
             $recentOther['editUrl'] = CRM_Utils_System::url('civicrm/contact/view/participant', "action=update&reset=1&id={$participant->id}&cid={$participant->contact_id}&context=home");
         }
         if (CRM_Core_Permission::check('delete in CiviEvent')) {
             $recentOther['deleteUrl'] = CRM_Utils_System::url('civicrm/contact/view/participant', "action=delete&reset=1&id={$participant->id}&cid={$participant->contact_id}&context=home");
         }
         $participantRoles = CRM_Event_PseudoConstant::participantRole();
         if ($participant->role_id) {
             $role = explode(CRM_Core_DAO::VALUE_SEPARATOR, $participant->role_id);
             foreach ($role as &$roleValue) {
                 if (isset($roleValue)) {
                     $roleValue = $participantRoles[$roleValue];
                 }
             }
             $roles = implode(', ', $role);
         }
         $roleString = empty($roles) ? '' : $roles;
         $eventTitle = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', $participant->event_id, 'title');
         $title = CRM_Contact_BAO_Contact::displayName($participant->contact_id) . ' (' . $roleString . ' - ' . $eventTitle . ')';
         // add the recently created Participant
         CRM_Utils_Recent::add($title, $url, $participant->id, 'Participant', $participant->contact_id, NULL, $recentOther);
     }
     return $participant;
 }
开发者ID:kcristiano,项目名称:civicrm-core,代码行数:97,代码来源:Participant.php


示例10: postProcess

 /**
  * process the form after the input has been submitted and validated
  *
  * @access public
  * @return None
  */
 public function postProcess()
 {
     $params = $this->exportValues();
     $dates = array('receive_date', 'receipt_date', 'thankyou_date', 'cancel_date');
     if (isset($params['field'])) {
         foreach ($params['field'] as $key => $value) {
             $value['custom'] = CRM_Core_BAO_CustomField::postProcess($value, CRM_Core_DAO::$_nullObject, $key, 'Contribution');
             $ids['contribution'] = $key;
             foreach ($dates as $val) {
                 $value[$val] = CRM_Utils_Date::processDate($value[$val]);
             }
             if ($value['contribution_type']) {
                 $value['contribution_type_id'] = $value['contribution_type'];
             }
             if ($value['payment_instrument']) {
                 $value['payment_instrument_id'] = $value['payment_instrument'];
             }
             if ($value['contribution_source']) {
                 $value['source'] = $value['contribution_source'];
             }
             unset($value['contribution_type']);
             unset($value['contribution_source']);
             $contribution = CRM_Contribute_BAO_Contribution::add($value, $ids);
             // add custom field values
             if (CRM_Utils_Array::value('custom', $value) && is_array($value['custom'])) {
                 require_once 'CRM/Core/BAO/CustomValueTable.php';
                 CRM_Core_BAO_CustomValueTable::store($value['custom'], 'civicrm_contribution', $contribution->id);
             }
         }
         CRM_Core_Session::setStatus("Your updates have been saved.");
     } else {
         CRM_Core_Session::setStatus("No updates have been saved.");
     }
 }
开发者ID:bhirsch,项目名称:voipdev,代码行数:40,代码来源:Batch.php


示例11: array

 /**
  * takes an associative array and creates a contribution object
  *
  * @param array $params (reference ) an assoc array of name/value pairs
  * @param array $ids    the array that holds all the db ids
  *
  * @return object CRM_Contribute_BAO_Contribution object 
  * @access public
  * @static
  */
 static function &create(&$params, &$ids)
 {
     require_once 'CRM/Utils/Money.php';
     require_once 'CRM/Utils/Date.php';
     require_once 'CRM/Contribute/PseudoConstant.php';
     // FIXME: a cludgy hack to fix the dates to MySQL format
     $dateFields = array('receive_date', 'cancel_date', 'receipt_date', 'thankyou_date');
     foreach ($dateFields as $df) {
         if (isset($params[$df])) {
             $params[$df] = CRM_Utils_Date::isoToMysql($params[$df]);
         }
     }
     require_once 'CRM/Core/Transaction.php';
     $transaction = new CRM_Core_Transaction();
     $contribution = self::add($params, $ids);
     if (is_a($contribution, 'CRM_Core_Error')) {
         $transaction->rollback();
         return $contribution;
     }
     $params['contribution_id'] = $contribution->id;
     if (CRM_Utils_Array::value('custom', $params) && is_array($params['custom'])) {
         require_once 'CRM/Core/BAO/CustomValueTable.php';
         CRM_Core_BAO_CustomValueTable::store($params['custom'], 'civicrm_contribution', $contribution->id);
     }
     $session =& CRM_Core_Session::singleton();
     if (CRM_Utils_Array::value('note', $params)) {
         require_once 'CRM/Core/BAO/Note.php';
         $noteParams = array('entity_table' => 'civicrm_contribution', 'note' => $params['note'], 'entity_id' => $contribution->id, 'contact_id' => $session->get('userID'), 'modified_date' => date('Ymd'));
         if (!$noteParams['contact_id']) {
             $noteParams['contact_id'] = $params['contact_id'];
         }
         CRM_Core_BAO_Note::add($noteParams, CRM_Utils_Array::value('note', $ids));
     }
     // check if activity record exist for this contribution, if
     // not add activity
     require_once "CRM/Activity/DAO/Activity.php";
     $activity = new CRM_Activity_DAO_Activity();
     $activity->source_record_id = $contribution->id;
     $activity->activity_type_id = CRM_Core_OptionGroup::getValue('activity_type', 'Contribution', 'name');
     if (!$activity->find()) {
         require_once "CRM/Activity/BAO/Activity.php";
         CRM_Activity_BAO_Activity::addActivity($contribution, 'Offline');
     }
     if (CRM_Utils_Array::value('soft_credit_to', $params)) {
         $csParams = array();
         if ($id = CRM_Utils_Array::value('softID', $params)) {
             $csParams['id'] = $params['softID'];
         }
         $csParams['pcp_display_in_roll'] = $params['pcp_display_in_roll'] ? 1 : 0;
         foreach (array('pcp_roll_nickname', 'pcp_personal_note') as $val) {
             if (CRM_Utils_Array::value($val, $params)) {
                 $csParams[$val] = $params[$val];
             }
         }
         $csParams['contribution_id'] = $contribution->id;
         $csParams['contact_id'] = $params['soft_credit_to'];
         // first stage: we register whole amount as credited to given person
         $csParams['amount'] = $contribution->total_amount;
         self::addSoftContribution($csParams);
     }
     $transaction->commit();
     // do not add to recent items for import, CRM-4399
     if (!CRM_Utils_Array::value('skipRecentView', $params)) {
         require_once 'CRM/Utils/Recent.php';
         require_once 'CRM/Contribute/PseudoConstant.php';
         require_once 'CRM/Contact/BAO/Contact.php';
         $url = CRM_Utils_System::url('civicrm/contact/view/contribution', "action=view&reset=1&id={$contribution->id}&cid={$contribution->contact_id}&context=home");
         $contributionTypes = CRM_Contribute_PseudoConstant::contributionType();
         $title = CRM_Contact_BAO_Contact::displayName($contribution->contact_id) . ' - (' . CRM_Utils_Money::format($contribution->total_amount, $contribution->currency) . ' ' . ' - ' . $contributionTypes[$contribution->contribution_type_id] . ')';
         $recentOther = array();
         if (CRM_Core_Permission::checkActionPermission('CiviContribute', CRM_Core_Action::UPDATE)) {
             $recentOther['editUrl'] = CRM_Utils_System::url('civicrm/contact/view/contribution', "action=update&reset=1&id={$contribution->id}&cid={$contribution->contact_id}&context=home");
         }
         if (CRM_Core_Permission::checkActionPermission('CiviContribute', CRM_Core_Action::DELETE)) {
             $recentOther['deleteUrl'] = CRM_Utils_System::url('civicrm/contact/view/contribution', "action=delete&reset=1&id={$contribution->id}&cid={$contribution->contact_id}&context=home");
         }
         // add the recently created Contribution
         CRM_Utils_Recent::add($title, $url, $contribution->id, 'Contribution', $contribution->contact_id, null, $recentOther);
     }
     return $contribution;
 }
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:91,代码来源:Contribution.php


示例12: testDeleteContact

 /**
  * Test case for deleteContact( ).
  */
 public function testDeleteContact()
 {
     $contactParams = $this->contactParams();
     $customGroup = $this->customGroupCreate();
     $fields = array('label' => 'testFld', 'data_type' => 'String', 'html_type' => 'Text', 'custom_group_id' => $customGroup['id']);
     $customField = CRM_Core_BAO_CustomField::create($fields);
     $contactParams['custom'] = array($customField->id => array(-1 => array('value' => 'Test custom value', 'type' => 'String', 'custom_field_id' => $customField->id, 'custom_group_id' => $customGroup['id'], 'table_name' => $customGroup['values'][$customGroup['id']]['table_name'], 'column_name' => $customField->column_name, 'file_id' => NULL)));
     //create contact
     $contact = CRM_Contact_BAO_Contact::create($contactParams);
     $contactId = $contact->id;
     //delete contact permanently.
     CRM_Contact_BAO_Contact::deleteContact($contactId, FALSE, TRUE);
     //Now check DB for location elements.
     //Now check DB for Address
     $this->assertDBNull('CRM_Core_DAO_Address', $contactId, 'id', 'street_address', 'Database check, Address deleted successfully.');
     //Now check DB for Email
     $this->assertDBNull('CRM_Core_DAO_Email', $contactId, 'id', 'email', 'Database check, Email deleted successfully.');
     //Now check DB for Phone
     $this->assertDBNull('CRM_Core_DAO_Phone', $contactId, 'id', 'phone', 'Database check, Phone deleted successfully.');
     //Now check DB for Mobile
     $this->assertDBNull('CRM_Core_DAO_Phone', $contactId, 'id', 'phone', 'Database check, Mobile deleted successfully.');
     //Now check DB for IM
     $this->assertDBNull('CRM_Core_DAO_IM', $contactId, 'id', 'name', 'Database check, IM deleted successfully.');
     //Now check DB for openId
     $this->assertDBNull('CRM_Core_DAO_OpenID', $contactId, 'id', 'openid', 'Database check, openId deleted successfully.');
     // Check that the custom field value is no longer present
     $params = array('entityID' => $contactId, 'custom_' . $customField->id => 1);
     $values = CRM_Core_BAO_CustomValueTable::getValues($params);
     $this->assertEquals(CRM_Utils_Array::value("custom_" . $customField->id, $values), '', 'Verify that the data value is empty for contact ' . $contactId);
     $this->assertEquals($values['is_error'], 1, 'Verify that is_error = 0 (success).');
     //Now check DB for contact.
     $this->assertDBNull('CRM_Contact_DAO_Contact', $contactId, 'id', 'sort_name', 'Database check, contact deleted successfully.');
     $this->quickCleanup(array('civicrm_contact', 'civicrm_note'));
     $this->customGroupDelete($customGroup['id']);
 }
开发者ID:kcristiano,项目名称:civicrm-core,代码行数:38,代码来源:ContactTest.php


示例13: postProcess


//.........这里部分代码省略.........
         // CRM-15622: fix for incorrect contribution.fee_amount
         $paymentParams['fee_amount'] = NULL;
         $result = $payment->doPayment($paymentParams);
         if (is_a($result, 'CRM_Core_Error')) {
             CRM_Core_Error::displaySessionError($result);
             CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/contact/view/participant', "reset=1&action=add&cid={$this->_contactId}&context=participant&mode={$this->_mode}"));
         }
         if ($result) {
             $this->_params = array_merge($this->_params, $result);
         }
         $this->_params['receive_date'] = $now;
         if (!empty($this->_params['send_receipt'])) {
             $this->_params['receipt_date'] = $now;
         } else {
             $this->_params['receipt_date'] = NULL;
         }
         $this->set('params', $this->_params);
         $this->assign('trxn_id', $result['trxn_id']);
         $this->assign('receive_date', CRM_Utils_Date::processDate($this->_params['receive_date']));
         //add contribution record
         $this->_params['financial_type_id'] = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', $params['event_id'], 'financial_type_id');
         $this->_params['mode'] = $this->_mode;
         //add contribution record
         $contributions[] = $contribution = CRM_Event_Form_Registration_Confirm::processContribution($this, $this->_params, $result, $contactID, FALSE);
         // add participant record
         $participants = array();
         if (!empty($this->_params['role_id']) && is_array($this->_params['role_id'])) {
             $this->_params['role_id'] = implode(CRM_Core_DAO::VALUE_SEPARATOR, $this->_params['role_id']);
         }
         //CRM-15372 patch to fix fee amount replacing amount
         $this->_params['fee_amount'] = $this->_params['amount'];
         $participants[] = CRM_Event_Form_Registration::addParticipant($this, $contactID);
         //add custom data for participant
         CRM_Core_BAO_CustomValueTable::postProcess($this->_params, 'civicrm_participant', $participants[0]->id, 'Participant');
         //add participant payment
         $paymentParticipant = array('participant_id' => $participants[0]->id, 'contribution_id' => $contribution->id);
         $ids = array();
         CRM_Event_BAO_ParticipantPayment::create($paymentParticipant, $ids);
         $this->_contactIds[] = $this->_contactId;
     } else {
         $participants = array();
         if ($this->_single) {
             if ($params['role_id']) {
                 $params['role_id'] = $roleIdWithSeparator;
             } else {
                 $params['role_id'] = 'NULL';
             }
             $participants[] = CRM_Event_BAO_Participant::create($params);
         } else {
             foreach ($this->_contactIds as $contactID) {
                 $commonParams = $params;
                 $commonParams['contact_id'] = $contactID;
                 if ($commonParams['role_id']) {
                     $commonParams['role_id'] = $commonParams['role_id'] = str_replace(',', CRM_Core_DAO::VALUE_SEPARATOR, $params['role_id']);
                 } else {
                     $commonParams['role_id'] = 'NULL';
                 }
                 $participants[] = CRM_Event_BAO_Participant::create($commonParams);
             }
         }
         if (isset($params['event_id'])) {
             $eventTitle = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', $params['event_id'], 'title');
         }
         if ($this->_single) {
             $this->_contactIds[] = $this->_contactId;
         }
开发者ID:kcristiano,项目名称:civicrm-core,代码行数:67,代码来源:Participant.php


示例14: createSignature

 /**
  * takes an associative array and creates a petition signature activity
  *
  * @param array $params (reference ) an assoc array of name/value pairs
  *
  * @return object CRM_Campaign_BAO_Petition
  * @access public
  * @static
  */
 function createSignature(&$params)
 {
     if (empty($params)) {
         return;
     }
     if (!isset($params['sid'])) {
         $statusMsg = ts('No survey sid parameter. Cannot process signature.');
         CRM_Core_Session::setStatus($statusMsg, ts('Sorry'), 'error');
         return;
     }
     if (isset($params['contactId'])) {
         // add signature as activity with survey id as source id
         // get the activity type id associated with this survey
         $surveyInfo = CRM_Campaign_BAO_Petition::getSurveyInfo($params['sid']);
         // create activity
         // 1-Schedule, 2-Completed
         $activityParams = array('source_contact_id' => $params['contactId'], 'target_contact_id' => $params['contactId'], 'source_record_id' => $params['sid'], 'subject' => $surveyInfo['title'], 'activity_type_id' => $surveyInfo['activity_type_id'], 'activity_date_time' => date("YmdHis"), 'status_id' => $params['statusId'], 'activity_campaign_id' => $params['activity_campaign_id']);
         //activity creation
         // *** check for activity using source id - if already signed
         $activity = CRM_Activity_BAO_Activity::create($activityParams);
         // save activity custom data
         if (!empty($params['custom']) && is_array($params['custom'])) {
             CRM_Core_BAO_CustomValueTable::store($params['custom'], 'civicrm_activity', $activity->id);
         }
         // set permanent cookie to indicate this petition already signed on the computer
         setcookie('signed_' . $params['sid'], $activity->id, time() + $this->cookieExpire, '/');
     }
     return $activity;
 }
开发者ID:prashantgajare,项目名称:civicrm-core,代码行数:38,代码来源:Petition.php


示例15: copyExtendedActivityData

 /**
  * Copy custom fields and attachments from an existing activity to another.
  *
  * @see CRM_Case_Page_AJAX::_convertToCaseActivity()
  *
  * @param array $params
  */
 public static function copyExtendedActivityData($params)
 {
     // attach custom data to the new activity
     $customParams = $htmlType = array();
     $customValues = CRM_Core_BAO_CustomValueTable::getEntityValues($params['activityID'], 'Activity');
     if (!empty($customValues)) {
         $fieldIds = implode(', ', array_keys($customValues));
         $sql = "SELECT id FROM civicrm_custom_field WHERE html_type = 'File' AND id IN ( {$fieldIds} )";
         $result = CRM_Core_DAO::executeQuery($sql);
         while ($result->fetch()) {
             $htmlType[] = $result->id;
         }
         foreach ($customValues as $key => $value) {
             if ($value !== NULL) {
                 // CRM-10542
                 if (in_array($key, $htmlType)) {
                     $fileValues = CRM_Core_BAO_File::path($value, $params['activityID']);
                     $customParams["custom_{$key}_-1"] = array('name' => $fileValues[0], 'path' => $fileValues[1]);
                 } else {
                     $customParams["custom_{$key}_-1"] = $value;
                 }
             }
         }
         CRM_Core_BAO_CustomValueTable::postProcess($customParams, 'civicrm_activity', $params['mainActivityId'], 'Activity');
     }
     // copy activity attachments ( if any )
     CRM_Core_BAO_File::copyEntityFile('civicrm_activity', $params['activityID'], 'civicrm_activity', $params['mainActivityId']);
 }
开发者ID:saurabhbatra96,项目名称:civicrm-core,代码行数:35,代码来源:Activity.php


示例16: testCustomGroupMultiple

 public function testCustomGroupMultiple()
 {
     $params = array();
     $contactID = $this->individualCreate();
     $customGroup = $this->customGroupCreate();
     $fields = array('custom_group_id' => $customGroup['id'], 'data_type' => 'String', 'html_type' => 'Text');
     $customField = $this->customFieldCreate($fields);
     $params = array('entityID' => $contactID, 'custom_' . $customField['id'] . '_-1' => 'First String');
     $error = CRM_Core_BAO_CustomValueTable::setValues($params);
     $newParams = array('entityID' => $contactID, 'custom_' . $customField['id'] => 1);
     $result = CRM_Core_BAO_CustomValueTable::getValues($newParams);
     $this->assertEquals($params['custom_' . $customField['id'] . '_-1'], $result['custom_' . $customField['id']]);
     $this->assertEquals($params['entityID'], $result['entityID']);
     $this->customFieldDelete($customField['id']);
     $this->customGroupDelete($customGroup['id']);
     $this->contactDelete($contactID);
 }
开发者ID:nielosz,项目名称:civicrm-core,代码行数:17,代码来源:CustomValueTableTest.php


示例17: processContribution


//.........这里部分代码省略.........
             $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
             if ($pledge->id) {
                 //build params to send acknowledgment.
                 $pledgeParams['id'] = $pledge->id;
                 $pledgeParams['receipt_from_name'] = $form->_values['receipt_from_name'];
                 $pledgeParams['receipt_from_email'] = $form->_values['receipt_from_email'];
                 //scheduled amount will be same as installment_amount.
                 $pledgeParams['scheduled_amount'] = $pledgeParams['installment_amount'];
                 //get total pledge amount.
                 $pledgeParams['total_pledge_amount'] = $pledge->amount;
                 CRM_Pledge_BAO_Pledge::sendAcknowledgment($form, $pledgeParams);
             }
         }
     }
     if ($online && $contribution) {
         CRM_Core_BAO_CustomValueTable::postProcess($form->_params, CRM 

鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP CRM_Core_BAO_Discount类代码示例发布时间:2022-05-20
下一篇:
PHP CRM_Core_BAO_CustomValue类代码示例发布时间: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