Merge remote-tracking branch 'origin/master'

This commit is contained in:
Dasc3er 2021-07-16 14:44:49 +02:00
commit baf48791d3
6 changed files with 35 additions and 6 deletions

View File

@ -150,9 +150,23 @@ echo '
</form>
<?php
if( !empty($newsletters)){
echo '
<div class="alert alert-danger">
'.tr('Questo template non può essere rimosso dal sistema perchè collegato alle seguenti newsletter:').'
<ul>';
if (!$record['predefined']) {
?>
foreach($newsletters as $newsletter){
echo '
<li>'.Modules::link('Newsletter', $newsletter->id, $newsletter->name, null, '').'</li>';
}
echo '
</ul>
</div>';
}elseif (!$record['predefined']) {
?>
<a class="btn btn-danger ask" data-backto="record-list">
<i class="fa fa-trash"></i> <?php echo tr('Elimina'); ?>
</a>

View File

@ -17,8 +17,13 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
use Modules\Newsletter\Newsletter;
include_once __DIR__.'/../../core.php';
if (isset($id_record)) {
$record = $dbo->fetchOne('SELECT * FROM em_templates WHERE id='.prepare($id_record).' AND deleted_at IS NULL');
//Controllo se ci sono newletter collegate a questo template
$newsletters = Newsletter::where('id_template',$id_record)->get();
}

View File

@ -26,7 +26,7 @@ echo '
<div class="row">
<div class="col-md-6">
{[ "type": "select", "label": "'.tr('Template email').'", "name": "id_template", "values": "query=SELECT id, name AS descrizione FROM em_templates", "required": 1 ]}
{[ "type": "select", "label": "'.tr('Template email').'", "name": "id_template", "values": "query=SELECT id, name AS descrizione FROM em_templates WHERE deleted_at IS NULL ORDER BY descrizione", "required": 1 ]}
</div>
<div class="col-md-6">

View File

@ -17,7 +17,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
if ($newsletter->state == 'DEV') {
if ($newsletter->state == 'DEV' && !empty($template)) {
echo '
<button type="button" class="btn btn-primary ask" data-msg="'.tr('Procedere ad inviare la newsletter?').'" data-op="send" data-button="'.tr('Invia').'" data-class="btn btn-lg btn-warning">
<i class="fa fa-envelope"></i> '.tr('Invia newsletter').'

View File

@ -18,9 +18,16 @@
*/
use Modules\Emails\Mail;
use Modules\Emails\Template;
include_once __DIR__.'/../../core.php';
//Controllo se il template è ancora attivo
if( empty($template) ){
echo '
<div class=" alert alert-danger">'.tr('ATTENZIONE! Questa newsletter risulta collegata ad un template non più presente a sistema').'</div>';
}
$block_edit = $newsletter->state != 'DEV';
$stati = [
@ -53,7 +60,7 @@ echo '
<div class="row">
<div class="col-md-6">
'.Modules::link('Template email', $record['id_template'], null, null, 'class="pull-right"').'
{[ "type": "select", "label": "'.tr('Template email').'", "name": "id_template", "values": "query=SELECT id, name AS descrizione FROM em_templates", "required": 1, "value": "$id_template$", "readonly": 1 ]}
{[ "type": "select", "label": "'.tr('Template email').'", "name": "id_template", "values": "query=SELECT id, name AS descrizione FROM em_templates WHERE deleted_at IS NULL ORDER BY descrizione", "required": 1, "value": "$id_template$", "readonly": 1 ]}
</div>
<div class="col-md-6">
@ -152,7 +159,7 @@ echo '
</h3>
</div>
<div class="panel-body">';
<div class="panel-body" style="max-height:700px;overflow-y:auto;">';
if (!$anagrafiche->isEmpty()) {
echo '

View File

@ -18,6 +18,7 @@
*/
use Modules\Newsletter\Newsletter;
use Modules\Emails\Template;
include_once __DIR__.'/../../core.php';
@ -25,4 +26,6 @@ if (isset($id_record)) {
$newsletter = Newsletter::find($id_record);
$record = $newsletter->toArray();
$template = Template::find($record['id_template']);
}