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

Fix search data showing null #201

Merged
merged 1 commit into from
Sep 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -839,7 +839,7 @@ function OpenmrsSearch(div, showIncludeVoided, searchHandler, selectionHandler,
var cols = this.options.fieldsAndHeaders;
rRowData = $j.map(cols, function(c) {
var data = rowData[c.fieldName];
if(data == null)
Copy link
Member

Choose a reason for hiding this comment

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

Have you looked into why we did not have this problem originally without this change?

Copy link
Member Author

Choose a reason for hiding this comment

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

Now we return null as a string. I am not sure where we made that change though.

Copy link
Member

Choose a reason for hiding this comment

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

Can you try to locate where we made that change?

Copy link
Member Author

@wikumChamith wikumChamith Sep 30, 2024

Choose a reason for hiding this comment

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

This is what is causing the issue:

if (first) {
familyName = WebUtil.escapeHTML(pn.getFamilyName());
middleName = WebUtil.escapeHTML(pn.getMiddleName());
givenName = WebUtil.escapeHTML(pn.getGivenName());
first = false;

WebUtil.escapeHTML() converts null to a string.

This was introduced here: https://github.com/openmrs/openmrs-module-legacyui/pull/191/files

if(data == null || data === "null")
data = " ";
//Escape html
data = $j('<div/>').text(data).html();
Expand Down
Loading