Project60 / org.project60.membership

CiviCRM extension to facilitate the "European" membership concept
GNU Affero General Public License v3.0
6 stars 14 forks source link

Custom fields are not displayed on the configuration page #50

Open twinkelicious opened 3 years ago

twinkelicious commented 3 years ago

I had some struggle to configure the Membership Nr. integration of this Extension.

I wasn't able to select any custom fields in the drop down menu for membership_number_field on the configuration page civicrm/admin/setting/membership - different settings of the custom fields or their groups doesn't had any effect on this.

While troubleshooting, i noticed that the selection for this menu ist restricted in line 329 of the MembershipExtension.php (org.project60.membership/CRM/Admin/Form/Setting) by 'is_view' => 0,. But in my MySQL database the value for "is_view" was set as NULL instead of 0. Only after I manually set the value for my desired field in the database to 0 it was displayed on the configuration page.

CiviCRM Verion 5.36.1 WordPress Version 5.7.1 Project60 Membership Extension Version 0.6.2 MySQL-Version 5.7

bjendres commented 3 years ago

Thanks for reporting @twinkelicious. The line you're referring to is HERE - just so people in the future will know what we're talking about.

That's very interesting: this seems to be a mistake. The documentation asks for a read-only field, so it should ask for

'is_view' => 1

to start with. Could you change that in your setup and see whether that works for you with read-only fields? Or do you have any objections?

twinkelicious commented 3 years ago

That's very interesting: this seems to be a mistake. The documentation asks for a read-only field, so it should ask for

'is_view' => 1

Oh yeah. I didn't notice this mistake before.

After changing this line in my MembershipExtension.php, I can actually select the appropriate fields if they are configured as read-only.

But in my opinion I don't see any need to limit the user in the field selection here. Perhaps some users would like to have the option of having a changeable field here. At least the German-language help-popup for this field selection does not say that the field has to be read-only.

mmgit commented 3 years ago

I see the same problem for the 'annual_amount_field' see here. I think it should be 'is_view' => $read_only ? '1' : NULL,

bjendres commented 3 years ago

I agree, there is a couple of (logical?) flaws in this pre-selection. Some of it was on purpose and needs to be documented (e.g. in a help bubble), some are just wrong. I won't be able to adjust this any time soon, as I'm going on holiday soon, but PRs are very welcome.