Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Smarty warning about missing contact subtype on New Individual #21410

Merged
merged 1 commit into from
Sep 8, 2021

Conversation

demeritcowboy
Copy link
Contributor

Overview

It's not unusual to have zero contact subtypes defined.

Before

Turn on Enable Debugging.

Notice: Trying to access array offset on value of type null in include() (line 89 of ...\templates_c\en_US%%FD\FD4\FD4493C8%%Individual.tpl.php).
Notice: Undefined index: contact_sub_type in include() (line 91 of ...\templates_c\en_US%%FD\FD4\FD4493C8%%Individual.tpl.php).
Notice: Trying to access array offset on value of type null in include() (line 91 of ...\templates_c\en_US%%FD\FD4\FD4493C8%%Individual.tpl.php).
Notice: Undefined index: prefix in include() (line 11 of ...\templates_c\en_US%%B2\B2F\B2F0EF90%%ContactReference.tpl.php).

After

Technical Details

The field gets skipped over here:

$subtypes = CRM_Contact_BAO_Contact::buildOptions('contact_sub_type', 'create', ['contact_type' => $this->_contactType]);

And I can't see any other reason for the javascript since the field doesn't exist for it to act on.

Comments

@civibot
Copy link

civibot bot commented Sep 8, 2021

(Standard links)

@civibot civibot bot added the master label Sep 8, 2021
@colemanw
Copy link
Member

colemanw commented Sep 8, 2021

Hard to say how and why the code was written like that, but sometimes people do things "the hard way" due to lack of awareness of better alternatives. That's as good a theory as any.

@demeritcowboy
Copy link
Contributor Author

It's a good theory.
I just noticed this <table> has a variable number of columns per row which might explain why it's always looked weird to me and never seems to "fit".

@eileenmcnaughton eileenmcnaughton merged commit bdd7b49 into civicrm:master Sep 8, 2021
@demeritcowboy demeritcowboy deleted the smarty-individual branch September 9, 2021 00:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants