1
0
mirror of https://github.com/devcode-it/openstamanager.git synced 2025-02-16 19:40:44 +01:00
This commit is contained in:
Pek5892 2024-03-01 17:32:31 +01:00
parent cd801efce9
commit a69f016a29
8 changed files with 90 additions and 84 deletions

View File

@ -120,7 +120,7 @@ if (!empty($options['create_document'])) {
elseif ($final_module['name'] == 'Interventi') {
echo '
<div class="col-md-6">
{[ "type": "select", "label": "'.tr('Stato').'", "name": "id_stato_intervento", "required": 1, "values": "query=SELECT `id_statiintervento`.`id`, `in_statiintervento_lang`.`name` as `descrizione`, `colore` AS _bgcolor_ FROM `in_statiintervento` LEFT JOIN `in_statiintervento_lang` ON (`in_statiintervento`.`id` = `in_statiintervento_lang`.`id_record` AND `in_statiintervento_lang`.`id_lang` = '.prepare(setting('Lingua')).') WHERE `deleted_at` IS NULL AND `is_completato` = 0 ORDER BY `name`" ]}
{[ "type": "select", "label": "'.tr('Stato').'", "name": "id_stato_intervento", "required": 1, "values": "query=SELECT `in_statiintervento`.`id`, `in_statiintervento_lang`.`name` as `descrizione`, `colore` AS _bgcolor_ FROM `in_statiintervento` LEFT JOIN `in_statiintervento_lang` ON (`in_statiintervento`.`id` = `in_statiintervento_lang`.`id_record` AND `in_statiintervento_lang`.`id_lang` = '.prepare(setting('Lingua')).') WHERE `deleted_at` IS NULL AND `is_completato` = 0 ORDER BY `name`" ]}
</div>
<div class="col-md-6">

View File

@ -63,6 +63,7 @@ switch (filter('op')) {
break;
case 'delete':
$lista = Lista::find($id_record);
$lista->delete();
flash()->info(tr('Lista newsletter rimossa!'));

View File

@ -99,6 +99,7 @@ echo '
</div>
</form>';
if ($lista) {
$numero_destinatari = $lista->destinatari()->count();
$destinatari_senza_mail = $lista->getNumeroDestinatariSenzaEmail();
@ -136,9 +137,8 @@ echo '
<a class="btn btn-danger ask" data-backto="record-list">
<i class="fa fa-trash"></i> '.tr('Elimina').'
</a>';
</a>
echo '
<script>
globals.newsletter = {
senza_consenso: "'.$lista->getNumeroDestinatariSenzaConsenso().'",
@ -181,3 +181,4 @@ $(document).ready(function() {
});
});
</script>';
}

View File

@ -35,7 +35,7 @@ switch (post('op')) {
], ['id' => $id_record]);
$dbo->update('in_statiintervento_lang', [
'descrizione' => post('descrizione'),
'name' => post('descrizione'),
], ['id_record' => $id_record, 'id_lang' => setting('Lingua')]);
flash()->info(tr('Informazioni salvate correttamente.'));

View File

@ -19,6 +19,9 @@
include_once __DIR__.'/../../core.php';
use Modules\Interventi\Stato;
$stato = Stato::find($id_record);
if ($record['can_delete']) {
$attr = '';
} else {
@ -39,7 +42,7 @@ if ($record['can_delete']) {
</div>
<div class="col-md-6">
{[ "type": "text", "label": "<?php echo tr('Descrizione'); ?>", "name": "descrizione", "required": 1, "value": "$descrizione$" ]}
{[ "type": "text", "label": "<?php echo tr('Descrizione'); ?>", "name": "descrizione", "required": 1, "value": "<?php echo $stato->name; ?>" ]}
</div>
<div class="col-md-3">

View File

@ -20,5 +20,6 @@
include_once __DIR__.'/../../core.php';
if (isset($id_record)) {
$record = $dbo->fetchOne('SELECT * FROM `in_statiintervento` LEFT JOIN `in_statiintervento_lang` ON (`in_statiintervento`.`id` = `in_statiintervento_lang`.`id_record` AND `in_statiintervento_lang`.`id_lang` = "'.prepare(setting('Lingua')).'") WHERE `id`='.prepare($id_record));
$record = $dbo->fetchOne('SELECT * FROM `in_statiintervento` LEFT JOIN `in_statiintervento_lang` ON (`in_statiintervento`.`id` = `in_statiintervento_lang`.`id_record` AND `in_statiintervento_lang`.`id_lang` = "'.prepare(setting('Lingua')).'") WHERE `in_statiintervento`.`id`='.prepare($id_record));
}

View File

@ -23,7 +23,6 @@ include_once __DIR__.'/../../core.php';
switch (post('op')) {
case 'update':
$tipo->name = post('descrizione');
$tipo->calcola_km = post('calcola_km');
$tipo->tempo_standard = post('tempo_standard');
$tipo->costo_orario = post('costo_orario');
@ -34,6 +33,8 @@ switch (post('op')) {
$tipo->costo_diritto_chiamata_tecnico = post('costo_diritto_chiamata_tecnico');
$tipo->save();
$database->query('UPDATE `in_tipiintervento_lang` SET `name` = '.prepare(post('descrizione')).' WHERE `id_record` = '.prepare($id_record).' AND `id_lang` = '.prepare(setting('Lingua')));
$fasce_ore = (array) post('fascia_ore');
$fascia_km = (array) post('fascia_km');
$fascia_diritto_chiamata = (array) post('fascia_diritto_chiamata');
@ -60,9 +61,9 @@ switch (post('op')) {
case 'add':
$codice = post('codice');
$descrizione = post('descrizione');
$tipo = Tipo::build($codice, $descrizione);
$tipo = Tipo::build($codice);
$database->query('INSERT INTO `in_tipiintervento_lang` (`id_lang`, `id_record`, `name`) VALUES ('.prepare(setting('Lingua')).', '.prepare($tipo->id).', '.prepare(post('descrizione')).')');
$tipo->tempo_standard = post('tempo_standard');
$tipo->calcola_km = post('calcola_km');

View File

@ -37,12 +37,11 @@ class Tipo extends Model
*
* @return self
*/
public static function build($codice, $descrizione)
public static function build($codice)
{
$model = new static();
$model->codice = $codice;
$model->name = $descrizione;
// Salvataggio delle informazioni
$model->save();