From a64084308d2c58d1f4ef89520a611ca050e775a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Sat, 17 Jan 2015 18:12:43 +0100 Subject: [PATCH] Fix: [ bug #1804 ] SQL error when sending email without addresee --- COPYRIGHT | 3 +++ ChangeLog | 1 + htdocs/comm/propal.php | 14 +++++++++----- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/COPYRIGHT b/COPYRIGHT index ed8a667acc8..7457542f060 100644 --- a/COPYRIGHT +++ b/COPYRIGHT @@ -52,6 +52,9 @@ http://www.fsf.org/licensing/licenses/index_html Copyright --------- +Copyright (C) 2015 +- Marcos García + Copyright (C) 2014 - Laurent Destailleur - Raphaël Doursenaud diff --git a/ChangeLog b/ChangeLog index 2a49b467783..da95f296432 100644 --- a/ChangeLog +++ b/ChangeLog @@ -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. diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index 4929ee9c70e..57d2508aefe 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -9,6 +9,7 @@ * Copyright (C) 2010-2011 Philippe Grand * Copyright (C) 2012-2013 Christophe Battarel * Copyright (C) 2013-2014 Florian Henry + * Copyright (C) 2015 Marcos García * * 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; } }