Compare commits

...

8 Commits

Author SHA1 Message Date
Beppe ad3b4d9647 Merge branch 'master' of https://github.com/devcode-it/openstamanager 2024-09-09 12:28:35 +02:00
Beppe f451174d9f Fix salvataggio sedi 2024-09-09 12:28:32 +02:00
valentina 6aee72c4dd Fix importazione anagrafiche 2024-09-09 12:25:31 +02:00
valentina b3e6ceb47d Fix minore 2024-09-09 11:13:54 +02:00
valentina 3d5ca01742 Fix per php8.3 2024-09-09 10:44:19 +02:00
valentina ae28bc6f5a Fix minore 2024-09-09 10:23:27 +02:00
valentina a9cc2ff678 Fix minore 2024-09-09 09:36:14 +02:00
valentina 11c0768197 Fix grafico in statistiche 2024-09-09 09:28:48 +02:00
11 changed files with 54 additions and 61 deletions

View File

@ -112,7 +112,7 @@ switch (filter('op')) {
if ($hook->permission != '-') {
$results[] = [
'id' => $hook->id,
'name' => $hook->getTranslation('title'),
'name' => $hook->name,
];
}
}

View File

@ -24,7 +24,7 @@
date_default_timezone_set('Europe/Rome');
// Controllo sulla versione PHP
$minimum = '7.2.0';
$minimum = '8.1.0';
if (version_compare(phpversion(), $minimum) < 0) {
echo '
<p>Stai utilizzando la versione PHP '.phpversion().', non compatibile con OpenSTAManager.</p>

View File

@ -47,7 +47,8 @@ if (!empty(post('db_host'))) {
'db_username' => $db_username,
'db_password' => $db_password,
]);
} catch (Exception) {
} catch (Throwable $e) {
error_log($e->getMessage());
}
// Test della configurazione

View File

@ -309,7 +309,7 @@ switch (filter('op')) {
->where('id', '=', $id)
->first();
flash()->info(tr('Hook "_NAME_" disabilitato!', [
'_NAME_' => $hook->getTranslation('title'),
'_NAME_' => $hook->name,
]));
echo json_encode([]);
@ -329,7 +329,7 @@ switch (filter('op')) {
->where('id', '=', $id)
->first();
flash()->info(tr('Hook "_NAME_" abilitato!', [
'_NAME_' => $hook->getTranslation('title'),
'_NAME_' => $hook->name,
]));
echo json_encode([]);

View File

@ -57,9 +57,9 @@ foreach ($gruppi as $modulo => $hooks) {
$nome_tipo = 'hook';
echo '
<tr class="'.$class.'" data-id="'.$hook->id.'" data-nome='.json_encode($hook->getTranslation('title')).'>
<tr class="'.$class.'" data-id="'.$hook->id.'" data-nome='.json_encode($hook->name).'>
<td>
'.$hook->getTranslation('title').(!empty($hook->help) ? '
'.$hook->name.(!empty($hook->help) ? '
<i class="tip fa fa-question-circle-o" title="'.$hook->help.'"</i>' : '').'
</td>

View File

@ -41,86 +41,72 @@ $(document).ready(function() {
},
success: function(data) {
data = JSON.parse(data);
crea_grafico(data);
}
});
});
function crea_grafico(values){
var ctx = $("#chart");
$data = [];
$labels = [];
var ctx = $("#chart");
$data = [];
$labels = [];
values.forEach(function(element) {
values.forEach(function(element) {
$data.push(element.size);
//Segnalazione se sul server sembrano mancare file rispetto a quanto previsto a DB
if (element.dbSize>0 && element.description == "Allegati"){
if (element.size<element.dbSize){
var diff = (element.dbSize-element.size);
if (diff>1000){
$("#message").append("<div class=\"badge badge-warning\" ><i class=\"fa fa-exclamation-triangle\" aria-hidden=\"true\"></i> "+formatBytes(diff)+" di files mancanti per allegati.</div><br>");
if (element.dbSize > 0 && element.description == "Allegati"){
if (element.size < element.dbSize){
var diff = (element.dbSize - element.size);
if (diff > 1000){
$("#message").append("<div class=\"badge badge-warning\"><i class=\"fa fa-exclamation-triangle\" aria-hidden=\"true\"></i> "+formatBytes(diff)+" di files mancanti per allegati.</div><br>");
}
}
}
//Segnalazione se sul server sembrano mancare file rispetto a quanto previsto a DB
if (element.dbCount>0 && element.description == "Allegati" ){
if (element.count<element.dbCount){
var diff = (element.dbCount-element.count);
if (element.dbCount > 0 && element.description == "Allegati" ){
if (element.count < element.dbCount){
var diff = (element.dbCount - element.count);
$("#message").append("<div class=\"badge badge-warning\"><i class=\"fa fa-exclamation-triangle\" aria-hidden=\"true\"></i> "+diff+" files non trovati per allegati.</div><br>");
$("#message").append("<div class=\"badge badge-warning\" ><i class=\"fa fa-exclamation-triangle\" aria-hidden=\"true\"></i> "+diff+" files non trovati per allegati.</div><br>");
}
}
//Numero di file in Allegati suddivisi per estensione
if (element.dbExtensions.length > 0){
$("#message").append("<br><p><b>Top 10 allegati:</b></p>");
element.dbExtensions.forEach(function(ext) {
$("#message").append("<div class=\"badge badge-info\" ><i class=\"fa fa-file\" aria-hidden=\"true\"></i> <b>"+ext["num"]+"</b> files con estensione <b>"+ext["extension"]+"</b>.</div><br>");
$("#message").append("<div class=\"badge badge-info\"><i class=\"fa fa-file\" aria-hidden=\"true\"></i> <b>"+ext.num+"</b> files con estensione <b>"+ext.extension+"</b>.</div><br>");
});
}
$labels.push(element.description + " (" + element.formattedSize + ")" + " [" + element.count + "]" )
$labels.push(`${element.description} (${element.formattedSize}) [${element.count}]`);
});
options = {
const options = {
responsive: true,
maintainAspectRatio: false,
legend: {
display: true,
position: "right",
},
animation:{
animateScale: true,
animateRotate: true,
legend: {
display: true,
position: "right",
},
animation: {
animateScale: true,
animateRotate: true,
},
tooltips: {
callbacks: {
title: function(tooltipItem, data) {
return data["labels"][tooltipItem[0]["index"]];
},
label: function(tooltipItem, data) {
//return data["datasets"][0]["data"][tooltipItem["index"]];
var dataset = data["datasets"][0];
var percent = Math.round((dataset["data"][tooltipItem["index"]] / dataset["_meta"][0]["total"]) * 100)
return "(" + percent + "%)";
},
afterLabel: function(tooltipItem, data) {
//var dataset = data["datasets"][0];
//var percent = Math.round((dataset["data"][tooltipItem["index"]] / dataset["_meta"][0]["total"]) * 100)
//return "(" + percent + "%)";
}
title: function(tooltipItem, data) {
return data.labels[tooltipItem[0].index];
},
label: function(tooltipItem, data) {
const dataset = data.datasets[0];
const percent = Math.round((dataset.data[tooltipItem.index] / dataset._meta[0].total) * 100);
return `(${percent}%)`;
},
},
backgroundColor: "#fbfbfb",
titleFontSize: 12,
@ -162,7 +148,7 @@ function crea_grafico(values){
});
}
</script>
<div id="message" class="pull-right"></div>
<div id="message float-right"></div>
<div class="chart-container">
<canvas id="chart"></canvas>
</div>';

View File

@ -172,7 +172,7 @@ switch ($operazione) {
$tipo = Tipo::find(post('idtipodocumento'));
if (!empty($accodare)) {
$documento = $dbo->fetchOne('SELECT `co_documenti`.`id` FROM `co_documenti` INNER JOIN `co_statidocumento` ON `co_documenti`.`idstatodocumento` = `co_statidocumento`.`id` LEFT JOIN `co_statidocumento_lang` ON (`co_statidocumento`.`id` = `co_statidocumento_lang`.`id_record` AND `co_statidocumento_lang`.`id_lang` = '.prepare(Models\Locale::getDefault()->id).') WHERE `co_statidocumento`.`title` = \'Bozza\' AND `idanagrafica` = '.prepare($contratto->idanagrafica));
$documento = $dbo->fetchOne('SELECT `co_documenti`.`id` FROM `co_documenti` INNER JOIN `co_statidocumento` ON `co_documenti`.`idstatodocumento` = `co_statidocumento`.`id` LEFT JOIN `co_statidocumento_lang` ON (`co_statidocumento`.`id` = `co_statidocumento_lang`.`id_record` AND `co_statidocumento_lang`.`id_lang` = '.prepare(Models\Locale::getDefault()->id).') WHERE `co_statidocumento_lang`.`title` = \'Bozza\' AND `idanagrafica` = '.prepare($contratto->idanagrafica));
$id_documento = $documento['id'];
}

View File

@ -20,6 +20,7 @@
include_once __DIR__.'/../../core.php';
use Modules\Anagrafiche\Sede;
use Modules\Anagrafiche\Anagrafica;
$operazione = filter('op');

View File

@ -136,7 +136,7 @@ class Backup
{
// Creazione del backup eventuale
if (!self::isDailyComplete()) {
return self::create();
return self::create([]);
}
return false;

View File

@ -74,11 +74,13 @@ class Upload extends Model
$model = new static();
// Informazioni di base
$name = $data['name'] ?? $name;
$name ??= basename($source);
$original_name = basename($source) ?? $name;
$category = $data['category'] ?? $category;
if (empty($name)) {
$name = $data['name'] ?? ($source['name'] ?? $source);
}
$original_name = $source['name'] ?? $name;
$category = $data['category'] ?? $category;
// Nome e categoria dell'allegato
$model->name = !empty($name) ? $name : $original_name;
$model->category = $category;

View File

@ -21,4 +21,7 @@ INSERT INTO `zz_settings` (`id`, `nome`, `valore`, `tipo`, `editable`, `sezione`
INSERT INTO `zz_settings_lang` (`id`, `id_lang`, `id_record`, `title`, `help`) VALUES (NULL, '1', (SELECT `zz_settings`.`id` FROM `zz_settings` WHERE `zz_settings`.`nome` = 'Geolocalizzazione automatica'), 'Geolocalizzazione automatica', '');
INSERT INTO `zz_settings_lang` (`id`, `id_lang`, `id_record`, `title`, `help`) VALUES (NULL, '1', (SELECT `zz_settings`.`id` FROM `zz_settings` WHERE `zz_settings`.`nome` = 'Gestore mappa'), 'Gestore mappa', '');
INSERT INTO `zz_settings_lang` (`id`, `id_lang`, `id_record`, `title`, `help`) VALUES (NULL, '1', (SELECT `zz_settings`.`id` FROM `zz_settings` WHERE `zz_settings`.`nome` = 'Gestore mappa'), 'Gestore mappa', '');
-- Fix widget statistiche
UPDATE `zz_widgets` SET `class` = 'col-md-6' WHERE `zz_widgets`.`name` = "Spazio utilizzato";