diff --git a/modules/emails/actions.php b/modules/emails/actions.php index 67406a137..859455a10 100755 --- a/modules/emails/actions.php +++ b/modules/emails/actions.php @@ -40,6 +40,7 @@ switch (post('op')) { 'id_account' => post('smtp'), 'icon' => post('icon'), 'subject' => post('subject'), + 'tipo_reply_to' => post('tipo_reply_to'), 'reply_to' => post('reply_to'), 'cc' => post('cc'), 'bcc' => post('bcc'), diff --git a/modules/emails/edit.php b/modules/emails/edit.php index fd25b1b6b..5274530c4 100755 --- a/modules/emails/edit.php +++ b/modules/emails/edit.php @@ -59,14 +59,9 @@ if (!$record['predefined']) {
-
+
{[ "type": "text", "label": "", "name": "subject", "value": "$subject$" ]}
- -
- - {[ "type": "text", "label": "", "name": "icon", "value": "" ,"help":"" ]} -
@@ -79,7 +74,18 @@ if (!$record['predefined']) {
- {[ "type": "email", "label": "", "name": "reply_to", "value": "$reply_to$", "help": "" ]} + + {[ "type": "text", "label": "", "name": "icon", "value": "" ,"help":"" ]} +
+
+ +
+
+ {[ "type": "select", "label": "", "name": "tipo_reply_to", "values": "list=\"0\":\"Mittente (predefinito)\", \"email_user\":\"Email dell'utente che esegue l'invio\", \"email_fissa\":\"Destinatario fisso\"", "value": "$tipo_reply_to$", "help": "" ]} +
+ +
+ {[ "type": "email", "label": "", "name": "reply_to", "value": "$reply_to$", "help": "" ]}
@@ -96,7 +102,7 @@ echo '
- {[ "type": "select", "multiple": "1", "label": "'.tr('Stampe').'", "name": "prints[]", "value": "'.implode(',', $selected_prints).'", "values": "query=SELECT id, title AS text FROM zz_prints WHERE id_module = '.prepare($record['id_module']).' AND enabled=1" ]} + {[ "type": "select", "multiple": "1", "label": "'.tr('Stampe').'", "name": "prints[]", "value": "'.implode(',', $selected_prints).'", "values": "query=SELECT id, title AS text FROM zz_prints WHERE id_module = '.prepare($record['id_module']).' AND enabled=1 AND is_record=1" ]}
@@ -196,3 +202,21 @@ if (!empty($newsletters[0])) { + + \ No newline at end of file diff --git a/modules/emails/src/Mail.php b/modules/emails/src/Mail.php index 4af5c3a2d..ee49ada2f 100755 --- a/modules/emails/src/Mail.php +++ b/modules/emails/src/Mail.php @@ -225,8 +225,18 @@ class Mail extends Model $this->subject = $template->subject; // Reply To - if (!empty($template['reply_to'])) { - $this->options['reply_to'] = $template['reply_to']; + if (!empty($template['tipo_reply_to'])) { + $reply_to = ''; + if ($template['tipo_reply_to'] == 'email_fissa') { + $reply_to = $template['reply_to']; + } else { + $user = \Auth::user(); + $reply_to = $user->email; + } + + if (!empty($reply_to)) { + $this->options['reply_to'] = $reply_to; + } } // CC diff --git a/update/2_4_48.sql b/update/2_4_48.sql new file mode 100644 index 000000000..047b0172b --- /dev/null +++ b/update/2_4_48.sql @@ -0,0 +1,3 @@ +-- Aggiunta tipologia reply to +ALTER TABLE `em_templates` ADD `tipo_reply_to` VARCHAR(255) NOT NULL AFTER `subject`; +UPDATE `em_templates` SET `tipo_reply_to` = 'email_fissa' WHERE `reply_to` != ''; \ No newline at end of file