Skip to main content
deleted 991 characters in body
Source Link
Pradeep Nayak
  • 24.7k
  • 1
  • 14
  • 34
From bfe24843d8c01578a8979f87807b6b4284d26f0e Mon Sep 17 00:00:00 2001
From: Pradeep Nayak <[email protected]>
Date: Mon, 4 Dec 2023 06:58:20 +0000
Subject: [PATCH] Update civicrm_group_roles.module

---
 modules/civicrm_group_roles/civicrm_group_roles.module | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/modules/civicrm_group_roles/civicrm_group_roles.module b/modules/civicrm_group_roles/civicrm_group_roles.module
index d760178..917d5b0 100644
--- a/modules/civicrm_group_roles/civicrm_group_roles.module
+++ b/modules/civicrm_group_roles/civicrm_group_roles.module
@@ -583,7 +583,7 @@ function civicrm_group_roles_add_rule_form_submit($form, &$form_state) {
   // If edit_flag is not set then get next highest number.
   $config = config('civicrm_group_roles.settings');
   if (empty($form_state['values']['edit_flag'])) {
-    $id = max(array_keys($config->get('rules'))) + 1;
+    $id = max(array_keys(($config->get('rules') ?? []))) + 1;
   }
   else {
     $id = (int) $form_state['values']['edit_flag'];

Regression from recent changes in https://github.com/civicrm/civicrm-backdrop/pull/150

Fix: https://github.com/civicrm/civicrm-backdrop/pull/169/files

Patch: https://patch-diff.githubusercontent.com/raw/civicrm/civicrm-backdrop/pull/169.patch

From bfe24843d8c01578a8979f87807b6b4284d26f0e Mon Sep 17 00:00:00 2001
From: Pradeep Nayak <[email protected]>
Date: Mon, 4 Dec 2023 06:58:20 +0000
Subject: [PATCH] Update civicrm_group_roles.module

---
 modules/civicrm_group_roles/civicrm_group_roles.module | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/modules/civicrm_group_roles/civicrm_group_roles.module b/modules/civicrm_group_roles/civicrm_group_roles.module
index d760178..917d5b0 100644
--- a/modules/civicrm_group_roles/civicrm_group_roles.module
+++ b/modules/civicrm_group_roles/civicrm_group_roles.module
@@ -583,7 +583,7 @@ function civicrm_group_roles_add_rule_form_submit($form, &$form_state) {
   // If edit_flag is not set then get next highest number.
   $config = config('civicrm_group_roles.settings');
   if (empty($form_state['values']['edit_flag'])) {
-    $id = max(array_keys($config->get('rules'))) + 1;
+    $id = max(array_keys(($config->get('rules') ?? []))) + 1;
   }
   else {
     $id = (int) $form_state['values']['edit_flag'];

Regression from recent changes in https://github.com/civicrm/civicrm-backdrop/pull/150

Source Link
Pradeep Nayak
  • 24.7k
  • 1
  • 14
  • 34

From bfe24843d8c01578a8979f87807b6b4284d26f0e Mon Sep 17 00:00:00 2001
From: Pradeep Nayak <[email protected]>
Date: Mon, 4 Dec 2023 06:58:20 +0000
Subject: [PATCH] Update civicrm_group_roles.module

---
 modules/civicrm_group_roles/civicrm_group_roles.module | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/modules/civicrm_group_roles/civicrm_group_roles.module b/modules/civicrm_group_roles/civicrm_group_roles.module
index d760178..917d5b0 100644
--- a/modules/civicrm_group_roles/civicrm_group_roles.module
+++ b/modules/civicrm_group_roles/civicrm_group_roles.module
@@ -583,7 +583,7 @@ function civicrm_group_roles_add_rule_form_submit($form, &$form_state) {
   // If edit_flag is not set then get next highest number.
   $config = config('civicrm_group_roles.settings');
   if (empty($form_state['values']['edit_flag'])) {
-    $id = max(array_keys($config->get('rules'))) + 1;
+    $id = max(array_keys(($config->get('rules') ?? []))) + 1;
   }
   else {
     $id = (int) $form_state['values']['edit_flag'];

Regression from recent changes in https://github.com/civicrm/civicrm-backdrop/pull/150