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

Wrong Contact linked to Mail Event on Bills when mass sending with at least one containing "external billing contact" #29659

Open
TedinfoRegis opened this issue May 13, 2024 · 0 comments
Labels
Bug This is a bug (something does not work as expected)

Comments

@TedinfoRegis
Copy link

Bug

When doing mass send by mail on bills : if one has a billing contact with mail address this contact will be linked to mail event generated
But after this if next bill aren't linked to a billing contact the last one found will be linked to mail event despite the fact it is not part of thirdparty

Reason found in core/actions_massactions.inc.php :
Near line 290 (in develop branch) : $contactidtosend is emptied only if $objectobj->element is "facture" AND if $listofobjectcontacts[$objectid] isn't empty

	} elseif ($objectobj->element == 'facture' && !empty($listofobjectcontacts[$objectid])) {
		$emails_to_sends = array();
		$objectobj->fetch_thirdparty();
		$contactidtosend = array();

But on next loop if $listofobjectcontacts[$objectid] is empty $contactidtosend is not emptied

Near line 601 (in develop branch) : $contactidtosend is used to link event generated

	$objectobj2->sendtoid = (empty($contactidtosend) ? 0 : $contactidtosend);

Workaround currently used :
Near line 316 (in develop branch) : empty $contactidtosend on default case

	} else {
		$contactidtosend = array();
		$objectobj->fetch_thirdparty();
		$sendto = $objectobj->thirdparty->email;
	}

Dolibarr Version

at least from 16 to develop

Environment PHP

No response

Environment Database

No response

Steps to reproduce the behavior and expected behavior

Have two bill
First one having a billing contact with mail address
Second one without billing contact but having thirdparty with mail address
Mass send bill by mail to this two bills in this order
The second bill will contain a event linked to firstbill contact

Attached files

No response

@TedinfoRegis TedinfoRegis added the Bug This is a bug (something does not work as expected) label May 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug This is a bug (something does not work as expected)
Projects
None yet
Development

No branches or pull requests

1 participant