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.46k stars 2.79k forks source link

Extra files do not attach V13.0.1 #16420

Closed conformist66 closed 3 years ago

conformist66 commented 3 years ago

Bug

[When attaching extra files when sending invoices, the files do not actually attach despite the dialogue saying success]

Environment

Expected and actual behavior

[Expect additional files to attach to email but they do not attach/send despite saying they do]

Steps to reproduce the behavior

[from the send invoice (email) dialogue, ask to open and attach a file. The file requested does not attach despite saying success., This issue was not present in V13.0.0]

xbloq commented 3 years ago
  1. Dolibarr deleted all log and temporary files
  2. Restart apache
  3. Clean browser 4- Setup my user display to english
  4. Sent mail from my user
  5. Attach my file.check.pdf. File it's attached
  6. Send mail
  7. Received mail (All it's ok with my file enclosed)
  8. I go to sent new mail again (Two files send in first mail remain in mail form attached. They aren¡t deleted at the time that I sent mail. I can't delete file without name, If I delete my file_check.pdf two files are deleted at same time)
  9. Attach my file again. Send mail and received mail with my file OK again)
  10. Return to sent a new mail (Two files remain in mail form) ...

In my usual language settings when I upload the first time my file_check.pdf, two files are upload and then another problem. I don't know why it's different with my usual language

xbloq commented 3 years ago

image with two files Screenshot_20210227_102707

xbloq commented 3 years ago
  1. I go to sent new mail again (Now two files remain in mail form attached, my file_check.pdf send with mail and another file withoutname ...
daraelmin commented 3 years ago

In my usual language settings when I upload the first time my file_check.pdf, two files are upload and then another problem. I don't know why it's different with my usual language.

Hum... I don't use translation so...

Maybe the issue is linked to this. I'll check.

xbloq commented 3 years ago

thanks and sorry for my explain

daraelmin commented 3 years ago

I just add an other commit to my PR. It seems to be related.

if (GETPOST('mode', 'alpha') == 'init' && (GETPOSTISSET('modelmailselected') && GETPOST('modelmailselected', 'alpha') != '-1')) {

if (!empty($arraydefaultmessage->joinfiles) && is_array($this->param['fileinit'])) { foreach ($this->param['fileinit'] as $file) { $this->add_attached_files($file, basename($file), dol_mimetype($file)); } } }

instead of

if (GETPOST('mode', 'alpha') == 'init' || (GETPOST('modelmailselected', 'alpha') && GETPOST('modelmailselected', 'alpha') != '-1')) {

if (!empty($arraydefaultmessage->joinfiles) && is_array($this->param['fileinit'])) { foreach ($this->param['fileinit'] as $file) { $this->add_attached_files($file, basename($file), dol_mimetype($file)); } } }

On line 420 (develop branch).

Could you try?

xbloq commented 3 years ago

Work, only file_check.pdf upload, no more file without name, its OK-. But mail received hasn't file ¿?. When I return to formmail for a new mail only remain file_check.pdf no more file without name Note: In my html.formmail.class.php V13.0.1 it's line 385

xbloq commented 3 years ago

Ii I apply email template I received file also

xbloq commented 3 years ago

One time I applied

Ii I apply email template I received file also

One time I applied email template work also with default template

xbloq commented 3 years ago

Only one thing. The file that I sent remain if I return to sent another email. Should it be deleted automatically?

daraelmin commented 3 years ago

I can not test anymore, cause I'm in the bus.

But for attached mail withoit using template, I think we should use

if (GETPOST('mode', 'alpha') == 'init' && (GETPOSTISSET('modelmailselected') && !in_array(GETPOST('modelmailselected', 'alpha'), array('','0','-1')) )){

on both line (develop: 370 & 420 or for 13.0.1: 354 & 385)