1
0
mirror of https://github.com/devcode-it/openstamanager.git synced 2024-12-27 00:06:14 +01:00

Ricereca mail referente per sede in invio mail

This commit is contained in:
Matteo 2022-02-07 17:45:28 +01:00
parent 90563bf6b7
commit 1800fd2a9d

View File

@ -60,13 +60,13 @@ switch ($resource) {
$results = [];
// Tutti i referenti per questo cliente
$q = "SELECT DISTINCT(email), idanagrafica, nome AS ragione_sociale FROM an_referenti WHERE email != '' ".$where.' ORDER BY idanagrafica';
$q = "SELECT DISTINCT(email), (SELECT nomesede FROM an_sedi WHERE an_sedi.id=an_referenti.idsede) AS sede, idanagrafica, nome AS ragione_sociale FROM an_referenti WHERE email != '' ".$where.' ORDER BY idanagrafica';
$rs = $dbo->fetchArray($q);
foreach ($rs as $r) {
$results[] = [
'value' => $r['email'],
'label' => $r['ragione_sociale'].' <'.$r['email'].'>',
'label' => $r['ragione_sociale'].($r['sede']!=''?' ('.$r['sede'].')':'').' <'.$r['email'].'>',
];
}