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


PHP CRM_Core_BAO_UFGroup::setProfileDefaults方法代码示例

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


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

示例1: setDefaultValues

 /**
  * This function sets the default values for the form.
  *
  * @access public
  */
 function setDefaultValues()
 {
     $defaults = array();
     $defaults['volunteer_role_id'] = CRM_Volunteer_BAO_Need::FLEXIBLE_ROLE_ID;
     $cid = CRM_Utils_Array::value('userID', $_SESSION['CiviCRM'], NULL);
     if ($cid) {
         $fields = array_flip(array_keys(CRM_Core_BAO_UFGroup::getFields($this->_ufgroup_id)));
         CRM_Core_BAO_UFGroup::setProfileDefaults($cid, $fields, $defaults);
     }
     return $defaults;
 }
开发者ID:relldoesphp,项目名称:civivolunteer,代码行数:16,代码来源:VolunteerSignUp.php

示例2: setDefaultValues

 function setDefaultValues()
 {
     $defaults = array($this->html_field_name('email') => $this->participant->email);
     list($custom_fields_pre, $custom_fields_post) = $this->get_participant_custom_data_fields($this->participant->event_id);
     $all_fields = $custom_fields_pre + $custom_fields_post;
     $flat = array();
     CRM_Core_BAO_UFGroup::setProfileDefaults($this->participant->contact_id, $all_fields, $flat);
     foreach ($flat as $name => $field) {
         $defaults["field[{$this->participant->id}][{$name}]"] = $field;
     }
     return $defaults;
 }
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:12,代码来源:MerParticipant.php

示例3: setDefaultValues

 /**
  * Set default values for the form.
  *
  * @access public
  */
 function setDefaultValues()
 {
     $defaults = array();
     $defaults['volunteer_role_id'] = CRM_Volunteer_BAO_Need::FLEXIBLE_ROLE_ID;
     if (key_exists('userID', $_SESSION['CiviCRM'])) {
         foreach ($this->getProfileIDs() as $profileID) {
             $fields = array_flip(array_keys(CRM_Core_BAO_UFGroup::getFields($profileID)));
             CRM_Core_BAO_UFGroup::setProfileDefaults($_SESSION['CiviCRM']['userID'], $fields, $defaults);
         }
     }
     return $defaults;
 }
开发者ID:Hack4Eugene,项目名称:Hack4Cause2016,代码行数:17,代码来源:VolunteerSignUp.php

示例4: setDefaultValues

 function setDefaultValues()
 {
     if (!$this->_donorID) {
         return;
     }
     foreach ($this->_fields as $name => $dontcare) {
         $fields[$name] = 1;
     }
     require_once "CRM/Core/BAO/UFGroup.php";
     CRM_Core_BAO_UFGroup::setProfileDefaults($this->_donorID, $fields, $this->_defaults);
     //set custom field defaults
     require_once "CRM/Core/BAO/CustomField.php";
     foreach ($this->_fields as $name => $field) {
         if ($customFieldID = CRM_Core_BAO_CustomField::getKeyID($name)) {
             if (!isset($this->_defaults[$name])) {
                 CRM_Core_BAO_CustomField::setProfileDefaults($customFieldID, $name, $this->_defaults, NULL, CRM_Profile_Form::MODE_REGISTER);
             }
         }
     }
     return $this->_defaults;
 }
开发者ID:archcidburnziso,项目名称:civicrm-core,代码行数:21,代码来源:ItemAccount.php

示例5: setDefaultsValues

 /**
  * Set default values for the form. Note that in edit/view mode
  * the default values are retrieved from the database
  *
  *
  * @return void
  */
 public function setDefaultsValues()
 {
     $this->_defaults = array();
     if ($this->_multiRecordProfile && $this->_multiRecord == CRM_Core_Action::DELETE) {
         return;
     }
     if ($this->_mode != self::MODE_SEARCH) {
         // set default values for country / state to start with
         CRM_Core_BAO_UFGroup::setRegisterDefaults($this->_fields, $this->_defaults);
     }
     if ($this->_id && !$this->_multiRecordProfile) {
         if ($this->_isContactActivityProfile) {
             $contactFields = $activityFields = array();
             foreach ($this->_fields as $fieldName => $field) {
                 if (CRM_Utils_Array::value('field_type', $field) == 'Activity') {
                     $activityFields[$fieldName] = $field;
                 } else {
                     $contactFields[$fieldName] = $field;
                 }
             }
             CRM_Core_BAO_UFGroup::setProfileDefaults($this->_id, $contactFields, $this->_defaults, TRUE);
             if ($this->_activityId) {
                 CRM_Core_BAO_UFGroup::setComponentDefaults($activityFields, $this->_activityId, 'Activity', $this->_defaults, TRUE);
             }
         } else {
             CRM_Core_BAO_UFGroup::setProfileDefaults($this->_id, $this->_fields, $this->_defaults, TRUE);
         }
     }
     //set custom field defaults
     if ($this->_multiRecordProfile) {
         foreach ($this->_multiRecordFields as $key => $field) {
             $fieldIds[] = CRM_Core_BAO_CustomField::getKeyID($key);
         }
         $defaultValues = array();
         if ($this->_multiRecord && $this->_multiRecord == CRM_Core_Action::UPDATE) {
             $defaultValues = CRM_Core_BAO_CustomValueTable::getEntityValues($this->_id, NULL, $fieldIds, TRUE);
             if ($this->_recordExists == TRUE) {
                 $defaultValues = $defaultValues[$this->_recordId];
             } else {
                 $defaultValues = NULL;
             }
         }
         if (!empty($defaultValues)) {
             foreach ($defaultValues as $key => $value) {
                 $name = "custom_{$key}";
                 $htmlType = $this->_multiRecordFields[$name]['html_type'];
                 if ($htmlType != 'File') {
                     if (isset($value)) {
                         CRM_Core_BAO_CustomField::setProfileDefaults($key, $name, $this->_defaults, $this->_id, $this->_mode, $value);
                     } else {
                         $this->_defaults[$name] = "";
                     }
                 }
                 if ($htmlType == 'File') {
                     $entityId = $this->_id;
                     if (CRM_Utils_Array::value('field_type', $field) == 'Activity' && $this->_activityId) {
                         $entityId = $this->_activityId;
                     }
                     $url = CRM_Core_BAO_CustomField::getFileURL($entityId, $key);
                     if ($url) {
                         $customFiles[$name]['displayURL'] = ts("Attached File") . ": {$url['file_url']}";
                         $deleteExtra = ts("Are you sure you want to delete attached file?");
                         $fileId = $url['file_id'];
                         $deleteURL = CRM_Utils_System::url('civicrm/file', "reset=1&id={$fileId}&eid={$entityId}&fid={$key}&action=delete");
                         $text = ts("Delete Attached File");
                         $customFiles[$field['name']]['deleteURL'] = "<a href=\"{$deleteURL}\" onclick = \"if (confirm( ' {$deleteExtra} ' )) this.href+='&amp;confirmed=1'; else return false;\">{$text}</a>";
                         // also delete the required rule that we've set on the form element
                         $this->removeFileRequiredRules($name);
                     }
                 }
             }
         }
     } else {
         foreach ($this->_fields as $name => $field) {
             if ($customFieldID = CRM_Core_BAO_CustomField::getKeyID($name)) {
                 $htmlType = $field['html_type'];
                 if ((!isset($this->_defaults[$name]) || $htmlType == 'File') && CRM_Utils_Array::value('field_type', $field) != 'Activity') {
                     CRM_Core_BAO_CustomField::setProfileDefaults($customFieldID, $name, $this->_defaults, $this->_id, $this->_mode);
                 }
                 if ($htmlType == 'File') {
                     $entityId = $this->_id;
                     if (CRM_Utils_Array::value('field_type', $field) == 'Activity' && $this->_activityId) {
                         $entityId = $this->_activityId;
                     }
                     $url = CRM_Core_BAO_CustomField::getFileURL($entityId, $customFieldID);
                     if ($url) {
                         $customFiles[$field['name']]['displayURL'] = ts("Attached File") . ": {$url['file_url']}";
                         $deleteExtra = ts("Are you sure you want to delete attached file?");
                         $fileId = $url['file_id'];
                         $deleteURL = CRM_Utils_System::url('civicrm/file', "reset=1&id={$fileId}&eid={$entityId}&fid={$customFieldID}&action=delete");
                         $text = ts("Delete Attached File");
                         $customFiles[$field['name']]['deleteURL'] = "<a href=\"{$deleteURL}\" onclick = \"if (confirm( ' {$deleteExtra} ' )) this.href+='&amp;confirmed=1'; else return false;\">{$text}</a>";
                         // also delete the required rule that we've set on the form element
//.........这里部分代码省略.........
开发者ID:hyebahi,项目名称:civicrm-core,代码行数:101,代码来源:Form.php

示例6: civicrm_api3_profile_get

/**
 * Retrieve Profile field values.
 *
 * NOTE this api is not standard & since it is tested we need to honour that
 * but the correct behaviour is for it to return an id indexed array as this supports
 * multiple instances - if a  single profile is passed in we will not return a normal api result array
 * in order to avoid breaking code. (This could still be confusing :-( but we have to keep the tested behaviour working
 *
 * Note that if contact_id is empty an array of defaults is returned
 *
 * @param array $params
 *   Associative array of property name/value.
 *   pairs to get profile field values
 *
 * @throws API_Exception
 * @return array
 */
function civicrm_api3_profile_get($params)
{
    $nonStandardLegacyBehaviour = is_numeric($params['profile_id']) ? TRUE : FALSE;
    if (!empty($params['check_permissions']) && !empty($params['contact_id']) && !1 === civicrm_api3('contact', 'getcount', array('contact_id' => $params['contact_id'], 'check_permissions' => 1))) {
        throw new API_Exception('permission denied');
    }
    $profiles = (array) $params['profile_id'];
    $values = array();
    $ufGroupBAO = new CRM_Core_BAO_UFGroup();
    foreach ($profiles as $profileID) {
        $profileID = _civicrm_api3_profile_getProfileID($profileID);
        $values[$profileID] = array();
        if (strtolower($profileID) == 'billing') {
            $values[$profileID] = _civicrm_api3_profile_getbillingpseudoprofile($params);
            continue;
        }
        if (!CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFGroup', $profileID, 'is_active')) {
            throw new API_Exception('Invalid value for profile_id : ' . $profileID);
        }
        $isContactActivityProfile = CRM_Core_BAO_UFField::checkContactActivityProfileType($profileID);
        $profileFields = CRM_Core_BAO_UFGroup::getFields($profileID, FALSE, NULL, NULL, NULL, FALSE, NULL, empty($params['check_permissions']) ? FALSE : TRUE, NULL, CRM_Core_Permission::EDIT);
        if ($isContactActivityProfile) {
            civicrm_api3_verify_mandatory($params, NULL, array('activity_id'));
            $errors = CRM_Profile_Form::validateContactActivityProfile($params['activity_id'], $params['contact_id'], $params['profile_id']);
            if (!empty($errors)) {
                throw new API_Exception(array_pop($errors));
            }
            $contactFields = $activityFields = array();
            foreach ($profileFields as $fieldName => $field) {
                if (CRM_Utils_Array::value('field_type', $field) == 'Activity') {
                    $activityFields[$fieldName] = $field;
                } else {
                    $contactFields[$fieldName] = $field;
                    // we should return 'Primary' with & without capitalisation. it is more consistent with api to not
                    // capitalise, but for form support we need it for now. Hopefully we can move away from it
                    $contactFields[strtolower($fieldName)] = $field;
                }
            }
            $ufGroupBAO->setProfileDefaults($params['contact_id'], $contactFields, $values[$profileID], TRUE);
            if ($params['activity_id']) {
                $ufGroupBAO->setComponentDefaults($activityFields, $params['activity_id'], 'Activity', $values[$profileID], TRUE);
            }
        } elseif (!empty($params['contact_id'])) {
            $ufGroupBAO->setProfileDefaults($params['contact_id'], $profileFields, $values[$profileID], TRUE);
            foreach ($values[$profileID] as $fieldName => $field) {
                // we should return 'Primary' with & without capitalisation. it is more consistent with api to not
                // capitalise, but for form support we need it for now. Hopefully we can move away from it
                $values[$profileID][strtolower($fieldName)] = $field;
            }
        } else {
            $values[$profileID] = array_fill_keys(array_keys($profileFields), '');
        }
    }
    if ($nonStandardLegacyBehaviour) {
        $result = civicrm_api3_create_success();
        $result['values'] = $values[$profileID];
        return $result;
    } else {
        return civicrm_api3_create_success($values, $params, 'Profile', 'Get');
    }
}
开发者ID:nielosz,项目名称:civicrm-core,代码行数:78,代码来源:Profile.php

示例7: setDefaultValues

 /**
  * This function sets the default values for the form in edit/view mode
  * the default values are retrieved from the database
  * 
  * @access public
  * @return None
  */
 public function setDefaultValues()
 {
     if ($this->_showFeeBlock) {
         return CRM_Event_Form_EventFees::setDefaultValues($this);
     }
     if ($this->_cdType) {
         return CRM_Custom_Form_CustomData::setDefaultValues($this);
     }
     $defaults = array();
     if ($this->_action & CRM_Core_Action::DELETE) {
         return $defaults;
     }
     if ($this->_participantId) {
         $ids = array();
         $params = array('id' => $this->_participantId);
         require_once "CRM/Event/BAO/Participant.php";
         CRM_Event_BAO_Participant::getValues($params, $defaults, $ids);
         $this->_contactID = $defaults[$this->_participantId]['contact_id'];
         $this->_statusId = $defaults[$this->_participantId]['participant_status_id'];
         //set defaults for note
         $noteDetails = CRM_Core_BAO_Note::getNote($this->_participantId, 'civicrm_participant');
         $defaults[$this->_participantId]['note'] = array_pop($noteDetails);
     }
     if ($this->_action & (CRM_Core_Action::VIEW | CRM_Core_Action::BROWSE)) {
         $inactiveNeeded = true;
         $viewMode = true;
     } else {
         $viewMode = false;
         $inactiveNeeded = false;
     }
     //setting default register date
     if ($this->_action == CRM_Core_Action::ADD) {
         if (CRM_Utils_Array::value('event_id', $defaults[$this->_participantId])) {
             $contributionTypeId = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', $defaults[$this->_participantId]['event_id'], 'contribution_type_id');
             if ($contributionTypeId) {
                 $defaults[$this->_participantId]['contribution_type_id'] = $contributionTypeId;
             }
         }
         if ($this->_mode) {
             $fields["email-{$this->_bltID}"] = 1;
             $fields["email-Primary"] = 1;
             require_once "CRM/Core/BAO/UFGroup.php";
             if ($this->_contactID) {
                 require_once "CRM/Core/BAO/UFGroup.php";
                 CRM_Core_BAO_UFGroup::setProfileDefaults($this->_contactID, $fields, $defaults);
             }
             if (empty($defaults["email-{$this->_bltID}"]) && !empty($defaults["email-Primary"])) {
                 $defaults[$this->_participantId]["email-{$this->_bltID}"] = $defaults["email-Primary"];
             }
         }
         $submittedRole = $this->getElementValue('role_id');
         if ($submittedRole[0]) {
             $roleID = $submittedRole[0];
         }
         $submittedEvent = $this->getElementValue('event_id');
         if ($submittedEvent[0]) {
             $eventID = $submittedEvent[0];
         }
     } else {
         $defaults[$this->_participantId]['record_contribution'] = 0;
         $recordContribution = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_ParticipantPayment', $defaults[$this->_participantId]['id'], 'contribution_id', 'participant_id');
         //contribution record exists for this participation
         if ($recordContribution) {
             foreach (array('contribution_type_id', 'payment_instrument_id', 'contribution_status_id', 'receive_date') as $field) {
                 $defaults[$this->_participantId][$field] = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_Contribution', $recordContribution, $field);
             }
         }
         if ($defaults[$this->_participantId]['participant_is_pay_later']) {
             $this->assign('participant_is_pay_later', true);
         }
         $this->assign('participant_status_id', $defaults[$this->_participantId]['participant_status_id']);
         $roleID = $defaults[$this->_participantId]['participant_role_id'];
         $eventID = $defaults[$this->_participantId]['event_id'];
         $this->_discountId = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Participant', $this->_participantId, 'discount_id');
         if ($this->_discountId) {
             $this->set('discountId', $this->_discountId);
         }
     }
     list($defaults[$this->_participantId]['register_date'], $defaults[$this->_participantId]['register_date_time']) = CRM_Utils_Date::setDateDefaults(CRM_Utils_Array::value('register_date', $defaults[$this->_participantId]));
     //assign event and role id, this is needed for Custom data building
     if (isset($_POST['role_id'])) {
         $roleID = $_POST['role_id'];
     }
     if (isset($roleID)) {
         $this->assign('roleID', $roleID);
     }
     if (isset($_POST['event_id'])) {
         $eventID = $_POST['event_id'];
     }
     if (isset($eventID)) {
         $this->assign('eventID', $eventID);
         $this->set('eventId', $eventID);
     }
//.........这里部分代码省略.........
开发者ID:ksecor,项目名称:civicrm,代码行数:101,代码来源:Participant.php

示例8: setDefaultValues

 /**
  * This function sets the default values for the form.
  * 
  * @access public
  * @return None
  */
 function setDefaultValues()
 {
     if (empty($this->_fields)) {
         return;
     }
     $defaults = array();
     foreach ($this->_participantIds as $participantId) {
         $details[$participantId] = array();
         require_once 'CRM/Event/BAO/Participant.php';
         $details[$participantId] = CRM_Event_BAO_Participant::participantDetails($participantId);
         CRM_Core_BAO_UFGroup::setProfileDefaults(null, $this->_fields, $defaults, false, $participantId, 'Event');
         //get the from status ids, CRM-4323
         if (array_key_exists('participant_status_id', $this->_fields)) {
             $this->_fromStatusIds[$participantId] = CRM_Utils_Array::value("field[{$participantId}][participant_status_id]", $defaults);
         }
     }
     $this->assign('details', $details);
     return $defaults;
 }
开发者ID:bhirsch,项目名称:voipdev,代码行数:25,代码来源:Batch.php

示例9: setDefaultValues

 /**
  * This function sets the default values for the form. MobileProvider that in edit/view mode
  * the default values are retrieved from the database
  *
  * @access public
  *
  * @return None
  */
 public function setDefaultValues()
 {
     if ($this->_cdType) {
         return CRM_Custom_Form_CustomData::setDefaultValues($this);
     }
     if ($this->_priceSetId) {
         return CRM_Price_BAO_Set::setDefaultPriceSet($this, $defaults);
     }
     $defaults = parent::setDefaultValues();
     //setting default join date and receive date
     list($now) = CRM_Utils_Date::setDateDefaults();
     if ($this->_action == CRM_Core_Action::ADD) {
         $defaults['receive_date'] = $now;
     }
     if (is_numeric($this->_memType)) {
         $defaults["membership_type_id"] = array();
         $defaults["membership_type_id"][0] = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipType', $this->_memType, 'member_of_contact_id', 'id');
         $defaults["membership_type_id"][1] = $this->_memType;
     } else {
         $defaults["membership_type_id"] = $this->_memType;
     }
     if (CRM_Utils_Array::value('id', $defaults)) {
         if ($this->_onlinePendingContributionId) {
             $defaults['record_contribution'] = $this->_onlinePendingContributionId;
         } else {
             $contributionId = CRM_Core_DAO::singleValueQuery("\n  SELECT contribution_id\n  FROM civicrm_membership_payment\n  WHERE membership_id = {$this->_id}\n  ORDER BY contribution_id\n  DESC limit 1");
             if ($contributionId) {
                 $defaults['record_contribution'] = $contributionId;
             }
         }
     }
     if (CRM_Utils_Array::value('record_contribution', $defaults) && !$this->_mode) {
         $contributionParams = array('id' => $defaults['record_contribution']);
         $contributionIds = array();
         //keep main object campaign in hand.
         $memberCampaignId = CRM_Utils_Array::value('campaign_id', $defaults);
         CRM_Contribute_BAO_Contribution::getValues($contributionParams, $defaults, $contributionIds);
         //get back original object campaign id.
         $defaults['campaign_id'] = $memberCampaignId;
         if (CRM_Utils_Array::value('receive_date', $defaults)) {
             list($defaults['receive_date']) = CRM_Utils_Date::setDateDefaults($defaults['receive_date']);
         }
         // Contribution::getValues() over-writes the membership record's source field value - so we need to restore it.
         if (CRM_Utils_Array::value('membership_source', $defaults)) {
             $defaults['source'] = $defaults['membership_source'];
         }
     }
     // User must explicitly choose to send a receipt in both add and update mode.
     $defaults['send_receipt'] = 0;
     if ($this->_action & CRM_Core_Action::UPDATE) {
         // in this mode by default uncheck this checkbox
         unset($defaults['record_contribution']);
     }
     if (CRM_Utils_Array::value('id', $defaults)) {
         $subscriptionCancelled = CRM_Member_BAO_Membership::isSubscriptionCancelled($this->_id);
     }
     $alreadyAutoRenew = FALSE;
     if (CRM_Utils_Array::value('contribution_recur_id', $defaults) && !$subscriptionCancelled) {
         $defaults['auto_renew'] = 1;
         $alreadyAutoRenew = TRUE;
     }
     $this->assign('alreadyAutoRenew', $alreadyAutoRenew);
     $this->assign("member_is_test", CRM_Utils_Array::value('member_is_test', $defaults));
     $this->assign('membership_status_id', CRM_Utils_Array::value('status_id', $defaults));
     if (CRM_Utils_Array::value('is_pay_later', $defaults)) {
         $this->assign('is_pay_later', TRUE);
     }
     if ($this->_mode) {
         $fields = array();
         foreach ($this->_fields as $name => $dontCare) {
             $fields[$name] = 1;
         }
         $names = array("first_name", "middle_name", "last_name", "street_address-{$this->_bltID}", "city-{$this->_bltID}", "postal_code-{$this->_bltID}", "country_id-{$this->_bltID}", "state_province_id-{$this->_bltID}");
         foreach ($names as $name) {
             $fields[$name] = 1;
         }
         $fields["state_province-{$this->_bltID}"] = 1;
         $fields["country-{$this->_bltID}"] = 1;
         $fields["email-{$this->_bltID}"] = 1;
         $fields["email-Primary"] = 1;
         if ($this->_contactID) {
             CRM_Core_BAO_UFGroup::setProfileDefaults($this->_contactID, $fields, $this->_defaults);
         }
         // use primary email address if billing email address is empty
         if (empty($this->_defaults["email-{$this->_bltID}"]) && !empty($this->_defaults["email-Primary"])) {
             $defaults["email-{$this->_bltID}"] = $this->_defaults["email-Primary"];
         }
         foreach ($names as $name) {
             if (!empty($this->_defaults[$name])) {
                 $defaults["billing_" . $name] = $this->_defaults[$name];
             }
         }
//.........这里部分代码省略.........
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:101,代码来源:Membership.php

示例10: setDefaultValues

 /**
  * This function sets the default values for the form.
  * the default values are retrieved from the database
  * 
  * @access public
  * @return None
  */
 public function setDefaultValues()
 {
     $defaults = array();
     $defaults =& parent::setDefaultValues();
     $this->_memType = $defaults["membership_type_id"];
     $defaults['renewal_date'] = CRM_Utils_Date::getToday($defaults['renewal_date'], 'm/d/Y');
     if ($defaults['id']) {
         $defaults['record_contribution'] = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipPayment', $defaults['id'], 'contribution_id', 'membership_id');
     }
     $defaults['contribution_type_id'] = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipType', $this->_memType, 'contribution_type_id');
     $defaults['total_amount'] = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipType', $this->_memType, 'minimum_fee');
     $defaults['record_contribution'] = 0;
     if ($defaults['record_contribution']) {
         $contributionParams = array('id' => $defaults['record_contribution']);
         $contributionIds = array();
         require_once "CRM/Contribute/BAO/Contribution.php";
         CRM_Contribute_BAO_Contribution::getValues($contributionParams, $defaults, $contributionIds);
     }
     $defaults['send_receipt'] = 0;
     if ($defaults['membership_type_id']) {
         $defaults['receipt_text_renewal'] = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipType', $defaults['membership_type_id'], 'receipt_text_renewal');
     }
     $this->assign("member_is_test", CRM_Utils_Array::value('member_is_test', $defaults));
     if ($this->_mode) {
         $fields = array();
         foreach ($this->_fields as $name => $dontCare) {
             $fields[$name] = 1;
         }
         $names = array("first_name", "middle_name", "last_name", "street_address-{$this->_bltID}", "city-{$this->_bltID}", "postal_code-{$this->_bltID}", "country_id-{$this->_bltID}", "state_province_id-{$this->_bltID}");
         foreach ($names as $name) {
             $fields[$name] = 1;
         }
         $fields["state_province-{$this->_bltID}"] = 1;
         $fields["country-{$this->_bltID}"] = 1;
         $fields["email-{$this->_bltID}"] = 1;
         $fields["email-Primary"] = 1;
         require_once "CRM/Core/BAO/UFGroup.php";
         CRM_Core_BAO_UFGroup::setProfileDefaults($this->_contactID, $fields, $this->_defaults);
         // use primary email address if billing email address is empty
         if (empty($this->_defaults["email-{$this->_bltID}"]) && !empty($this->_defaults["email-Primary"])) {
             $defaults["email-{$this->_bltID}"] = $this->_defaults["email-Primary"];
         }
         foreach ($names as $name) {
             if (!empty($this->_defaults[$name])) {
                 $defaults["billing_" . $name] = $this->_defaults[$name];
             }
         }
     }
     return $defaults;
 }
开发者ID:bhirsch,项目名称:voipdev,代码行数:57,代码来源:MembershipRenewal.php

示例11: formatFieldsAndSetProfileDefaults

 /**
  * CRM-17797 -- Format fields and setDefaults for primary and additional participants profile
  * @param int $contactId
  * @param CRM_Core_Form $form
  */
 public static function formatFieldsAndSetProfileDefaults($contactId, &$form)
 {
     if (!$contactId) {
         return;
     }
     $fields = array();
     if (!empty($form->_fields)) {
         $removeCustomFieldTypes = array('Participant');
         foreach ($form->_fields as $name => $dontCare) {
             if (substr($name, 0, 7) == 'custom_' && !$form->_allowConfirmation && !CRM_Core_BAO_CustomGroup::checkCustomField(substr($name, 7), $removeCustomFieldTypes) || substr($name, 0, 12) == 'participant_') {
                 continue;
             }
             $fields[$name] = 1;
         }
         if (!empty($fields)) {
             CRM_Core_BAO_UFGroup::setProfileDefaults($contactId, $fields, $form->_defaults);
         }
     }
 }
开发者ID:kcristiano,项目名称:civicrm-core,代码行数:24,代码来源:Participant.php

示例12: setDefaultValues

 /**
  * Set default values for the form.
  *
  *
  * @return void
  */
 public function setDefaultValues()
 {
     if (empty($this->_fields)) {
         return;
     }
     $defaults = array();
     foreach ($this->_memberIds as $memberId) {
         $details[$memberId] = array();
         CRM_Core_BAO_UFGroup::setProfileDefaults(NULL, $this->_fields, $defaults, FALSE, $memberId, 'Membership');
     }
     return $defaults;
 }
开发者ID:rajeshrhino,项目名称:civicrm-core,代码行数:18,代码来源:Batch.php

示例13: setDefaultValues

 /**
  * This function sets the default values for the form.
  *
  * @access public
  *
  * @return None
  */
 function setDefaultValues()
 {
     if (empty($this->_fields)) {
         return;
     }
     $defaults = array();
     foreach ($this->_participantIds as $participantId) {
         $details[$participantId] = array();
         $details[$participantId] = CRM_Event_BAO_Participant::participantDetails($participantId);
         CRM_Core_BAO_UFGroup::setProfileDefaults(NULL, $this->_fields, $defaults, FALSE, $participantId, 'Event');
         //get the from status ids, CRM-4323
         if (array_key_exists('participant_status', $this->_fields)) {
             $this->_fromStatusIds[$participantId] = CRM_Utils_Array::value("field[{$participantId}][participant_status]", $defaults);
         }
         if (array_key_exists('participant_role', $this->_fields)) {
             if ($defaults["field[{$participantId}][participant_role]"]) {
                 $roles = $defaults["field[{$participantId}][participant_role]"];
                 foreach (explode(CRM_Core_DAO::VALUE_SEPARATOR, $roles) as $k => $v) {
                     $defaults["field[{$participantId}][participant_role][{$v}]"] = 1;
                 }
                 unset($defaults["field[{$participantId}][participant_role]"]);
             }
         }
     }
     $this->assign('details', $details);
     return $defaults;
 }
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:34,代码来源:Batch.php

示例14: setDefaultValues

 /**
  * @return array
  */
 public function setDefaultValues()
 {
     $this->_defaults = array();
     if ($this->_subscriptionDetails->contact_id) {
         $fields = array();
         $names = array('first_name', 'middle_name', 'last_name', "street_address-{$this->_bltID}", "city-{$this->_bltID}", "postal_code-{$this->_bltID}", "country_id-{$this->_bltID}", "state_province_id-{$this->_bltID}");
         foreach ($names as $name) {
             $fields[$name] = 1;
         }
         $fields["state_province-{$this->_bltID}"] = 1;
         $fields["country-{$this->_bltID}"] = 1;
         $fields["email-{$this->_bltID}"] = 1;
         $fields['email-Primary'] = 1;
         CRM_Core_BAO_UFGroup::setProfileDefaults($this->_subscriptionDetails->contact_id, $fields, $this->_defaults);
         // use primary email address if billing email address is empty
         if (empty($this->_defaults["email-{$this->_bltID}"]) && !empty($this->_defaults['email-Primary'])) {
             $this->_defaults["email-{$this->_bltID}"] = $this->_defaults['email-Primary'];
         }
         foreach ($names as $name) {
             if (!empty($this->_defaults[$name])) {
                 $this->_defaults['billing_' . $name] = $this->_defaults[$name];
             }
         }
     }
     $config = CRM_Core_Config::singleton();
     // set default country from config if no country set
     if (empty($this->_defaults["billing_country_id-{$this->_bltID}"])) {
         $this->_defaults["billing_country_id-{$this->_bltID}"] = $config->defaultContactCountry;
     }
     return $this->_defaults;
 }
开发者ID:indydas,项目名称:civi-demo,代码行数:34,代码来源:UpdateBilling.php

示例15: setDefaultValues

 /**
  * Set default values for the form.
  *
  * @access public
  */
 function setDefaultValues()
 {
     $defaults = array();
     if (key_exists('userID', $_SESSION['CiviCRM'])) {
         foreach ($this->getProfileIDs() as $profileID) {
             $fields = array_flip(array_keys(CRM_Core_BAO_UFGroup::getFields($profileID)));
             CRM_Core_BAO_UFGroup::setProfileDefaults($_SESSION['CiviCRM']['userID'], $fields, $defaults);
         }
     }
     return $defaults;
 }
开发者ID:JohnFF,项目名称:org.civicrm.volunteer,代码行数:16,代码来源:VolunteerSignUp.php


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