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

CLOSE|Close #29274 Add possibility to have different mail for autocopy for holiday #29275

Merged
merged 4 commits into from
Apr 8, 2024

Conversation

lunoshist
Copy link
Contributor

Add possibility to have several mail for autocopy,
Let me explain myself, it's currently possible to define a mail added in hidden copy each time a mail is send via dolibarr in Home > Setup > Mails > Others options. What I want to add is the possibility to change this email according to the situation.
Use case

Here is an example to better understand:
Until now, this email was set up on commercial@my-compagny.com, but I recently added the holiday module manage leaves and my emails were polluted by leave requests and validation, so I need to be able to set up many emails.

This feature is necessary for large companies that have different services to manage the commercial side, human resource management... and where each service has its own email address

@eldy
Copy link
Member

eldy commented Apr 8, 2024

I seems there is already a feature to allow MAIN_MAIL_AUTOCOPY according to module
MAIN_MAIL_AUTOCOPY_TO is for everywhere
MAIN_MAIL_AUTOCOPY_XXX_TO is for module XXX

For example
MAIN_MAIL_AUTOCOPY_INVOICE_TO
MAIN_MAIL_AUTOCOPY_ORDER_TO
MAIN_MAIL_AUTOCOPY_SHIPMENT_TO
MAIN_MAIL_AUTOCOPY_PROJECT_TO
...

You should have a look at how it is done for existing case and see how to reproduce the same mecanism for holiday...
It seems the autocopy is propagated to CMailfile into $sendtobcc with this line of code by the caller

			// Autocomplete the $sendtobcc
			// $autocopy can be MAIN_MAIL_AUTOCOPY_PROPOSAL_TO, MAIN_MAIL_AUTOCOPY_ORDER_TO, MAIN_MAIL_AUTOCOPY_INVOICE_TO, MAIN_MAIL_AUTOCOPY_SUPPLIER_PROPOSAL_TO...
			if (!empty($autocopy)) {
				$sendtobcc .= (getDolGlobalString($autocopy) ? (($sendtobcc ? ", " : "") . getDolGlobalString($autocopy)) : '');
			}

So can you do the same for holiday ?

@eldy eldy added the PR to fix - See feedback in comments PR needs to be fixed to be integrated (some comments should describes the fix to do) label Apr 8, 2024
@lunoshist
Copy link
Contributor Author

You're right, what I had done was complex for nothing simply add getDolGlobalString('MAIN_MAIL_AUTOCOPY_HOLIDAY_TO') in the function call was enough

@lunoshist lunoshist changed the title CLOSE|Close #29274 Add possibility to have several mail for autocopy CLOSE|Close #29274 Add possibility to have different mail for autocopy for holiday Apr 8, 2024
@eldy eldy merged commit 4aca061 into Dolibarr:develop Apr 8, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR to fix - See feedback in comments PR needs to be fixed to be integrated (some comments should describes the fix to do)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants