bugness-chl / sendrecurringinvoicebymail

Dolibarr module to send recurring invoice by email
GNU General Public License v3.0
10 stars 3 forks source link

Sends email to random thirdparty with supplier invoices template #10

Closed jpardenoy closed 7 months ago

jpardenoy commented 7 months ago

When I create a supplier invoice template, it sends an email to a random thirdparty with the supplier invoice. It happens weither the template is set to draft or not. I have no form to stop it.

jpardenoy commented 7 months ago

I figured a quickfix myself but I don't know if it will work. In class/actions_sendrecurringinvoicebymail.class.php under line 86 $facturerec = $parameters['facturerec'];, add the code : if(!($facturerec instanceof FactureRec)){ return 0; }

If someone can confirm...?

bugness-chl commented 7 months ago

💥 Howie ! 🤕 Pretty bad bug, sorry : Dolibarr 16 reused the afterCreationOfRecurringInvoice hook for the suppliers' invoice templates but with a different table in the database. Thus, generated supplier's invoices are sent to the eventual customer which has a template with a matching the database's id...

Your fix seems great. I'll test it some more with old versions of Dolibarr and release it.

Thanks for the notice !