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
*
* Generated from xml/schema/CRM/Member/MembershipStatus.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:62a534dbf9aed62f4d496939b44acf3d)
+ * (GenCodeChecksum:e60a982e078b6f3b7d14b16ea2139f14)
*/
/**
'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,
*
* Generated from xml/schema/CRM/Member/MembershipType.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:89dc1a77c01ca0255a2dad8637f5e835)
+ * (GenCodeChecksum:9cb69957096aad15ee7d55a4efceb53e)
*/
/**
'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',
namespace Civi\Financialacls;
+use Civi\Api4\Generic\Result;
use Civi\Api4\MembershipType;
// I fought the Autoloader and the autoloader won.
* @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();
<type>varchar</type>
<import>true</import>
<length>128</length>
+ <required>true</required>
<comment>Name for Membership Status</comment>
<add>1.5</add>
</field>
<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>