Skip to content

Commit

Permalink
TRUNK-6192 init method should be called once
Browse files Browse the repository at this point in the history
  • Loading branch information
dkayiwa committed Apr 29, 2024
1 parent 97360f6 commit e878c63
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions api/src/main/java/org/openmrs/layout/name/NameSupport.java
Expand Up @@ -64,8 +64,9 @@ private void init() {

if (nameTemplate != null) {
updateLayoutTemplates(nameTemplate);
initialized = true;
}

initialized = true;
}

/**
Expand Down Expand Up @@ -121,9 +122,6 @@ public boolean supportsPropertyName(String propertyName) {
*/
@Override
public void globalPropertyChanged(GlobalProperty newValue) {
if (!OpenmrsConstants.GLOBAL_PROPERTY_LAYOUT_NAME_TEMPLATE.equals(newValue.getPropertyValue())) {
return;
}

This comment has been minimized.

Copy link
@Ruhanga

Ruhanga May 3, 2024

Member

Hi @dkayiwa, thanks for the fix. But this can soon be catastrophic as, for which ever global property get's changed, that value gets updated as the value for OpenmrsConstants.GLOBAL_PROPERTY_LAYOUT_NAME_TEMPLATE.

There was this fix here part of the PR I'd made earlier, maybe can be a follow-on commit separately for the above commit,

https://github.com/openmrs/openmrs-core/pull/4586/files#diff-e90a7ebea383f369ad59af638163aea623fe04d6338aef4211ba3bc2c5bc2004R120-R121

This comment has been minimized.

Copy link
@Ruhanga

Ruhanga May 3, 2024

Member

After a second look, I think it's all fine. My worry is handled by the not seen supportsPropertyName() function. Sorry for the noise @dkayiwa...

NameTemplate nameTemplate = deserializeXmlTemplate(newValue.getPropertyValue());
if (nameTemplate != null) {
updateLayoutTemplates(nameTemplate);
Expand Down

0 comments on commit e878c63

Please sign in to comment.