Fix fatal on Manage Extensions caused by financialacls links
authorMathieu Lu <mathieu@symbiotic.coop>
Sat, 2 Sep 2023 18:02:07 +0000 (14:02 -0400)
committerMathieu Lu <mathieu@symbiotic.coop>
Sat, 2 Sep 2023 18:09:24 +0000 (14:09 -0400)
ext/financialacls/financialacls.php

index 41992b8a5aaaa78a6c40e6dbcb49a9db6426a298..0e079fe4010b8fa259ba8ce2d279f73c7b01841f 100644 (file)
@@ -384,7 +384,13 @@ function financialacls_civicrm_alterMenu(array &$menu): void {
   $menu['civicrm/admin/financial/financialType']['access_arguments'] = [['administer CiviCRM Financial Types']];
 }
 
-function financialacls_civicrm_links(string $op, ?string $objectName, ?int $objectID, array &$links, ?int &$mask, array &$values) {
+/**
+ * Hide edit/enable/disable links for memberships of a given Financial Type
+ * Note: The $objectID param can be an int, string or null, hence not typed
+ *
+ * Implements hook_civicrm_links()
+ */
+function financialacls_civicrm_links(string $op, ?string $objectName, $objectID, array &$links, ?int &$mask, array &$values) {
   if ($objectName === 'MembershipType') {
     $financialType = CRM_Core_PseudoConstant::getName('CRM_Member_BAO_MembershipType', 'financial_type_id', CRM_Member_BAO_MembershipType::getMembershipType($objectID)['financial_type_id']);
     $hasEditPermission = CRM_Core_Permission::check('edit contributions of type ' . $financialType);