Dolibarr / dolibarr

Dolibarr ERP CRM is a modern software package to manage your company or foundation's activity (contacts, suppliers, invoices, orders, stocks, agenda, accounting, ...). it's an open source Web application (written in PHP) designed for businesses of any sizes, foundations and freelancers.
https://www.dolibarr.org
GNU General Public License v3.0
5.51k stars 2.8k forks source link

Disappearance of a substitution variable when sending email to multiple recipients #31310

Open corent1lb opened 1 month ago

corent1lb commented 1 month ago

Bug

Some substitution variables when used in an email template are not displayed in the body of the email (when writing) when you send an email to several Third Parties via the invoice list

Dolibarr Version

20.0.0

Environment PHP

8.2.22

Environment Database

MariaDB 11.4.3

Steps to reproduce the behavior and expected behavior

When you are in the list of invoices, you check several invoices and click on "select an action" and click on "send email", if the selected mail template contains the variable "ONLINE_PAYMENT_URL" then when you apply this mail template, this variable is absent (I dont mean present in the body and then the recipient does not receive the link) from the body of the mail.

I use other variables in my mail template and it works correctly for the others, only this one is problematic.

Attached files

My email template : pic02

The email template when selected in invoices list : pic01

corent1lb commented 1 month ago

Une solution ?

corent1lb commented 1 week ago

Le bug est toujours présent dans la version 20.0.2

lemathou commented 1 week ago

You are writing "when you send an email to several Third Parties via the invoice list". In the default installation, I do not see the possibility to send invoices to each customer, but to send many invoices to destinations, using the group action "Send email".

One email will be send, containing all the invoices, for each email in the destination field. This does not send an email by invoice to each customer.

corent1lb commented 1 week ago

I mean when you check multiple invoices in invoices list, then you select "send an email" and it send email to the third party attached to the invoice checked. I described step by step how to reproduce the probleme :

"When you are in the list of invoices, you check several invoices and click on "select an action" and click on "send email", if the selected mail template contains the variable "ONLINE_PAYMENT_URL" then when you apply this mail template, this variable is absent (I dont mean present in the body and then the recipient does not receive the link) from the body of the mail."

lemathou commented 1 week ago

The functionnality is not the same for me :

You say : "I mean when you check multiple invoices ... and it send email to the third party attached to the invoice checked."

On my installation, this does not send an email "to the third party attached to the invoice checked". This send an email to the destination addresses you choose, with all the invoices checked attached at once.

lemathou commented 1 week ago

OK I think I am missing informations on my thirdparties, on a production instance, it seems to work as you describes... I look in more precisely.

corent1lb commented 1 week ago

This should be clearer with a screenshot : sdgfdsfg

lemathou commented 1 week ago

Yes this is what I am doing but on my fresh install for testing, I had not the same behaviour, soi I tried on a production instance and I can see exactly what you said, so now I am working on it.

lemathou commented 1 week ago

I fixed it, since version 16, when we do not click on "one email per recipient". https://github.com/Dolibarr/dolibarr/pull/31927 We shall wait the fix to be merged.

lemathou commented 6 days ago

@corent1lb Can you tell me if the fix solves your problem ?

corent1lb commented 6 days ago

Nope, it don't solve the problem and the modification in html.formmail.class.php cause an error 500 when I want to modify an email template

lemathou commented 6 days ago

On my fresh 20 I do not see an error... I have warnings (already there, not caused by the fix), but this is working. I tested modifying the template :

Can you send me a screen shot or at least more debugging information ?