Skip to content

Fix: Proper Saving and Refresh of All CPP Modules in Encounter Window#372

Merged
yingbull merged 2 commits intodevelop/coyotefrom
bugfix/cpp-notes-save-refresh-struts2
Jul 16, 2025
Merged

Fix: Proper Saving and Refresh of All CPP Modules in Encounter Window#372
yingbull merged 2 commits intodevelop/coyotefrom
bugfix/cpp-notes-save-refresh-struts2

Conversation

@D3V41
Copy link
Copy Markdown
Collaborator

@D3V41 D3V41 commented Jul 16, 2025

This PR addresses issues with the Social History (all CPP) notes not saving correctly within the Encounter Window. Specifically:

  • Notes were not being saved properly due to incorrect or missing data handling.

  • After saving a note, the corresponding div container in the UI was not refreshing as expected.

Fixes and Improvements:

  • Restored some critical code that was inadvertently removed in previous updates.

  • Ensured all relevant data is correctly passed and stored in the session.

  • Converted related code blocks to follow Struts 2 conventions properly.

  • Verified the UI refreshes correctly after note submission, reflecting the updated content.

Summary by Sourcery

Fix saving and UI refresh of all CPP modules in the Encounter Window by restoring missing logic, implementing session persistence, and converting to proper Struts 2 and JSTL conventions.

Bug Fixes:

  • Restore inadvertently removed code for handling CPP notes to ensure proper data storage and retrieval from session.
  • Fix post‐save UI refresh by redirecting the listCPPNotes result to a dynamic reloadUrl.
  • Correct session and request parameter handling to reliably read the method and providerNo during note operations.

Enhancements:

  • Implement SessionAware in CaseManagementEntry2Action to persist and restore form state across actions.
  • Update JSPs to use standard JSTL taglibs, fmt for i18n, and unified loops for local and remote notes display.
  • Refactor struts.xml to redirect to a reload URL after saving CPP notes.

D3V41 added 2 commits July 16, 2025 14:16
…gfix]

- Fixed saving issue for Social History (all CPP) notes
- Restored missing code required for correct session storage
- Passed data properly to backend and stored it correctly in session
- Ensured the note container div refreshes correctly after saving
- Refactored necessary logic to align with Struts 2 conventions
@sourcery-ai
Copy link
Copy Markdown

sourcery-ai bot commented Jul 16, 2025

Reviewer's Guide

This PR restores missing data handling, refactors JSP views to use JSTL/Struts2 conventions, enhances session management in action classes (implementing SessionAware with form state restoration and reloadUrl support), and updates Struts redirects to ensure Social History CPP notes persist correctly and the UI refreshes appropriately after save.

Sequence diagram for saving a Social History (CPP) note and UI refresh

sequenceDiagram
    actor User
    participant EncounterWindow as Encounter Window (JSP/UI)
    participant EntryAction as CaseManagementEntry2Action
    participant Struts as Struts2 Framework
    participant Session as Session
    participant ViewAction as CaseManagementView2Action
    participant DB as Database

    User->>EncounterWindow: Add/Edit Social History note
    EncounterWindow->>EntryAction: Submit form (save note)
    EntryAction->>Session: Restore form state from session
    EntryAction->>DB: Save note data
    EntryAction->>Session: Update session with new state
    EntryAction->>Struts: Return "listCPPNotes" result with reloadUrl
    Struts->>EncounterWindow: Redirect to reloadUrl (CaseManagementView)
    EncounterWindow->>ViewAction: Load updated notes
    ViewAction->>DB: Fetch updated notes
    ViewAction->>EncounterWindow: Render refreshed notes UI
    EncounterWindow->>User: Display updated notes
Loading

File-Level Changes

Change Details Files
Refactor JSPs to JSTL/Struts2 conventions, removing legacy scriptlets
  • Replaced direct scriptlet taglib imports with JSTL , , and EL in viewNotes.jsp
  • Removed old form in ChartNotes.jsp and added proper form id and naming
  • Fixed conditional display and link generation in noteIssueList.jsp to use EL for boolean checks
src/main/webapp/casemgmt/viewNotes.jsp
src/main/webapp/casemgmt/ChartNotes.jsp
src/main/webapp/casemgmt/noteIssueList.jsp
Restore and unify CPP note data handling and UI rendering
  • Reintroduced hidden inputs and index mapping for JSP note items
  • Rebuilt note and noteExts processing logic (HTML escaping, partial date, additional data)
  • Applied alternating row styles and conditional single-line/truncate behavior based on user property
src/main/webapp/casemgmt/viewNotes.jsp
Enhance action classes for session-based form state and reload URL support
  • Implemented SessionAware in CaseManagementEntry2Action, adding mySessionMap, setSession, and restoreFromSession
  • Moved form bean state into session map and restored issue check lists on entry
  • Introduced reloadUrl property with getter/setter and unified method parameter handling in both Entry2Action and View2Action
src/main/java/org/oscarehr/casemgmt/web/CaseManagementEntry2Action.java
src/main/java/org/oscarehr/casemgmt/web/CaseManagementView2Action.java
Update Struts configuration and forward logic to use redirect with reloadUrl
  • Changed listCPPNotes result to type=redirect referencing reloadUrl
  • Added providerNo parameter to forward.jsp redirect URL
  • Unified method routing in struts.xml to respect reloadUrl for correct post-save navigation
src/main/webapp/WEB-INF/classes/struts.xml
src/main/webapp/casemgmt/forward.jsp

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@yingbull yingbull requested review from Copilot and yingbull July 16, 2025 18:52
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes issues with CPP module note saving and UI refresh in the Encounter Window by implementing proper session management, converting JSP code to use JSTL conventions, and ensuring reliable parameter handling.

  • Implements SessionAware interface for proper form state persistence across actions
  • Converts JSP templates from mixed scriptlet/JSTL code to standardized JSTL approach with proper i18n support
  • Adds dynamic redirect URL configuration for post-save UI refresh

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
viewNotes.jsp Major refactor from JSTL/EL to scriptlet approach for note display logic
noteIssueList.jsp Fixes property access path for issue usage check
forward.jsp Adds providerNo parameter to redirect URL
ChartNotes.jsp Moves form declaration and adds proper form naming
struts.xml Changes listCPPNotes result to dynamic redirect with reloadUrl parameter
CaseManagementView2Action.java Adds fallback method parameter retrieval from request attributes
CaseManagementEntry2Action.java Implements SessionAware interface and adds session-based form state management

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.

3 participants