Update MembershipType.duration and MembershipStatus.name to be required
authorEileen McNaughton <emcnaughton@wikimedia.org>
Fri, 13 Aug 2021 06:32:16 +0000 (18:32 +1200)
committerEileen McNaughton <emcnaughton@wikimedia.org>
Fri, 13 Aug 2021 09:35:13 +0000 (21:35 +1200)
This updates these fields to be required as that appears to be the case.

We could alternatively go with a default of 'month' for
MembershipType.duration_unit

CRM/Member/DAO/MembershipStatus.php
CRM/Member/DAO/MembershipType.php
ext/financialacls/tests/phpunit/Civi/Financialacls/MembershipTypesTest.php
xml/schema/Member/MembershipStatus.xml
xml/schema/Member/MembershipType.xml

index 85b8e054d8e85cd36d1e1d9216bd432c22038890..cea61d91d13c1cb2c192bee67b8494de64dd5374 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Member/MembershipStatus.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:62a534dbf9aed62f4d496939b44acf3d)
+ * (GenCodeChecksum:e60a982e078b6f3b7d14b16ea2139f14)
  */
 
 /**
@@ -189,6 +189,7 @@ class CRM_Member_DAO_MembershipStatus extends CRM_Core_DAO {
           'type' => CRM_Utils_Type::T_STRING,
           'title' => ts('Membership Status'),
           'description' => ts('Name for Membership Status'),
+          'required' => TRUE,
           'maxlength' => 128,
           'size' => CRM_Utils_Type::HUGE,
           'import' => TRUE,
index 5bd91e8e80abd871e22ccc01b542dca4d4886ef2..50038a30a7fca22762c8fbd66ecaed4a3424bfbc 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Member/MembershipType.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:89dc1a77c01ca0255a2dad8637f5e835)
+ * (GenCodeChecksum:9cb69957096aad15ee7d55a4efceb53e)
  */
 
 /**
@@ -365,6 +365,7 @@ class CRM_Member_DAO_MembershipType extends CRM_Core_DAO {
           'type' => CRM_Utils_Type::T_STRING,
           'title' => ts('Membership Type Duration Unit'),
           'description' => ts('Unit in which membership period is expressed.'),
+          'required' => TRUE,
           'maxlength' => 8,
           'size' => CRM_Utils_Type::EIGHT,
           'where' => 'civicrm_membership_type.duration_unit',
index 131754a1292882f554e044e3e55fad590780f0f5..3daf742b608ae60c34b563124b986a77d31f9f80 100644 (file)
@@ -2,6 +2,7 @@
 
 namespace Civi\Financialacls;
 
+use Civi\Api4\Generic\Result;
 use Civi\Api4\MembershipType;
 
 // I fought the Autoloader and the autoloader won.
@@ -38,13 +39,13 @@ class MembershipTypesTest extends BaseTestClass {
    * @throws \API_Exception
    * @throws \Civi\API\Exception\UnauthorizedException
    */
-  protected function setUpMembershipTypesACLLimited(): \Civi\Api4\Generic\Result {
+  protected function setUpMembershipTypesACLLimited(): Result {
     $types = MembershipType::save(FALSE)
       ->setRecords([
         ['name' => 'Forbidden', 'financial_type_id:name' => 'Member Dues', 'weight' => 1],
         ['name' => 'Go for it', 'financial_type_id:name' => 'Donation', 'weight' => 2],
       ])
-      ->setDefaults(['period_type' => 'rolling', 'member_of_contact_id' => 1])
+      ->setDefaults(['period_type' => 'rolling', 'member_of_contact_id' => 1, 'duration_unit' => 'month'])
       ->execute()
       ->indexBy('name');
     $this->setupLoggedInUserWithLimitedFinancialTypeAccess();
index 7fbe3e04e211794a9868651d60ff2d882b7cf3f3..2bf75d8ad6d792b9ad2eefc1f78bc884f0c923e3 100644 (file)
@@ -31,6 +31,7 @@
     <type>varchar</type>
     <import>true</import>
     <length>128</length>
+    <required>true</required>
     <comment>Name for Membership Status</comment>
     <add>1.5</add>
   </field>
index 47e28d46428d4bcbc294cc35ab771f32ca04a1ae..189712ce83643258dcce0756559e8f320c34d47b 100644 (file)
     <title>Membership Type Duration Unit</title>
     <type>varchar</type>
     <length>8</length>
+    <required>true</required>
     <comment>Unit in which membership period is expressed.</comment>
     <pseudoconstant>
       <callback>CRM_Core_SelectValues::membershipTypeUnitList</callback>