Fix mishandling of renamed membership status labels on membership import
[civicrm-core.git] / CRM / Member / PseudoConstant.php
index 5d94876895b6855ef35c52f1922c6d97c3b1fbc4..dedf38aaaf0da074d9d5a418a903ee4e0333335e 100644 (file)
@@ -3,7 +3,7 @@
  +--------------------------------------------------------------------+
  | CiviCRM version 5                                                  |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2018                                |
+ | Copyright CiviCRM LLC (c) 2004-2019                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
@@ -28,7 +28,7 @@
 /**
  *
  * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2018
+ * @copyright CiviCRM LLC (c) 2004-2019
  * $Id$
  *
  */
@@ -65,7 +65,7 @@ class CRM_Member_PseudoConstant extends CRM_Core_PseudoConstant {
     if (!self::$membershipType || $force) {
       CRM_Core_PseudoConstant::populate(self::$membershipType,
         'CRM_Member_DAO_MembershipType',
-        FALSE, 'name', 'is_active', NULL, 'weight', 'id', TRUE
+        FALSE, 'name', 'is_active', NULL, 'weight', 'id'
       );
     }
     if ($id) {
@@ -92,11 +92,11 @@ class CRM_Member_PseudoConstant extends CRM_Core_PseudoConstant {
    * @param bool $allStatus
    *
    * @return array
-   *    array reference of all membership statuses if any
+   *   array reference of all membership statuses if any
    */
   public static function &membershipStatus($id = NULL, $cond = NULL, $column = 'name', $force = FALSE, $allStatus = FALSE) {
     if (self::$membershipStatus === NULL) {
-      self::$membershipStatus = array();
+      self::$membershipStatus = [];
     }
 
     $cacheKey = $column;
@@ -132,6 +132,9 @@ class CRM_Member_PseudoConstant extends CRM_Core_PseudoConstant {
     if (isset(self::$$name)) {
       self::$$name = NULL;
     }
+    // The preferred source of membership pseudoconstants is in fact the Core class.
+    // which buildOptions accesses - better flush that too.
+    CRM_Core_PseudoConstant::flush();
   }
 
 }