diff --git a/modules/contratti/variables.php b/modules/contratti/variables.php
index b32e3a6c0..fb7706dcf 100755
--- a/modules/contratti/variables.php
+++ b/modules/contratti/variables.php
@@ -17,7 +17,7 @@
* along with this program. If not, see .
*/
-$r = $dbo->fetchOne('SELECT *,
+$r = $dbo->fetchOne('SELECT *, co_contratti.idanagrafica,
IF( (an_referenti.email IS NOT NULL AND an_referenti.email!=""), an_referenti.email, an_anagrafiche.email) AS email,
an_anagrafiche.ragione_sociale
FROM co_contratti INNER JOIN an_anagrafiche ON co_contratti.idanagrafica=an_anagrafiche.idanagrafica LEFT OUTER JOIN an_referenti ON an_referenti.id=co_contratti.idreferente WHERE co_contratti.id='.prepare($id_record));
diff --git a/modules/ordini/variables.php b/modules/ordini/variables.php
index 429975a67..20b0492c6 100755
--- a/modules/ordini/variables.php
+++ b/modules/ordini/variables.php
@@ -17,7 +17,7 @@
* along with this program. If not, see .
*/
-$r = $dbo->fetchOne('SELECT *,
+$r = $dbo->fetchOne('SELECT *, or_ordini.idanagrafica,
IF( (an_referenti.email IS NOT NULL AND an_referenti.email!=""), an_referenti.email, an_anagrafiche.email) AS email
FROM or_ordini INNER JOIN an_anagrafiche ON an_anagrafiche.idanagrafica=or_ordini.idanagrafica LEFT OUTER JOIN an_referenti ON an_referenti.id=or_ordini.idreferente WHERE or_ordini.id='.prepare($id_record));
diff --git a/modules/preventivi/variables.php b/modules/preventivi/variables.php
index 3a56a7398..b2b01564c 100755
--- a/modules/preventivi/variables.php
+++ b/modules/preventivi/variables.php
@@ -18,7 +18,7 @@
*/
$r = $dbo->fetchOne('SELECT *,
- an_anagrafiche.ragione_sociale,
+ an_anagrafiche.ragione_sociale, co_preventivi.idanagrafica,
IF( (an_referenti.email IS NOT NULL AND an_referenti.email!=""), an_referenti.email, an_anagrafiche.email) AS email
FROM co_preventivi INNER JOIN an_anagrafiche ON co_preventivi.idanagrafica=an_anagrafiche.idanagrafica LEFT OUTER JOIN an_referenti ON an_referenti.id=co_preventivi.idreferente WHERE co_preventivi.id='.prepare($id_record));