From cf498a7c56d046ba8024f1134cb43b3ebec86f30 Mon Sep 17 00:00:00 2001 From: Luca Date: Mon, 12 Nov 2018 18:49:51 +0100 Subject: [PATCH] Completamento invio PEC --- modules/fatture/variables.php | 7 +++++-- src/Notifications/EmailNotification.php | 2 +- update/2_4_2.sql | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/modules/fatture/variables.php b/modules/fatture/variables.php index 610f54854..d05cfde83 100644 --- a/modules/fatture/variables.php +++ b/modules/fatture/variables.php @@ -2,15 +2,18 @@ $r = $dbo->fetchOne('SELECT *, (SELECT email FROM an_anagrafiche WHERE an_anagrafiche.idanagrafica=co_documenti.idanagrafica) AS email, - (SELECT pec FROM an_anagrafiche WHERE an_anagrafiche.idanagrafica=co_documenti.idanagrafica) AS pec + (SELECT pec FROM an_anagrafiche WHERE an_anagrafiche.idanagrafica=co_documenti.idanagrafica) AS pec, + (SELECT pec FROM zz_smtps WHERE zz_smtps.id='.$template['id_smtp'].') AS is_pec FROM co_documenti WHERE id='.prepare($id_record)); // Variabili da sostituire return [ - 'email' => $template['name'] == 'Fattura Elettronica' ? $r['pec'] : $r['email'], + 'email' => $r['is_pec'] ? $r['pec'] : $r['email'], 'id_anagrafica' => $r['idanagrafica'], 'numero' => empty($r['numero_esterno']) ? $r['numero'] : $r['numero_esterno'], 'note' => $r['note'], 'data' => Translator::dateToLocale($r['data']), 'id_anagrafica' => $r['idanagrafica'], ]; + + diff --git a/src/Notifications/EmailNotification.php b/src/Notifications/EmailNotification.php index 819027528..a6785164d 100644 --- a/src/Notifications/EmailNotification.php +++ b/src/Notifications/EmailNotification.php @@ -193,7 +193,7 @@ class EmailNotification extends Notification } /** - * Aggiunge un destinataro alla notifica. + * Aggiunge un destinatario alla notifica. * * @param string $value * @param string $type diff --git a/update/2_4_2.sql b/update/2_4_2.sql index df4613008..7fb864ee4 100644 --- a/update/2_4_2.sql +++ b/update/2_4_2.sql @@ -640,7 +640,7 @@ UPDATE `zz_group_module` SET `name` = 'Mostra ai clienti solo i propri impianti' -- Importazione dell'account email PEC -INSERT INTO `zz_smtps` (`id`, `name`, `note`, `server`, `port`, `username`, `password`, `from_name`, `from_address`, `encryption`, `pec`, `predefined`) VALUES (NULL, 'PEC aziendale', '', '', '', '', '', '', '', '', '1', '1'); +INSERT INTO `zz_smtps` (`id`, `name`, `note`, `server`, `port`, `username`, `password`, `from_name`, `from_address`, `encryption`, `pec`, `predefined`) VALUES (NULL, 'PEC aziendale', '', '', '', '', '', '', '', '', '1', '0'); INSERT INTO `zz_emails` (`id`, `id_module`, `id_smtp`, `name`, `icon`, `subject`, `reply_to`, `cc`, `bcc`, `body`, `read_notify`, `predefined`) VALUES (NULL, (SELECT `id` FROM `zz_modules` WHERE `name` = 'Fatture di vendita'), (SELECT `id` FROM `zz_smtps` WHERE `pec` = 1 LIMIT 0,1), 'PEC', 'fa fa-file', 'Invio fattura numero {numero} del {data}', '', 'sdi01@pec.fatturapa.it', '', '

Gentile Cliente,

\r\n

inviamo in allegato la fattura numero {numero} del {data}.

\r\n

 

\r\n

Distinti saluti

\r\n', '0', '0');