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


PHP CRM_Core_PseudoConstant::honor方法代码示例

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


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

示例1: preProcess

 /**
  * Function to set variables up before form is built
  *
  * @return void
  * @access public
  */
 public function preProcess()
 {
     $values = $ids = array();
     $params = array('id' => $this->get('id'));
     CRM_Pledge_BAO_Pledge::getValues($params, $values, $ids);
     $values['frequencyUnit'] = ts('%1(s)', array(1 => $values['frequency_unit']));
     if (isset($values["honor_contact_id"]) && $values["honor_contact_id"]) {
         $sql = "SELECT display_name FROM civicrm_contact WHERE id = " . $values["honor_contact_id"];
         $dao = new CRM_Core_DAO();
         $dao->query($sql);
         if ($dao->fetch()) {
             $url = CRM_Utils_System::url('civicrm/contact/view', "reset=1&cid={$values['honor_contact_id']}");
             $values["honor_display"] = "<A href = {$url}>" . $dao->display_name . "</A>";
         }
         $honor = CRM_Core_PseudoConstant::honor();
         $values['honor_type'] = $honor[$values['honor_type_id']];
     }
     //handle custom data.
     $groupTree = CRM_Core_BAO_CustomGroup::getTree('Pledge', $this, $params['id']);
     CRM_Core_BAO_CustomGroup::buildCustomDataView($this, $groupTree);
     if (CRM_Utils_Array::value('contribution_page_id', $values)) {
         $values['contribution_page'] = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_ContributionPage', $values['contribution_page_id'], 'title');
     }
     $values['contribution_type'] = CRM_Utils_Array::value($values['contribution_type_id'], CRM_Contribute_PseudoConstant::contributionType());
     if ($values['status_id']) {
         $values['pledge_status'] = CRM_Utils_Array::value($values['status_id'], CRM_Contribute_PseudoConstant::contributionStatus());
     }
     $url = CRM_Utils_System::url('civicrm/contact/view/pledge', "action=view&reset=1&id={$values['id']}&cid={$values['contact_id']}&context=home");
     $recentOther = array();
     if (CRM_Core_Permission::checkActionPermission('CiviPledge', CRM_Core_Action::UPDATE)) {
         $recentOther['editUrl'] = CRM_Utils_System::url('civicrm/contact/view/pledge', "action=update&reset=1&id={$values['id']}&cid={$values['contact_id']}&context=home");
     }
     if (CRM_Core_Permission::checkActionPermission('CiviPledge', CRM_Core_Action::DELETE)) {
         $recentOther['deleteUrl'] = CRM_Utils_System::url('civicrm/contact/view/pledge', "action=delete&reset=1&id={$values['id']}&cid={$values['contact_id']}&context=home");
     }
     $displayName = CRM_Contact_BAO_Contact::displayName($values['contact_id']);
     $this->assign('displayName', $displayName);
     $title = $displayName . ' - (' . ts('Pledged') . ' ' . CRM_Utils_Money::format($values['pledge_amount']) . ' - ' . $values['contribution_type'] . ')';
     // add Pledge to Recent Items
     CRM_Utils_Recent::add($title, $url, $values['id'], 'Pledge', $values['contact_id'], NULL, $recentOther);
     //do check for campaigns
     if ($campaignId = CRM_Utils_Array::value('campaign_id', $values)) {
         $campaigns = CRM_Campaign_BAO_Campaign::getCampaigns($campaignId);
         $values['campaign'] = $campaigns[$campaignId];
     }
     $this->assign($values);
 }
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:53,代码来源:PledgeView.php

示例2: preProcess

 /**  
  * Function to set variables up before form is built  
  *                                                            
  * @return void  
  * @access public  
  */
 public function preProcess()
 {
     require_once 'CRM/Pledge/BAO/Pledge.php';
     $values = $ids = array();
     $params = array('id' => $this->get('id'));
     CRM_Pledge_BAO_Pledge::getValues($params, $values, $ids);
     $values['frequencyUnit'] = ts('%1(s)', array(1 => $values['frequency_unit']));
     $values['eachPaymentAmount'] = floor($values['amount'] / $values['installments']);
     if (isset($values["honor_contact_id"]) && $values["honor_contact_id"]) {
         $sql = "SELECT display_name FROM civicrm_contact WHERE id = " . $values["honor_contact_id"];
         $dao =& new CRM_Core_DAO();
         $dao->query($sql);
         if ($dao->fetch()) {
             $url = CRM_Utils_System::url('civicrm/contact/view', "reset=1&cid={$values['honor_contact_id']}");
             $values["honor_display"] = "<A href = {$url}>" . $dao->display_name . "</A>";
         }
         $honor = CRM_Core_PseudoConstant::honor();
         $values['honor_type'] = $honor[$values['honor_type_id']];
     }
     //handle custom data.
     $groupTree =& CRM_Core_BAO_CustomGroup::getTree('Pledge', $this, $params['id']);
     CRM_Core_BAO_CustomGroup::buildCustomDataView($this, $groupTree);
     if (CRM_Utils_Array::value('contribution_page_id', $values)) {
         $values['contribution_page'] = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_ContributionPage', $values['contribution_page_id'], 'title');
     }
     $values['contribution_type'] = CRM_Utils_Array::value($values['contribution_type_id'], CRM_Contribute_PseudoConstant::contributionType());
     if ($values['status_id']) {
         $values['pledge_status'] = CRM_Utils_Array::value($values['status_id'], CRM_Contribute_PseudoConstant::contributionStatus());
     }
     require_once 'CRM/Utils/Recent.php';
     require_once 'CRM/Contact/BAO/Contact.php';
     $url = CRM_Utils_System::url('civicrm/contact/view/pledge', "action=view&reset=1&id={$values['id']}&cid={$values['contact_id']}&context=home");
     require_once 'CRM/Utils/Money.php';
     $displayName = CRM_Contact_BAO_Contact::displayName($values['contact_id']);
     $this->assign('displayName', $displayName);
     $title = $displayName . ' - (' . ts('Pledged') . ' ' . CRM_Utils_Money::format($values['pledge_amount']) . ' - ' . $values['contribution_type'] . ')';
     // add Pledge to Recent Items
     CRM_Utils_Recent::add($title, $url, $values['id'], 'Pledge', $values['contact_id'], null);
     $this->assign($values);
 }
开发者ID:bhirsch,项目名称:voipdev,代码行数:46,代码来源:PledgeView.php

示例3: buildQuickForm


//.........这里部分代码省略.........
        }
        $allowAutoRenew = FALSE;
        if ($this->_mode && !empty($recurProcessor)) {
            $allowAutoRenew = TRUE;
        }
        $this->assign('allowAutoRenew', $allowAutoRenew);
        $this->assign('autoRenewOptions', json_encode($autoRenew));
        $this->assign('recurProcessor', json_encode($recurProcessor));
        $sel =& $this->addElement('hierselect', 'membership_type_id', ts('Membership Organization and Type'), $memTypeJs);
        $sel->setOptions(array($selMemTypeOrg, $selOrgMemType));
        $elements = array();
        if ($sel) {
            $elements[] = $sel;
        }
        $this->applyFilter('__ALL__', 'trim');
        $this->addDate('join_date', ts('Member Since'), FALSE, array('formatType' => 'activityDate'));
        $this->addDate('start_date', ts('Start Date'), FALSE, array('formatType' => 'activityDate'));
        $endDate = $this->addDate('end_date', ts('End Date'), FALSE, array('formatType' => 'activityDate'));
        if ($endDate) {
            $elements[] = $endDate;
        }
        $this->add('text', 'source', ts('Source'), CRM_Core_DAO::getAttribute('CRM_Member_DAO_Membership', 'source'));
        //CRM-7362 --add campaigns.
        $campaignId = NULL;
        if ($this->_id) {
            $campaignId = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_Membership', $this->_id, 'campaign_id');
        }
        CRM_Campaign_BAO_Campaign::addCampaign($this, $campaignId);
        if (!$this->_mode) {
            $this->add('select', 'status_id', ts('Membership Status'), array('' => ts('- select -')) + CRM_Member_PseudoConstant::membershipStatus(NULL, NULL, 'label'));
            $statusOverride = $this->addElement('checkbox', 'is_override', ts('Status Override?'), NULL, array('onClick' => 'showHideMemberStatus()'));
            if ($statusOverride) {
                $elements[] = $statusOverride;
            }
            $this->addElement('checkbox', 'record_contribution', ts('Record Membership Payment?'));
            $this->add('select', 'contribution_type_id', ts('Contribution Type'), array('' => ts('- select -')) + CRM_Contribute_PseudoConstant::contributionType());
            $this->add('text', 'total_amount', ts('Amount'));
            $this->addRule('total_amount', ts('Please enter a valid amount.'), 'money');
            $this->addDate('receive_date', ts('Received'), FALSE, array('formatType' => 'activityDate'));
            $this->add('select', 'payment_instrument_id', ts('Paid By'), array('' => ts('- select -')) + CRM_Contribute_PseudoConstant::paymentInstrument(), FALSE, array('onChange' => "return showHideByValue('payment_instrument_id','4','checkNumber','table-row','select',false);"));
            $this->add('text', 'trxn_id', ts('Transaction ID'));
            $this->addRule('trxn_id', ts('Transaction ID already exists in Database.'), 'objectExists', array('CRM_Contribute_DAO_Contribution', $this->_id, 'trxn_id'));
            $allowStatuses = array();
            $statuses = CRM_Contribute_PseudoConstant::contributionStatus();
            if ($this->_onlinePendingContributionId) {
                $statusNames = CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'name');
                foreach ($statusNames as $val => $name) {
                    if (in_array($name, array('In Progress', 'Overdue'))) {
                        continue;
                    }
                    $allowStatuses[$val] = $statuses[$val];
                }
            } else {
                $allowStatuses = $statuses;
            }
            $this->add('select', 'contribution_status_id', ts('Payment Status'), $allowStatuses);
            $this->add('text', 'check_number', ts('Check Number'), CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_Contribution', 'check_number'));
        } else {
            //add field for amount to allow an amount to be entered that differs from minimum
            $this->add('text', 'total_amount', ts('Amount'));
        }
        if ($this->_context != 'standalone') {
            //CRM-10223 - allow contribution to be recorded against different contact
            // causes a conflict in standalone mode so skip in standalone for now
            $this->addElement('checkbox', 'is_different_contribution_contact', ts('Record Payment from a Different Contact?'));
            $this->add('select', 'honor_type_id', ts('Membership payment is : '), array('' => ts('-')) + CRM_Core_PseudoConstant::honor());
            CRM_Contact_Form_NewContact::buildQuickForm($this, 1, null, false, 'contribution_');
        }
        $this->addElement('checkbox', 'send_receipt', ts('Send Confirmation and Receipt?'), NULL, array('onclick' => "showHideByValue( 'send_receipt', '', 'notice', 'table-row', 'radio', false); showHideByValue( 'send_receipt', '', 'fromEmail', 'table-row', 'radio', false);"));
        $this->add('select', 'from_email_address', ts('Receipt From'), $this->_fromEmails);
        $this->add('textarea', 'receipt_text_signup', ts('Receipt Message'));
        if ($this->_mode) {
            $this->add('select', 'payment_processor_id', ts('Payment Processor'), $this->_processors, TRUE, array('onChange' => "buildAutoRenew( null, this.value );"));
            CRM_Core_Payment_Form::buildCreditCard($this, TRUE);
        }
        // Retrieve the name and email of the contact - this will be the TO for receipt email
        if ($this->_contactID) {
            list($this->_memberDisplayName, $this->_memberEmail) = CRM_Contact_BAO_Contact_Location::getEmailDetails($this->_contactID);
            $this->assign('emailExists', $this->_memberEmail);
            $this->assign('displayName', $this->_memberDisplayName);
        }
        $isRecur = FALSE;
        if ($this->_action & CRM_Core_Action::UPDATE) {
            $recurContributionId = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_Membership', $this->_id, 'contribution_recur_id');
            if ($recurContributionId && !CRM_Member_BAO_Membership::isSubscriptionCancelled($this->_id)) {
                $isRecur = TRUE;
                if (CRM_Member_BAO_Membership::isCancelSubscriptionSupported($this->_id)) {
                    $this->assign('cancelAutoRenew', CRM_Utils_System::url('civicrm/contribute/unsubscribe', "reset=1&mid={$this->_id}"));
                }
                foreach ($elements as $elem) {
                    $elem->freeze();
                }
            }
        }
        $this->assign('isRecur', $isRecur);
        $this->addFormRule(array('CRM_Member_Form_Membership', 'formRule'), $this);
        $mailingInfo = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::MAILING_PREFERENCES_NAME, 'mailing_backend');
        $this->assign('outBound_option', $mailingInfo['outBound_option']);
        parent::buildQuickForm();
    }
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:101,代码来源:Membership.php

示例4: setDefaultValues

 /**
  * This function sets the default values for the form. 
  * the default values are retrieved from the database
  * 
  * @access public
  * @return None
  */
 function setDefaultValues()
 {
     $defaults = $this->_values;
     $fields = array();
     if ($this->_action & CRM_Core_Action::DELETE) {
         return $defaults;
     }
     if (CRM_Utils_Array::value('is_test', $defaults)) {
         $this->assign("is_test", true);
     }
     if ($this->_id) {
         $startDate = CRM_Utils_Array::value('start_date', $this->_values);
         $createDate = CRM_Utils_Array::value('create_date', $this->_values);
         list($defaults['start_date']) = CRM_Utils_Date::setDateDefaults($startDate);
         list($defaults['create_date']) = CRM_Utils_Date::setDateDefaults($createDate);
         if ($this->_values['acknowledge_date']) {
             list($defaults['acknowledge_date']) = CRM_Utils_Date::setDateDefaults(CRM_Utils_Array::value('acknowledge_date', $this->_values));
         }
         //check is this pledge pending
         // fix the display of the monetary value, CRM-4038
         require_once 'CRM/Utils/Money.php';
         if ($this->_isPending) {
             $defaults['eachPaymentAmount'] = $this->_values['amount'] / $this->_values['installments'];
             $defaults['eachPaymentAmount'] = CRM_Utils_Money::format($defaults['eachPaymentAmount'], null, '%a');
         } else {
             $this->assign('start_date', $startDate);
             $this->assign('create_date', $createDate);
         }
         // fix the display of the monetary value, CRM-4038
         if (isset($this->_values['amount'])) {
             $defaults['amount'] = CRM_Utils_Money::format($this->_values['amount'], null, '%a');
         }
     } else {
         //default values.
         list($now) = CRM_Utils_Date::setDateDefaults();
         $defaults['create_date'] = $now;
         $defaults['start_date'] = $now;
         $defaults['installments'] = 12;
         $defaults['frequency_interval'] = 1;
         $defaults['frequency_day'] = 1;
         $defaults['initial_reminder_day'] = 5;
         $defaults['max_reminders'] = 1;
         $defaults['additional_reminder_day'] = 5;
         $defaults['frequency_unit'] = array_search('monthly', $this->_freqUnits);
         $defaults['contribution_type_id'] = array_search('Donation', CRM_Contribute_PseudoConstant::contributionType());
     }
     //assign status.
     $this->assign('status', CRM_Utils_Array::value(CRM_Utils_Array::value('status_id', $this->_values), CRM_Contribute_PseudoConstant::contributionStatus(), 'Pending'));
     //honoree contact.
     if ($this->_honorID) {
         require_once 'CRM/Contact/BAO/Contact.php';
         $honorDefault = array();
         $idParams = array('contact_id' => $this->_honorID);
         CRM_Contact_BAO_Contact::retrieve($idParams, $honorDefault, $ids);
         $honorType = CRM_Core_PseudoConstant::honor();
         $defaults["honor_prefix_id"] = $honorDefault["prefix_id"];
         $defaults["honor_first_name"] = CRM_Utils_Array::value("first_name", $honorDefault);
         $defaults["honor_last_name"] = CRM_Utils_Array::value("last_name", $honorDefault);
         $defaults["honor_email"] = CRM_Utils_Array::value("email", $honorDefault["location"][1]["email"][1]);
         $defaults["honor_type"] = $honorType[$defaults["honor_type_id"]];
     }
     $this->assign('email', $this->userEmail);
     // custom data set defaults
     $defaults += CRM_Custom_Form_Customdata::setDefaultValues($this);
     return $defaults;
 }
开发者ID:ksecor,项目名称:civicrm,代码行数:73,代码来源:Pledge.php

示例5: sendMail

 function sendMail(&$input, &$ids, &$objects, &$values, $recur = false, $returnMessageText = false)
 {
     $contribution =& $objects['contribution'];
     $membership =& $objects['membership'];
     $participant =& $objects['participant'];
     $event =& $objects['event'];
     if (empty($values)) {
         $values = array();
         if ($input['component'] == 'contribute') {
             require_once 'CRM/Contribute/BAO/ContributionPage.php';
             if (isset($contribution->contribution_page_id)) {
                 CRM_Contribute_BAO_ContributionPage::setValues($contribution->contribution_page_id, $values);
             } else {
                 // Handle re-print receipt for offline contributions (call from PDF.php - no contribution_page_id)
                 $values['is_email_receipt'] = 1;
                 $values['title'] = 'Contribution';
             }
         } else {
             // event
             $eventParams = array('id' => $objects['event']->id);
             $values['event'] = array();
             require_once 'CRM/Event/BAO/Event.php';
             CRM_Event_BAO_Event::retrieve($eventParams, $values['event']);
             $eventParams = array('id' => $objects['event']->id);
             $values['event'] = array();
             require_once 'CRM/Event/BAO/Event.php';
             CRM_Event_BAO_Event::retrieve($eventParams, $values['event']);
             //get location details
             $locationParams = array('entity_id' => $objects['event']->id, 'entity_table' => 'civicrm_event');
             require_once 'CRM/Core/BAO/Location.php';
             require_once 'CRM/Event/Form/ManageEvent/Location.php';
             $values['location'] = CRM_Core_BAO_Location::getValues($locationParams);
             require_once 'CRM/Core/BAO/UFJoin.php';
             $ufJoinParams = array('entity_table' => 'civicrm_event', 'entity_id' => $ids['event'], 'weight' => 1);
             $values['custom_pre_id'] = CRM_Core_BAO_UFJoin::findUFGroupId($ufJoinParams);
             $ufJoinParams['weight'] = 2;
             $values['custom_post_id'] = CRM_Core_BAO_UFJoin::findUFGroupId($ufJoinParams);
         }
     }
     $template =& CRM_Core_Smarty::singleton();
     // CRM_Core_Error::debug('tpl',$template);
     //assign honor infomation to receiptmessage
     if ($honarID = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_Contribution', $contribution->id, 'honor_contact_id')) {
         $honorDefault = array();
         $honorIds = array();
         $honorIds['contribution'] = $contribution->id;
         $idParams = array('id' => $honarID, 'contact_id' => $honarID);
         require_once "CRM/Contact/BAO/Contact.php";
         CRM_Contact_BAO_Contact::retrieve($idParams, $honorDefault, $honorIds);
         require_once "CRM/Core/PseudoConstant.php";
         $honorType = CRM_Core_PseudoConstant::honor();
         $prefix = CRM_Core_PseudoConstant::individualPrefix();
         $template->assign('honor_block_is_active', 1);
         $template->assign('honor_prefix', $prefix[$honorDefault["prefix_id"]]);
         $template->assign('honor_first_name', CRM_Utils_Array::value("first_name", $honorDefault));
         $template->assign('honor_last_name', CRM_Utils_Array::value("last_name", $honorDefault));
         $template->assign('honor_email', CRM_Utils_Array::value("email", $honorDefault["email"][1]));
         $template->assign('honor_type', $honorType[$contribution->honor_type_id]);
     }
     require_once 'CRM/Contribute/DAO/ContributionProduct.php';
     $dao =& new CRM_Contribute_DAO_ContributionProduct();
     $dao->contribution_id = $contribution->id;
     if ($dao->find(true)) {
         $premiumId = $dao->product_id;
         $template->assign('option', $dao->product_option);
         require_once 'CRM/Contribute/DAO/Product.php';
         $productDAO =& new CRM_Contribute_DAO_Product();
         $productDAO->id = $premiumId;
         $productDAO->find(true);
         $template->assign('selectPremium', true);
         $template->assign('product_name', $productDAO->name);
         $template->assign('price', $productDAO->price);
         $template->assign('sku', $productDAO->sku);
     }
     // add the new contribution values
     if ($input['component'] == 'contribute') {
         $template->assign('title', $values['title']);
         $template->assign('amount', $input['amount']);
         //PCP Info
         require_once 'CRM/Contribute/DAO/ContributionSoft.php';
         $softDAO =& new CRM_Contribute_DAO_ContributionSoft();
         $softDAO->contribution_id = $contribution->id;
         if ($softDAO->find(true)) {
             $template->assign('pcpBlock', true);
             $template->assign('pcp_display_in_roll', $softDAO->pcp_display_in_roll);
             $template->assign('pcp_roll_nickname', $softDAO->pcp_roll_nickname);
             $template->assign('pcp_personal_note', $softDAO->pcp_personal_note);
             //assign the pcp page title for email subject
             require_once 'CRM/Contribute/DAO/PCP.php';
             $pcpDAO =& new CRM_Contribute_DAO_PCP();
             $pcpDAO->id = $softDAO->pcp_id;
             if ($pcpDAO->find(true)) {
                 $template->assign('title', $pcpDAO->title);
             }
         }
     } else {
         $template->assign('title', $values['event']['title']);
         $template->assign('totalAmount', $input['amount']);
     }
     $template->assign('trxn_id', $contribution->trxn_id);
//.........这里部分代码省略.........
开发者ID:bhirsch,项目名称:voipdev,代码行数:101,代码来源:BaseIPN.php

示例6: createHonorContact

 /**
  * Create the Honor contact
  *
  * @return void
  * @access public
  */
 function createHonorContact()
 {
     $params = $this->controller->exportValues('Main');
     // return if we dont have enough information
     if (empty($params["honor_first_name"]) && empty($params["honor_last_name"]) && empty($params["honor_email"])) {
         return null;
     }
     //assign to template for email reciept
     $honor_block_is_active = $this->get('honor_block_is_active');
     $this->assign('honor_block_is_active', $honor_block_is_active);
     $this->assign("honor_block_title", $this->_values['honor_block_title']);
     require_once "CRM/Core/PseudoConstant.php";
     $prefix = CRM_Core_PseudoConstant::individualPrefix();
     $honorType = CRM_Core_PseudoConstant::honor();
     $this->assign("honor_type", $honorType[$params["honor_type_id"]]);
     $this->assign("honor_prefix", $prefix[$params["honor_prefix_id"]]);
     $this->assign("honor_first_name", $params["honor_first_name"]);
     $this->assign("honor_last_name", $params["honor_last_name"]);
     $this->assign("honor_email", $params["honor_email"]);
     //create honoree contact
     require_once 'CRM/Contribute/BAO/Contribution.php';
     return CRM_Contribute_BAO_Contribution::createHonorContact($params);
 }
开发者ID:bhirsch,项目名称:civicrm,代码行数:29,代码来源:Confirm.php

示例7: setDefaultValues

 /**
  * This function sets the default values for the form.
  * the default values are retrieved from the database
  *
  * @access public
  *
  * @return None
  */
 function setDefaultValues()
 {
     $defaults = $this->_values;
     $fields = array();
     if ($this->_action & CRM_Core_Action::DELETE) {
         return $defaults;
     }
     if (CRM_Utils_Array::value('is_test', $defaults)) {
         $this->assign('is_test', TRUE);
     }
     if ($this->_id) {
         $startDate = CRM_Utils_Array::value('start_date', $this->_values);
         $createDate = CRM_Utils_Array::value('create_date', $this->_values);
         list($defaults['start_date']) = CRM_Utils_Date::setDateDefaults($startDate);
         list($defaults['create_date']) = CRM_Utils_Date::setDateDefaults($createDate);
         if ($ackDate = CRM_Utils_Array::value('acknowledge_date', $this->_values)) {
             list($defaults['acknowledge_date']) = CRM_Utils_Date::setDateDefaults($ackDate);
         }
         //check is this pledge pending
         // fix the display of the monetary value, CRM-4038
         if ($this->_isPending) {
             $defaults['eachPaymentAmount'] = $this->_values['amount'] / $this->_values['installments'];
             $defaults['eachPaymentAmount'] = CRM_Utils_Money::format($defaults['eachPaymentAmount'], NULL, '%a');
         } else {
             $this->assign('start_date', $startDate);
             $this->assign('create_date', $createDate);
         }
         // fix the display of the monetary value, CRM-4038
         if (isset($this->_values['amount'])) {
             $defaults['amount'] = CRM_Utils_Money::format($this->_values['amount'], NULL, '%a');
         }
         $this->assign('amount', $this->_values['amount']);
         $this->assign('installments', $defaults['installments']);
     } else {
         //default values.
         list($now) = CRM_Utils_Date::setDateDefaults();
         $defaults['create_date'] = $now;
         $defaults['start_date'] = $now;
         $defaults['installments'] = 12;
         $defaults['frequency_interval'] = 1;
         $defaults['frequency_day'] = 1;
         $defaults['initial_reminder_day'] = 5;
         $defaults['max_reminders'] = 1;
         $defaults['additional_reminder_day'] = 5;
         $defaults['frequency_unit'] = array_search('month', $this->_freqUnits);
         $defaults['contribution_type_id'] = array_search('Donation', CRM_Contribute_PseudoConstant::contributionType());
     }
     $pledgeStatus = CRM_Contribute_PseudoConstant::contributionStatus();
     $pledgeStatusNames = CRM_Core_OptionGroup::values('contribution_status', FALSE, FALSE, FALSE, NULL, 'name', TRUE);
     // get default status label (pending)
     $defaultPledgeStatus = CRM_Utils_Array::value(array_search('Pending', $pledgeStatusNames), $pledgeStatus);
     //assign status.
     $this->assign('status', CRM_Utils_Array::value(CRM_Utils_Array::value('status_id', $this->_values), $pledgeStatus, $defaultPledgeStatus));
     //honoree contact.
     if ($this->_honorID) {
         $honorDefault = array();
         $idParams = array('contact_id' => $this->_honorID);
         CRM_Contact_BAO_Contact::retrieve($idParams, $honorDefault);
         $honorType = CRM_Core_PseudoConstant::honor();
         $defaults['honor_prefix_id'] = $honorDefault['prefix_id'];
         $defaults['honor_first_name'] = CRM_Utils_Array::value('first_name', $honorDefault);
         $defaults['honor_last_name'] = CRM_Utils_Array::value('last_name', $honorDefault);
         $defaults['honor_email'] = CRM_Utils_Array::value('email', $honorDefault['email'][1]);
         $defaults['honor_type'] = $honorType[$defaults['honor_type_id']];
     }
     if (isset($this->userEmail)) {
         $this->assign('email', $this->userEmail);
     }
     // custom data set defaults
     $defaults += CRM_Custom_Form_CustomData::setDefaultValues($this);
     return $defaults;
 }
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:80,代码来源:Pledge.php

示例8: buildQuickForm


//.........这里部分代码省略.........
            $this->assign('orgName', $selMemTypeOrg[$allMemberships[$this->_memType]['member_of_contact_id']]);
            $this->assign('memType', $allMemberships[$this->_memType]['name']);
        }
        // force select of organization by default, if only one organization in
        // the list
        if (count($selMemTypeOrg) == 2) {
            unset($selMemTypeOrg[0], $selOrgMemType[0][0]);
        }
        //sort membership organization and type, CRM-6099
        natcasesort($selMemTypeOrg);
        foreach ($selOrgMemType as $index => $orgMembershipType) {
            natcasesort($orgMembershipType);
            $selOrgMemType[$index] = $orgMembershipType;
        }
        $js = array('onChange' => "setPaymentBlock( ); buildCustomData( 'Membership', this.value );");
        //build the form for auto renew.
        $recurProcessor = array();
        if ($this->_mode || $this->_action & CRM_Core_Action::UPDATE) {
            //get the valid recurring processors.
            $recurring = CRM_Core_PseudoConstant::paymentProcessor(FALSE, FALSE, 'is_recur = 1');
            $recurProcessor = array_intersect_assoc($this->_processors, $recurring);
            if (!empty($recurProcessor)) {
                $autoRenew = array();
                if (!empty($membershipType)) {
                    $sql = '
SELECT  id,
        auto_renew,
        duration_unit,
        duration_interval
 FROM   civicrm_membership_type
WHERE   id IN ( ' . implode(' , ', array_keys($membershipType)) . ' )';
                    $recurMembershipTypes = CRM_Core_DAO::executeQuery($sql);
                    while ($recurMembershipTypes->fetch()) {
                        $autoRenew[$recurMembershipTypes->id] = $recurMembershipTypes->auto_renew;
                        foreach (array('id', 'auto_renew', 'duration_unit', 'duration_interval') as $fld) {
                            $this->_recurMembershipTypes[$recurMembershipTypes->id][$fld] = $recurMembershipTypes->{$fld};
                        }
                    }
                }
                $js = array('onChange' => "setPaymentBlock(); buildCustomData( 'Membership', this.value );");
                $this->assign('autoRenew', json_encode($autoRenew));
            }
            $autoRenewElement = $this->addElement('checkbox', 'auto_renew', ts('Membership renewed automatically'), NULL, array('onclick' => "showHideByValue('auto_renew','','send-receipt','table-row','radio',true); showHideNotice( );"));
            if ($this->_action & CRM_Core_Action::UPDATE) {
                $autoRenewElement->freeze();
            }
        }
        $this->assign('recurProcessor', json_encode($recurProcessor));
        $sel =& $this->addElement('hierselect', 'membership_type_id', ts('Renewal Membership Organization and Type'), $js);
        $sel->setOptions(array($selMemTypeOrg, $selOrgMemType));
        $elements = array();
        if ($sel) {
            $elements[] = $sel;
        }
        $this->applyFilter('__ALL__', 'trim');
        $this->addDate('renewal_date', ts('Date Renewal Entered'), FALSE, array('formatType' => 'activityDate'));
        if (CRM_Core_Permission::access('CiviContribute') && !$this->_mode) {
            $this->addElement('checkbox', 'record_contribution', ts('Record Renewal Payment?'), NULL, array('onclick' => "checkPayment();"));
            $this->add('select', 'contribution_type_id', ts('Contribution Type'), array('' => ts('- select -')) + CRM_Contribute_PseudoConstant::contributionType());
            $this->add('text', 'total_amount', ts('Amount'));
            $this->addRule('total_amount', ts('Please enter a valid amount.'), 'money');
            $this->addDate('receive_date', ts('Received'), FALSE, array('formatType' => 'activityDate'));
            $this->add('text', 'num_terms', ts('Extend Membership by'), array('onchange' => "setPaymentBlock();"), TRUE);
            $this->addRule('num_terms', ts('Please enter a whole number for how many periods to renew.'), 'integer');
            $this->add('select', 'payment_instrument_id', ts('Paid By'), array('' => ts('- select -')) + CRM_Contribute_PseudoConstant::paymentInstrument(), FALSE, array('onChange' => "return showHideByValue('payment_instrument_id','4','checkNumber','table-row','select',false);"));
            $this->add('text', 'trxn_id', ts('Transaction ID'));
            $this->addRule('trxn_id', ts('Transaction ID already exists in Database.'), 'objectExists', array('CRM_Contribute_DAO_Contribution', $this->_id, 'trxn_id'));
            $this->add('select', 'contribution_status_id', ts('Payment Status'), CRM_Contribute_PseudoConstant::contributionStatus());
            $this->add('text', 'check_number', ts('Check Number'), CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_Contribution', 'check_number'));
        } else {
            $this->add('text', 'total_amount', ts('Amount'));
            $this->addRule('total_amount', ts('Please enter a valid amount.'), 'money');
        }
        $this->addElement('checkbox', 'send_receipt', ts('Send Confirmation and Receipt?'), NULL, array('onclick' => "showHideByValue( 'send_receipt', '', 'notice', 'table-row', 'radio', false ); showHideByValue( 'send_receipt', '', 'fromEmail', 'table-row', 'radio',false);"));
        $this->add('select', 'from_email_address', ts('Receipt From'), $this->_fromEmails);
        $this->add('textarea', 'receipt_text_renewal', ts('Renewal Message'));
        if ($this->_mode) {
            $this->add('select', 'payment_processor_id', ts('Payment Processor'), $this->_processors, TRUE);
            CRM_Core_Payment_Form::buildCreditCard($this, TRUE);
        }
        // Retrieve the name and email of the contact - this will be the TO for receipt email
        list($this->_contributorDisplayName, $this->_contributorEmail) = CRM_Contact_BAO_Contact_Location::getEmailDetails($this->_contactID);
        $this->assign('email', $this->_contributorEmail);
        $mailingInfo = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::MAILING_PREFERENCES_NAME, 'mailing_backend');
        $this->assign('outBound_option', $mailingInfo['outBound_option']);
        if (CRM_Core_DAO::getFieldValue('CRM_Member_DAO_Membership', $this->_id, 'contribution_recur_id')) {
            if (CRM_Member_BAO_Membership::isCancelSubscriptionSupported($this->_id)) {
                $this->assign('cancelAutoRenew', CRM_Utils_System::url('civicrm/contribute/unsubscribe', "reset=1&mid={$this->_id}"));
            }
        }
        $this->addFormRule(array('CRM_Member_Form_MembershipRenewal', 'formRule'));
        if ($this->_context != 'standalone') {
            //CRM-10223 - allow contribution to be recorded against different contact
            // causes a conflict in standalone mode so skip in standalone for now
            $this->addElement('checkbox', 'contribution_contact', ts('Record Payment from a Different Contact?'));
            $this->add('select', 'honor_type_id', ts('Membership payment is : '), array('' => ts('-')) + CRM_Core_PseudoConstant::honor());
            require_once 'CRM/Contact/Form/NewContact.php';
            CRM_Contact_Form_NewContact::buildQuickForm($this, 1, null, false, 'contribution_');
        }
    }
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:101,代码来源:MembershipRenewal.php

示例9: emailReceipt

 /** 
  * Function to send email receipt.
  * 
  * @form object  of Contribution form.
  * @param array  $params (reference ) an assoc array of name/value pairs.
  * @$ccContribution boolen,  is it credit card contribution.
  * @access public. 
  * @return None.
  */
 function emailReceipt(&$form, &$params, $ccContribution = false)
 {
     $this->assign('receiptType', 'contribution');
     // Retrieve Contribution Type Name from contribution_type_id
     $params['contributionType_name'] = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_ContributionType', $params['contribution_type_id']);
     if (CRM_Utils_Array::value('payment_instrument_id', $params)) {
         require_once 'CRM/Contribute/PseudoConstant.php';
         $paymentInstrument = CRM_Contribute_PseudoConstant::paymentInstrument();
         $params['paidBy'] = $paymentInstrument[$params['payment_instrument_id']];
     }
     // retrieve individual prefix value for honoree
     if (CRM_Utils_Array::value('hidden_Honoree', $params)) {
         $individualPrefix = CRM_Core_PseudoConstant::individualPrefix();
         $honor = CRM_Core_PseudoConstant::honor();
         $params['honor_prefix'] = CRM_Utils_Array::value($params['honor_prefix_id'], $individualPrefix);
         $params["honor_type"] = CRM_Utils_Array::value($params["honor_type_id"], $honor);
     }
     // retrieve premium product name and assigned fulfilled
     // date to template
     if (CRM_Utils_Array::value('hidden_Premium', $params)) {
         if (CRM_Utils_Array::value($params['product_name'][0], $form->_options)) {
             $params['product_option'] = $form->_options[$params['product_name'][0]][$params['product_name'][1]];
         }
         //fix for crm-4584
         if (!empty($params['product_name'])) {
             require_once 'CRM/Contribute/DAO/Product.php';
             $productDAO = new CRM_Contribute_DAO_Product();
             $productDAO->id = $params['product_name'][0];
             $productDAO->find(true);
             $params['product_name'] = $productDAO->name;
             $params['product_sku'] = $productDAO->sku;
         }
         $this->assign('fulfilled_date', CRM_Utils_Date::processDate($params['fulfilled_date']));
     }
     $this->assign('ccContribution', $ccContribution);
     if ($ccContribution) {
         //build the name.
         $name = CRM_Utils_Array::value('billing_first_name', $params);
         if (CRM_Utils_Array::value('billing_middle_name', $params)) {
             $name .= " {$params['billing_middle_name']}";
         }
         $name .= ' ' . CRM_Utils_Array::value('billing_last_name', $params);
         $name = trim($name);
         $this->assign('billingName', $name);
         //assign the address formatted up for display
         $addressParts = array("street_address" => "billing_street_address-{$form->_bltID}", "city" => "billing_city-{$form->_bltID}", "postal_code" => "billing_postal_code-{$form->_bltID}", "state_province" => "state_province-{$form->_bltID}", "country" => "country-{$form->_bltID}");
         $addressFields = array();
         foreach ($addressParts as $name => $field) {
             $addressFields[$name] = CRM_Utils_Array::value($field, $params);
         }
         require_once 'CRM/Utils/Address.php';
         $this->assign('address', CRM_Utils_Address::format($addressFields));
         $date = CRM_Utils_Date::format($params['credit_card_exp_date']);
         $date = CRM_Utils_Date::mysqlToIso($date);
         $this->assign('credit_card_type', CRM_Utils_Array::value('credit_card_type', $params));
         $this->assign('credit_card_exp_date', $date);
         $this->assign('credit_card_number', CRM_Utils_System::mungeCreditCard($params['credit_card_number']));
     } else {
         //offline contribution
         //Retrieve the name and email from receipt is to be send
         $params['receipt_from_name'] = $form->userDisplayName;
         $params['receipt_from_email'] = $form->userEmail;
         // assigned various dates to the templates
         $form->assign('receipt_date', CRM_Utils_Date::processDate($params['receipt_date']));
         $form->assign('cancel_date', CRM_Utils_Date::processDate($params['cancel_date']));
         if (CRM_Utils_Array::value('thankyou_date', $params)) {
             $form->assign('thankyou_date', CRM_Utils_Date::processDate($params['thankyou_date']));
         }
         if ($form->_action & CRM_Core_Action::UPDATE) {
             $form->assign('lineItem', empty($form->_lineItems) ? false : $form->_lineItems);
         }
     }
     //handle custom data
     if (CRM_Utils_Array::value('hidden_custom', $params)) {
         $contribParams = array(array('contribution_id', '=', $params['contribution_id'], 0, 0));
         if ($form->_mode == 'test') {
             $contribParams[] = array('contribution_test', '=', 1, 0, 0);
         }
         //retrieve custom data
         require_once "CRM/Core/BAO/UFGroup.php";
         $customGroup = array();
         foreach ($form->_groupTree as $groupID => $group) {
             $customFields = $customValues = array();
             if ($groupID == 'info') {
                 continue;
             }
             foreach ($group['fields'] as $k => $field) {
                 $field['title'] = $field['label'];
                 $customFields["custom_{$k}"] = $field;
             }
             //build the array of customgroup contain customfields.
//.........这里部分代码省略.........
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:101,代码来源:AdditionalInfo.php

示例10: buildHonorBlock

 /**
  * Function to add the honor block
  *
  * @return None
  * @access public
  */
 function buildHonorBlock()
 {
     $this->assign('honor_block_is_active', TRUE);
     $this->set('honor_block_is_active', TRUE);
     $this->assign('honor_block_title', CRM_Utils_Array::value('honor_block_title', $this->_values));
     $this->assign('honor_block_text', CRM_Utils_Array::value('honor_block_text', $this->_values));
     $attributes = CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Contact');
     $extraOption = array('onclick' => "enableHonorType();");
     // radio button for Honor Type
     $honorOptions = array();
     $honor = CRM_Core_PseudoConstant::honor();
     foreach ($honor as $key => $var) {
         $honorTypes[$key] = $this->createElement('radio', NULL, NULL, $var, $key, $extraOption);
     }
     $this->addGroup($honorTypes, 'honor_type_id', NULL);
     // prefix
     $this->addElement('select', 'honor_prefix_id', ts('Prefix'), array('' => ts('- prefix -')) + CRM_Core_PseudoConstant::individualPrefix());
     // first_name
     $this->addElement('text', 'honor_first_name', ts('First Name'), $attributes['first_name']);
     //last_name
     $this->addElement('text', 'honor_last_name', ts('Last Name'), $attributes['last_name']);
     //email
     $this->addElement('text', 'honor_email', ts('Email Address'));
     $this->addRule('honor_email', ts('Honoree Email is not valid.'), 'email');
 }
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:31,代码来源:Main.php

示例11: createHonorContact

 /**
  * Create the Honor contact
  *
  * @return void
  * @access public
  */
 function createHonorContact()
 {
     $params = $this->controller->exportValues('Main');
     // email is enough to create a contact
     if (!CRM_Utils_Array::value('honor_email', $params) && (!CRM_Utils_Array::value('honor_first_name', $params) || !CRM_Utils_Array::value('honor_last_name', $params))) {
         //don't create contact - possibly the form was left blank
         return null;
     }
     //assign to template for email receipt
     $honor_block_is_active = $this->get('honor_block_is_active');
     $this->assign('honor_block_is_active', $honor_block_is_active);
     $this->assign('honor_block_title', CRM_Utils_Array::value('honor_block_title', $this->_values));
     $prefix = CRM_Core_PseudoConstant::individualPrefix();
     $honorType = CRM_Core_PseudoConstant::honor();
     $this->assign('honor_type', CRM_Utils_Array::value(CRM_Utils_Array::value('honor_type_id', $params), $honorType));
     $this->assign('honor_prefix', CRM_Utils_Array::value(CRM_Utils_Array::value('honor_prefix_id', $params), $prefix));
     $this->assign('honor_first_name', CRM_Utils_Array::value('honor_first_name', $params));
     $this->assign('honor_last_name', CRM_Utils_Array::value('honor_last_name', $params));
     $this->assign('honor_email', CRM_Utils_Array::value('honor_email', $params));
     //create honoree contact
     return CRM_Contribute_BAO_Contribution::createHonorContact($params);
 }
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:28,代码来源:Confirm.php

示例12: setDefaultValues

 function setDefaultValues()
 {
     if ($this->_cdType) {
         return CRM_Custom_Form_CustomData::setDefaultValues($this);
     }
     $defaults = $this->_values;
     //set defaults for pledge payment.
     if ($this->_ppID) {
         $defaults['total_amount'] = CRM_Utils_Array::value('scheduled_amount', $this->_pledgeValues['pledgePayment']);
         $defaults['honor_type_id'] = CRM_Utils_Array::value('honor_type_id', $this->_pledgeValues);
         $defaults['honor_contact_id'] = CRM_Utils_Array::value('honor_contact_id', $this->_pledgeValues);
         $defaults['contribution_type_id'] = CRM_Utils_Array::value('contribution_type_id', $this->_pledgeValues);
     }
     $fields = array();
     if ($this->_action & CRM_Core_Action::DELETE) {
         return $defaults;
     }
     if ($this->_mode) {
         $billingFields = array();
         foreach ($this->_fields as $name => $dontCare) {
             if (strpos($name, 'billing_') === 0) {
                 $name = $idName = substr($name, 8);
                 if (in_array($name, array("state_province_id-{$this->_bltID}", "country_id-{$this->_bltID}"))) {
                     $name = str_replace('_id', '', $name);
                 }
                 $billingFields[$name] = "billing_" . $idName;
             }
             $fields[$name] = 1;
         }
         require_once "CRM/Core/BAO/UFGroup.php";
         if ($this->_contactID) {
             CRM_Core_BAO_UFGroup::setProfileDefaults($this->_contactID, $fields, $defaults);
         }
         foreach ($billingFields as $name => $billingName) {
             $defaults[$billingName] = $defaults[$name];
         }
     }
     if ($this->_id) {
         $this->_contactID = $defaults['contact_id'];
     } else {
         list($defaults['receive_date']) = CRM_Utils_Date::setDateDefaults();
     }
     require_once 'CRM/Utils/Money.php';
     // fix the display of the monetary value, CRM-4038
     if (isset($defaults['total_amount'])) {
         $defaults['total_amount'] = CRM_Utils_Money::format($defaults['total_amount'], null, '%a');
     }
     if (isset($defaults['non_deductible_amount'])) {
         $defaults['non_deductible_amount'] = CRM_Utils_Money::format($defaults['non_deductible_amount'], null, '%a');
     }
     if (isset($defaults['fee_amount'])) {
         $defaults['fee_amount'] = CRM_Utils_Money::format($defaults['fee_amount'], null, '%a');
     }
     if (isset($defaults['net_amount'])) {
         $defaults['net_amount'] = CRM_Utils_Money::format($defaults['net_amount'], null, '%a');
     }
     if ($this->_contributionType) {
         $defaults['contribution_type_id'] = $this->_contributionType;
     }
     if (CRM_Utils_Array::value('is_test', $defaults)) {
         $this->assign("is_test", true);
     }
     if (isset($defaults["honor_contact_id"])) {
         $honorDefault = array();
         $ids = array();
         $this->_honorID = $defaults["honor_contact_id"];
         $honorType = CRM_Core_PseudoConstant::honor();
         $idParams = array('id' => $defaults["honor_contact_id"], 'contact_id' => $defaults["honor_contact_id"]);
         CRM_Contact_BAO_Contact::retrieve($idParams, $honorDefault, $ids);
         $defaults["honor_prefix_id"] = $honorDefault["prefix_id"];
         $defaults["honor_first_name"] = CRM_Utils_Array::value("first_name", $honorDefault);
         $defaults["honor_last_name"] = CRM_Utils_Array::value("last_name", $honorDefault);
         $defaults["honor_email"] = CRM_Utils_Array::value("email", $honorDefault["location"][1]["email"][1]);
         $defaults["honor_type"] = $honorType[$defaults["honor_type_id"]];
     }
     $this->assign('showOption', true);
     // for Premium section
     if ($this->_premiumID) {
         $this->assign('showOption', false);
         $options = isset($this->_options[$this->_productDAO->product_id]) ? $this->_options[$this->_productDAO->product_id] : "";
         if (!$options) {
             $this->assign('showOption', true);
         }
         $options_key = CRM_Utils_Array::key($this->_productDAO->product_option, $options);
         if ($options_key) {
             $defaults['product_name'] = array($this->_productDAO->product_id, trim($options_key));
         } else {
             $defaults['product_name'] = array($this->_productDAO->product_id);
         }
         list($defaults['fulfilled_date']) = CRM_Utils_Date::setDateDefaults($this->_productDAO->fulfilled_date);
     }
     if (isset($this->userEmail)) {
         $this->assign('email', $this->userEmail);
     }
     if (CRM_Utils_Array::value('is_pay_later', $defaults)) {
         $this->assign('is_pay_later', true);
     }
     $this->assign('contribution_status_id', CRM_Utils_Array::value('contribution_status_id', $defaults));
     $dates = array('receive_date', 'receipt_date', 'cancel_date', 'thankyou_date');
     foreach ($dates as $key) {
//.........这里部分代码省略.........
开发者ID:ksecor,项目名称:civicrm,代码行数:101,代码来源:Contribution.php

示例13: setDefaultValues

 function setDefaultValues()
 {
     if ($this->_cdType) {
         return CRM_Custom_Form_CustomData::setDefaultValues($this);
     }
     $defaults = $this->_values;
     //set defaults for pledge payment.
     if ($this->_ppID) {
         $defaults['total_amount'] = CRM_Utils_Array::value('scheduled_amount', $this->_pledgeValues['pledgePayment']);
         $defaults['honor_type_id'] = CRM_Utils_Array::value('honor_type_id', $this->_pledgeValues);
         $defaults['honor_contact_id'] = CRM_Utils_Array::value('honor_contact_id', $this->_pledgeValues);
         $defaults['contribution_type_id'] = CRM_Utils_Array::value('contribution_type_id', $this->_pledgeValues);
         $defaults['currency'] = CRM_Utils_Array::value('currency', $this->_pledgeValues);
         $defaults['option_type'] = 1;
     }
     $fields = array();
     if ($this->_action & CRM_Core_Action::DELETE) {
         return $defaults;
     }
     if ($this->_mode) {
         $billingFields = array();
         foreach ($this->_fields as $name => $dontCare) {
             if (strpos($name, 'billing_') === 0) {
                 $name = $idName = substr($name, 8);
                 if (in_array($name, array("state_province_id-{$this->_bltID}", "country_id-{$this->_bltID}"))) {
                     $name = str_replace('_id', '', $name);
                 }
                 $billingFields[$name] = 'billing_' . $idName;
             }
             $fields[$name] = 1;
         }
         if ($this->_contactID) {
             CRM_Core_BAO_UFGroup::setProfileDefaults($this->_contactID, $fields, $defaults);
         }
         foreach ($billingFields as $name => $billingName) {
             $defaults[$billingName] = CRM_Utils_Array::value($name, $defaults);
         }
         $config = CRM_Core_Config::singleton();
         // set default country from config if no country set
         if (!CRM_Utils_Array::value("billing_country_id-{$this->_bltID}", $defaults)) {
             $defaults["billing_country_id-{$this->_bltID}"] = $config->defaultContactCountry;
         }
         // now fix all state country selectors
         CRM_Core_BAO_Address::fixAllStateSelects($this, $defaults);
         //             // hack to simplify credit card entry for testing
         //             $defaults['credit_card_type']     = 'Visa';
         //             $defaults['total_amount']         = 50;
         //             $defaults['credit_card_number']   = '4807731747657838';
         //             $defaults['cvv2']                 = '000';
         //             $defaults['credit_card_exp_date'] = array( 'Y' => '2012', 'M' => '05' );
     }
     if ($this->_id) {
         $this->_contactID = $defaults['contact_id'];
     }
     // fix the display of the monetary value, CRM-4038
     if (isset($defaults['total_amount'])) {
         $defaults['total_amount'] = CRM_Utils_Money::format($defaults['total_amount'], NULL, '%a');
     }
     if (isset($defaults['non_deductible_amount'])) {
         $defaults['non_deductible_amount'] = CRM_Utils_Money::format($defaults['non_deductible_amount'], NULL, '%a');
     }
     if (isset($defaults['fee_amount'])) {
         $defaults['fee_amount'] = CRM_Utils_Money::format($defaults['fee_amount'], NULL, '%a');
     }
     if (isset($defaults['net_amount'])) {
         $defaults['net_amount'] = CRM_Utils_Money::format($defaults['net_amount'], NULL, '%a');
     }
     if ($this->_contributionType) {
         $defaults['contribution_type_id'] = $this->_contributionType;
     }
     if (CRM_Utils_Array::value('is_test', $defaults)) {
         $this->assign('is_test', TRUE);
     }
     if (isset($defaults['honor_contact_id'])) {
         $honorDefault = $ids = array();
         $this->_honorID = $defaults['honor_contact_id'];
         $honorType = CRM_Core_PseudoConstant::honor();
         $idParams = array('id' => $defaults['honor_contact_id'], 'contact_id' => $defaults['honor_contact_id']);
         CRM_Contact_BAO_Contact::retrieve($idParams, $honorDefault, $ids);
         $defaults['honor_prefix_id'] = CRM_Utils_Array::value('prefix_id', $honorDefault);
         $defaults['honor_first_name'] = CRM_Utils_Array::value('first_name', $honorDefault);
         $defaults['honor_last_name'] = CRM_Utils_Array::value('last_name', $honorDefault);
         $defaults['honor_email'] = CRM_Utils_Array::value('email', $honorDefault['email'][1]);
         $defaults['honor_type'] = $honorType[$defaults['honor_type_id']];
     }
     $this->assign('showOption', TRUE);
     // for Premium section
     if ($this->_premiumID) {
         $this->assign('showOption', FALSE);
         $options = isset($this->_options[$this->_productDAO->product_id]) ? $this->_options[$this->_productDAO->product_id] : "";
         if (!$options) {
             $this->assign('showOption', TRUE);
         }
         $options_key = CRM_Utils_Array::key($this->_productDAO->product_option, $options);
         if ($options_key) {
             $defaults['product_name'] = array($this->_productDAO->product_id, trim($options_key));
         } else {
             $defaults['product_name'] = array($this->_productDAO->product_id);
         }
         if ($this->_productDAO->fulfilled_date) {
//.........这里部分代码省略.........
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:101,代码来源:Contribution.php

示例14: sendAcknowledgment

 /** 
  * Function to send Acknowledgment and create activity.
  * 
  * @param object $form form object.
  * @param array  $params (reference ) an assoc array of name/value pairs.
  * @access public 
  * @return None.
  */
 function sendAcknowledgment(&$form, $params)
 {
     //handle Acknowledgment.
     $allPayments = $payments = array();
     //get All Payments status types.
     require_once 'CRM/Contribute/PseudoConstant.php';
     $paymentStatusTypes = CRM_Contribute_PseudoConstant::contributionStatus(null, 'name');
     $returnProperties = array('status_id', 'scheduled_amount', 'scheduled_date', 'contribution_id');
     //get all paymnets details.
     CRM_Core_DAO::commonRetrieveAll('CRM_Pledge_DAO_Payment', 'pledge_id', $params['id'], $allPayments, $returnProperties);
     if (!empty($allPayments)) {
         foreach ($allPayments as $payID => $values) {
             $contributionValue = $contributionStatus = array();
             if (isset($values['contribution_id'])) {
                 $contributionParams = array('id' => $values['contribution_id']);
                 $returnProperties = array('contribution_status_id', 'receive_date');
                 CRM_Core_DAO::commonRetrieve('CRM_Contribute_DAO_Contribution', $contributionParams, $contributionStatus, $returnProperties);
                 $contributionValue = array('status' => CRM_Utils_Array::value('contribution_status_id', $contributionStatus), 'receive_date' => CRM_Utils_Array::value('receive_date', $contributionStatus));
             }
             $payments[$payID] = array_merge($contributionValue, array('amount' => CRM_Utils_Array::value('scheduled_amount', $values), 'due_date' => CRM_Utils_Array::value('scheduled_date', $values)));
             //get the first valid payment id.
             if (!$form->paymentId && ($paymentStatusTypes[$values['status_id']] == 'Pending' || $paymentStatusTypes[$values['status_id']] == 'Overdue')) {
                 $form->paymentId = $values['id'];
             }
         }
     }
     //end
     //assign pledge fields value to template.
     $pledgeFields = array('create_date', 'total_pledge_amount', 'frequency_interval', 'frequency_unit', 'installments', 'frequency_day', 'scheduled_amount');
     foreach ($pledgeFields as $field) {
         if (CRM_Utils_Array::value($field, $params)) {
             $form->assign($field, $params[$field]);
         }
     }
     //assign all payments details.
     if ($payments) {
         $form->assign('payments', $payments);
     }
     //assign honor fields.
     $honor_block_is_active = false;
     //make sure we have values for it
     if (CRM_Utils_Array::value('honor_type_id', $params) && (!empty($params["honor_first_name"]) && !empty($params["honor_last_name"]) || !empty($params["honor_email"]))) {
         $honor_block_is_active = true;
         require_once "CRM/Core/PseudoConstant.php";
         $prefix = CRM_Core_PseudoConstant::individualPrefix();
         $honor = CRM_Core_PseudoConstant::honor();
         $form->assign("honor_type", $honor[$params["honor_type_id"]]);
         $form->assign("honor_prefix", $prefix[$params["honor_prefix_id"]]);
         $form->assign("honor_first_name", $params["honor_first_name"]);
         $form->assign("honor_last_name", $params["honor_last_name"]);
         $form->assign("honor_email", $params["honor_email"]);
     }
     $form->assign('honor_block_is_active', $honor_block_is_active);
     //handle domain token values
     require_once 'CRM/Core/BAO/Domain.php';
     $domain =& CRM_Core_BAO_Domain::getDomain();
     $tokens = array('domain' => array('name', 'phone', 'address', 'email'), 'contact' => CRM_Core_SelectValues::contactTokens());
     require_once 'CRM/Utils/Token.php';
     $domainValues = array();
     foreach ($tokens['domain'] as $token) {
         $domainValues[$token] = CRM_Utils_Token::getDomainTokenReplacement($token, $domain);
     }
     $form->assign('domain', $domainValues);
     //handle contact token values.
     require_once 'CRM/Contact/BAO/Contact.php';
     require_once 'CRM/Mailing/BAO/Mailing.php';
     $ids = array($params['contact_id']);
     $fields = array_merge(array_keys(CRM_Contact_BAO_Contact::importableFields()), array('display_name', 'checksum', 'contact_id'));
     foreach ($fields as $key => $val) {
         $returnProperties[$val] = true;
     }
     $details = CRM_Mailing_BAO_Mailing::getDetails($ids, $returnProperties);
     $form->assign('contact', $details[0][$params['contact_id']]);
     //handle custom data.
     if (CRM_Utils_Array::value('hidden_custom', $params)) {
         require_once 'CRM/Core/BAO/CustomGroup.php';
         $groupTree =& CRM_Core_BAO_CustomGroup::getTree('Pledge', CRM_Core_DAO::$_nullObject, $params['id']);
         $pledgeParams = array(array('pledge_id', '=', $params['id'], 0, 0));
         $customGroup = array();
         // retrieve custom data
         require_once "CRM/Core/BAO/UFGroup.php";
         foreach ($groupTree as $groupID => $group) {
             $customFields = $customValues = array();
             if ($groupID == 'info') {
                 continue;
             }
             foreach ($group['fields'] as $k => $field) {
                 $field['title'] = $field['label'];
                 $customFields["custom_{$k}"] = $field;
             }
             //to build array of customgroup & customfields in it
             CRM_Core_BAO_UFGroup::getValues($params['contact_id'], $customFields, $customValues, false, $pledgeParams);
//.........这里部分代码省略.........
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:101,代码来源:Pledge.php

示例15: buildQuickForm

 /**
  * Function to actually build the form
  *
  * @return void
  * @access public
  */
 public function buildQuickForm()
 {
     $this->assignToTemplate();
     $productID = $this->get('productID');
     $option = $this->get('option');
     $membershipTypeID = $this->get('membershipTypeID');
     $this->assign('receiptFromEmail', CRM_Utils_Array::value('receipt_from_email', $this->_values));
     if ($productID) {
         require_once 'CRM/Contribute/BAO/Premium.php';
         CRM_Contribute_BAO_Premium::buildPremiumBlock($this, $this->_id, false, $productID, $option);
     }
     $this->assign('lineItem', $this->_lineItem);
     $this->assign('priceSetID', $this->_priceSetId);
     $params = $this->_params;
     $honor_block_is_active = $this->get('honor_block_is_active');
     if ($honor_block_is_active && (!empty($params["honor_first_name"]) && !empty($params["honor_last_name"]) || !empty($params["honor_email"]))) {
         $this->assign('honor_block_is_active', $honor_block_is_active);
         $this->assign('honor_block_title', CRM_Utils_Array::value('honor_block_title', $this->_values));
         require_once "CRM/Core/PseudoConstant.php";
         $prefix = CRM_Core_PseudoConstant::individualPrefix();
         $honor = CRM_Core_PseudoConstant::honor();
         $this->assign('honor_type', $honor[$params["honor_type_id"]]);
         $this->assign('honor_prefix', $params["honor_prefix_id"] ? $prefix[$params["honor_prefix_id"]] : ' ');
         $this->assign('honor_first_name', $params["honor_first_name"]);
         $this->assign('honor_last_name', $params["honor_last_name"]);
         $this->assign('honor_email', $params["honor_email"]);
     }
     //pcp elements
     if ($this->_pcpId) {
         $this->assign('pcpBlock', true);
         foreach (array('pcp_display_in_roll', 'pcp_is_anonymous', 'pcp_roll_nickname', 'pcp_personal_note') as $val) {
             if (CRM_Utils_Array::value($val, $this->_params)) {
                 $this->assign($val, $this->_params[$val]);
             }
         }
     }
     if ($membershipTypeID) {
         $transactionID = $this->get('membership_trx_id');
         $membershipAmount = $this->get('membership_amount');
         $renewalMode = $this->get('renewal_mode');
         $this->assign('membership_trx_id', $transactionID);
         $this->assign('membership_amount', $membershipAmount);
         $this->assign('renewal_mode', $renewalMode);
         CRM_Member_BAO_Membership::buildMembershipBlock($this, $this->_id, false, $membershipTypeID, true, null, $this->_membershipContactID);
     }
     $this->_separateMembershipPayment = $this->get('separateMembershipPayment');
     $this->assign("is_separate_payment", $this->_separateMembershipPayment);
     $this->buildCustom($this->_values['custom_pre_id'], 'customPre', true);
     $this->buildCustom($this->_values['custom_post_id'], 'customPost', true);
     $this->assign('trxn_id', CRM_Utils_Array::value('trxn_id', $this->_params));
     $this->assign('receive_date', CRM_Utils_Date::mysqlToIso(CRM_Utils_Array::value('receive_date', $this->_params)));
     $defaults = array();
     $options = array();
     $fields = array();
     require_once "CRM/Core/BAO/CustomGroup.php";
     $removeCustomFieldTypes = array('Contribution');
     foreach ($this->_fields as $name => $dontCare) {
         $fields[$name] = 1;
     }
     $fields['state_province'] = $fields['country'] = $fields['email'] = 1;
     $contact = $this->_params = $this->controller->exportValues('Main');
     foreach ($fields as $name => $dontCare) {
         if (isset($contact[$name])) {
             $defaults[$name] = $contact[$name];
             if (substr($name, 0, 7) == 'custom_') {
                 $timeField = "{$name}_time";
                 if (isset($contact[$timeField])) {
                     $defaults[$timeField] = $contact[$timeField];
                 }
             } else {
                 if (in_array($name, array('addressee', 'email_greeting', 'postal_greeting')) && CRM_Utils_Array::value($name . '_custom', $contact)) {
                     $defaults[$name . '_custom'] = $contact[$name . '_custom'];
                 }
             }
         }
     }
     $this->_submitValues = array_merge($this->_submitValues, $defaults);
     $this->setDefaults($defaults);
     require_once 'CRM/Friend/BAO/Friend.php';
     $values['entity_id'] = $this->_id;
     $values['entity_table'] = 'civicrm_contribution_page';
     CRM_Friend_BAO_Friend::retrieve($values, $data);
     $tellAFriend = false;
     if ($this->_pcpId) {
         if ($this->_pcpBlock['is_tellfriend_enabled']) {
             $this->assign('friendText', ts('Tell a Friend'));
             $subUrl = "eid={$this->_pcpId}&blockId={$this->_pcpBlock['id']}&page=pcp";
             $tellAFriend = true;
         }
     } else {
         if (CRM_Utils_Array::value('is_active', $data)) {
             $friendText = $data['title'];
             $this->assign('friendText', $friendText);
             $subUrl = "eid={$this->_id}&page=contribution";
//.........这里部分代码省略.........
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:101,代码来源:ThankYou.php


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