-
Notifications
You must be signed in to change notification settings - Fork 13
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
Display "Not defined" in listing for patients without MRN set #84
Conversation
url, value=mrn) | ||
mrn = obj.getMRN() | ||
if not mrn: | ||
item["before"]["mrn"] = self.icon_tag("info", width=16) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just use the get_image
function to get the info icon tag:
https://github.com/senaite/senaite.core/blob/2.x/src/bika/lims/utils/__init__.py#L709-L727
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed with 3c6d98a
"""Returns the translated message | ||
""" | ||
ts = api.get_tool("translation_service") | ||
return ts.translate(message) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you should pass in here the context
and request
as well to make it work in different languages.
Also see Products.CMFPlone.TranslationServiceTool.TranslationServiceTool.translate
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that Plone's ts ultimately relies on Zope's i18n translate
function. And if the message passed in is from type Message
, i18n gives priority to the domain and other info set at Message
level, regardless of what you pass through kwargs: https://github.com/zopefoundation/zope.i18n/blob/bb0b8d2ee88a1e280cc86d858e7a2524ba0dc8d9/src/zope/i18n/__init__.py#L164-L170
Since we always rely on our own add-on MessageFactory
, the domain is always assigned to the message and therefore, there is no need to explicitely pass the domain. However, I agree is always a good idea to be consistent, so I added a translate
function (that we could eventually port to senaite.core
and replace the existing utils.t
): 3c6d98a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[..] that we could eventually port to senaite.core and replace the existing utils.t): 3c6d98a
Done with senaite/senaite.core#2389
Description of the issue/feature this PR addresses
When the configuration option "Require Medical Record Number (MRN)" is disabled, the "MRN" field in Patient add/edit view is not required and therefore, Patient objects with empty MRN can be created. In those cases, the internal ID of the patient is displayed in the patients listing.
This Pull Request displays "Not defined" instead of the object internal ID for patients with an empty MRN.
Current behavior before PR
Patient internal id is displayed as MRN in listing for patients without MRN set.
Desired behavior after PR is merged
"Not defined", along with an alert is displayed as MRN in listing for patients without MRN set
--
I confirm I have tested this PR thoroughly and coded it according to PEP8
and Plone's Python styleguide standards.