mirror of
https://github.com/devcode-it/openstamanager.git
synced 2025-02-17 12:00:46 +01:00
Compare commits
3 Commits
b110f2bc3b
...
4e7802a4ea
Author | SHA1 | Date | |
---|---|---|---|
|
4e7802a4ea | ||
|
0dbd5040f0 | ||
|
8c5a99400d |
@ -44,8 +44,10 @@ class SollecitoTask extends Manager
|
|||||||
public function execute()
|
public function execute()
|
||||||
{
|
{
|
||||||
if (setting('Invio solleciti in automatico') > 0) {
|
if (setting('Invio solleciti in automatico') > 0) {
|
||||||
|
$giorni_promemoria = setting('Intervallo di giorni in anticipo per invio promemoria scadenza');
|
||||||
$giorni_scadenza = setting('Ritardo in giorni della scadenza della fattura per invio sollecito pagamento');
|
$giorni_scadenza = setting('Ritardo in giorni della scadenza della fattura per invio sollecito pagamento');
|
||||||
$giorni_prossimo_sollecito = setting("Ritardo in giorni dall'ultima email per invio sollecito pagamento");
|
$giorni_prossimo_sollecito = setting("Ritardo in giorni dall'ultima email per invio sollecito pagamento");
|
||||||
|
$template_promemoria = setting('Template email promemoria scadenza');
|
||||||
$template_1 = setting('Template email primo sollecito');
|
$template_1 = setting('Template email primo sollecito');
|
||||||
$template_2 = setting('Template email secondo sollecito');
|
$template_2 = setting('Template email secondo sollecito');
|
||||||
$template_3 = setting('Template email terzo sollecito');
|
$template_3 = setting('Template email terzo sollecito');
|
||||||
@ -53,6 +55,86 @@ class SollecitoTask extends Manager
|
|||||||
$id_user = database()->selectOne('zz_users', 'id', ['idgruppo' => 1, 'enabled' => 1])['id'];
|
$id_user = database()->selectOne('zz_users', 'id', ['idgruppo' => 1, 'enabled' => 1])['id'];
|
||||||
$user = User::find($id_user);
|
$user = User::find($id_user);
|
||||||
|
|
||||||
|
// Invio promemoria
|
||||||
|
$rs = database()->fetchArray("SELECT `co_scadenziario`.* FROM `co_scadenziario` INNER JOIN `co_documenti` ON `co_scadenziario`.`iddocumento`=`co_documenti`.`id` INNER JOIN `co_tipidocumento` ON `co_documenti`.`idtipodocumento`=`co_tipidocumento`.`id` INNER JOIN `zz_segments` ON `co_documenti`.`id_segment`=`zz_segments`.`id` WHERE `co_tipidocumento`.`dir`='entrata' AND `is_fiscale`=1 AND `zz_segments`.`autofatture`=0 AND ABS(`co_scadenziario`.`pagato`) < ABS(`co_scadenziario`.`da_pagare`) AND `scadenza` = DATE_FORMAT(DATE_ADD(NOW(), INTERVAL ".prepare($giorni_promemoria).' DAY),"%Y-%m-%d")');
|
||||||
|
foreach ($rs as $r) {
|
||||||
|
$has_inviata = database()->fetchOne('SELECT * FROM em_emails WHERE sent_at IS NOT NULL AND id_template='.prepare($template_promemoria).' AND id_record='.prepare($r['id']));
|
||||||
|
$id_template = $template_promemoria;
|
||||||
|
|
||||||
|
if (!$has_inviata && $id_template) {
|
||||||
|
$template = Template::find($id_template);
|
||||||
|
$id = $r['id'];
|
||||||
|
|
||||||
|
$scadenza = Scadenza::find($id);
|
||||||
|
$documento = $scadenza->documento;
|
||||||
|
|
||||||
|
$id_documento = $documento->id;
|
||||||
|
$id_anagrafica = $documento->idanagrafica;
|
||||||
|
$id_module = Module::where('name', 'Scadenzario')->first()->id;
|
||||||
|
|
||||||
|
$fattura_allegata = database()->selectOne('zz_files', 'id', ['id_module' => $id_module, 'id_record' => $id, 'original' => 'Fattura di vendita.pdf'])['id'];
|
||||||
|
|
||||||
|
// Allego stampa della fattura se non presente
|
||||||
|
if (empty($fattura_allegata)) {
|
||||||
|
$print_predefined = PrintTemplate::where('predefined', 1)->where('id_module', Module::where('name', 'Fatture di vendita')->first()->id)->first();
|
||||||
|
$print = \Prints::render($print_predefined['id'], $id_documento, null, true);
|
||||||
|
$name = 'Fattura di vendita';
|
||||||
|
$upload = \Uploads::upload($print['pdf'], [
|
||||||
|
'name' => $name,
|
||||||
|
'original_name' => $name.'.pdf',
|
||||||
|
'category' => 'Generale',
|
||||||
|
'id_module' => $id_module,
|
||||||
|
'id_record' => $id,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$fattura_allegata = database()->selectOne('zz_files', 'id', ['id_module' => $id_module, 'id_record' => $id, 'original' => 'Fattura di vendita.pdf'])['id'];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Selezione destinatari e invio mail
|
||||||
|
if (!empty($template)) {
|
||||||
|
$creata_mail = false;
|
||||||
|
$emails = [];
|
||||||
|
|
||||||
|
// Aggiungo email anagrafica
|
||||||
|
if (!empty($documento->anagrafica->email)) {
|
||||||
|
$emails[] = $documento->anagrafica->email;
|
||||||
|
$mail = Mail::build($user, $template, $id);
|
||||||
|
$mail->addReceiver($documento->anagrafica->email);
|
||||||
|
$creata_mail = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Aggiungo email referenti in base alla mansione impostata nel template
|
||||||
|
$mansioni = database()->select('em_mansioni_template', 'idmansione', [], ['id_template' => $template->id]);
|
||||||
|
foreach ($mansioni as $mansione) {
|
||||||
|
$referenti = database()->table('an_referenti')->where('idmansione', $mansione['idmansione'])->where('idanagrafica', $id_anagrafica)->where('email', '!=', '')->get();
|
||||||
|
if (!$referenti->isEmpty() && $creata_mail == false) {
|
||||||
|
$mail = Mail::build($user, $template, $id);
|
||||||
|
$creata_mail = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($referenti as $referente) {
|
||||||
|
if (!in_array($referente->email, $emails)) {
|
||||||
|
$emails[] = $referente->email;
|
||||||
|
$mail->addReceiver($referente->email);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($emails)) {
|
||||||
|
if (!empty($fattura_allegata)) {
|
||||||
|
$mail->addUpload($fattura_allegata);
|
||||||
|
}
|
||||||
|
|
||||||
|
$mail->save();
|
||||||
|
OperationLog::setInfo('id_email', $mail->id);
|
||||||
|
OperationLog::setInfo('id_module', $id_module);
|
||||||
|
OperationLog::setInfo('id_record', $id);
|
||||||
|
OperationLog::build('send-email');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$rs = database()->fetchArray("SELECT `co_scadenziario`.* FROM `co_scadenziario` INNER JOIN `co_documenti` ON `co_scadenziario`.`iddocumento`=`co_documenti`.`id` INNER JOIN `co_tipidocumento` ON `co_documenti`.`idtipodocumento`=`co_tipidocumento`.`id` INNER JOIN `zz_segments` ON `co_documenti`.`id_segment`=`zz_segments`.`id` WHERE `co_tipidocumento`.`dir`='entrata' AND `is_fiscale`=1 AND `zz_segments`.`autofatture`=0 AND ABS(`co_scadenziario`.`pagato`) < ABS(`co_scadenziario`.`da_pagare`) AND `scadenza` < DATE_SUB(NOW(), INTERVAL ".prepare($giorni_scadenza).' DAY)');
|
$rs = database()->fetchArray("SELECT `co_scadenziario`.* FROM `co_scadenziario` INNER JOIN `co_documenti` ON `co_scadenziario`.`iddocumento`=`co_documenti`.`id` INNER JOIN `co_tipidocumento` ON `co_documenti`.`idtipodocumento`=`co_tipidocumento`.`id` INNER JOIN `zz_segments` ON `co_documenti`.`id_segment`=`zz_segments`.`id` WHERE `co_tipidocumento`.`dir`='entrata' AND `is_fiscale`=1 AND `zz_segments`.`autofatture`=0 AND ABS(`co_scadenziario`.`pagato`) < ABS(`co_scadenziario`.`da_pagare`) AND `scadenza` < DATE_SUB(NOW(), INTERVAL ".prepare($giorni_scadenza).' DAY)');
|
||||||
|
|
||||||
foreach ($rs as $r) {
|
foreach ($rs as $r) {
|
||||||
|
@ -123,6 +123,7 @@ switch ($operazione) {
|
|||||||
if (!empty($r->idarticolo)) {
|
if (!empty($r->idarticolo)) {
|
||||||
$articolo = ArticoloOriginale::find($r->idarticolo);
|
$articolo = ArticoloOriginale::find($r->idarticolo);
|
||||||
$riga = Articolo::build($contratto, $articolo);
|
$riga = Articolo::build($contratto, $articolo);
|
||||||
|
$riga->original_id = $r->id;
|
||||||
} else {
|
} else {
|
||||||
$riga = Riga::build($contratto);
|
$riga = Riga::build($contratto);
|
||||||
}
|
}
|
||||||
|
@ -43,32 +43,42 @@ UPDATE `zz_plugins` SET `options` = '{ \"main_query\": [ { \"type\": \"table\",
|
|||||||
UPDATE `zz_views` INNER JOIN `zz_modules` ON `zz_views`.`id_module` = `zz_modules`.`id` SET `zz_views`.`query` = '`sottocategorie_lang`.`title`' WHERE `zz_modules`.`name` = 'Articoli' AND `zz_views`.`name` = 'Sottocategoria';
|
UPDATE `zz_views` INNER JOIN `zz_modules` ON `zz_views`.`id_module` = `zz_modules`.`id` SET `zz_views`.`query` = '`sottocategorie_lang`.`title`' WHERE `zz_modules`.`name` = 'Articoli' AND `zz_views`.`name` = 'Sottocategoria';
|
||||||
|
|
||||||
-- Gestione solleciti automatici
|
-- Gestione solleciti automatici
|
||||||
INSERT INTO `em_templates` (`id`, `id_module`, `name`, `icon`, `tipo_reply_to`, `reply_to`, `cc`, `bcc`, `read_notify`, `predefined`, `note_aggiuntive`, `deleted_at`, `id_account`, `created_at`) VALUES (NULL, (SELECT `id` FROM `zz_modules` WHERE `name`='Scadenzario'), 'Secondo sollecito di pagamento', 'fa fa-envelope', '', '', '', '', '0', '1', '', NULL, '1', NULL);
|
INSERT INTO `em_templates` (`id_module`, `name`, `icon`, `tipo_reply_to`, `reply_to`, `cc`, `bcc`, `read_notify`, `predefined`, `note_aggiuntive`, `deleted_at`, `id_account`) VALUES ((SELECT `id` FROM `zz_modules` WHERE `name`='Scadenzario'), 'Secondo sollecito di pagamento', 'fa fa-envelope', '', '', '', '', '0', '1', '', NULL, '1');
|
||||||
INSERT INTO `em_templates_lang` (`id`, `id_lang`, `id_record`, `title`, `subject`, `body`, `created_at`) VALUES (NULL, (SELECT `valore` FROM `zz_settings` WHERE `nome` = 'Lingua'), (SELECT `id` FROM `em_templates` WHERE `name`='Secondo sollecito di pagamento'), 'Secondo sollecito di pagamento', 'Sollecito di pagamento fattura {numero}', '', NULL);
|
INSERT INTO `em_templates_lang` (`id_lang`, `id_record`, `title`, `subject`, `body`) VALUES ((SELECT `valore` FROM `zz_settings` WHERE `nome` = 'Lingua'), (SELECT `id` FROM `em_templates` WHERE `name`='Secondo sollecito di pagamento'), 'Secondo sollecito di pagamento', 'Sollecito di pagamento fattura {numero}', '');
|
||||||
|
|
||||||
INSERT INTO `em_templates` (`id`, `id_module`, `name`, `icon`, `tipo_reply_to`, `reply_to`, `cc`, `bcc`, `read_notify`, `predefined`, `note_aggiuntive`, `deleted_at`, `id_account`, `created_at`) VALUES (NULL, (SELECT `id` FROM `zz_modules` WHERE `name`='Scadenzario'), 'Terzo sollecito di pagamento', 'fa fa-envelope', '', '', '', '', '0', '1', '', NULL, '1', NULL);
|
INSERT INTO `em_templates` (`id_module`, `name`, `icon`, `tipo_reply_to`, `reply_to`, `cc`, `bcc`, `read_notify`, `predefined`, `note_aggiuntive`, `deleted_at`, `id_account`) VALUES ((SELECT `id` FROM `zz_modules` WHERE `name`='Scadenzario'), 'Terzo sollecito di pagamento', 'fa fa-envelope', '', '', '', '', '0', '1', '', NULL, '1');
|
||||||
INSERT INTO `em_templates_lang` (`id`, `id_lang`, `id_record`, `title`, `subject`, `body`, `created_at`) VALUES (NULL, (SELECT `valore` FROM `zz_settings` WHERE `nome` = 'Lingua'), (SELECT `id` FROM `em_templates` WHERE `name`='Terzo sollecito di pagamento'), 'Terzo sollecito di pagamento', 'Sollecito di pagamento fattura {numero}', '', NULL);
|
INSERT INTO `em_templates_lang` (`id_lang`, `id_record`, `title`, `subject`, `body`) VALUES ((SELECT `valore` FROM `zz_settings` WHERE `nome` = 'Lingua'), (SELECT `id` FROM `em_templates` WHERE `name`='Terzo sollecito di pagamento'), 'Terzo sollecito di pagamento', 'Sollecito di pagamento fattura {numero}', '');
|
||||||
|
|
||||||
INSERT INTO `em_templates` (`id`, `id_module`, `name`, `icon`, `tipo_reply_to`, `reply_to`, `cc`, `bcc`, `read_notify`, `predefined`, `note_aggiuntive`, `deleted_at`, `id_account`, `created_at`) VALUES (NULL, (SELECT `id` FROM `zz_modules` WHERE `name`='Scadenzario'), 'Notifica interna sollecito di pagamento', 'fa fa-envelope', '', '', '', '', '0', '1', '', NULL, '1', NULL);
|
INSERT INTO `em_templates` (`id_module`, `name`, `icon`, `tipo_reply_to`, `reply_to`, `cc`, `bcc`, `read_notify`, `predefined`, `note_aggiuntive`, `deleted_at`, `id_account`) VALUES ((SELECT `id` FROM `zz_modules` WHERE `name`='Scadenzario'), 'Notifica interna sollecito di pagamento', 'fa fa-envelope', '', '', '', '', '0', '1', '', NULL, '1');
|
||||||
INSERT INTO `em_templates_lang` (`id`, `id_lang`, `id_record`, `title`, `subject`, `body`, `created_at`) VALUES (NULL, (SELECT `valore` FROM `zz_settings` WHERE `nome` = 'Lingua'), (SELECT `id` FROM `em_templates` WHERE `name`='Notifica interna sollecito di pagamento'), 'Notifica interna sollecito di pagamento', 'Notifica interna sollecito di pagamento fattura {numero}', '', NULL);
|
INSERT INTO `em_templates_lang` (`id_lang`, `id_record`, `title`, `subject`, `body`) VALUES ((SELECT `valore` FROM `zz_settings` WHERE `nome` = 'Lingua'), (SELECT `id` FROM `em_templates` WHERE `name`='Notifica interna sollecito di pagamento'), 'Notifica interna sollecito di pagamento', 'Notifica interna sollecito di pagamento fattura {numero}', '');
|
||||||
|
|
||||||
UPDATE `zz_settings` SET `nome` = 'Template email primo sollecito' WHERE `zz_settings`.`nome` = 'Template email invio sollecito';
|
UPDATE `zz_settings` SET `nome` = 'Template email primo sollecito' WHERE `zz_settings`.`nome` = 'Template email invio sollecito';
|
||||||
UPDATE `zz_settings_lang` SET `title` = 'Template email primo sollecito' WHERE `zz_settings_lang`.`id_record` = (SELECT `id` FROM `zz_settings` WHERE `nome`='Template email primo sollecito');
|
UPDATE `zz_settings_lang` SET `title` = 'Template email primo sollecito' WHERE `zz_settings_lang`.`id_record` = (SELECT `id` FROM `zz_settings` WHERE `nome`='Template email primo sollecito');
|
||||||
|
|
||||||
INSERT INTO `zz_settings` (`id`, `nome`, `valore`, `tipo`, `editable`, `sezione`, `created_at`, `order`) VALUES (NULL, 'Template email secondo sollecito', (SELECT `id` FROM `em_templates` WHERE `name`='Secondo sollecito di pagamento'), 'query=SELECT `em_templates`.`id`, `name` AS descrizione FROM `em_templates` LEFT JOIN `em_templates_lang` ON (`em_templates_lang`.`id_record` = `em_templates`.`id` AND `em_templates_lang`.`id_lang` = (SELECT `valore` FROM `zz_settings` WHERE `nome` = \"Lingua\"))', '1', 'Scadenzario', NULL, '3');
|
INSERT INTO `zz_settings` (`nome`, `valore`, `tipo`, `editable`, `sezione`, `order`) VALUES ('Template email secondo sollecito', (SELECT `id` FROM `em_templates` WHERE `name`='Secondo sollecito di pagamento'), 'query=SELECT `em_templates`.`id`, `name` AS descrizione FROM `em_templates` LEFT JOIN `em_templates_lang` ON (`em_templates_lang`.`id_record` = `em_templates`.`id` AND `em_templates_lang`.`id_lang` = (SELECT `valore` FROM `zz_settings` WHERE `nome` = \"Lingua\"))', '1', 'Scadenzario', '3');
|
||||||
INSERT INTO `zz_settings_lang` (`id`, `id_lang`, `id_record`, `title`, `help`, `created_at`) VALUES (NULL, (SELECT `valore` FROM `zz_settings` WHERE `nome` = 'Lingua'), (SELECT `id` FROM `zz_settings` WHERE `nome`='Template email secondo sollecito'), 'Template email secondo sollecito', '', NULL);
|
INSERT INTO `zz_settings_lang` (`id_lang`, `id_record`, `title`, `help`) VALUES ((SELECT `valore` FROM `zz_settings` WHERE `nome` = 'Lingua'), (SELECT `id` FROM `zz_settings` WHERE `nome`='Template email secondo sollecito'), 'Template email secondo sollecito', '');
|
||||||
|
|
||||||
INSERT INTO `zz_settings` (`id`, `nome`, `valore`, `tipo`, `editable`, `sezione`, `created_at`, `order`) VALUES (NULL, 'Template email terzo sollecito', (SELECT `id` FROM `em_templates` WHERE `name`='Terzo sollecito di pagamento'), 'query=SELECT `em_templates`.`id`, `name` AS descrizione FROM `em_templates` LEFT JOIN `em_templates_lang` ON (`em_templates_lang`.`id_record` = `em_templates`.`id` AND `em_templates_lang`.`id_lang` = (SELECT `valore` FROM `zz_settings` WHERE `nome` = \"Lingua\"))', '1', 'Scadenzario', NULL, '4');
|
INSERT INTO `zz_settings` (`nome`, `valore`, `tipo`, `editable`, `sezione`, `order`) VALUES ( 'Template email terzo sollecito', (SELECT `id` FROM `em_templates` WHERE `name`='Terzo sollecito di pagamento'), 'query=SELECT `em_templates`.`id`, `name` AS descrizione FROM `em_templates` LEFT JOIN `em_templates_lang` ON (`em_templates_lang`.`id_record` = `em_templates`.`id` AND `em_templates_lang`.`id_lang` = (SELECT `valore` FROM `zz_settings` WHERE `nome` = \"Lingua\"))', '1', 'Scadenzario', '4');
|
||||||
INSERT INTO `zz_settings_lang` (`id`, `id_lang`, `id_record`, `title`, `help`, `created_at`) VALUES (NULL, (SELECT `valore` FROM `zz_settings` WHERE `nome` = 'Lingua'), (SELECT `id` FROM `zz_settings` WHERE `nome`='Template email terzo sollecito'), 'Template email terzo sollecito', '', NULL);
|
INSERT INTO `zz_settings_lang` (`id_lang`, `id_record`, `title`, `help`) VALUES ((SELECT `valore` FROM `zz_settings` WHERE `nome` = 'Lingua'), (SELECT `id` FROM `zz_settings` WHERE `nome`='Template email terzo sollecito'), 'Template email terzo sollecito', '');
|
||||||
|
|
||||||
INSERT INTO `zz_settings` (`id`, `nome`, `valore`, `tipo`, `editable`, `sezione`, `created_at`, `order`) VALUES (NULL, 'Template email mancato pagamento dopo i solleciti', (SELECT `id` FROM `em_templates` WHERE `name`='Notifica interna sollecito di pagamento'), 'query=SELECT `em_templates`.`id`, `name` AS descrizione FROM `em_templates` LEFT JOIN `em_templates_lang` ON (`em_templates_lang`.`id_record` = `em_templates`.`id` AND `em_templates_lang`.`id_lang` = (SELECT `valore` FROM `zz_settings` WHERE `nome` = \"Lingua\"))', '1', 'Scadenzario', NULL, '4');
|
INSERT INTO `zz_settings` (`nome`, `valore`, `tipo`, `editable`, `sezione`, `order`) VALUES ('Template email mancato pagamento dopo i solleciti', (SELECT `id` FROM `em_templates` WHERE `name`='Notifica interna sollecito di pagamento'), 'query=SELECT `em_templates`.`id`, `name` AS descrizione FROM `em_templates` LEFT JOIN `em_templates_lang` ON (`em_templates_lang`.`id_record` = `em_templates`.`id` AND `em_templates_lang`.`id_lang` = (SELECT `valore` FROM `zz_settings` WHERE `nome` = \"Lingua\"))', '1', 'Scadenzario', '4');
|
||||||
INSERT INTO `zz_settings_lang` (`id`, `id_lang`, `id_record`, `title`, `help`, `created_at`) VALUES (NULL, (SELECT `valore` FROM `zz_settings` WHERE `nome` = 'Lingua'), (SELECT `id` FROM `zz_settings` WHERE `nome`='Template email mancato pagamento dopo i solleciti'), 'Template email mancato pagamento dopo i solleciti', '', NULL);
|
INSERT INTO `zz_settings_lang` (`id_lang`, `id_record`, `title`, `help`) VALUES ((SELECT `valore` FROM `zz_settings` WHERE `nome` = 'Lingua'), (SELECT `id` FROM `zz_settings` WHERE `nome`='Template email mancato pagamento dopo i solleciti'), 'Template email mancato pagamento dopo i solleciti', '');
|
||||||
|
|
||||||
INSERT INTO `zz_settings` (`id`, `nome`, `valore`, `tipo`, `editable`, `sezione`, `created_at`, `order`) VALUES (NULL, 'Indirizzo email mancato pagamento dopo i solleciti', '', 'string', '1', 'Scadenzario', NULL, '4');
|
INSERT INTO `zz_settings` (`nome`, `valore`, `tipo`, `editable`, `sezione`, `order`) VALUES ('Indirizzo email mancato pagamento dopo i solleciti', '', 'string', '1', 'Scadenzario', '4');
|
||||||
INSERT INTO `zz_settings_lang` (`id`, `id_lang`, `id_record`, `title`, `help`, `created_at`) VALUES (NULL, (SELECT `valore` FROM `zz_settings` WHERE `nome` = 'Lingua'), (SELECT `id` FROM `zz_settings` WHERE `nome`='Indirizzo email mancato pagamento dopo i solleciti'), 'Indirizzo email mancato pagamento dopo i solleciti', '', NULL);
|
INSERT INTO `zz_settings_lang` (`id_lang`, `id_record`, `title`, `help`) VALUES ((SELECT `valore` FROM `zz_settings` WHERE `nome` = 'Lingua'), (SELECT `id` FROM `zz_settings` WHERE `nome`='Indirizzo email mancato pagamento dopo i solleciti'), 'Indirizzo email mancato pagamento dopo i solleciti', '');
|
||||||
|
|
||||||
-- Ripristino impostazione per limitare la visualizzazione degli impianti a quelli gestiti dal tecnico
|
-- Ripristino impostazione per limitare la visualizzazione degli impianti a quelli gestiti dal tecnico
|
||||||
INSERT INTO `zz_settings` (`id`, `nome`, `valore`, `tipo`, `editable`, `sezione`, `order`) VALUES (NULL, 'Limita la visualizzazione degli impianti a quelli gestiti dal tecnico', '0', 'boolean', '1', 'Applicazione', '9');
|
INSERT INTO `zz_settings` (`nome`, `valore`, `tipo`, `editable`, `sezione`, `order`) VALUES ('Limita la visualizzazione degli impianti a quelli gestiti dal tecnico', '0', 'boolean', '1', 'Applicazione', '9');
|
||||||
|
INSERT INTO `zz_settings_lang` (`id_lang`, `id_record`, `title`, `help`) VALUES ((SELECT `valore` FROM `zz_settings` WHERE `nome` = 'Lingua'), (SELECT `id` FROM `zz_settings` WHERE `nome`='Limita la visualizzazione degli impianti a quelli gestiti dal tecnico'), 'Limita la visualizzazione degli impianti a quelli gestiti dal tecnico', '');
|
||||||
|
|
||||||
-- Fix plugin Ddt del cliente
|
-- Fix plugin Ddt del cliente
|
||||||
UPDATE `zz_plugins` SET `options` = '{ \"main_query\": [ { \"type\": \"table\", \"fields\": \"Numero, Data, Descrizione, Qtà\", \"query\": \"SELECT `dt_ddt`.`id`, (CASE WHEN `dt_tipiddt`.`dir` = \'entrata\' THEN (SELECT `id` FROM `zz_modules` WHERE `name` = \'Ddt in uscita\') ELSE (SELECT `id` FROM `zz_modules` WHERE `name` = \'Ddt in entrata\') END) AS _link_module_, `dt_ddt`.`id` AS _link_record_, IF(`dt_ddt`.`numero_esterno` = \'\', `dt_ddt`.`numero`, `dt_ddt`.`numero_esterno`) AS Numero, DATE_FORMAT(`dt_ddt`.`data`, \'%d/%m/%Y\') AS Data, `dt_righe_ddt`.`descrizione` AS `Descrizione`, REPLACE(REPLACE(REPLACE(FORMAT(`dt_righe_ddt`.`qta`, 2), \',\', \'#\'), \'.\', \',\'), \'#\', \'.\') AS `Qtà` FROM `dt_ddt` LEFT JOIN `dt_righe_ddt` ON `dt_ddt`.`id`=`dt_righe_ddt`.`idddt` JOIN `dt_tipiddt` ON `dt_ddt`.`idtipoddt` = `dt_tipiddt`.`id` WHERE `dt_ddt`.`idanagrafica`=|id_parent| ORDER BY `dt_ddt`.`id` DESC\"} ]}' WHERE `zz_plugins`.`name` = 'Ddt del cliente';
|
UPDATE `zz_plugins` SET `options` = '{ \"main_query\": [ { \"type\": \"table\", \"fields\": \"Numero, Data, Descrizione, Qtà\", \"query\": \"SELECT `dt_ddt`.`id`, (CASE WHEN `dt_tipiddt`.`dir` = \'entrata\' THEN (SELECT `id` FROM `zz_modules` WHERE `name` = \'Ddt in uscita\') ELSE (SELECT `id` FROM `zz_modules` WHERE `name` = \'Ddt in entrata\') END) AS _link_module_, `dt_ddt`.`id` AS _link_record_, IF(`dt_ddt`.`numero_esterno` = \'\', `dt_ddt`.`numero`, `dt_ddt`.`numero_esterno`) AS Numero, DATE_FORMAT(`dt_ddt`.`data`, \'%d/%m/%Y\') AS Data, `dt_righe_ddt`.`descrizione` AS `Descrizione`, REPLACE(REPLACE(REPLACE(FORMAT(`dt_righe_ddt`.`qta`, 2), \',\', \'#\'), \'.\', \',\'), \'#\', \'.\') AS `Qtà` FROM `dt_ddt` LEFT JOIN `dt_righe_ddt` ON `dt_ddt`.`id`=`dt_righe_ddt`.`idddt` JOIN `dt_tipiddt` ON `dt_ddt`.`idtipoddt` = `dt_tipiddt`.`id` WHERE `dt_ddt`.`idanagrafica`=|id_parent| ORDER BY `dt_ddt`.`id` DESC\"} ]}' WHERE `zz_plugins`.`name` = 'Ddt del cliente';
|
||||||
|
|
||||||
|
-- Promemoria scadenze automatiche
|
||||||
|
INSERT INTO `em_templates` (`id_module`, `name`, `icon`, `tipo_reply_to`, `reply_to`, `cc`, `bcc`, `read_notify`, `predefined`, `note_aggiuntive`, `deleted_at`, `id_account`) VALUES ((SELECT `id` FROM `zz_modules` WHERE `name`='Scadenzario'), 'Promemoria scadenza di pagamento', 'fa fa-envelope', '', '', '', '', '0', '1', '', NULL, '1');
|
||||||
|
INSERT INTO `em_templates_lang` (`id_lang`, `id_record`, `title`, `subject`, `body`) VALUES ((SELECT `valore` FROM `zz_settings` WHERE `nome` = 'Lingua'), (SELECT `id` FROM `em_templates` WHERE `name`='Promemoria scadenza di pagamento'), 'Promemoria scadenza di pagamento', 'Promemoria scadenza di pagamento fattura {numero}', '');
|
||||||
|
|
||||||
|
INSERT INTO `zz_settings` (`nome`, `valore`, `tipo`, `editable`, `sezione`, `order`) VALUES ('Template email promemoria scadenza', (SELECT `id` FROM `em_templates` WHERE `name`='Promemoria scadenza di pagamento'), 'query=SELECT `em_templates`.`id`, `name` AS descrizione FROM `em_templates` LEFT JOIN `em_templates_lang` ON (`em_templates_lang`.`id_record` = `em_templates`.`id` AND `em_templates_lang`.`id_lang` = (SELECT `valore` FROM `zz_settings` WHERE `nome` = \"Lingua\"))', '1', 'Scadenzario', '4');
|
||||||
|
INSERT INTO `zz_settings_lang` (`id_lang`, `id_record`, `title`, `help`) VALUES ((SELECT `valore` FROM `zz_settings` WHERE `nome` = 'Lingua'), (SELECT `id` FROM `zz_settings` WHERE `nome`='Template email promemoria scadenza'), 'Template email promemoria scadenza', '');
|
||||||
|
INSERT INTO `zz_settings` (`nome`, `valore`, `tipo`, `editable`, `sezione`, `order`) VALUES ('Intervallo di giorni in anticipo per invio promemoria scadenza', '5', 'integer', '1', 'Scadenzario', '4');
|
||||||
|
INSERT INTO `zz_settings_lang` (`id_lang`, `id_record`, `title`, `help`) VALUES ((SELECT `valore` FROM `zz_settings` WHERE `nome` = 'Lingua'), (SELECT `id` FROM `zz_settings` WHERE `nome`='Intervallo di giorni in anticipo per invio promemoria scadenza'), 'Intervallo di giorni in anticipo per invio promemoria scadenza', '');
|
Loading…
x
Reference in New Issue
Block a user