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: Fix Nation Notes unable to share templates #7144

Merged
merged 3 commits into from
Jan 5, 2024

Conversation

sjpadgett
Copy link
Member

@sjpadgett sjpadgett commented Jan 5, 2024

  • add preventdefault to keep form from submitting on button
  • fix numerous php warnings
  • fix sql query error for orphan query
  • some restyle for colors

This picks up from PR #7130

Fixes #7129

- add prevent default to keep form from submitting on button
- fix numerous php warnings
- fix sql query error for orphan query
- some restyle for colors
@sjpadgett
Copy link
Member Author

I still need to fix text template to allow template created in nation notes and vica versa.

@sjpadgett
Copy link
Member Author

@juggernautsei I thought you were testing NN and not Text Notes.
Concerning authUserID in search for context in TN I prevent using component created in NN in TN because I thought because of text limitation in TN there might be issues with stylings. Turns out thats not true so I'm going to allow for this PR.
I wish you'd have mention using TN in your PR....

- adjust dialog
- fix escape for attr from htmlspecialchar refactor
@stephenwaite stephenwaite changed the title Fix Nation Notes unable to share templates fix: Fix Nation Notes unable to share templates Jan 5, 2024
@sjpadgett
Copy link
Member Author

sjpadgett commented Jan 5, 2024

@juggernautsei This is testing very well for me. I'm glad you brought up sharing templates between NN and TN which I now allow. Would have done sooner if it was brought up.
Sharing between users is working well also where you can now select context, users and right panel now sticks. I have hundreds of templates on my dev server so it is a pretty good test but let me know if your client finds issues.

@stephenwaite
Copy link
Member

excited_elephant

@sjpadgett sjpadgett merged commit 9e7ce34 into openemr:master Jan 5, 2024
24 checks passed
@sjpadgett sjpadgett deleted the nn_fix branch January 5, 2024 15:02
sjpadgett added a commit to sjpadgett/openemr that referenced this pull request Jan 5, 2024
* Fix Nation Notes unable to share templates
- add prevent default to keep form from submitting on button
- fix numerous php warnings
- fix sql query error for orphan query
- some restyle for colors

* - add allow share templaes between NN and Text Notes
- adjust dialog
- fix escape for attr from htmlspecialchar refactor

* - fix component list to match theming

(cherry picked from commit 9e7ce34)
@sjpadgett
Copy link
Member Author

fyi just cherry picked to v7.0.2 for next patch

echo "<textarea name='item' id='item' class='w-100'></textarea><br />";
echo "<input type='button' name='save' value='" . htmlspecialchars(xl('Save'), ENT_QUOTES) . "' onclick='save_item()'><input type='button' name='cancel' value='" . htmlspecialchars(xl('Cancel'), ENT_QUOTES) . "' onclick=cancel_item('" . htmlspecialchars($row['cl_list_slno'], ENT_QUOTES) . "')></div></li>";
echo "<textarea name='item' id='item' class='w-100 bg-dark text-light'></textarea><br />";
echo "<input type='button' name='save' value='" . htmlspecialchars(xl('Save'), ENT_QUOTES) . "' onclick='save_item()'><input type='button' name='cancel' value='" . htmlspecialchars(xl('Cancel'), ENT_QUOTES) . "' onclick=cancel_item('" . attr_js($row['cl_list_slno'] ?? '') . "')></div></li>";
Copy link
Member

@bradymiller bradymiller Jan 6, 2024

Choose a reason for hiding this comment

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

should drop the outside ' around the attr_js call
(nice when i get to provide some escaping input every once i awhile to feel useful :) )

Copy link
Member Author

Choose a reason for hiding this comment

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

it's fine Brady catch as catch can!:)
Maybe @stephenwaite can add this to his PR though I disagree it is needed. Again, inspect it in browser.

Copy link
Member

Choose a reason for hiding this comment

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

@sjpadgett , Current codebase doesn't have the ' in all the calls and have not seen issue with this yet. Is there a use case where this breaks?

Copy link
Member Author

Choose a reason for hiding this comment

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

Last issue I had was in one of my modules. I believe it was ringcentral but no matter. In this use case I suppose it doesn't matter but in the case where passing a string or an int was my issue I believe. Still either way it will parse and render the same up to the browser. I don't have an explanation for that!
I'll use it the way you intended though.

Copy link
Member

@bradymiller bradymiller Jan 7, 2024

Choose a reason for hiding this comment

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

Sounds good. Note in the special case of an int, attr_js will not add an ' (json_encode does not add surrounding quote to int), which would be a reason not to also hard-code quotes around this function (since would then convert an int to a string).

<?php
if (AclMain::aclCheckCore('nationnotes', 'nn_configure')) {
?>
<a href="add_template.php?list_id=<?php echo attr($_REQUEST['list_id']); ?>" onclick="top.restoreSession();" class="iframe_small btn btn-primary" title="<?php echo text(xl('Add Category')); ?>"><?php echo text(xl('Add Category')); ?></a>
Copy link
Member

Choose a reason for hiding this comment

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

attr instead of text for title attribute

<?php
if (AclMain::aclCheckCore('nationnotes', 'nn_configure')) {
?>
<a href="add_context.php" class="iframe_medium btn btn-primary" onclick="top.restoreSession();" title="<?php echo text(xl('Add Context')); ?>"><?php echo text(xl('Add Context')); ?></a>
Copy link
Member

Choose a reason for hiding this comment

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

attr instead of text for title attribute

<?php
$where = '';
if ($filter_context ?? null) {
$where .= " AND cl_list_id='" . $filter_context . "'";
Copy link
Member

Choose a reason for hiding this comment

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

bookmarking this for issue

Copy link
Member Author

Choose a reason for hiding this comment

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

Really should be bound but this is why I hate touching these old scripts, everything needs to be done to them....
Again i'd appreciate if @stephenwaite would fix these or it will have to wait for my next PR

@bradymiller
Copy link
Member

tenor99

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.

bug: Unable to share templates in nations note
3 participants