Skip to content

Conversation

@D3V41
Copy link
Contributor

@D3V41 D3V41 commented Oct 18, 2025

Problem

The email tool was crashing in non-Ontario regions (e.g., British Columbia) when users attempted to compose emails with attachments. This was caused by the system attempting to check for HRM (Hospital Report Manager) attachments, but non-Ontario regions don't have the _hrm security permission configured since HRM is Ontario-specific.

Solution

Added defensive checks:

  1. EmailComposeAction.java: Only prepare HRM attachments for Ontario regions

    if (OscarProperties.getInstance().isOntarioBillingRegion()) {
        emailAttachmentList.addAll(emailComposeManager.prepareHRMAttachments(loggedInInfo, attachedHRMDocuments));
    }
  2. EmailComposeManager.prepareHRMAttachments(): Return empty list instead of throwing exception
    - Check if Ontario region → if not, return empty list
    - Check if user has _hrm permission → if not, return empty list with warning log
    - Changed from throwing RuntimeException to graceful degradation

  3. HRMUtil.listHRMDocuments(): Added region and permission guards
    - Return empty list for non-Ontario regions
    - Return empty list when _hrm permission is missing (with warning log)

@kk-chung
Copy link
Contributor

kk-chung commented Oct 18, 2025

@D3V41 question --> since HRM is an ON specific thing, instead of a !BC thing, can you speak to why you're checking for not-British Columbia instead of checking for is-Ontario? I see that there's an ON equivalent function

public boolean isOntarioBillingRegion() {
return ( "ON".equals( getProperty("billregion") ) );
}

@D3V41
Copy link
Contributor Author

D3V41 commented Oct 18, 2025

@kk-chung That was a mistake on my part - I was initially thinking HRM just wasn’t present in BC and completely forgot it’s Ontario-specific. I’ve updated the code to check for the Ontario billing region instead and pushed the changes.

@D3V41 D3V41 changed the title Fix email tool crash in BC due to missing _hrm permission Fix email tool crash due to missing _hrm permission in non-Ontario regions Oct 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants