CRM-20385 : IIDA-72 oversensitive deferred revenue account validation
authorPradeep Nayak <pradpnayak@gmail.com>
Tue, 21 Feb 2017 13:19:53 +0000 (18:49 +0530)
committerdeb.monish <monish.deb@jmaconsulting.biz>
Fri, 7 Apr 2017 08:17:13 +0000 (13:47 +0530)
16 files changed:
CRM/Admin/Form/Preferences/Contribute.php
CRM/Contribute/BAO/Contribution.php
CRM/Event/BAO/Event.php
CRM/Event/Form/ManageEvent/Fee.php
CRM/Financial/BAO/FinancialAccount.php
CRM/Member/BAO/MembershipType.php
CRM/Member/Form/MembershipType.php
CRM/Price/BAO/PriceFieldValue.php
CRM/Price/BAO/PriceSet.php
CRM/Price/Form/Field.php
CRM/Price/Form/Option.php
CRM/Price/Form/Set.php
templates/CRM/Event/Form/ManageEvent/Fee.tpl
templates/CRM/Member/Form/MembershipType.tpl
templates/CRM/common/deferredFinancialType.tpl [new file with mode: 0644]
tests/phpunit/CRM/Financial/BAO/FinancialAccountTest.php

index e07b876a3f39429220b7fc0f705a9ecc4233df5e..1c26bc51a2d4682fd651a64080f35fa55fe1cce6 100644 (file)
@@ -166,34 +166,6 @@ class CRM_Admin_Form_Preferences_Contribute extends CRM_Admin_Form_Preferences {
     }
     $this->assign('htmlFields', $htmlFields);
     parent::buildQuickForm();
-    $this->addFormRule(array('CRM_Admin_Form_Preferences_Contribute', 'formRule'), $this);
-  }
-
-  /**
-   * Global validation rules for the form.
-   *
-   * @param array $values
-   *   posted values of the form
-   * @param $files
-   * @param $self
-   *
-   * @return array
-   *   list of errors to be posted back to the form
-   */
-  public static function formRule($values, $files, $self) {
-    $errors = array();
-    if (CRM_Utils_Array::value('deferred_revenue_enabled', $values)) {
-      $errorMessage = CRM_Financial_BAO_FinancialAccount::validateTogglingDeferredRevenue();
-      if ($errorMessage) {
-        // Since the error msg is too long and
-        // takes the whole space to display inline
-        // therefore setting blank text to highlight the field
-        // setting actual error msg to _qf_default to show in pop-up screen
-        $errors['deferred_revenue_enabled'] = ' ';
-        $errors['_qf_default'] = $errorMessage;
-      }
-    }
-    return $errors;
   }
 
   /**
index a259fb270c7b303586a6ea2a3da6deaee8d99ab8..04abf8642a34f22f67308c51de21e7cd6b136c2f 100644 (file)
@@ -193,8 +193,6 @@ class CRM_Contribute_BAO_Contribution extends CRM_Contribute_DAO_Contribution {
       $params['prevContribution'] = self::getOriginalContribution($contributionID);
     }
 
-    // CRM-16189
-    CRM_Financial_BAO_FinancialAccount::checkFinancialTypeHasDeferred($params, $contributionID);
     if ($contributionID && !empty($params['revenue_recognition_date']) && !empty($params['prevContribution'])
       && !($contributionStatus[$params['prevContribution']->contribution_status_id] == 'Pending')
       && !self::allowUpdateRevenueRecognitionDate($contributionID)
index cd9d8294dba10f9a7aafd4d21256c1c8df8c907e..3affafcfd581fc7bf8de0f6007f9a23c1bd83942 100644 (file)
@@ -95,11 +95,6 @@ class CRM_Event_BAO_Event extends CRM_Event_DAO_Event {
       CRM_Utils_Hook::pre('create', 'Event', NULL, $params);
     }
 
-    // CRM-16189
-    if (!empty($params['financial_type_id'])) {
-      CRM_Financial_BAO_FinancialAccount::validateFinancialType($params['financial_type_id']);
-    }
-
     $event = new CRM_Event_DAO_Event();
 
     $event->copyValues($params);
index 4ab1176e7f4b18710a43ffb9b3e53e7a942b609d..beaeb885bfaa1c8ff0d1f9e6c46f0984149d1a27 100644 (file)
@@ -386,7 +386,10 @@ class CRM_Event_Form_ManageEvent_Fee extends CRM_Event_Form_ManageEvent {
     $this->addElement('submit', $this->getButtonName('submit'), ts('Add Discount Set to Fee Table'),
       array('class' => 'crm-form-submit cancel')
     );
-
+    if (CRM_Contribute_BAO_Contribution::checkContributeSettings('deferred_revenue_enabled')) {
+      $deferredFinancialType = CRM_Financial_BAO_FinancialAccount::getDeferredFinancialType();
+      $this->assign('deferredFinancialType', array_keys($deferredFinancialType));
+    }
     $this->buildAmountLabel();
     parent::buildQuickForm();
   }
@@ -524,13 +527,6 @@ class CRM_Event_Form_ManageEvent_Fee extends CRM_Event_Form_ManageEvent {
         }
       }
     }
-    // CRM-16189
-    try {
-      CRM_Financial_BAO_FinancialAccount::validateFinancialType($values['financial_type_id']);
-    }
-    catch (CRM_Core_Exception $e) {
-      $errors['financial_type_id'] = $e->getMessage();
-    }
     return empty($errors) ? TRUE : $errors;
   }
 
index 182865e66cfcf6b1dcae3800674408eea5b949fa..089d225a89b73f317d72f13fe739b24ffe6062d9 100644 (file)
@@ -426,118 +426,12 @@ LIMIT 1";
     }
 
     if ($isError) {
-      $error = ts('Revenue recognition date can only be specified if the financial type selected has a deferred revenue account configured. Please have an administrator set up the deferred revenue account at Administer > CiviContribute > Financial Accounts, then configure it for financial types at Administer > CiviContribution > Financial Types, Accounts');
+      $error = ts('Revenue Recognition Date cannot be processed unless there is a Deferred Revenue account setup for the Financial Type. Please remove Revenue Recognition Date, select a different Financial Type with a Deferred Revenue account setup for it, or setup a Deferred Revenue account for this Financial Type.');
       throw new CRM_Core_Exception($error);
     }
     return $isError;
   }
 
-  /**
-   * Check if financial type has Deferred Revenue Account is relationship
-   * with Financial Account.
-   *
-   * @param int $financialTypeId
-   *   Financial Type Id.
-   *
-   * @param int $entityID
-   *   Holds id for PriceSet/PriceField/PriceFieldValue.
-   *
-   * @param string $entity
-   *   Entity like PriceSet/PriceField/PriceFieldValue.
-   *
-   * @return bool
-   *
-   */
-  public static function validateFinancialType($financialTypeId, $entityID = NULL, $entity = NULL) {
-    if (!CRM_Contribute_BAO_Contribution::checkContributeSettings('deferred_revenue_enabled')) {
-      return FALSE;
-    }
-    if ($entityID) {
-      $query = ' SELECT ps.extends FROM civicrm_price_set ps';
-      $params = array(
-        1 => array('ps', 'Text'),
-        2 => array($entityID, 'Integer'),
-      );
-      if ($entity == 'PriceField') {
-        $params[1] = array('pf', 'Text');
-        $query .= ' INNER JOIN civicrm_price_field pf ON pf.price_set_id = ps.id ';
-      }
-      $query .= ' WHERE %1.id = %2';
-      $extends = CRM_Core_DAO::singleValueQuery($query, $params);
-      $extends = explode('\ 1', $extends);
-      if (!(in_array(CRM_Core_Component::getComponentID('CiviEvent'), $extends)
-        || in_array(CRM_Core_Component::getComponentID('CiviMember'), $extends))
-      ) {
-        return FALSE;
-      }
-    }
-    $deferredFinancialType = self::getDeferredFinancialType();
-    if (!array_key_exists($financialTypeId, $deferredFinancialType)) {
-      throw new CRM_Core_Exception(ts('Deferred revenue account is not configured for selected financial type. Please have an administrator set up the deferred revenue account at Administer > CiviContribute > Financial Accounts, then configure it for financial types at Administer > CiviContribution > Financial Types, Accounts'));
-    }
-    return FALSE;
-  }
-
-  /**
-   * Validate if Deferred Account is set for Financial Type
-   * when Deferred Revenue is enabled
-   *
-   * @return string
-   *
-   */
-  public static function validateTogglingDeferredRevenue() {
-    $deferredFinancialType = self::getDeferredFinancialType();
-    $message = ts('Before Deferred Revenue can be enabled, a Deferred Revenue Account relationship must be defined for all financial types currently used for Memberships and Events, including
-<ul>
-<li>those specified for each membership type at Admin > CiviMember > Membership Types, edit</li>
-<li>on the Fees tab when managing events</li>
-<li>the default financial type associated with a membership or event price set</li>
-<li>the financial type for a membership price set field option when the membership type is non-blank</li>
-<li>as the financial type for a price set field with participant count > 0</li>
-<li>as the financial type for a price set field option with participant count > 0</li>
-</ul>
-In other words, please create deferred revenue accounts at Administer > CiviContribute > Financial Accounts, then configure them for the following financial types at Administer > CiviContribute > Financial Types, accounts:');
-    $tables = array(
-      'civicrm_membership_type',
-      'civicrm_event',
-      'civicrm_price_set',
-      'civicrm_price_field_value',
-    );
-    $params[2] = array('', 'Text');
-    if (!empty($deferredFinancialType)) {
-      $params[2] = array(' AND financial_type_id NOT IN (' . implode(',', array_keys($deferredFinancialType)) . ') ', 'Text');
-    }
-    $query_1 = 'SELECT %5.id FROM %4 WHERE %5.is_active = 1';
-    $query_2 = $query_1 . ' %2';
-    foreach ($tables as $table) {
-      $params[4] = array($table, 'Text');
-      $params[5] = array($table, 'Text');
-      $dao = CRM_Core_DAO::executeQuery($query_1, $params);
-      if ($dao->N) {
-        if (in_array($table, array('civicrm_price_set', 'civicrm_price_field_value'))) {
-          $query_2 .= " AND civicrm_price_set.name NOT IN ('default_contribution_amount', 'default_membership_type_amount') AND (civicrm_price_set.extends LIKE '%1%' OR civicrm_price_set.extends like '3')";
-          if ($table == 'civicrm_price_field_value') {
-            $string = $table . ' INNER JOIN civicrm_price_field ON civicrm_price_field.id = civicrm_price_field_value.price_field_id INNER JOIN civicrm_price_set ON civicrm_price_set.id = civicrm_price_field.price_set_id ';
-            $params[4] = array($string, 'Text');
-            $params[2][0] = str_replace('financial_type_id', "{$table}.financial_type_id", $params[2][0]);
-          }
-        }
-        $dao = CRM_Core_DAO::executeQuery($query_2, $params);
-        if ($dao->N) {
-          $message .= '<ul>';
-          $financialTypes = CRM_Contribute_PseudoConstant::financialType();
-          $financialTypes = array_diff_key($financialTypes, $deferredFinancialType);
-          foreach ($financialTypes as $financialType) {
-            $message .= "<li>{$financialType}</li>";
-          }
-          $message .= '</ul>';
-          return $message;
-        }
-      }
-    }
-    return NULL;
-  }
-
   /**
    * Retrieve all Deferred Financial Accounts.
    *
index 74887ed0ac5da20ebd98fc0b74de77a360a007cf..d65d2fe2090712a651b3fcdb9fe05e36204337db 100644 (file)
@@ -106,13 +106,6 @@ class CRM_Member_BAO_MembershipType extends CRM_Member_DAO_MembershipType {
       }
     }
 
-    // CRM-16189
-    if (!empty($params['financial_type_id'])) {
-      CRM_Financial_BAO_FinancialAccount::validateFinancialType(
-        $params['financial_type_id']
-      );
-    }
-
     // action is taken depending upon the mode
     $membershipType = new CRM_Member_DAO_MembershipType();
     $membershipType->copyValues($params);
index 067f1b3c258170ace02f984503694c5ee6d07f56..026f7ab70e3ee6e3da5b53019d4625d4e8432358 100644 (file)
@@ -204,6 +204,11 @@ class CRM_Member_Form_MembershipType extends CRM_Member_Form_MembershipConfig {
     $this->addFormRule(array('CRM_Member_Form_MembershipType', 'formRule'));
 
     $this->assign('membershipTypeId', $this->_id);
+
+    if (CRM_Contribute_BAO_Contribution::checkContributeSettings('deferred_revenue_enabled')) {
+      $deferredFinancialType = CRM_Financial_BAO_FinancialAccount::getDeferredFinancialType();
+      $this->assign('deferredFinancialType', array_keys($deferredFinancialType));
+    }
   }
 
   /**
@@ -282,14 +287,6 @@ class CRM_Member_Form_MembershipType extends CRM_Member_Form_MembershipConfig {
       }
     }
 
-    // CRM-16189
-    try {
-      CRM_Financial_BAO_FinancialAccount::validateFinancialType($params['financial_type_id']);
-    }
-    catch (CRM_Core_Exception $e) {
-      $errors['financial_type_id'] = $e->getMessage();
-    }
-
     return empty($errors) ? TRUE : $errors;
   }
 
index f6b8b3687bd4ad40364cf9a387f4c557ba535847..186c4326c89552f65a36e86f319625074e1727c2 100644 (file)
@@ -64,13 +64,6 @@ class CRM_Price_BAO_PriceFieldValue extends CRM_Price_DAO_PriceFieldValue {
     if (!$priceFieldID) {
       $priceFieldID = CRM_Core_DAO::getFieldValue('CRM_Price_BAO_PriceFieldValue', $id, 'price_field_id');
     }
-    if (!empty($params['financial_type_id'])) {
-      CRM_Financial_BAO_FinancialAccount::validateFinancialType(
-        $params['financial_type_id'],
-        $priceFieldID,
-        'PriceField'
-      );
-    }
     if (!empty($params['is_default'])) {
       $query = 'UPDATE civicrm_price_field_value SET is_default = 0 WHERE  price_field_id = %1';
       $p = array(1 => array($params['price_field_id'], 'Integer'));
index 531372bc6f4ade601be8eee32e7f776d5e03adf5..d59c50faca69b13b8e44f9db62a8f5bec22886f8 100644 (file)
@@ -76,13 +76,6 @@ class CRM_Price_BAO_PriceSet extends CRM_Price_DAO_PriceSet {
     else {
       $priceSetID = CRM_Utils_Array::value('id', $params);
     }
-    // CRM-16189
-    if ($validatePriceSet && !empty($params['financial_type_id'])) {
-      CRM_Financial_BAO_FinancialAccount::validateFinancialType(
-        $params['financial_type_id'],
-        $priceSetID
-      );
-    }
     $priceSetBAO = new CRM_Price_BAO_PriceSet();
     $priceSetBAO->copyValues($params);
     if (self::eventPriceSetDomainID()) {
index 51f7d3fd053f100b0b02e63e3b01334a8595fcf8..f17e11ad1644e5d906605e151ea495ca36d61f4f 100644 (file)
@@ -404,15 +404,6 @@ class CRM_Price_Form_Field extends CRM_Core_Form {
       if ($fields['financial_type_id'] == '') {
         $errors['financial_type_id'] = ts('Financial Type is a required field');
       }
-      else {
-        // CRM-16189
-        try {
-          CRM_Financial_BAO_FinancialAccount::validateFinancialType($fields['financial_type_id'], $form->_sid);
-        }
-        catch (CRM_Core_Exception $e) {
-          $errors['financial_type_id'] = $e->getMessage();
-        }
-      }
     }
 
     //avoid the same price field label in Within PriceSet
@@ -529,13 +520,6 @@ class CRM_Price_Form_Field extends CRM_Core_Form {
           }
 
           $_flagOption = $_emptyRow = 0;
-          // CRM-16189
-          try {
-            CRM_Financial_BAO_FinancialAccount::validateFinancialType($fields['option_financial_type_id'][$index], $form->_fid, 'PriceField');
-          }
-          catch(CRM_Core_Exception $e) {
-            $errors["option_financial_type_id[{$index}]"] = $e->getMessage();
-          }
         }
 
         if (!empty($memTypesIDS)) {
index 99126381c8a9b963b46c9e267d6bbb88c7a7473e..0bd160b25c13be3a84ca16161a42ed39fc799443 100644 (file)
@@ -288,13 +288,6 @@ class CRM_Price_Form_Option extends CRM_Core_Form {
     ) {
       $errors['count'] = ts('Participant count can not be greater than max participants.');
     }
-    // CRM-16189
-    try {
-      CRM_Financial_BAO_FinancialAccount::validateFinancialType($fields['financial_type_id'], $form->_fid, 'PriceField');
-    }
-    catch (CRM_Core_Exception $e) {
-      $errors['financial_type_id'] = $e->getMessage();
-    }
     return empty($errors) ? TRUE : $errors;
   }
 
index a2127502504835da7276e44b16202ed79108b969..0169689aa7eace45a18ca9947abde70d33ce1864 100644 (file)
@@ -102,18 +102,6 @@ class CRM_Price_Form_Set extends CRM_Core_Form {
     if ($asciiValue >= 48 && $asciiValue <= 57) {
       $errors['title'] = ts("Name cannot not start with a digit");
     }
-    // CRM-16189
-    if (!empty($fields['extends'])
-      && (array_key_exists(CRM_Core_Component::getComponentID('CiviEvent'), $fields['extends'])
-        || array_key_exists(CRM_Core_Component::getComponentID('CiviMember'), $fields['extends']))
-    ) {
-      try {
-        CRM_Financial_BAO_FinancialAccount::validateFinancialType($fields['financial_type_id']);
-      }
-      catch (CRM_Core_Exception $e) {
-        $errors['financial_type_id'] = $e->getMessage();
-      }
-    }
     return empty($errors) ? TRUE : $errors;
   }
 
index b3307236dba377e197069f3dd34588231e265044..6ba2f04cf601ad8e15ffa00a5cf1f44e371e223d 100644 (file)
 </div>
 </div>
 
+{include file="CRM/common/deferredFinancialType.tpl" context='Event'}
 {include file="CRM/common/showHide.tpl"}
 <script type="text/javascript">
     {if $price}
     });
 </script>
 {/literal}
-{/if}
+{/if}
\ No newline at end of file
index ed4c88818c6364dbd270a742f99b799087d29396..a01c6107595134df2091a7c763d2deca66f3c9af 100644 (file)
   </div>
 </div>
 
+{include file="CRM/common/deferredFinancialType.tpl" context='MembershipType'}
 {literal}
 <script type="text/javascript">
 CRM.$(function($) {
diff --git a/templates/CRM/common/deferredFinancialType.tpl b/templates/CRM/common/deferredFinancialType.tpl
new file mode 100644 (file)
index 0000000..3185321
--- /dev/null
@@ -0,0 +1,47 @@
+{*
+ +--------------------------------------------------------------------+
+ | CiviCRM version 4.7                                                |
+ +--------------------------------------------------------------------+
+ | Copyright CiviCRM LLC (c) 2004-2017                                |
+ +--------------------------------------------------------------------+
+ | This file is a part of CiviCRM.                                    |
+ |                                                                    |
+ | CiviCRM is free software; you can copy, modify, and distribute it  |
+ | under the terms of the GNU Affero General Public License           |
+ | Version 3, 19 November 2007 and the CiviCRM Licensing Exception.   |
+ |                                                                    |
+ | CiviCRM is distributed in the hope that it will be useful, but     |
+ | WITHOUT ANY WARRANTY; without even the implied warranty of         |
+ | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.               |
+ | See the GNU Affero General Public License for more details.        |
+ |                                                                    |
+ | You should have received a copy of the GNU Affero General Public   |
+ | License and the CiviCRM Licensing Exception along                  |
+ | with this program; if not, contact CiviCRM LLC                     |
+ | at info[AT]civicrm[DOT]org. If you have questions about the        |
+ | GNU Affero General Public License or the licensing of CiviCRM,     |
+ | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
+ +--------------------------------------------------------------------+
+*}
+{if isset($deferredFinancialType)}
+<div id='warningDialog' style="display:none;"></div>
+{literal}
+<script type="text/javascript">
+CRM.$(function($) {
+  var more = $('.crm-button input.validate').click(function(e) {
+    var message = "{/literal} {if $context eq 'Event'}
+        {ts}Note: Revenue for this event registration will not be deferred as the financial type does not have a deferred revenue account setup for it. If you want the revenue to be deferred, please select a different Financial Type with a Deferred Revenue account setup for it, or setup a Deferred Revenue account for this Financial Type.{/ts}
+      {else if $context eq 'MembershipType'}
+        {ts}Note: Revenue for these types of memberships will not be deferred as the financial type does not have a deferred revenue account setup for it. If you want the revenue to be deferred, please select a different Financial Type with a Deferred Revenue account setup for it, or setup a Deferred Revenue account for this Financial Type.{/ts}
+      {/if}
+    {literal}";
+    var deferredFinancialType = {/literal}{$deferredFinancialType|@json_encode}{literal};
+    var financialType = parseInt($('#financial_type_id').val());
+    if ($.inArray(financialType, deferredFinancialType) == -1) {
+      return confirm(message);
+    }
+  });
+});
+</script>
+{/literal}
+{/if}
index c1b6a2416a0181e9f2a1216ed9a7daff7b977f29..ae06581e4db39a5eefd8a4e68a716878b1d712c0 100644 (file)
@@ -331,78 +331,10 @@ class CRM_Financial_BAO_FinancialAccountTest extends CiviUnitTestCase {
       $this->fail("Missed expected exception");
     }
     catch (CRM_Core_Exception $e) {
-      $this->assertEquals('Revenue recognition date can only be specified if the financial type selected has a deferred revenue account configured. Please have an administrator set up the deferred revenue account at Administer > CiviContribute > Financial Accounts, then configure it for financial types at Administer > CiviContribution > Financial Types, Accounts', $e->getMessage());
+      $this->assertEquals('Revenue Recognition Date cannot be processed unless there is a Deferred Revenue account setup for the Financial Type. Please remove Revenue Recognition Date, select a different Financial Type with a Deferred Revenue account setup for it, or setup a Deferred Revenue account for this Financial Type.', $e->getMessage());
     }
   }
 
-  /**
-   * Test if financial type has Deferred Revenue Account is relationship with Financial Account.
-   *
-   */
-  public function testValidateFinancialType() {
-    Civi::settings()->set('contribution_invoice_settings', array('deferred_revenue_enabled' => '1'));
-    $financialTypes = CRM_Contribute_PseudoConstant::financialType();
-    foreach ($financialTypes as $key => $value) {
-      try {
-        CRM_Financial_BAO_FinancialAccount::validateFinancialType($key);
-        if (!in_array($value, array('Member Dues', 'Event Fee'))) {
-          $this->fail("Missed expected exception");
-        }
-      }
-      catch (CRM_Core_Exception $e) {
-        if (in_array($value, array('Member Dues', 'Event Fees'))) {
-          $this->fail("Should not call exception");
-        }
-        else {
-          $this->assertEquals('Deferred revenue account is not configured for selected financial type. Please have an administrator set up the deferred revenue account at Administer > CiviContribute > Financial Accounts, then configure it for financial types at Administer > CiviContribution > Financial Types, Accounts', $e->getMessage());
-        }
-      }
-    }
-  }
-
-  /**
-   * Test Validate if Deferred Account is set for Financial Type.
-   */
-  public function testValidateTogglingDeferredRevenue() {
-    $orgContactID = $this->organizationCreate();
-
-    //create relationship
-    $params = array(
-      'name_a_b' => 'Relation 1',
-      'name_b_a' => 'Relation 2',
-      'contact_type_a' => 'Individual',
-      'contact_type_b' => 'Organization',
-      'is_reserved' => 1,
-      'is_active' => 1,
-    );
-    $relationshipTypeId = $this->relationshipTypeCreate($params);
-    $ids = array();
-    $params = array(
-      'name' => 'test type',
-      'domain_id' => 1,
-      'description' => NULL,
-      'minimum_fee' => 10,
-      'duration_unit' => 'year',
-      'member_of_contact_id' => $orgContactID,
-      'relationship_type_id' => $relationshipTypeId,
-      'period_type' => 'fixed',
-      'duration_interval' => 1,
-      'financial_type_id' => 1,
-      'visibility' => 'Public',
-      'is_active' => 1,
-    );
-
-    $membershipType = CRM_Member_BAO_MembershipType::add($params, $ids);
-
-    $membership = $this->assertDBNotNull('CRM_Member_BAO_MembershipType', $orgContactID,
-      'name', 'member_of_contact_id',
-      'Database check on updated membership record.'
-    );
-    $error = CRM_Financial_BAO_FinancialAccount::validateTogglingDeferredRevenue();
-    $this->assertTrue(!empty($error), "Error message did not appear");
-    $this->membershipTypeDelete(array('id' => $membershipType->id));
-  }
-
   /**
    * Test testGetAllDeferredFinancialAccount.
    */