Fix: [ bug #1804 ] SQL error when sending email without addresee

This commit is contained in:
Marcos García de La Fuente 2015-01-17 18:12:43 +01:00
parent d1a0187f82
commit a64084308d
3 changed files with 13 additions and 5 deletions

View File

@ -52,6 +52,9 @@ http://www.fsf.org/licensing/licenses/index_html
Copyright
---------
Copyright (C) 2015
- Marcos García <marcosgdf@gmail.com>
Copyright (C) 2014
- Laurent Destailleur <eldy@users.sourceforge.net>
- Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>

View File

@ -7,6 +7,7 @@ English Dolibarr ChangeLog
- Fix: amarok is a bugged theme making dolidroid failed. We swith to eldy automatically with dolidroid.
- Fix: withdrawal create error if in the same month are deleted previus withdrawals.
- Fix: [ bug #1801 ] FAC_FORCE_DATE_VALIDATION constant alters supplier invoice date given to numeration modules
- Fix: [ bug #1804 ] SQL error when sending email without addresee
***** ChangeLog for 3.6.2 compared to 3.6.1 *****
- Fix: fix ErrorBadValueForParamNotAString error message in price customer multiprice.

View File

@ -9,6 +9,7 @@
* Copyright (C) 2010-2011 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2012-2013 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -404,20 +405,23 @@ if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! G
$langs->load('mails');
if ($object->id > 0) {
$receiver = GETPOST('receiver');
if ($_POST ['sendto']) {
// Le destinataire a ete fourni via le champ libre
$sendto = $_POST ['sendto'];
$sendtoid = 0;
} elseif ($_POST ['receiver'] != '-1') {
} elseif ($receiver !== "") {
// Recipient was provided from combo list
if ($_POST ['receiver'] == 'thirdparty') // Id of third party
if ($receiver == 'thirdparty') // Id of third party
{
$sendto = $object->client->email;
$sendtoid = 0;
} else // Id du contact
} elseif ($receiver != '-1') // Id du contact
{
$sendto = $object->client->contact_get_property($_POST ['receiver'], 'email');
$sendtoid = $_POST ['receiver'];
$sendto = $object->client->contact_get_property($receiver, 'email');
$sendtoid = $receiver;
}
}