Fix newsletters
This commit is contained in:
parent
ace89cd3ca
commit
fae81cc5c6
|
@ -150,9 +150,23 @@ echo '
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
<?php
|
<?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">
|
<a class="btn btn-danger ask" data-backto="record-list">
|
||||||
<i class="fa fa-trash"></i> <?php echo tr('Elimina'); ?>
|
<i class="fa fa-trash"></i> <?php echo tr('Elimina'); ?>
|
||||||
</a>
|
</a>
|
||||||
|
|
|
@ -17,8 +17,13 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
use Modules\Newsletter\Newsletter;
|
||||||
|
|
||||||
include_once __DIR__.'/../../core.php';
|
include_once __DIR__.'/../../core.php';
|
||||||
|
|
||||||
if (isset($id_record)) {
|
if (isset($id_record)) {
|
||||||
$record = $dbo->fetchOne('SELECT * FROM em_templates WHERE id='.prepare($id_record).' AND deleted_at IS NULL');
|
$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();
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@ echo '
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-6">
|
<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>
|
||||||
|
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ($newsletter->state == 'DEV') {
|
if ($newsletter->state == 'DEV' && !empty($template)) {
|
||||||
echo '
|
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">
|
<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').'
|
<i class="fa fa-envelope"></i> '.tr('Invia newsletter').'
|
||||||
|
|
|
@ -18,9 +18,16 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use Modules\Emails\Mail;
|
use Modules\Emails\Mail;
|
||||||
|
use Modules\Emails\Template;
|
||||||
|
|
||||||
include_once __DIR__.'/../../core.php';
|
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';
|
$block_edit = $newsletter->state != 'DEV';
|
||||||
|
|
||||||
$stati = [
|
$stati = [
|
||||||
|
@ -53,7 +60,7 @@ echo '
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
'.Modules::link('Template email', $record['id_template'], null, null, 'class="pull-right"').'
|
'.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>
|
||||||
|
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
|
@ -152,7 +159,7 @@ echo '
|
||||||
</h3>
|
</h3>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="panel-body">';
|
<div class="panel-body" style="max-height:700px;overflow-y:auto;">';
|
||||||
|
|
||||||
if (!$anagrafiche->isEmpty()) {
|
if (!$anagrafiche->isEmpty()) {
|
||||||
echo '
|
echo '
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use Modules\Newsletter\Newsletter;
|
use Modules\Newsletter\Newsletter;
|
||||||
|
use Modules\Emails\Template;
|
||||||
|
|
||||||
include_once __DIR__.'/../../core.php';
|
include_once __DIR__.'/../../core.php';
|
||||||
|
|
||||||
|
@ -25,4 +26,6 @@ if (isset($id_record)) {
|
||||||
$newsletter = Newsletter::find($id_record);
|
$newsletter = Newsletter::find($id_record);
|
||||||
|
|
||||||
$record = $newsletter->toArray();
|
$record = $newsletter->toArray();
|
||||||
|
|
||||||
|
$template = Template::find($record['id_template']);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue