Miglioramenti email
This commit is contained in:
parent
18a03845e3
commit
ae7de0d8b3
|
@ -79,12 +79,9 @@ $_SESSION['superselect']['id_categoria'] = $record['id_categoria'];
|
|||
{[ "type": "select", "label": "<?php echo tr('Unità di misura'); ?>", "name": "um", "value": "$um$", "ajax-source": "misure", "icon-after": "add|<?php echo Modules::get('Unità di misura')['id']; ?>" ]}
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-md-4">
|
||||
{[ "type": "checkbox", "label": "<?php echo tr('Abilita serial number'); ?>", "name": "abilita_serial", "value": "$abilita_serial$", "help": "<?php echo tr('Abilita serial number in fase di aggiunta articolo in fattura o ddt'); ?>", "placeholder": "<?php echo tr('Serial number'); ?>", "extra": "<?php echo ($record['serial'] > 0) ? 'readonly' : ''; ?>" ]}
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class='row' id="div_modifica_manuale" style="display:none;">
|
||||
|
|
|
@ -24,6 +24,7 @@ class EmailHook extends Manager
|
|||
$accounts = Account::all();
|
||||
$remaining = Mail::whereNull('sent_at')
|
||||
->where($failed)
|
||||
->where('attempt', '<', 10)
|
||||
->whereIn('id_account', $accounts->pluck('id'))
|
||||
->count();
|
||||
|
||||
|
@ -55,6 +56,7 @@ class EmailHook extends Manager
|
|||
$mail = Mail::whereNull('sent_at')
|
||||
->where('id_account', $account->id)
|
||||
->where($failed)
|
||||
->where('attempt', '<', 10)
|
||||
->orderBy('created_at')
|
||||
->first();
|
||||
|
||||
|
@ -83,12 +85,14 @@ class EmailHook extends Manager
|
|||
$user = auth()->getUser();
|
||||
|
||||
$current = Mail::whereDate('sent_at', '>', $yesterday)
|
||||
->where('attempt', '<', 10)
|
||||
->where('created_by', $user->id)
|
||||
->count();
|
||||
$total = Mail::where(function ($query) use ($yesterday) {
|
||||
$query->whereDate('sent_at', '>', $yesterday)
|
||||
->orWhereNull('sent_at');
|
||||
})
|
||||
->where('attempt', '<', 10)
|
||||
->where('created_by', $user->id)
|
||||
->count();
|
||||
|
||||
|
|
|
@ -160,7 +160,7 @@ echo '
|
|||
</table>
|
||||
|
||||
<div class='pull-right'>
|
||||
<a onclick="launch_modal( 'Registra contabile pagamento', '<?php echo $rootdir; ?>/add.php?id_module=<?php echo Modules::get('Prima nota')['id']; ?>&<?php echo (!empty($record['iddocumento']) ? 'id_documenti='.$record['iddocumento'].'&single=1' : 'id_scadenze='.$id_record) ?>');" class="btn btn-sm btn-primary"><i class="fa fa-euro"></i> <?php echo tr('Registra contabile pagamento...'); ?></a>
|
||||
<a onclick="launch_modal( 'Registra contabile pagamento', '<?php echo $rootdir; ?>/add.php?id_module=<?php echo Modules::get('Prima nota')['id']; ?>&<?php echo !empty($record['iddocumento']) ? 'id_documenti='.$record['iddocumento'].'&single=1' : 'id_scadenze='.$id_record; ?>');" class="btn btn-sm btn-primary"><i class="fa fa-euro"></i> <?php echo tr('Registra contabile pagamento...'); ?></a>
|
||||
</div>
|
||||
|
||||
<div class="clearfix"></div>
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
<?php
|
||||
|
||||
include_once __DIR__.'/../../core.php';
|
||||
|
||||
switch (post('op')) {
|
||||
case 'retry':
|
||||
$mail->attempt = 0;
|
||||
|
||||
$mail->save();
|
||||
break;
|
||||
|
||||
case 'delete':
|
||||
if (empty($mail->sent_at)) {
|
||||
$mail->delete();
|
||||
|
||||
flash()->info(tr('Email rimossa dalla coda di invio!'));
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
|
@ -29,7 +29,9 @@ echo '
|
|||
|
||||
<div class="col-md-3">
|
||||
<h4>'.tr('Ultimo tentativo').'</h4>
|
||||
'.($mail->failed_at ? timestampFormat($mail->failed_at) : '-').'
|
||||
'.($mail->processing_at ? timestampFormat($mail->processing_at) : '-').' ('.tr('totale: _TOT_', [
|
||||
'_TOT_' => $mail->attempt,
|
||||
]).')
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -139,3 +141,17 @@ echo '
|
|||
<div class="well">
|
||||
'.$mail->content.'
|
||||
</div>';
|
||||
|
||||
if (empty($mail->sent_at)) {
|
||||
echo '
|
||||
<a class="btn btn-danger ask" data-backto="record-list">
|
||||
<i class="fa fa-trash"></i> '.tr('Elimina').'
|
||||
</a>';
|
||||
|
||||
if ($mail->attempt >= 10) {
|
||||
echo '
|
||||
<a class="btn btn-warning ask pull-right" data-backto="record-edit" data-msg="'.tr("Rimettere in coda l'email?").'" data-op="retry" data-button="'.tr('Rimetti in coda').'" data-class="btn btn-lg btn-warning" >
|
||||
<i class="fa fa-refresh"></i> '.tr('Rimetti in coda').'
|
||||
</a>';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -159,6 +159,9 @@ class EmailNotification extends PHPMailer implements NotificationInterface
|
|||
$this->mail->failed_at = date('Y-m-d H:i:s');
|
||||
}
|
||||
|
||||
// Salvataggio del numero di tentativi
|
||||
$this->mail->attempt = $this->mail->attempt + 1;
|
||||
|
||||
$this->mail->save();
|
||||
}
|
||||
|
||||
|
@ -226,7 +229,7 @@ class EmailNotification extends PHPMailer implements NotificationInterface
|
|||
|
||||
$info = Prints::render($print['id'], $id_record, $path);
|
||||
$name = $name ?: $info['name'];
|
||||
|
||||
|
||||
$this->addAttachment($info['path'], $name);
|
||||
}
|
||||
|
||||
|
|
|
@ -853,3 +853,6 @@ UPDATE `zz_settings` SET `tipo` = 'list[1,2,3,4,5]' WHERE `nome` = 'Cifre decima
|
|||
|
||||
-- Aggiunta percentuale combinata in listini
|
||||
ALTER TABLE `mg_listini` ADD `prc_combinato` VARCHAR(255);
|
||||
|
||||
-- Aggiunto supporto ai tentativi di invio email
|
||||
ALTER TABLE `em_emails` ADD `attempt` INT(11) NOT NULL DEFAULT 0;
|
||||
|
|
Loading…
Reference in New Issue