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


PHP CRM_Financial_BAO_FinancialType::del方法代码示例

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


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

示例1: postProcess

 /**
  * Process the form submission.
  *
  * @return void
  */
 public function postProcess()
 {
     if ($this->_action & CRM_Core_Action::DELETE) {
         $errors = CRM_Financial_BAO_FinancialType::del($this->_id);
         if (!empty($errors)) {
             CRM_Core_Error::statusBounce($errors['error_message'], CRM_Utils_System::url('civicrm/admin/financial/financialType', "reset=1&action=browse"), ts('Cannot Delete'));
         }
         CRM_Core_Session::setStatus(ts('Selected financial type has been deleted.'), ts('Record Deleted'), 'success');
     } else {
         $params = $ids = array();
         // store the submitted values in an array
         $params = $this->exportValues();
         if ($this->_action & CRM_Core_Action::UPDATE) {
             $ids['financialType'] = $this->_id;
         }
         $financialType = CRM_Financial_BAO_FinancialType::add($params, $ids);
         if ($this->_action & CRM_Core_Action::UPDATE) {
             $url = CRM_Utils_System::url('civicrm/admin/financial/financialType', 'reset=1&action=browse');
             CRM_Core_Session::setStatus(ts('The financial type "%1" has been updated.', array(1 => $financialType->name)), ts('Saved'), 'success');
         } else {
             $url = CRM_Utils_System::url('civicrm/admin/financial/financialType/accounts', 'reset=1&action=browse&aid=' . $financialType->id);
             $statusArray = array(1 => $financialType->name, 2 => $financialType->name, 3 => CRM_Utils_Array::value(0, $financialType->titles), 4 => CRM_Utils_Array::value(1, $financialType->titles), 5 => CRM_Utils_Array::value(2, $financialType->titles));
             if (empty($financialType->titles)) {
                 $text = ts('Your Financial "%1" Type has been created and assigned to an existing financial account with the same title. You should review the assigned account and determine whether additional account relationships are needed.', $statusArray);
             } else {
                 $text = ts('Your Financial "%1" Type has been created, along with a corresponding income account "%2". That income account, along with standard financial accounts "%3", "%4" and "%5" have been linked to the financial type. You may edit or replace those relationships here.', $statusArray);
             }
             CRM_Core_Session::setStatus($text, ts('Saved'), 'success', array('expires' => 0));
         }
         $session = CRM_Core_Session::singleton();
         $session->replaceUserContext($url);
     }
 }
开发者ID:nganivet,项目名称:civicrm-core,代码行数:38,代码来源:FinancialType.php

示例2: postProcess

 /**
  * Function to process the form
  *
  * @access public
  * @return void
  */
 public function postProcess()
 {
     if ($this->_action & CRM_Core_Action::DELETE) {
         $errors = CRM_Financial_BAO_FinancialType::del($this->_id);
         if (!empty($errors)) {
             $message = ts('This item cannot be deleted.') . $errors['error_message'];
             CRM_Core_Session::setStatus($message);
             return CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/admin/financial/financialType', "reset=1&action=browse"));
         }
         CRM_Core_Session::setStatus(ts('Selected financial type has been deleted.'));
     } else {
         $params = $ids = array();
         // store the submitted values in an array
         $params = $this->exportValues();
         if ($this->_action & CRM_Core_Action::UPDATE) {
             $ids['financialType'] = $this->_id;
         }
         $financialType = CRM_Financial_BAO_FinancialType::add($params, $ids);
         if ($this->_action & CRM_Core_Action::UPDATE) {
             $url = CRM_Utils_System::url('civicrm/admin/financial/financialType', 'reset=1&action=browse');
             CRM_Core_Session::setStatus(ts('The financial type \'%1\' has been saved.', array(1 => $financialType->name)));
         } else {
             $url = CRM_Utils_System::url('civicrm/admin/financial/financialType/accounts', 'reset=1&action=browse&aid=' . $financialType->id);
             $statusArray = array(1 => $financialType->name, 2 => $financialType->name, 3 => $financialType->titles[0], 4 => $financialType->titles[1], 5 => $financialType->titles[2]);
             CRM_Core_Session::setStatus(ts('Your Financial \'%1\' Type has been created, along with a corresponding income account \'%2\'. That income account, along with standard financial accounts \'%3\', \'%4\' and \'%5\' have been linked to the financial type. You may edit or replace those relationships here.', $statusArray));
         }
         $session = CRM_Core_Session::singleton();
         $session->replaceUserContext($url);
     }
 }
开发者ID:archcidburnziso,项目名称:civicrm-core,代码行数:36,代码来源:FinancialType.php

示例3: testDel

 /**
  * Check method del()
  */
 public function testDel()
 {
     $params = array('name' => 'Donations', 'is_deductible' => 0, 'is_active' => 1);
     $ids = array();
     $financialType = CRM_Financial_BAO_FinancialType::add($params, $ids);
     CRM_Financial_BAO_FinancialType::del($financialType->id);
     $params = array('id' => $financialType->id);
     $result = CRM_Financial_BAO_FinancialType::retrieve($params, $defaults);
     $this->assertEquals(empty($result), TRUE, 'Verify financial types record deletion.');
 }
开发者ID:rajeshrhino,项目名称:civicrm-core,代码行数:13,代码来源:FinancialTypeTest.php


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