Introduzione modulo fasce orarie e modulo eventi

This commit is contained in:
Luca 2022-03-25 19:26:50 +01:00
parent c8215016e1
commit 07636b7e7a
15 changed files with 751 additions and 3 deletions

View File

@ -185,7 +185,7 @@ if (!function_exists('replace')) {
*/
function replace($string, $array)
{
return str_replace(array_keys($array), array_values($array), $string);
return str_replace(array_keys($array), array_values($array), (string) $string);
}
}

View File

@ -0,0 +1,92 @@
<?php
/*
* OpenSTAManager: il software gestionale open source per l'assistenza tecnica e la fatturazione
* Copyright (C) DevCode s.r.l.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
include_once __DIR__.'/../../core.php';
switch (post('op')) {
case 'update':
$nome = post('nome');
$data = post('data');
$id_nazione = post('id_nazione');
$id_regione = post('id_regione');
$is_recurring = post('is_recurring');
$is_bank_holiday = post('is_recurring');
if ($dbo->fetchNum('SELECT * FROM `zz_events` WHERE `nome`='.prepare($nome).' AND `id`!='.prepare($id_record)) == 0) {
$dbo->update('zz_events', [
'nome' => $nome,
'data' => $data,
'id_nazione' =>$id_nazione,
'id_regione' => $id_regione,
'is_recurring' => $is_recurring,
'is_bank_holiday' => $is_bank_holiday,
], [
'id' => $id_record,
]);
flash()->info(tr('Salvataggio completato.'));
} else {
flash()->error(tr("E' già presente un _TYPE_ con lo stesso nome", [
'_TYPE_' => 'evento',
]));
}
break;
case 'add':
$nome = post('nome');
$id_nazione = post('id_nazione');
if ($dbo->fetchNum('SELECT * FROM `zz_events` WHERE `id_nazione` = '.prepare($id_nazione).' AND `nome`='.prepare($nome)) == 0) {
$dbo->insert('zz_events', [
'nome' => $nome,
'id_nazione' => $id_nazione,
]);
$id_record = $dbo->lastInsertedID();
if (isAjaxRequest()) {
echo json_encode(['id' => $id_record, 'text' => $nome]);
}
flash()->info(tr('Aggiunto nuovo _TYPE_', [
'_TYPE_' => 'evento',
]));
} else {
flash()->error(tr("E' già presente un _TYPE_ con lo stesso nome e nazione", [
'_TYPE_' => 'evento',
]));
}
break;
case 'delete':
$dbo->delete('zz_events', [
'id' => $id_record,
]);
flash()->info(tr('_TYPE_ eliminato con successo.', [
'_TYPE_' => 'Evento',
]));
break;
}

43
modules/eventi/add.php Normal file
View File

@ -0,0 +1,43 @@
<?php
/*
* OpenSTAManager: il software gestionale open source per l'assistenza tecnica e la fatturazione
* Copyright (C) DevCode s.r.l.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
include_once __DIR__.'/../../core.php';
?><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-6">
{[ "type": "text", "label": "<?php echo tr('Nome'); ?>", "name": "nome", "required": 1 ]}
</div>
<div class="col-md-6">
{[ "type": "select", "label": "<?php echo tr('Nazione'); ?>", "name": "id_nazione", "required": 1, "ajax-source": "nazioni" ]}
</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> <?php echo tr('Aggiungi'); ?></button>
</div>
</div>
</form>

View File

@ -0,0 +1,35 @@
<?php
/*
* OpenSTAManager: il software gestionale open source per l'assistenza tecnica e la fatturazione
* Copyright (C) DevCode s.r.l.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
include_once __DIR__.'/../../../core.php';
switch ($resource) {
case 'fasce_orarie':
$query = 'SELECT id, nome AS descrizione FROM zz_events |where| ORDER BY nome ASC';
foreach ($elements as $element) {
$filter[] = 'id='.prepare($element);
}
if (!empty($search)) {
$search_fields[] = 'nome LIKE '.prepare('%'.$search.'%');
}
break;
}

74
modules/eventi/edit.php Normal file
View File

@ -0,0 +1,74 @@
<?php
/*
* OpenSTAManager: il software gestionale open source per l'assistenza tecnica e la fatturazione
* Copyright (C) DevCode s.r.l.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
use Carbon\Carbon;
include_once __DIR__.'/../../core.php';
//$block_edit = $record['is_predefined'];
?>
<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"><?php echo tr('Dati'); ?></h3>
</div>
<div class="panel-body">
<div class="row">
<div class="col-md-6">
{[ "type": "text", "label": "<?php echo tr('Nome'); ?>", "name": "nome", "required": 1, "value": "$nome$" ]}
</div>
<div class="col-md-6">
{[ "type": "date", "label": "<?php echo tr('Data'); ?>", "name": "data", "required": 1, "value": "$data$" ]}
</div>
</div>
<div class="row">
<div class="col-md-6">
{[ "type": "select", "label": "<?php echo tr('Nazione'); ?>", "name": "id_nazione", "required": 1, "value": "$id_nazione$", "ajax-source": "nazioni" ]}
</div>
<div class="col-md-6">
{[ "type": "select", "label": "<?php echo tr('Regione'); ?>", "name": "id_regione", "value": "$id_regione$", "ajax-source": "regioni" ]}
</div>
</div>
<div class="row">
<div class="col-md-6">
{[ "type": "checkbox", "label": "<?php echo tr('Ricorrente'); ?>", "name": "is_recurring", "value": "$is_recurring$" ]}
</div>
<div class="col-md-6">
{[ "type": "checkbox", "label": "<?php echo tr('Festività'); ?>", "name": "is_bank_holiday", "value": "$is_bank_holiday$" ]}
</div>
</div>
</div>
</div>
</form>
<a class="btn btn-danger ask" data-backto="record-list">
<i class="fa fa-trash"></i> <?php echo tr('Elimina'); ?>
</a>

24
modules/eventi/init.php Normal file
View File

@ -0,0 +1,24 @@
<?php
/*
* OpenSTAManager: il software gestionale open source per l'assistenza tecnica e la fatturazione
* Copyright (C) DevCode s.r.l.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
include_once __DIR__.'/../../core.php';
if (isset($id_record)) {
$record = $dbo->fetchOne('SELECT * FROM `zz_events` WHERE id='.prepare($id_record));
}

View File

@ -0,0 +1,103 @@
<?php
/*
* OpenSTAManager: il software gestionale open source per l'assistenza tecnica e la fatturazione
* Copyright (C) DevCode s.r.l.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
include_once __DIR__.'/../../core.php';
switch (post('op')) {
case 'update':
$nome = post('nome');
$giorni = (array) post('giorni');
$ora_inizio = post('ora_inizio');
$ora_fine = post('ora_fine');
$include_bank_holidays = post('include_bank_holidays');
if ($dbo->fetchNum('SELECT * FROM `in_fasceorarie` WHERE `nome`='.prepare($nome).' AND `id`!='.prepare($id_record)) == 0) {
$dbo->update('in_fasceorarie', [
'nome' => $nome,
'giorni' => $giorni ? implode(',' , $giorni) : null,
'ora_inizio' =>$ora_inizio,
'ora_fine' => $ora_fine,
'include_bank_holidays' => $include_bank_holidays,
], [
'id' => $id_record,
]);
flash()->info(tr('Salvataggio completato.'));
} else {
flash()->error(tr("E' già presente una _TYPE_ con lo stesso nome", [
'_TYPE_' => 'fascia oraria',
]));
}
break;
case 'add':
$nome = post('nome');
if ($dbo->fetchNum('SELECT * FROM `in_fasceorarie` WHERE `nome`='.prepare($nome)) == 0) {
$dbo->insert('in_fasceorarie', [
'nome' => $nome,
]);
$id_record = $dbo->lastInsertedID();
if (isAjaxRequest()) {
echo json_encode(['id' => $id_record, 'text' => $nome]);
}
flash()->info(tr('Aggiunta nuova _TYPE_', [
'_TYPE_' => 'fascia oraria',
]));
} else {
flash()->error(tr("E' già presente una _TYPE_ con lo stesso nome", [
'_TYPE_' => 'fascia oraria',
]));
}
break;
case 'delete':
$tipi_interventi = $dbo->fetchNum('SELECT idtipointervento FROM in_fasceorarie_tipiintervento WHERE idfasciaoraria='.prepare($id_record));
if (isset($id_record) && empty($tipi_interventi)) {
$dbo->delete('in_fasceorarie', [
'id' => $id_record,
'can_delete' => 1,
]);
flash()->info(tr('_TYPE_ eliminata con successo.', [
'_TYPE_' => 'Fascia oraria',
]));
} else {
flash()->error(tr('Sono presenti dei tipi interventi collegate a questa fascia oraria.'));
# soft delete
/*$dbo->update('in_fasceorarie', [
'deleted_at' => date('Y-m-d H:i:s'),
], ['id' => $id_record, 'can_delete' => 1]);*/
}
break;
}

View File

@ -0,0 +1,38 @@
<?php
/*
* OpenSTAManager: il software gestionale open source per l'assistenza tecnica e la fatturazione
* Copyright (C) DevCode s.r.l.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
include_once __DIR__.'/../../core.php';
?><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": "<?php echo tr('Nome'); ?>", "name": "nome", "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> <?php echo tr('Aggiungi'); ?></button>
</div>
</div>
</form>

View File

@ -0,0 +1,35 @@
<?php
/*
* OpenSTAManager: il software gestionale open source per l'assistenza tecnica e la fatturazione
* Copyright (C) DevCode s.r.l.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
include_once __DIR__.'/../../../core.php';
switch ($resource) {
case 'fasce_orarie':
$query = 'SELECT id, nome AS descrizione FROM in_fasceorarie |where| ORDER BY nome ASC';
foreach ($elements as $element) {
$filter[] = 'id='.prepare($element);
}
if (!empty($search)) {
$search_fields[] = 'nome LIKE '.prepare('%'.$search.'%');
}
break;
}

View File

@ -0,0 +1,182 @@
<?php
/*
* OpenSTAManager: il software gestionale open source per l'assistenza tecnica e la fatturazione
* Copyright (C) DevCode s.r.l.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
include_once __DIR__.'/../../core.php';
//$block_edit = $record['is_predefined'];
?>
<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"><?php echo tr('Dati'); ?></h3>
</div>
<div class="panel-body">
<div class="row">
<div class="col-md-6">
{[ "type": "text", "label": "<?php echo tr('Nome'); ?>", "name": "nome", "required": 1, "value": "$nome$" ]}
</div>
<div class="col-md-6">
{[ "type": "select", "multiple":"1", "label": "<?php echo tr('Giorni'); ?>", "name": "giorni[]", "required": 0, "value": "$giorni$", "values": "list=\"1\":\"<?php echo tr('Lunedì'); ?>\", \"2\":\"<?php echo tr('Martedì'); ?>\", \"3\":\"<?php echo tr('Mercoledì'); ?>\", \"4\":\"<?php echo tr('Giovedì'); ?>\", \"5\":\"<?php echo tr('Venerdì'); ?>\", \"6\":\"<?php echo tr('Sabato'); ?>\", \"7\":\"<?php echo tr('Domenica'); ?>\"" ]}
</div>
</div>
<div class="row">
<div class="col-md-4">
{[ "type": "time", "label": "<?php echo tr('Ora inizio'); ?>", "name": "ora_inizio", "required": 1, "value": "$ora_inizio$" ]}
</div>
<div class="col-md-4">
{[ "type": "time", "label": "<?php echo tr('Ora fine'); ?>", "name": "ora_fine", "required": 1, "value": "$ora_fine$" ]}
</div>
<div class="col-md-4">
{[ "type": "checkbox", "label": "<?php echo tr('Includi festività'); ?>", "name": "include_bank_holidays", "required": 0, "value": "$include_bank_holidays$" ]}
</div>
</div>
</div>
</div>
<!-- Date aggiuntive -->
<div class="panel panel-primary hide">
<div class="panel-heading">
<h3 class="panel-title"><?php echo tr('Date aggiuntive'); ?></h3>
</div>
<div class="panel-body">
<div id="elenco-date">
<?php
$results = $dbo->fetchArray('SELECT * FROM `co_pagamenti` WHERE descrizione='.prepare($record['descrizione']).' ORDER BY `num_giorni` ASC');
$numero_data = 1;
foreach ($results as $result) {
}
?>
</div>
<div class="pull-right">
<button type="button" class="btn btn-info" onclick="aggiungiData()">
<i class="fa fa-plus"></i> <?php echo tr('Aggiungi'); ?>
</button>
<button type="submit" class="btn btn-success">
<i class="fa fa-check"></i> <?php echo tr('Salva'); ?>
</button>
</div>
</div>
</div>
</form>
<?php
echo '
<form class="hide" id="template">
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">'.tr('Nuova data').'</h3>
</div>
<div class="box-body">
<input type="hidden" value="" name="id[-id-]">
<div class="row">
<div class="col-md-6">
{[ "type": "text", "label": "'.tr('Nome').'", "name": "nome[-id-]"]}
</div>
<div class="col-md-3">
{[ "type": "date", "label": "'.tr('Data').'", "name": "data[-id-]" ]}
</div>
<div class="col-md-3">
{[ "type": "checkbox", "label": "'.tr('Data ricorrente').'", "name": "data_ricorrente[-id-]", "value": "" ]}
</div>
</div>
</div>
</div>
</form>';
?>
<script>
var indice_data = "<?php echo $numero_data; ?>";
function aggiungiData() {
aggiungiContenuto("#elenco-date", "#template", {"-id-": indice_data});
indice_data++;
}
</script>
<?php
$elementi = $dbo->fetchArray('SELECT in_tipiintervento.codice, in_tipiintervento.descrizione, in_tipiintervento.idtipointervento FROM in_tipiintervento LEFT JOIN in_fasceorarie_tipiintervento ON in_tipiintervento.idtipointervento=in_fasceorarie_tipiintervento.idtipointervento WHERE in_fasceorarie_tipiintervento.idfasciaoraria='.prepare($id_record));
if (!empty($elementi)) {
echo '
<div class="box box-warning collapsable collapsed-box">
<div class="box-header with-border">
<h3 class="box-title"><i class="fa fa-warning"></i> '.tr('Tipi interventi collegati: _NUM_', [
'_NUM_' => count($elementi),
]).'</h3>
<div class="box-tools pull-right">
<button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-plus"></i></button>
</div>
</div>
<div class="box-body">
<ul>';
foreach ($elementi as $elemento) {
$descrizione = tr('_REF_ (_TIPO_INTERVENTO_)', [
'_REF_' => $elemento['descrizione'],
'_TIPO_INTERVENTO_' => $elemento['codice'],
]);
$modulo = 'Tipi di intervento';
$id = $elemento['idtipointervento'];
echo '
<li>'.Modules::link($modulo, $id, $descrizione).'</li>';
}
echo '
</ul>
</div>
</div>';
}
?>
<a class="btn btn-danger ask <?php echo (intval($record['can_delete']) ? 'disabled' : ''); ?>" data-backto="record-list">
<i class="fa fa-trash"></i> <?php echo tr('Elimina'); ?>
</a>

View File

@ -0,0 +1,24 @@
<?php
/*
* OpenSTAManager: il software gestionale open source per l'assistenza tecnica e la fatturazione
* Copyright (C) DevCode s.r.l.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
include_once __DIR__.'/../../core.php';
if (isset($id_record)) {
$record = $dbo->fetchOne('SELECT * FROM `in_fasceorarie` WHERE id='.prepare($id_record));
}

View File

@ -79,7 +79,7 @@ class Query
$user = Auth::user();
// Sostituzione periodi temporali
preg_match('|date_period\((.+?)\)|', $query, $matches);
preg_match('|date_period\((.+?)\)|', (string) $query, $matches);
$date_query = $date_filter = null;
if (!empty($matches)) {
$dates = explode(',', $matches[1]);
@ -102,7 +102,7 @@ class Query
}
// Sostituzione periodi temporali
preg_match('|segment\((.+?)\)|', $query, $matches);
preg_match('|segment\((.+?)\)|', (string) $query, $matches);
$segment_name = !empty($matches[1]) ? $matches[1] : 'id_segment';
$segment_filter = !empty($matches[0]) ? $matches[0] : 'segment';

25
update/2_4_33.php Normal file
View File

@ -0,0 +1,25 @@
<?php
$fascie_orarie = $database->fetchArray('SELECT * FROM in_fasceorarie');
$tipi_intervento = $database->fetchArray('SELECT * FROM in_tipiintervento');
foreach ($fascie_orarie as $fascia_oraria) {
foreach ($tipi_intervento as $tipo_intervento) {
$database->insert('in_fasceorarie_tipiintervento', [
'idfasciaoraria' => $fascia_oraria['id'],
'idtipointervento' => $tipo_intervento['idtipointervento'],
'costo_orario' => $tipo_intervento['costo_orario'],
'costo_km' => $tipo_intervento['costo_km'],
'costo_diritto_chiamata' => $tipo_intervento['costo_diritto_chiamata'],
'costo_orario_tecnico' => $tipo_intervento['costo_orario_tecnico'],
'costo_km_tecnico' => $tipo_intervento['costo_km_tecnico'],
'costo_diritto_chiamata_tecnico' => $tipo_intervento['costo_km_tecnico'],
]);
}
}
?>

70
update/2_4_33.sql Normal file
View File

@ -0,0 +1,70 @@
-- Nuovo modulo "Fasce orarie"
CREATE TABLE IF NOT EXISTS `in_fasceorarie` (
`id` int NOT NULL AUTO_INCREMENT,
`nome` varchar(255) NOT NULL,
`giorni` varchar(255) DEFAULT NULL,
`ora_inizio` time DEFAULT NULL,
`ora_fine` time DEFAULT NULL,
`can_delete` BOOLEAN NOT NULL DEFAULT TRUE,
`include_bank_holidays` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=InnoDB;
INSERT INTO `zz_modules` (`id`, `name`, `title`, `directory`, `options`, `options2`, `icon`, `version`, `compatibility`, `order`, `parent`, `default`, `enabled`, `use_notes`, `use_checklists`) VALUES (NULL, 'Fasce orarie', 'Fasce orarie', 'fasce_orarie', 'SELECT |select| FROM `in_fasceorarie` WHERE 1=1 HAVING 2=2', '', 'fa fa-angle-right', '2.4.32', '2.4.32', '1', (SELECT id FROM zz_modules t WHERE t.name = 'Interventi'), '1', '1', '0', '0');
INSERT INTO `zz_views` (`id`, `id_module`, `name`, `query`, `order`, `visible`, `format`, `default`) VALUES
(NULL, (SELECT `id` FROM `zz_modules` WHERE `name` = 'Fasce orarie'), 'id', 'in_fasceorarie.id', 1, 1, 0, 1),
(NULL, (SELECT `id` FROM `zz_modules` WHERE `name` = 'Fasce orarie'), 'Nome', 'in_fasceorarie.nome', 2, 1, 0, 1),
(NULL, (SELECT `id` FROM `zz_modules` WHERE `name` = 'Fasce orarie'), 'Festività', 'IF(in_fasceorarie.include_bank_holidays, ''S&igrave;'', ''No'')', 3, 1, 0, 1);
-- Fascia oraria "Ordinaria"
INSERT INTO `in_fasceorarie` (`id`, `nome`, `giorni`, `ora_inizio`, `ora_fine`, `can_delete`) VALUES (NULL, 'Ordinario', '1,2,3,4,5,6,7', '00:00', '23:59', '0');
-- Relazione fasca oraria / tipo intervento
CREATE TABLE IF NOT EXISTS `in_fasceorarie_tipiintervento` (
`idfasciaoraria` int NOT NULL,
`idtipointervento` int NOT NULL,
`costo_orario` decimal(12,6) NOT NULL,
`costo_km` decimal(12,6) NOT NULL,
`costo_diritto_chiamata` decimal(12,6) NOT NULL,
`costo_orario_tecnico` decimal(12,6) NOT NULL,
`costo_km_tecnico` decimal(12,6) NOT NULL,
`costo_diritto_chiamata_tecnico` decimal(12,6) NOT NULL,
PRIMARY KEY (`idfasciaoraria`,`idtipointervento`),
FOREIGN KEY (`idfasciaoraria`) REFERENCES `in_fasceorarie` (`id`),
FOREIGN KEY (`idtipointervento`) REFERENCES `in_tipiintervento` (`idtipointervento`),
KEY `idtipointervento` (`idtipointervento`)
) ENGINE=InnoDB;
-- Nuovo modulo "Eventi"
CREATE TABLE IF NOT EXISTS `zz_events` (
`id` int NOT NULL AUTO_INCREMENT,
`nome` varchar(255) NOT NULL,
`data` date NOT NULL,
`id_nazione` int NOT NULL,
`id_regione` int DEFAULT NULL,
`is_recurring` tinyint(1) NOT NULL DEFAULT '0',
`is_bank_holiday` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
FOREIGN KEY (`id_nazione`) REFERENCES `an_nazioni` (`id`)
) ENGINE=InnoDB;
INSERT INTO `zz_modules` (`id`, `name`, `title`, `directory`, `options`, `options2`, `icon`, `version`, `compatibility`, `order`, `parent`, `default`, `enabled`, `use_notes`, `use_checklists`) VALUES (NULL, 'Eventi', 'Eventi', 'eventi', 'SELECT |select| FROM `zz_events` INNER JOIN `an_nazioni` ON `an_nazioni`.id = `zz_events`.id_nazione WHERE 1=1 HAVING 2=2', '', 'fa fa-angle-right', '2.4.32', '2.4.32', '1', (SELECT id FROM zz_modules t WHERE t.name = 'Tabelle'), '1', '1', '0', '0');
INSERT INTO `zz_views` (`id`, `id_module`, `name`, `query`, `order`, `visible`, `format`, `default`) VALUES
(NULL, (SELECT `id` FROM `zz_modules` WHERE `name` = 'Eventi'), 'id', 'zz_events.id', 1, 0, 0, 1),
(NULL, (SELECT `id` FROM `zz_modules` WHERE `name` = 'Eventi'), 'Nome', 'zz_events.nome', 2, 1, 0, 1),
(NULL, (SELECT `id` FROM `zz_modules` WHERE `name` = 'Eventi'), 'Nazione', 'an_nazioni.nome', 3, 1, 0, 1)
(NULL, (SELECT `id` FROM `zz_modules` WHERE `name` = 'Eventi'), 'Data', 'zz_events.data', 4, 1, 1, 1),;
-- Natale
INSERT INTO `zz_events` (`id`, `nome`, `data`, `id_nazione`, `id_regione`, `is_recurring`, `is_bank_holiday`) VALUES (NULL, 'Natale', '2022-12-25', (SELECT id FROM an_nazioni WHERE nome = 'Italia'), NULL, '1', '1');
-- Fix ordine colonne Conto dare e Conto avere in Prima nota
UPDATE `zz_views` SET `order` = '8' WHERE `zz_views`.`name` = 'Conto dare';
UPDATE `zz_views` SET `order` = '9' WHERE `zz_views`.`name` = 'Conto avere';
UPDATE `zz_views` SET `order` = '20' WHERE `zz_views`.`name` = '_print_';

View File

@ -82,6 +82,8 @@ return [
'in_tariffe',
'in_tipiintervento',
'in_vociservizio',
'in_fasceorarie',
'in_fasceorarie_tipiintervento',
'mg_articoli',
'mg_fornitore_articolo',
'mg_categorie',
@ -118,6 +120,7 @@ return [
'zz_checklist_items',
'zz_documenti',
'zz_documenti_categorie',
'zz_events',
'zz_field_record',
'zz_fields',
'zz_files',