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


PHP CRM_Core_BAO_CustomGroup::postProcess方法代码示例

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


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

示例1: formatParams

 /**
  * A hackish function needed to massage CRM_Contact_Form_$ctype::formRule()
  * object into a valid $params array for dedupe
  *
  * @param array $fields  contact structure from formRule()
  * @param string $ctype  contact type of the given contact
  *
  * @return array  valid $params array for dedupe
  */
 static function formatParams($fields, $ctype)
 {
     $flat = array();
     CRM_Utils_Array::flatten($fields, $flat);
     $replace_these = array('individual_prefix' => 'prefix_id', 'individual_suffix' => 'suffix_id', 'gender' => 'gender_id');
     //handle for individual_suffix, individual_prefix, gender
     foreach (array('individual_suffix', 'individual_prefix', 'gender') as $name) {
         if (CRM_Utils_Array::value($name, $fields)) {
             $flat[$replace_these[$name]] = $flat[$name];
             unset($flat[$name]);
         }
     }
     // handle {birth,deceased}_date
     foreach (array('birth_date', 'deceased_date') as $date) {
         if (CRM_Utils_Array::value($date, $fields)) {
             $flat[$date] = $fields[$date];
             if (is_array($flat[$date])) {
                 $flat[$date] = CRM_Utils_Date::format($flat[$date]);
             }
             $flat[$date] = CRM_Utils_Date::processDate($flat[$date]);
         }
     }
     if (CRM_Utils_Array::value('contact_source', $flat)) {
         $flat['source'] = $flat['contact_source'];
         unset($flat['contact_source']);
     }
     // handle preferred_communication_method
     if (array_key_exists('preferred_communication_method', $fields)) {
         $methods = array_intersect($fields['preferred_communication_method'], array('1'));
         $methods = array_keys($methods);
         sort($methods);
         if ($methods) {
             $flat['preferred_communication_method'] = CRM_Core_DAO::VALUE_SEPARATOR . implode(CRM_Core_DAO::VALUE_SEPARATOR, $methods) . CRM_Core_DAO::VALUE_SEPARATOR;
         }
     }
     // handle custom data
     $tree = CRM_Core_BAO_CustomGroup::getTree($ctype, CRM_Core_DAO::$_nullObject, NULL, -1);
     CRM_Core_BAO_CustomGroup::postProcess($tree, $fields, TRUE);
     foreach ($tree as $key => $cg) {
         if (!is_int($key)) {
             continue;
         }
         foreach ($cg['fields'] as $cf) {
             $flat[$cf['column_name']] = CRM_Utils_Array::value('data', $cf['customValue']);
         }
     }
     // if the key is dotted, keep just the last part of it
     foreach ($flat as $key => $value) {
         if (substr_count($key, '.')) {
             $last = array_pop(explode('.', $key));
             // make sure the first occurence is kept, not the last
             if (!isset($flat[$last])) {
                 $flat[$last] = $value;
             }
             unset($flat[$key]);
         }
     }
     // drop the -digit (and -Primary, for CRM-3902) postfixes (so event registration's $flat['email-5'] becomes $flat['email'])
     // FIXME: CRM-5026 should be fixed here; the below clobbers all address info; we should split off address fields and match
     // the -digit to civicrm_address.location_type_id and -Primary to civicrm_address.is_primary
     foreach ($flat as $key => $value) {
         $matches = array();
         if (preg_match('/(.*)-(\\d+|Primary)$/', $key, $matches)) {
             $flat[$matches[1]] = $value;
             unset($flat[$key]);
         }
     }
     $params = array();
     $supportedFields = CRM_Dedupe_BAO_RuleGroup::supportedFields($ctype);
     if (is_array($supportedFields)) {
         foreach ($supportedFields as $table => $fields) {
             if ($table == 'civicrm_address') {
                 // for matching on civicrm_address fields, we also need the location_type_id
                 $fields['location_type_id'] = '';
                 // FIXME: we also need to do some hacking for id and name fields, see CRM-3902’s comments
                 $fixes = array('address_name' => 'name', 'country' => 'country_id', 'state_province' => 'state_province_id', 'county' => 'county_id');
                 foreach ($fixes as $orig => $target) {
                     if (CRM_Utils_Array::value($orig, $flat)) {
                         $params[$table][$target] = $flat[$orig];
                     }
                 }
             }
             foreach ($fields as $field => $title) {
                 if (CRM_Utils_Array::value($field, $flat)) {
                     $params[$table][$field] = $flat[$field];
                 }
             }
         }
     }
     return $params;
 }
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:100,代码来源:Finder.php

示例2: postProcess

 /** 
  * Function to process the form 
  * 
  * @access public 
  * @return None 
  */
 function postProcess()
 {
     if ($this->_action & CRM_CORE_ACTION_DELETE) {
         require_once 'CRM/Contribute/BAO/Contribution.php';
         CRM_Contribute_BAO_Contribution::deleteContribution($this->_id);
         return;
     }
     // get the submitted form values.
     $formValues = $this->controller->exportValues($this->_name);
     //print_r($formValues);
     $config =& CRM_Core_Config::singleton();
     $params = array();
     $ids = array();
     $params['contact_id'] = $this->_contactID;
     $params['currency'] = $config->defaultCurrency;
     $fields = array('contribution_type_id', 'payment_instrument_id', 'non_deductible_amount', 'total_amount', 'fee_amount', 'net_amount', 'trxn_id', 'invoice_id', 'cancel_reason', 'source', 'note');
     foreach ($fields as $f) {
         $params[$f] = CRM_Utils_Array::value($f, $formValues);
     }
     $dates = array('receive_date', 'receipt_date', 'thankyou_date', 'cancel_date');
     $currentTime = getDate();
     foreach ($dates as $d) {
         if (!CRM_Utils_System::isNull($formValues[$d])) {
             $formValues[$d]['H'] = $currentTime['hours'];
             $formValues[$d]['i'] = $currentTime['minutes'];
             $formValues[$d]['s'] = '00';
             $params[$d] = CRM_Utils_Date::format($formValues[$d]);
         }
     }
     $ids['contribution'] = $params['id'] = $this->_id;
     $contribution =& CRM_Contribute_BAO_Contribution::create($params, $ids);
     // do the updates/inserts
     CRM_Core_BAO_CustomGroup::postProcess($this->_groupTree, $formValues);
     //process premium
     if ($formValues['product_name'][0]) {
         require_once 'CRM/Contribute/DAO/ContributionProduct.php';
         $dao =& new CRM_Contribute_DAO_ContributionProduct();
         $dao->contribution_id = $contribution->id;
         $dao->product_id = $formValues['product_name'][0];
         $dao->fulfilled_date = CRM_Utils_Date::format($formValues['fulfilled_date']);
         $dao->product_option = $this->_options[$formValues['product_name'][0]][$formValues['product_name'][1]];
         if ($this->_premiumId) {
             $premoumDAO =& new CRM_Contribute_DAO_ContributionProduct();
             $premoumDAO->id = $this->_premiumId;
             $premoumDAO->find(true);
             if ($premoumDAO->product_id == $formValues['product_name'][0]) {
                 $dao->id = $this->_premiumId;
                 $premium = $dao->save();
             } else {
                 $premoumDAO->delete();
                 $premium = $dao->save();
             }
         } else {
             $premium = $dao->save();
         }
     }
     CRM_Core_BAO_CustomGroup::updateCustomData($this->_groupTree, 'Contribution', $contribution->id);
 }
开发者ID:bhirsch,项目名称:voipdrupal-4.7-1.0,代码行数:64,代码来源:Contribution.php

示例3: postProcess

 /**
  * Function to process the form
  *
  * @access public
  * @return None
  */
 function postProcess()
 {
     if ($this->_action & CRM_CORE_ACTION_VIEW) {
         return;
     }
     if ($this->_action & CRM_CORE_ACTION_DELETE) {
         CRM_Core_BAO_Meeting::del($this->_id);
         CRM_Core_Session::setStatus(ts("Selected Meeting is deleted sucessfully."));
         return;
     }
     // store the submitted values in an array
     $params = $this->controller->exportValues($this->_name);
     $ids = array();
     $dateTime = $params['scheduled_date_time'];
     $dateTime = CRM_Utils_Date::format($dateTime);
     // store the date with proper format
     $params['scheduled_date_time'] = $dateTime;
     // store the contact id and current drupal user id
     $params['source_contact_id'] = $this->_userId;
     $params['target_entity_id'] = $this->_contactId;
     $params['target_entity_table'] = 'civicrm_contact';
     //set parent id if exists for follow up activities
     if ($this->_pid) {
         $params['parent_id'] = $this->_pid;
     }
     if ($this->_action & CRM_CORE_ACTION_UPDATE) {
         $ids['meeting'] = $this->_id;
     }
     $meeting = CRM_Core_BAO_Meeting::add($params, $ids);
     CRM_Core_BAO_CustomGroup::postProcess($this->_groupTree, $params);
     // do the updates/inserts
     CRM_Core_BAO_CustomGroup::updateCustomData($this->_groupTree, 'Meeting', $meeting->id);
     if ($meeting->status == 'Completed') {
         // we need to insert an activity history record here
         $params = array('entity_table' => 'civicrm_contact', 'entity_id' => $this->_contactId, 'activity_type' => ts('Meeting'), 'module' => 'CiviCRM', 'callback' => 'CRM_Activity_Form_Meeting::showMeetingDetails', 'activity_id' => $meeting->id, 'activity_summary' => $meeting->subject, 'activity_date' => $meeting->scheduled_date_time);
         if (is_a(crm_create_activity_history($params), 'CRM_Core_Error')) {
             return false;
         }
     }
     if ($meeting->status == 'Completed') {
         CRM_Core_Session::setStatus(ts('Meeting "%1" has been logged to Activity History.', array(1 => $meeting->subject)));
     } else {
         CRM_Core_Session::setStatus(ts('Meeting "%1" has been saved.', array(1 => $meeting->subject)));
     }
 }
开发者ID:bhirsch,项目名称:voipdrupal-4.7-1.0,代码行数:51,代码来源:Meeting.php

示例4: postProcess

 /**
  * Form submission of new/edit contact is processed.
  *
  * @access public
  * @return None
  */
 function postProcess()
 {
     // check if dedupe button, if so return.
     $buttonName = $this->controller->getButtonName();
     if ($buttonName == $this->_dedupeButtonName) {
         return;
     }
     // store the submitted values in an array
     $params = $this->controller->exportValues($this->_name);
     // action is taken depending upon the mode
     $ids = array();
     if ($this->_action & CRM_CORE_ACTION_UPDATE) {
         // if update get all the valid database ids
         // from the session
         $ids = $this->get('ids');
     }
     $params['contact_type'] = $this->_contactType;
     $contact = CRM_Contact_BAO_Contact::create($params, $ids, CRM_CONTACT_FORM_EDIT_LOCATION_BLOCKS);
     //add contact to gruoup
     CRM_Contact_BAO_GroupContact::create($params['group'], $params['contact_id']);
     //add contact to tags
     CRM_Core_BAO_EntityTag::create($params['tag'], $params['contact_id']);
     // here we replace the user context with the url to view this contact
     $config =& CRM_Core_Config::singleton();
     $session =& CRM_Core_Session::singleton();
     CRM_Core_Session::setStatus(ts('Your %1 contact record has been saved.', array(1 => $contact->contact_type_display)));
     $buttonName = $this->controller->getButtonName();
     if ($buttonName == $this->getButtonName('next', 'new')) {
         // add the recently viewed contact
         list($displayName, $contactImage) = CRM_Contact_BAO_Contact::getDisplayAndImage($contact->id);
         CRM_Utils_Recent::add($displayName, CRM_Utils_System::url('civicrm/contact/view', 'reset=1&cid=' . $contact->id), $contactImage, $contact->id);
         $session->replaceUserContext(CRM_Utils_System::url('civicrm/contact/add' . $contact->contact_type[0], 'reset=1&c_type=' . $contact->contact_type));
     } else {
         $session->replaceUserContext(CRM_Utils_System::url('civicrm/contact/view', 'reset=1&cid=' . $contact->id));
     }
     CRM_Core_BAO_CustomGroup::postProcess($this->_groupTree, $params);
     // do the updates/inserts
     CRM_Core_BAO_CustomGroup::updateCustomData($this->_groupTree, $this->_contactType, $contact->id);
 }
开发者ID:bhirsch,项目名称:voipdrupal-4.7-1.0,代码行数:45,代码来源:Edit.php

示例5: postProcess

 /**
  * Process the form
  *
  * @return void
  * @access public
  */
 function postProcess()
 {
     $contactID = $this->get('contactID');
     if (!$contactID) {
         // make a copy of params so we dont destroy our params
         // (since we pass this by reference)
         $premiumParams = $params = $this->_params;
         // so now we have a confirmed financial transaction
         // lets create or update a contact first
         require_once 'api/crm.php';
         $ids = CRM_Core_BAO_UFGroup::findContact($params);
         $contactsIDs = explode(',', $ids);
         // if we find more than one contact, use the first one
         $contact_id = $contactsIDs[0];
         $contact = null;
         if ($contact_id) {
             $contact =& crm_get_contact(array('contact_id' => $contact_id));
         }
         $ids = array();
         if (!$contact || !is_a($contact, 'CRM_Contact_BAO_Contact')) {
             $contact =& CRM_Contact_BAO_Contact::createFlat($params, $ids);
         } else {
             // need to fix and unify all contact creation
             $idParams = array('id' => $contact_id, 'contact_id' => $contact_id);
             $defaults = array();
             CRM_Contact_BAO_Contact::retrieve($idParams, $defaults, $ids);
             $contact =& CRM_Contact_BAO_Contact::createFlat($params, $ids);
         }
         if (is_a($contact, 'CRM_Core_Error')) {
             CRM_Core_Error::fatal("Failed creating contact for contributor");
         }
         $contactID = $contact->id;
         $this->set('contactID', $contactID);
     }
     $contributionType =& new CRM_Contribute_DAO_ContributionType();
     $contributionType->id = $this->_values['contribution_type_id'];
     if (!$contributionType->find(true)) {
         CRM_Core_Error::fatal("Could not find a system table");
     }
     // add some contribution type details to the params list
     // if folks need to use it
     $this->_params['contributionType_name'] = $contributionType->name;
     $this->_params['contributionType_accounting_code'] = $contributionType->accounting_code;
     $this->_params['contributionForm_id'] = $this->_values['id'];
     require_once 'CRM/Contribute/Payment.php';
     $payment =& CRM_Contribute_Payment::singleton($this->_mode);
     if ($this->_contributeMode == 'express') {
         $result =& $payment->doExpressCheckout($this->_params);
     } else {
         $result =& $payment->doDirectPayment($this->_params);
     }
     if (is_a($result, 'CRM_Core_Error')) {
         CRM_Core_Error::displaySessionError($result);
         CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/contribute/transact', '_qf_Main_display=true'));
     }
     $now = date('YmdHis');
     $this->_params = array_merge($this->_params, $result);
     $this->_params['receive_date'] = $now;
     $this->set('params', $this->_params);
     $this->assign('trxn_id', $result['trxn_id']);
     $this->assign('receive_date', CRM_Utils_Date::mysqlToIso($this->_params['receive_date']));
     // result has all the stuff we need
     // lets archive it to a financial transaction
     $config =& CRM_Core_Config::singleton();
     $receiptDate = null;
     if ($this->_values['is_email_receipt']) {
         $receiptDate = $now;
     }
     if ($contributionType->is_deductible) {
         $this->assign('is_deductible', true);
         $this->set('is_deductible', true);
     }
     // assigning Premium information to receipt tpl
     if ($premiumParams['selectProduct'] && $premiumParams['selectProduct'] != 'no_thanks') {
         $startDate = $endDate = "";
         $this->assign('selectPremium', true);
         require_once 'CRM/Contribute/DAO/Product.php';
         $productDAO =& new CRM_Contribute_DAO_Product();
         $productDAO->id = $premiumParams['selectProduct'];
         $productDAO->find(true);
         $this->assign('product_name', $productDAO->name);
         $this->assign('price', $productDAO->price);
         $this->assign('sku', $productDAO->sku);
         $this->assign('option', $premiumParams['options_' . $premiumParams['selectProduct']]);
         $periodType = $productDAO->period_type;
         if ($periodType) {
             $fixed_period_start_day = $productDAO->fixed_period_start_day;
             $duration_unit = $productDAO->duration_unit;
             $duration_interval = $productDAO->duration_interval;
             if ($periodType == 'rolling') {
                 $startDate = date('Y-m-d');
             } else {
                 if ($periodType == 'fixed') {
                     if ($fixed_period_start_day) {
//.........这里部分代码省略.........
开发者ID:bhirsch,项目名称:voipdrupal-4.7-1.0,代码行数:101,代码来源:Confirm.php

示例6: postProcess

 /**
  * Process the form when submitted
  *
  * @return void
  * @access public
  */
 function postProcess()
 {
     if ($this->_action & CRM_CORE_ACTION_DELETE) {
         CRM_Contact_BAO_Group::discard($this->_id);
         CRM_Core_Session::setStatus(ts('The Group "%1" has been deleted.', array(1 => $this->_title)));
     } else {
         // store the submitted values in an array
         $params = $this->exportValues();
         $params['domain_id'] = CRM_Core_Config::domainID();
         $params['is_active'] = 1;
         if ($this->_action & CRM_CORE_ACTION_UPDATE) {
             $params['id'] = $this->_id;
         }
         $group =& CRM_Contact_BAO_Group::create($params);
         // do the updates/inserts
         CRM_Core_BAO_CustomGroup::postProcess($this->_groupTree, $params);
         CRM_Core_BAO_CustomGroup::updateCustomData($this->_groupTree, 'Group', $group->id);
         CRM_Core_Session::setStatus(ts('The Group "%1" has been saved.', array(1 => $group->title)));
         /*
          * Add context to the session, in case we are adding members to the group
          */
         if ($this->_action & CRM_CORE_ACTION_ADD) {
             $this->set('context', 'amtg');
             $this->set('amtgID', $group->id);
             $session =& CRM_Core_Session::singleton();
             $session->pushUserContext(CRM_Utils_System::url('civicrm/group/search', 'reset=1&force=1&context=smog&gid=' . $group->id));
         }
     }
 }
开发者ID:bhirsch,项目名称:voipdrupal-4.7-1.0,代码行数:35,代码来源:Edit.php

示例7: postProcess

 /**
  * Process the user submitted custom data values.
  *
  * @access public
  * @return void
  */
 function postProcess()
 {
     // Get the form values and groupTree
     $fv = $this->controller->exportValues($this->_name);
     CRM_Core_BAO_CustomGroup::postProcess($this->_groupTree, $fv);
     // do the updates/inserts
     CRM_Core_BAO_CustomGroup::updateCustomData($this->_groupTree, $this->_entityType, $this->_tableId);
 }
开发者ID:bhirsch,项目名称:voipdrupal-4.7-1.0,代码行数:14,代码来源:CustomData.php


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