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

use object contact as priority in MAIN_MAIL_NO_WITH_TO_SELECTED #30143

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

rycks
Copy link
Contributor

@rycks rycks commented Jun 24, 2024

See #29759 : mail to is not auto selected, that is a "user bug" not a "code bug" -> develop ... maybe in 20.0 (or too late) ?

@@ -1096,7 +1097,7 @@ public function get_form($addfileaction = 'addfile', $removefileaction = 'remove
*/
public function getHtmlForTo()
{
global $langs, $form;
global $langs, $form, $object;
Copy link
Member

@eldy eldy Jun 24, 2024

Choose a reason for hiding this comment

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

Using $object as global variable has unpredicable results. ($object is often used by different purposes).
Also later having the selection of $withtoselected done inside the method breaks the idea of the component html.formmail.class.

So I suggest to add a proterty ->withtoselected into the component html.formmail.class that will be used to set $withtoselected if defined.
So the content of the preselected email can be set by the caller by setting ->withtoselected.
The code added into this method to set $withtoselected can then be moved into the caller to fill ->withtoselected.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok, i use global to be as close as possible with other dolibarr code, but that's a good news to avoid global object :)

@eldy eldy added the PR to fix or conflict to solve PR needs to be fixed to be integrated (except for conflicts, a comment describes the fix to do) label Jun 24, 2024
@rycks
Copy link
Contributor Author

rycks commented Jun 24, 2024

@eldy done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR to fix or conflict to solve PR needs to be fixed to be integrated (except for conflicts, a comment describes the fix to do)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants