mirror of
https://github.com/devcode-it/openstamanager.git
synced 2025-02-23 14:57:46 +01:00
Supporto liste per le newsletter
This commit is contained in:
parent
d01377e984
commit
5412002e55
@ -375,3 +375,17 @@ function clean($string, $permitted = '')
|
||||
{
|
||||
return preg_replace('/[^A-Za-z0-9'.$permitted.']/', '', $string); // Removes special chars.
|
||||
}
|
||||
|
||||
function check_query($query)
|
||||
{
|
||||
$query = mb_strtoupper($query);
|
||||
|
||||
$blacklist = ['INSERT', 'UPDATE', 'TRUNCATE', 'DELETE', 'DROP', 'GRANT', 'CREATE', 'REVOKE'];
|
||||
foreach ($blacklist as $value) {
|
||||
if (preg_match("/\b".preg_quote($value)."\b/", $query)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
55
modules/liste_newsletter/actions.php
Normal file
55
modules/liste_newsletter/actions.php
Normal file
@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
use Modules\Newsletter\Lista;
|
||||
|
||||
include_once __DIR__.'/../../core.php';
|
||||
|
||||
switch (filter('op')) {
|
||||
case 'add':
|
||||
$lista = Lista::build(filter('name'));
|
||||
$id_record = $lista->id;
|
||||
|
||||
flash()->info(tr('Nuova lista newsletter creata!'));
|
||||
|
||||
break;
|
||||
|
||||
case 'update':
|
||||
$lista->name = filter('name');
|
||||
$lista->description = filter('description');
|
||||
|
||||
$query = filter('query');
|
||||
if (check_query($query)) {
|
||||
$lista->query = $query;
|
||||
}
|
||||
|
||||
$lista->save();
|
||||
|
||||
flash()->info(tr('Lista newsletter salvata!'));
|
||||
|
||||
break;
|
||||
|
||||
case 'delete':
|
||||
$lista->delete();
|
||||
|
||||
flash()->info(tr('Lista newsletter rimossa!'));
|
||||
|
||||
break;
|
||||
|
||||
case 'add_receivers':
|
||||
$receivers = post('receivers');
|
||||
|
||||
$lista->anagrafiche()->syncWithoutDetaching($receivers);
|
||||
|
||||
flash()->info(tr('Aggiunti nuovi destinatari alla newsletter!'));
|
||||
|
||||
break;
|
||||
|
||||
case 'remove_receiver':
|
||||
$receiver = post('id');
|
||||
|
||||
$lista->anagrafiche()->detach($receiver);
|
||||
|
||||
flash()->info(tr('Destinatario rimosso dalla newsletter!'));
|
||||
|
||||
break;
|
||||
}
|
22
modules/liste_newsletter/add.php
Normal file
22
modules/liste_newsletter/add.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
include_once __DIR__.'/../../core.php';
|
||||
|
||||
echo '
|
||||
<form action="" method="post" id="add-form">
|
||||
<input type="hidden" name="op" value="add">
|
||||
<input type="hidden" name="backto" value="record-edit">
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
{[ "type": "text", "label": "'.tr('Nome').'", "name": "name", "required": 1 ]}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- PULSANTI -->
|
||||
<div class="row">
|
||||
<div class="col-md-12 text-right">
|
||||
<button type="submit" class="btn btn-primary"><i class="fa fa-plus"></i> '.tr('Aggiungi').'</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>';
|
122
modules/liste_newsletter/edit.php
Normal file
122
modules/liste_newsletter/edit.php
Normal file
@ -0,0 +1,122 @@
|
||||
<?php
|
||||
|
||||
include_once __DIR__.'/../../core.php';
|
||||
|
||||
echo '
|
||||
<form action="" method="post" id="edit-form">
|
||||
<input type="hidden" name="backto" value="record-edit">
|
||||
<input type="hidden" name="op" value="update">
|
||||
|
||||
<!-- DATI -->
|
||||
<div class="panel panel-primary">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">'.tr('Dati campagna').'</h3>
|
||||
</div>
|
||||
|
||||
<div class="panel-body">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
{[ "type": "text", "label": "'.tr('Nome').'", "name": "name", "required": 1, "value": "$name$" ]}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
{[ "type": "textarea", "label": "'.tr('Descrizione').'", "name": "description", "required": 0, "value": "$description$" ]}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
{[ "type": "textarea", "label": "'.tr('Query dinamica').'", "name": "query", "required": 0, "value": "$query$", "help": "'.tr("La query SQL deve restituire gli identificativi delle anagrafiche da inserire nella lista, sotto un campo di nome ''id''").'. '.tr('Per esempio: _SQL_', [
|
||||
'_SQL_' => 'SELECT idanagrafica AS id FROM an_anagrafiche',
|
||||
]).'" ]}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<form action="" method="post" id="receivers-form">
|
||||
<input type="hidden" name="backto" value="record-edit">
|
||||
<input type="hidden" name="op" value="add_receivers">
|
||||
|
||||
<!-- Destinatari -->
|
||||
<div class="box box-primary">
|
||||
<div class="box-header">
|
||||
<h3 class="box-title">'.tr('Aggiunta destinatari').'</h3>
|
||||
</div>
|
||||
|
||||
<div class="box-body">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
{[ "type": "select", "label": "'.tr('Destinatari').'", "name": "receivers[]", "ajax-source": "anagrafiche_newsletter", "multiple": 1, "disabled": '.intval(!empty($lista->query)).' ]}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row pull-right">
|
||||
<div class="col-md-12">
|
||||
<button type="submit" class="btn btn-primary">
|
||||
<i class="fa fa-plus"></i> '.tr('Aggiungi').'
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>';
|
||||
|
||||
$anagrafiche = $lista->anagrafiche;
|
||||
|
||||
echo '
|
||||
<!-- Destinatari -->
|
||||
<div class="panel panel-primary">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">
|
||||
'.tr('Destinatari').'
|
||||
<span class="badge">'.$anagrafiche->count().'</span>
|
||||
</h3>
|
||||
</div>
|
||||
|
||||
<div class="panel-body">';
|
||||
|
||||
if (!$anagrafiche->isEmpty()) {
|
||||
echo '
|
||||
<table class="table table-hover table-condensed table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>'.tr('Nome').'</th>
|
||||
<th class="text-center">'.tr('Indirizzo').'</th>
|
||||
<th class="text-center" width="60">#</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>';
|
||||
|
||||
foreach ($anagrafiche as $anagrafica) {
|
||||
echo '
|
||||
<tr '.(empty($anagrafica->email) ? 'class="bg-danger"' : '').'>
|
||||
<td>'.Modules::link('Anagrafiche', $anagrafica->id, $anagrafica->ragione_sociale).'</td>
|
||||
<td class="text-center">'.$anagrafica->email.'</td>
|
||||
<td class="text-center">
|
||||
<a class="btn btn-danger ask btn-sm '.(!empty($lista->query) ? 'disabled' : '').'" data-backto="record-edit" data-op="remove_receiver" data-id="'.$anagrafica->id.'" '.(!empty($lista->query) ? 'disabled' : '').'>
|
||||
<i class="fa fa-trash"></i>
|
||||
</a>
|
||||
</td>
|
||||
</tr>';
|
||||
}
|
||||
|
||||
echo '
|
||||
</tbody>
|
||||
</table>';
|
||||
} else {
|
||||
echo '
|
||||
<p>'.tr('Nessuna anagrafica collegata alla lista').'.</p>';
|
||||
}
|
||||
|
||||
echo '
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<a class="btn btn-danger ask" data-backto="record-list">
|
||||
<i class="fa fa-trash"></i> '.tr('Elimina').'
|
||||
</a>';
|
11
modules/liste_newsletter/init.php
Normal file
11
modules/liste_newsletter/init.php
Normal file
@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
use Modules\Newsletter\Lista;
|
||||
|
||||
include_once __DIR__.'/../../core.php';
|
||||
|
||||
if (isset($id_record)) {
|
||||
$lista = Lista::find($id_record);
|
||||
|
||||
$record = $lista->toArray();
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
|
||||
use Modules\Emails\Template;
|
||||
use Modules\Newsletter\Lista;
|
||||
use Modules\Newsletter\Newsletter;
|
||||
|
||||
include_once __DIR__.'/../../core.php';
|
||||
@ -93,9 +94,15 @@ switch (filter('op')) {
|
||||
case 'add_receivers':
|
||||
$receivers = post('receivers');
|
||||
|
||||
$newsletter->anagrafiche()->attach($receivers);
|
||||
$id_list = post('id_list');
|
||||
if (!empty($id_list)) {
|
||||
$list = Lista::find($id_list);
|
||||
$receivers = $list->anagrafiche->pluck('idanagrafica');
|
||||
}
|
||||
|
||||
flash()->info(tr('Nuovi destinatari della newsletter aggiunti!'));
|
||||
$newsletter->anagrafiche()->syncWithoutDetaching($receivers);
|
||||
|
||||
flash()->info(tr('Aggiunti nuovi destinatari alla newsletter!'));
|
||||
|
||||
break;
|
||||
|
||||
|
@ -4,7 +4,7 @@ include_once __DIR__.'/../../../core.php';
|
||||
|
||||
switch ($resource) {
|
||||
case 'anagrafiche_newsletter':
|
||||
$query = "SELECT an_anagrafiche.idanagrafica AS id, CONCAT_WS('', ragione_sociale, IF(citta !='' OR provincia != '', CONCAT(' (', citta, IF(provincia!='', CONCAT(' ', provincia), ''), ')'), ''), IF(deleted_at IS NULL, '', ' (".tr('eliminata').")')) AS descrizione, `an_tipianagrafiche`.`descrizione` AS optgroup FROM an_anagrafiche INNER JOIN (an_tipianagrafiche_anagrafiche INNER JOIN an_tipianagrafiche ON an_tipianagrafiche_anagrafiche.idtipoanagrafica=an_tipianagrafiche.idtipoanagrafica) ON an_anagrafiche.idanagrafica=an_tipianagrafiche_anagrafiche.idanagrafica |where| ORDER BY `optgroup` ASC, ragione_sociale ASC";
|
||||
$query = "SELECT an_anagrafiche.idanagrafica AS id, CONCAT(ragione_sociale, IF(citta != '' OR provincia != '', CONCAT(' (', citta, IF(provincia != '', provincia, ''), ')'), ''), ' [', email, ']') AS descrizione, `an_tipianagrafiche`.`descrizione` AS optgroup FROM an_anagrafiche INNER JOIN (an_tipianagrafiche_anagrafiche INNER JOIN an_tipianagrafiche ON an_tipianagrafiche_anagrafiche.idtipoanagrafica=an_tipianagrafiche.idtipoanagrafica) ON an_anagrafiche.idanagrafica=an_tipianagrafiche_anagrafiche.idanagrafica |where| ORDER BY `optgroup` ASC, ragione_sociale ASC";
|
||||
|
||||
foreach ($elements as $element) {
|
||||
$filter[] = 'an_anagrafiche.idanagrafica='.prepare($element);
|
||||
@ -19,6 +19,7 @@ switch ($resource) {
|
||||
$search_fields[] = 'ragione_sociale LIKE '.prepare('%'.$search.'%');
|
||||
$search_fields[] = 'citta LIKE '.prepare('%'.$search.'%');
|
||||
$search_fields[] = 'provincia LIKE '.prepare('%'.$search.'%');
|
||||
$search_fields[] = 'email LIKE '.prepare('%'.$search.'%');
|
||||
}
|
||||
|
||||
// Aggiunta filtri di ricerca
|
||||
@ -46,4 +47,30 @@ switch ($resource) {
|
||||
];
|
||||
}
|
||||
break;
|
||||
|
||||
case 'liste_newsletter':
|
||||
$query = "SELECT id, CONCAT(name, ' (', (SELECT COUNT(*) FROM em_list_anagrafica WHERE em_lists.id = em_list_anagrafica.id_list), ' destinatari)') AS descrizione FROM em_lists |where| ORDER BY `name` ASC";
|
||||
|
||||
foreach ($elements as $element) {
|
||||
$filter[] = 'id='.prepare($element);
|
||||
}
|
||||
|
||||
if (empty($filter)) {
|
||||
$where[] = 'deleted_at IS NULL';
|
||||
}
|
||||
|
||||
if (!empty($search)) {
|
||||
$search_fields[] = 'name LIKE '.prepare('%'.$search.'%');
|
||||
}
|
||||
|
||||
// Aggiunta filtri di ricerca
|
||||
if (!empty($search_fields)) {
|
||||
$where[] = '('.implode(' OR ', $search_fields).')';
|
||||
}
|
||||
|
||||
if (!empty($filter)) {
|
||||
$where[] = '('.implode(' OR ', $filter).')';
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
@ -74,31 +74,73 @@ echo '
|
||||
<input type="hidden" name="op" value="add_receivers">
|
||||
|
||||
<!-- Destinatari -->
|
||||
<div class="panel panel-primary">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">'.tr('Destinatari').'</h3>
|
||||
<div class="box box-primary">
|
||||
<div class="box-header">
|
||||
<h3 class="box-title">'.tr('Aggiunta destinatari').'</h3>
|
||||
</div>
|
||||
|
||||
<div class="panel-body">
|
||||
<div class="box-body">
|
||||
<div class="row">
|
||||
<div class="col-md-9">
|
||||
<div class="col-md-6">
|
||||
{[ "type": "select", "label": "'.tr('Destinatari').'", "name": "receivers[]", "ajax-source": "anagrafiche_newsletter", "multiple": 1 ]}
|
||||
</div>
|
||||
|
||||
<div class="col-md-3 text-right">
|
||||
<div class="col-md-6">
|
||||
{[ "type": "select", "label": "'.tr('Lista').'", "name": "id_list", "ajax-source": "liste_newsletter" ]}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row pull-right">
|
||||
<div class="col-md-12">
|
||||
<button type="submit" class="btn btn-primary">
|
||||
<i class="fa fa-plus"></i> '.tr('Aggiungi').'
|
||||
</button>
|
||||
</div>
|
||||
</div>';
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$("#receivers").on("change", function() {
|
||||
if ($(this).selectData()) {
|
||||
$("#id_list").attr("disabled", true).addClass("disabled")
|
||||
} else {
|
||||
$("#id_list").attr("disabled", false).removeClass("disabled")
|
||||
}
|
||||
})
|
||||
|
||||
$("#id_list").on("change", function() {
|
||||
if ($(this).selectData()) {
|
||||
$("#receivers").attr("disabled", true).addClass("disabled")
|
||||
} else {
|
||||
$("#receivers").attr("disabled", false).removeClass("disabled")
|
||||
}
|
||||
})
|
||||
})
|
||||
</script>';
|
||||
|
||||
$anagrafiche = $newsletter->anagrafiche;
|
||||
|
||||
echo '
|
||||
<!-- Destinatari -->
|
||||
<div class="panel panel-primary">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">
|
||||
'.tr('Destinatari').'
|
||||
<span class="badge">'.$anagrafiche->count().'</span>
|
||||
</h3>
|
||||
</div>
|
||||
|
||||
<div class="panel-body">';
|
||||
|
||||
if (!$anagrafiche->isEmpty()) {
|
||||
echo '
|
||||
<table class="table table-striped table-hover table-condensed table-bordered">
|
||||
<table class="table table-hover table-condensed table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>'.tr('Nome').'</th>
|
||||
<th class="text-center">'.tr('Indirizzo').'</th>
|
||||
<th class="text-center">'.tr('Data di invio').'</th>
|
||||
<th class="text-center" width="60">#</th>
|
||||
</tr>
|
||||
@ -116,8 +158,9 @@ if (!$anagrafiche->isEmpty()) {
|
||||
}
|
||||
|
||||
echo '
|
||||
<tr>
|
||||
<tr '.(empty($anagrafica->email) ? 'class="bg-danger"' : '').'>
|
||||
<td>'.Modules::link('Anagrafiche', $anagrafica->id, $anagrafica->ragione_sociale).'</td>
|
||||
<td class="text-center">'.$anagrafica->email.'</td>
|
||||
<td class="text-center">'.$data.'</td>
|
||||
<td class="text-center">
|
||||
<a class="btn btn-danger ask btn-sm" data-backto="record-edit" data-op="remove_receiver" data-id="'.$anagrafica->id.'">
|
||||
@ -137,8 +180,7 @@ if (!$anagrafiche->isEmpty()) {
|
||||
|
||||
echo '
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
{( "name": "filelist_and_upload", "id_module": "$id_module$", "id_record": "$id_record$" )}
|
||||
|
||||
|
48
modules/newsletter/src/Lista.php
Normal file
48
modules/newsletter/src/Lista.php
Normal file
@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Newsletter;
|
||||
|
||||
use Common\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Modules\Anagrafiche\Anagrafica;
|
||||
use Traits\RecordTrait;
|
||||
|
||||
class Lista extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
use RecordTrait;
|
||||
|
||||
protected $table = 'em_lists';
|
||||
|
||||
public static function build($name)
|
||||
{
|
||||
$model = parent::build();
|
||||
$model->name = $name;
|
||||
|
||||
$model->save();
|
||||
|
||||
return $model;
|
||||
}
|
||||
|
||||
public function save(array $options = [])
|
||||
{
|
||||
$result = parent::save($options);
|
||||
|
||||
$query = $this->query;
|
||||
if (!empty($query)) {
|
||||
$results = database()->fetchArray($query);
|
||||
|
||||
$anagrafiche = array_column($results, 'id');
|
||||
$this->anagrafiche()->sync($anagrafiche);
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
// Relazione Eloquent
|
||||
|
||||
public function anagrafiche()
|
||||
{
|
||||
return $this->belongsToMany(Anagrafica::class, 'em_list_anagrafica', 'id_list', 'id_anagrafica')->withTrashed();
|
||||
}
|
||||
}
|
@ -67,7 +67,7 @@ class Newsletter extends Model
|
||||
|
||||
public function anagrafiche()
|
||||
{
|
||||
return $this->belongsToMany(Anagrafica::class, 'em_newsletter_anagrafica', 'id_newsletter', 'id_anagrafica')->withPivot('id_email');
|
||||
return $this->belongsToMany(Anagrafica::class, 'em_newsletter_anagrafica', 'id_newsletter', 'id_anagrafica')->withPivot('id_email')->withTrashed();
|
||||
}
|
||||
|
||||
public function emails()
|
||||
|
@ -4,20 +4,6 @@ include_once __DIR__.'/../../core.php';
|
||||
|
||||
use Models\Module;
|
||||
|
||||
function check_query($query)
|
||||
{
|
||||
$query = mb_strtoupper($query);
|
||||
|
||||
$blacklist = ['INSERT', 'UPDATE', 'TRUNCATE', 'DELETE', 'DROP', 'GRANT', 'CREATE', 'REVOKE'];
|
||||
foreach ($blacklist as $value) {
|
||||
if (preg_match("/\b".preg_quote($value)."\b/", $query)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
switch (filter('op')) {
|
||||
case 'update':
|
||||
$options2 = htmlspecialchars_decode(post('options2'), ENT_QUOTES);
|
||||
|
@ -267,11 +267,11 @@ UPDATE `zz_modules` SET `use_notes` = 1 WHERE `name` IN ('Anagrafiche', 'Interve
|
||||
UPDATE `zz_modules` SET `use_checklists` = 1 WHERE `name` IN ('Interventi', 'MyImpianti');
|
||||
|
||||
-- Modulo per i template delle Checklist
|
||||
INSERT INTO `zz_modules` (`id`, `name`, `title`, `directory`, `options`, `options2`, `icon`, `version`, `compatibility`, `order`, `parent`, `default`, `enabled`) VALUES (NULL, 'Checklists', 'Checklists', 'checklists', 'SELECT |select| FROM `zz_checklists` WHERE 1=1 HAVING 2=2', '', 'fa fa-check-square-o', '2.4.11', '2.4.11', '1', (SELECT `id` FROM `zz_modules` t WHERE t.`name` = 'Strumenti'), '1', '1');
|
||||
INSERT INTO `zz_modules` (`id`, `name`, `title`, `directory`, `options`, `options2`, `icon`, `version`, `compatibility`, `order`, `parent`, `default`, `enabled`) VALUES (NULL, 'Checklists', 'Checklists', 'checklists', 'SELECT |select| FROM `zz_checklists` WHERE 1=1 HAVING 2=2', '', 'fa fa-check-square-o', '2.4.11', '2.*', '1', (SELECT `id` FROM `zz_modules` t WHERE t.`name` = 'Strumenti'), '1', '1');
|
||||
|
||||
INSERT INTO `zz_views` (`id_module`, `name`, `query`, `order`, `search`, `slow`, `default`, `visible`) VALUES
|
||||
((SELECT `id` FROM `zz_modules` WHERE `name` = 'Checklists'), 'id', 'id', 1, 0, 0, 1, 0),
|
||||
((SELECT `id` FROM `zz_modules` WHERE `name` = 'Checklists'), 'Nome', 'name', 2, 1, 0, 0, 1),
|
||||
((SELECT `id` FROM `zz_modules` WHERE `name` = 'Checklists'), 'Nome', 'name', 2, 1, 0, 1, 1),
|
||||
((SELECT `id` FROM `zz_modules` WHERE `name` = 'Checklists'), 'Modulo', '(SELECT name FROM zz_modules WHERE id = zz_checklists.id_module)', 5, 1, 0, 1, 1),
|
||||
((SELECT `id` FROM `zz_modules` WHERE `name` = 'Checklists'), 'Plugin', '(SELECT name FROM zz_plugins WHERE id = zz_checklists.id_plugin)', 5, 1, 0, 1, 1);
|
||||
|
||||
@ -399,11 +399,11 @@ ALTER TABLE `zz_hooks` CHANGE `id_module` `id_module` INT(11) NULL;
|
||||
INSERT INTO `zz_hooks` (`id`, `name`, `class`, `frequency`, `id_module`) VALUES (NULL, 'Email', 'Modules\\Emails\\EmailHook', '1 minute', NULL);
|
||||
|
||||
-- Modulo Newsletter
|
||||
INSERT INTO `zz_modules` (`id`, `name`, `title`, `directory`, `options`, `options2`, `icon`, `version`, `compatibility`, `order`, `parent`, `default`, `enabled`) VALUES (NULL, 'Newsletter', 'Newsletter', 'newsletter', 'SELECT |select| FROM `em_newsletters` WHERE 1=1 AND deleted_at IS NULL HAVING 2=2', '', 'fa fa-newspaper-o ', '2.4.11', '2.4.11', '1', (SELECT `id` FROM `zz_modules` t WHERE t.`name` = 'Gestione email'), '1', '1');
|
||||
INSERT INTO `zz_modules` (`id`, `name`, `title`, `directory`, `options`, `options2`, `icon`, `version`, `compatibility`, `order`, `parent`, `default`, `enabled`) VALUES (NULL, 'Newsletter', 'Newsletter', 'newsletter', 'SELECT |select| FROM `em_newsletters` WHERE 1=1 AND deleted_at IS NULL HAVING 2=2', '', 'fa fa-newspaper-o ', '2.4.11', '2.*', '1', (SELECT `id` FROM `zz_modules` t WHERE t.`name` = 'Gestione email'), '1', '1');
|
||||
|
||||
INSERT INTO `zz_views` (`id_module`, `name`, `query`, `order`, `search`, `slow`, `default`, `visible`) VALUES
|
||||
((SELECT `id` FROM `zz_modules` WHERE `name` = 'Newsletter'), 'id', 'id', 1, 0, 0, 1, 0),
|
||||
((SELECT `id` FROM `zz_modules` WHERE `name` = 'Newsletter'), 'Nome', 'name', 2, 1, 0, 0, 1),
|
||||
((SELECT `id` FROM `zz_modules` WHERE `name` = 'Newsletter'), 'Nome', 'name', 2, 1, 0, 1, 1),
|
||||
((SELECT `id` FROM `zz_modules` WHERE `name` = 'Newsletter'), 'Template', '(SELECT name FROM em_templates WHERE id = em_newsletters.id_template)', 3, 1, 0, 1, 1),
|
||||
((SELECT `id` FROM `zz_modules` WHERE `name` = 'Newsletter'), 'Completato', 'IF(completed_at IS NULL, ''No'', ''Si'')', 4, 1, 0, 1, 1);
|
||||
|
||||
@ -414,11 +414,11 @@ FROM `em_emails`
|
||||
INNER JOIN `zz_users` ON `zz_users`.`id` = `em_emails`.`created_by`
|
||||
WHERE 1=1 AND (`em_emails`.`created_at` BETWEEN ''|period_start|'' AND ''|period_end|'' OR `em_emails`.`sent_at` IS NULL)
|
||||
HAVING 2=2
|
||||
ORDER BY `em_emails`.`created_at` DESC', '', 'fa fa-spinner ', '2.4.11', '2.4.11', '1', (SELECT `id` FROM `zz_modules` t WHERE t.`name` = 'Gestione email'), '1', '1');
|
||||
ORDER BY `em_emails`.`created_at` DESC', '', 'fa fa-spinner ', '2.4.11', '2.*', '1', (SELECT `id` FROM `zz_modules` t WHERE t.`name` = 'Gestione email'), '1', '1');
|
||||
|
||||
INSERT INTO `zz_views` (`id_module`, `name`, `query`, `order`, `search`, `slow`, `default`, `visible`, `format`) VALUES
|
||||
((SELECT `id` FROM `zz_modules` WHERE `name` = 'Stato email'), 'em_emails.id', 'id', 1, 0, 0, 1, 0, 0),
|
||||
((SELECT `id` FROM `zz_modules` WHERE `name` = 'Stato email'), 'Oggetto', 'em_emails.subject', 2, 1, 0, 0, 1, 0),
|
||||
((SELECT `id` FROM `zz_modules` WHERE `name` = 'Stato email'), 'Oggetto', 'em_emails.subject', 2, 1, 0, 1, 1, 0),
|
||||
((SELECT `id` FROM `zz_modules` WHERE `name` = 'Stato email'), 'Contenuto', 'em_emails.content', 3, 1, 0, 0, 1, 0),
|
||||
((SELECT `id` FROM `zz_modules` WHERE `name` = 'Stato email'), 'Template', 'em_templates.name', 3, 1, 0, 1, 1, 0),
|
||||
((SELECT `id` FROM `zz_modules` WHERE `name` = 'Stato email'), 'Data invio', 'em_emails.sent_at', 4, 1, 0, 1, 1, 1),
|
||||
@ -653,3 +653,28 @@ INSERT INTO `zz_plugins` (`id`, `name`, `title`, `idmodule_from`, `idmodule_to`,
|
||||
|
||||
INSERT INTO `zz_settings` (`id`, `nome`, `valore`, `tipo`, `editable`, `sezione`, `order`) VALUES
|
||||
(NULL, 'Iva per lettere d''intento', '', 'query=SELECT id, descrizione FROM `co_iva` WHERE codice_natura_fe = ''N3'' AND deleted_at IS NULL ORDER BY descrizione ASC', 1, 'Fatturazione', 11);
|
||||
|
||||
-- Liste per le newsletter
|
||||
CREATE TABLE IF NOT EXISTS `em_lists` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`name` varchar(255) NOT NULL,
|
||||
`description` TEXT,
|
||||
`query` TEXT,
|
||||
`deleted_at` TIMESTAMP NULL DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `em_list_anagrafica` (
|
||||
`id_list` int(11) NOT NULL,
|
||||
`id_anagrafica` int(11) NOT NULL,
|
||||
FOREIGN KEY (`id_list`) REFERENCES `em_newsletters`(`id`) ON DELETE CASCADE,
|
||||
FOREIGN KEY (`id_anagrafica`) REFERENCES `an_anagrafiche`(`idanagrafica`) ON DELETE CASCADE
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
INSERT INTO `zz_modules` (`id`, `name`, `title`, `directory`, `options`, `options2`, `icon`, `version`, `compatibility`, `order`, `parent`, `default`, `enabled`) VALUES (NULL, 'Liste newsletter', 'Liste', 'liste_newsletter', 'SELECT |select| FROM `em_lists` WHERE deleted_at IS NULL AND 1=1 HAVING 2=2', '', 'fa fa-list', '2.4.11', '2.*', '1', (SELECT `id` FROM `zz_modules` t WHERE t.`name` = 'Gestione email'), '1', '0');
|
||||
|
||||
INSERT INTO `zz_views` (`id_module`, `name`, `query`, `order`, `search`, `slow`, `default`, `visible`) VALUES
|
||||
((SELECT `id` FROM `zz_modules` WHERE `name` = 'Liste newsletter'), 'id', 'id', 1, 0, 0, 1, 0),
|
||||
((SELECT `id` FROM `zz_modules` WHERE `name` = 'Liste newsletter'), 'Nome', 'name', 2, 1, 0, 1, 1),
|
||||
((SELECT `id` FROM `zz_modules` WHERE `name` = 'Liste newsletter'), 'Descrizione', 'description', 3, 1, 0, 1, 1),
|
||||
((SELECT `id` FROM `zz_modules` WHERE `name` = 'Liste newsletter'), 'Dinamica', 'IF(query IS NULL, ''No'', ''Si'')', 4, 1, 0, 1, 1);
|
||||
|
@ -12,6 +12,7 @@ return [
|
||||
'an_zone',
|
||||
'co_banche',
|
||||
'co_contratti',
|
||||
'co_dichiarazioni_intento',
|
||||
'co_promemoria',
|
||||
'co_contratti_tipiintervento',
|
||||
'co_documenti',
|
||||
@ -52,6 +53,8 @@ return [
|
||||
'em_accounts',
|
||||
'em_templates',
|
||||
'em_newsletters',
|
||||
'em_lists',
|
||||
'em_list_anagrafica',
|
||||
'em_emails',
|
||||
'em_email_receiver',
|
||||
'em_email_upload',
|
||||
|
Loading…
x
Reference in New Issue
Block a user