. */ use Modules\Emails\Template; include_once __DIR__.'/core.php'; $template = Template::find(get('id')); $module = $template->module; $smtp = $template->account; $body = $module->replacePlaceholders($id_record, $template['body']); $subject = $module->replacePlaceholders($id_record, $template['subject']); $email = $module->replacePlaceholders($id_record, '{email}'); $id_anagrafica = $module->replacePlaceholders($id_record, '{id_anagrafica}'); // Campi mancanti $campi_mancanti = []; if (empty($smtp['from_address'])) { $campi_mancanti[] = tr('Mittente'); } if (empty($smtp['server'])) { $campi_mancanti[] = tr('Server SMTP'); } if (empty($smtp['port'])) { $campi_mancanti[] = tr('Porta'); } if (sizeof($campi_mancanti) > 0) { echo '
'.tr("Prima di procedere all'invio completa: _VALUES_", [ '_VALUES_' => ''.implode(', ', $campi_mancanti).'', ]).'
'.Modules::link('Account email', $smtp['id'], tr('Vai alla scheda account email'), null).'
'; } // Form echo '

'.tr('Mittente').': '.$smtp['from_name'].' <'.$smtp['from_address'].'>

'; if (!empty($template['cc'])) { echo '

'.tr('CC').': '.$template['cc'].'

'; } if (!empty($template['bcc'])) { echo '

'.tr('CCN').': '.$template['bcc'].'

'; } echo ' '.tr('Destinatari').'
{[ "type": "email", "name": "destinatari[0]", "value": "'.$email.'", "icon-before": "choice|email", "extra": "onkeyup=\'aggiungi_destinatario();\'", "class": "destinatari", "required": 1 ]}

{[ "type": "text", "label": "'.tr('Oggetto').'", "name": "subject", "value": "'.$subject.'", "required": 1 ]}
{[ "type": "checkbox", "label": "'.tr('Richiedi notifica di lettura').'", "name": "read_notify", "value": "'.$template['read_notify'].'" ]}
'; // Stampe $selected_prints = $dbo->fetchArray('SELECT id_print FROM em_print_template WHERE id_template = '.prepare($template['id'])); $selected = array_column($selected_prints, 'id_print'); echo '
{[ "type": "select", "multiple": "1", "label": "'.tr('Stampe').'", "name": "prints[]", "value": "'.implode(',', $selected).'", "values": "query=SELECT id, title AS text FROM zz_prints WHERE id_module = '.prepare($id_module).' AND enabled=1" ]}
'; $uploads = []; if ($template['name'] == 'Fattura Elettronica') { $uploads = $dbo->fetchArray('SELECT id FROM zz_files WHERE id_module = '.prepare($module['id']).' AND id_record = '.prepare($id_record).' AND category = \'Fattura Elettronica\''); $uploads = array_column($uploads, 'id'); } // Allegati echo '
{[ "type": "select", "multiple": "1", "label": "'.tr('Allegati').'", "name": "uploads[]", "value": "'.implode(',', $uploads).'", "help": "'.tr('Allegati del documento o caricati nell\'anagrafica dell\'azienda.').'", "values": "query=SELECT id, name AS text FROM zz_files WHERE id_module = '.prepare($id_module).' AND id_record = '.prepare($id_record)." UNION SELECT id, CONCAT(name, ' (Azienda)') AS text FROM zz_files WHERE id_module = ".prepare(Modules::get('Anagrafiche')['id'])." AND id_record = (SELECT valore FROM zz_settings WHERE nome = 'Azienda predefinita')\"]}
"; echo '
{[ "type": "ckeditor", "label": "'.tr('Contenuto').'", "name": "body", "id": "body_'.rand(0, 999).'", "value": '.json_encode($body).' ]}
'; echo '
'; echo ' '; echo ' '; echo ' ';