Merge branch 'master' of https://github.com/devcode-it/openstamanager
This commit is contained in:
commit
061c0ce46f
|
@ -25,6 +25,10 @@
|
||||||
|
|
||||||
use HTMLBuilder\HTMLBuilder;
|
use HTMLBuilder\HTMLBuilder;
|
||||||
use Models\OperationLog;
|
use Models\OperationLog;
|
||||||
|
use Symfony\Component\Filesystem\Exception\IOException;
|
||||||
|
use Symfony\Component\Filesystem\Filesystem as SymfonyFilesystem;
|
||||||
|
use Symfony\Component\Finder\Finder;
|
||||||
|
use Util\FileSystem;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Esegue il redirect.
|
* Esegue il redirect.
|
||||||
|
@ -71,12 +75,12 @@ function sanitizeFilename($filename)
|
||||||
function delete($files)
|
function delete($files)
|
||||||
{
|
{
|
||||||
// Filesystem Symfony
|
// Filesystem Symfony
|
||||||
$fs = new Symfony\Component\Filesystem\Filesystem();
|
$fs = new SymfonyFilesystem();
|
||||||
|
|
||||||
// Eliminazione
|
// Eliminazione
|
||||||
try {
|
try {
|
||||||
$fs->remove($files);
|
$fs->remove($files);
|
||||||
} catch (Symfony\Component\Filesystem\Exception\IOException $e) {
|
} catch (IOException $e) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,7 +114,7 @@ function copyr($source, $destination, $ignores = [])
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$files = Symfony\Component\Finder\Finder::create()
|
$files = Finder::create()
|
||||||
->files()
|
->files()
|
||||||
->exclude((array) $ignores['dirs'])
|
->exclude((array) $ignores['dirs'])
|
||||||
->ignoreDotFiles(false)
|
->ignoreDotFiles(false)
|
||||||
|
@ -124,14 +128,17 @@ function copyr($source, $destination, $ignores = [])
|
||||||
$result = true;
|
$result = true;
|
||||||
|
|
||||||
// Filesystem Symfony
|
// Filesystem Symfony
|
||||||
$fs = new Symfony\Component\Filesystem\Filesystem();
|
$fs = new SymfonyFilesystem();
|
||||||
|
|
||||||
|
$fs->chmod($destination, 0777, 0000, true);
|
||||||
|
|
||||||
foreach ($files as $file) {
|
foreach ($files as $file) {
|
||||||
$filename = rtrim($destination, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR.$file->getRelativePathname();
|
$filename = rtrim($destination, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR.$file->getRelativePathname();
|
||||||
|
|
||||||
// Copia
|
// Copia effettiva del file
|
||||||
try {
|
try {
|
||||||
$fs->copy($file, $filename);
|
$fs->copy($file, $filename, true);
|
||||||
} catch (Symfony\Component\Filesystem\Exception\IOException $e) {
|
} catch (IOException $e) {
|
||||||
$result = false;
|
$result = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,12 +21,15 @@ namespace Modules\Articoli\Import;
|
||||||
|
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use Importer\CSVImporter;
|
use Importer\CSVImporter;
|
||||||
|
use Models\Upload;
|
||||||
|
use Modules;
|
||||||
use Modules\Anagrafiche\Anagrafica;
|
use Modules\Anagrafiche\Anagrafica;
|
||||||
use Modules\Anagrafiche\Sede;
|
use Modules\Anagrafiche\Sede;
|
||||||
use Modules\Articoli\Articolo;
|
use Modules\Articoli\Articolo;
|
||||||
use Modules\Articoli\Categoria;
|
use Modules\Articoli\Categoria;
|
||||||
use Modules\Iva\Aliquota;
|
use Modules\Iva\Aliquota;
|
||||||
use Plugins\ListinoClienti\DettaglioPrezzo;
|
use Plugins\ListinoClienti\DettaglioPrezzo;
|
||||||
|
use Uploads;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Struttura per la gestione delle operazioni di importazione (da CSV) degli Articoli.
|
* Struttura per la gestione delle operazioni di importazione (da CSV) degli Articoli.
|
||||||
|
@ -43,6 +46,14 @@ class CSV extends CSVImporter
|
||||||
'label' => 'Codice',
|
'label' => 'Codice',
|
||||||
'primary_key' => true,
|
'primary_key' => true,
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
'field' => 'immagine',
|
||||||
|
'label' => 'Immagine',
|
||||||
|
'names' => [
|
||||||
|
'Immagine',
|
||||||
|
'Foto',
|
||||||
|
],
|
||||||
|
],
|
||||||
[
|
[
|
||||||
'field' => 'descrizione',
|
'field' => 'descrizione',
|
||||||
'label' => 'Descrizione',
|
'label' => 'Descrizione',
|
||||||
|
@ -210,6 +221,8 @@ class CSV extends CSVImporter
|
||||||
{
|
{
|
||||||
$database = database();
|
$database = database();
|
||||||
$primary_key = $this->getPrimaryKey();
|
$primary_key = $this->getPrimaryKey();
|
||||||
|
$url = $record['immagine'];
|
||||||
|
unset($record['immagine']);
|
||||||
|
|
||||||
// Fix per campi con contenuti derivati da query implicite
|
// Fix per campi con contenuti derivati da query implicite
|
||||||
if (!empty($record['id_fornitore'])) {
|
if (!empty($record['id_fornitore'])) {
|
||||||
|
@ -316,6 +329,34 @@ class CSV extends CSVImporter
|
||||||
$articolo->movimenta($qta_movimento, tr('Movimento da importazione'), new Carbon(), false, [
|
$articolo->movimenta($qta_movimento, tr('Movimento da importazione'), new Carbon(), false, [
|
||||||
'idsede' => $id_sede,
|
'idsede' => $id_sede,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
//Gestione immagine
|
||||||
|
if (!empty($url)) {
|
||||||
|
$file_content = file_get_contents($url);
|
||||||
|
|
||||||
|
if (!empty($file_content)) {
|
||||||
|
$name = 'immagine_'.$articolo->id.'.'.Upload::getExtensionFromMimeType($file_content);
|
||||||
|
|
||||||
|
$upload = Uploads::upload($file_content, [
|
||||||
|
'name' => 'Immagine',
|
||||||
|
'category' => 'Immagini',
|
||||||
|
'original_name' => $name,
|
||||||
|
'id_module' => Modules::get('Articoli')['id'],
|
||||||
|
'id_record' => $articolo->id,
|
||||||
|
], [
|
||||||
|
'thumbnails' => true,
|
||||||
|
]);
|
||||||
|
$filename = $upload->filename;
|
||||||
|
|
||||||
|
if (!empty($filename)) {
|
||||||
|
$database->update('mg_articoli', [
|
||||||
|
'immagine' => $filename,
|
||||||
|
], [
|
||||||
|
'id' => $articolo->id,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getExample()
|
public static function getExample()
|
||||||
|
|
|
@ -317,7 +317,6 @@ switch (filter('op')) {
|
||||||
$max_number = $informazioni['maxNumber'];
|
$max_number = $informazioni['maxNumber'];
|
||||||
$avviso_numero = !empty($max_number) && floatval($history[0]['number']) > 0.9 * $max_number;
|
$avviso_numero = !empty($max_number) && floatval($history[0]['number']) > 0.9 * $max_number;
|
||||||
|
|
||||||
|
|
||||||
// Formattazione dei contenuti dello storico
|
// Formattazione dei contenuti dello storico
|
||||||
foreach ($history as $key => $value) {
|
foreach ($history as $key => $value) {
|
||||||
$history[$key]['size'] = (($history[$key]['size']) ? Filesystem::formatBytes($value['size']) : '-');
|
$history[$key]['size'] = (($history[$key]['size']) ? Filesystem::formatBytes($value['size']) : '-');
|
||||||
|
|
|
@ -25,16 +25,16 @@ include_once __DIR__.'/../../core.php';
|
||||||
// Informazioni sui servizi attivi
|
// Informazioni sui servizi attivi
|
||||||
echo '
|
echo '
|
||||||
<div class="row">';
|
<div class="row">';
|
||||||
|
$days = 60;
|
||||||
$limite_scadenze = (new Carbon())->addDays(60);
|
$limite_scadenze = (new Carbon())->addDays($days);
|
||||||
if (Services::isEnabled()) {
|
if (Services::isEnabled()) {
|
||||||
echo '
|
echo '
|
||||||
<!-- Informazioni sui Servizi attivi -->
|
<!-- Informazioni sui Servizi attivi -->
|
||||||
<div class="col-md-12 col-lg-6">
|
<div class="col-md-12 col-lg-6">
|
||||||
<div class="box box-success">
|
<div class="box box-primary">
|
||||||
<div class="box-header">
|
<div class="box-header">
|
||||||
<h3 class="box-title">
|
<h3 class="box-title">
|
||||||
'.tr('Servizi attivi').'
|
'.tr('Servizi').'
|
||||||
</h3>
|
</h3>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -43,12 +43,12 @@ if (Services::isEnabled()) {
|
||||||
$servizi = Services::getServiziAttivi()->flatten(1);
|
$servizi = Services::getServiziAttivi()->flatten(1);
|
||||||
if (!$servizi->isEmpty()) {
|
if (!$servizi->isEmpty()) {
|
||||||
echo '
|
echo '
|
||||||
<table class="table table-striped table-hover">
|
<table class="box-body table table-striped table-hover table-condensed">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
<th width="50%">'.tr('Nome').'</th>
|
||||||
<th>'.tr('Tipo').'</th>
|
<th>'.tr('Tipo').'</th>
|
||||||
<th>'.tr('Nome').'</th>
|
<th width="30%">'.tr('Scadenza').'</th>
|
||||||
<th>'.tr('Scadenza').'</th>
|
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
|
||||||
|
@ -57,9 +57,9 @@ if (Services::isEnabled()) {
|
||||||
$scadenza = Carbon::parse($servizio['data_conclusione']);
|
$scadenza = Carbon::parse($servizio['data_conclusione']);
|
||||||
|
|
||||||
echo '
|
echo '
|
||||||
<tr class="'.($scadenza->lessThan($limite_scadenze) ? 'info' : '').'">
|
<tr class="'.($scadenza->lessThan(Carbon::now()) ? 'danger' : ($scadenza->lessThan($limite_scadenze) ? 'warning' : '')).'">
|
||||||
<td>'.$servizio['sottocategoria'].'</td>
|
|
||||||
<td>'.$servizio['codice'].' - '.$servizio['nome'].'</td>
|
<td>'.$servizio['codice'].' - '.$servizio['nome'].'</td>
|
||||||
|
<td>'.$servizio['sottocategoria'].'</td>
|
||||||
<td>'.dateFormat($scadenza).' ('.$scadenza->diffForHumans().')</td>
|
<td>'.dateFormat($scadenza).' ('.$scadenza->diffForHumans().')</td>
|
||||||
</tr>';
|
</tr>';
|
||||||
}
|
}
|
||||||
|
@ -84,7 +84,7 @@ if (Services::isEnabled()) {
|
||||||
<div class="box box-primary">
|
<div class="box box-primary">
|
||||||
<div class="box-header">
|
<div class="box-header">
|
||||||
<h3 class="box-title">
|
<h3 class="box-title">
|
||||||
'.tr('Risorse Services').'
|
'.tr('Risorse').'
|
||||||
</h3>
|
</h3>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -94,31 +94,39 @@ if (Services::isEnabled()) {
|
||||||
$risorse_attive = Services::getRisorseAttive();
|
$risorse_attive = Services::getRisorseAttive();
|
||||||
if (!$risorse_attive->isEmpty()) {
|
if (!$risorse_attive->isEmpty()) {
|
||||||
$risorse_in_scadenza = Services::getRisorseInScadenza($limite_scadenze);
|
$risorse_in_scadenza = Services::getRisorseInScadenza($limite_scadenze);
|
||||||
|
$risorse_scadute = Services::getRisorseScadute();
|
||||||
|
|
||||||
|
if (!$risorse_in_scadenza->isEmpty() || !$risorse_scadute->isEmpty() ) {
|
||||||
|
|
||||||
if (!$risorse_in_scadenza->isEmpty()){
|
if (!$risorse_in_scadenza->isEmpty()){
|
||||||
echo '
|
echo '
|
||||||
<div class="alert alert-warning" role="alert"> <i class="fa fa-warning"></i> '.tr('Attenzione, _NUM_ risorse sono in scadenza:', [
|
<div class="alert alert-warning" role="alert"> <i class="fa fa-clock-o"></i> '.tr('Attenzione, _NUM_ risorse sono in scadenza o stanno per esaurire i crediti:', [
|
||||||
|
'_NUM_' => $risorse_in_scadenza->count(),
|
||||||
'_NUM_' => $risorse_in_scadenza->count()
|
|
||||||
|
|
||||||
]).'</div>';
|
|
||||||
|
|
||||||
}else{
|
|
||||||
|
|
||||||
echo '
|
|
||||||
<div class="alert alert-success" role="alert"> <i class="fa fa-check"></i> '.tr('Bene, tutte le risorse sono attive e non presentano avvisi:', [
|
|
||||||
'_NUM_' => $risorse_attive->count()
|
|
||||||
]).'</div>';
|
]).'</div>';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!$risorse_scadute->isEmpty()){
|
||||||
echo '
|
echo '
|
||||||
<table class="table table-striped table-hover">
|
<div class="alert alert-danger" role="alert"> <i class="fa fa-exclamation-triangle"></i> '.tr('Attenzione, _NUM_ risorse sono scadute o hanno esaurito i crediti:', [
|
||||||
|
'_NUM_' => $risorse_scadute->count(),
|
||||||
|
]).'</div>';
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
echo '
|
||||||
|
<div class="alert alert-success" role="alert"> <i class="fa fa-check-circle"></i> '.tr('Bene, tutte le risorse sono attive e non presentano avvisi:', [
|
||||||
|
'_NUM_' => $risorse_attive->count(),
|
||||||
|
]).'</div>';
|
||||||
|
}
|
||||||
|
|
||||||
|
echo '
|
||||||
|
<table class="box-body table table-striped table-hover table-condensed">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th width="50%">'.tr('Nome').'</th>
|
<th width="50%">'.tr('Nome').'</th>
|
||||||
<th>'.tr('Crediti').'</th>
|
<th>'.tr('Crediti').'</th>
|
||||||
<th>'.tr('Scadenza').'</th>
|
<th width="30%">'.tr('Scadenza').'</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
|
||||||
|
@ -127,26 +135,23 @@ if (Services::isEnabled()) {
|
||||||
foreach ($risorse_attive as $servizio) {
|
foreach ($risorse_attive as $servizio) {
|
||||||
$scadenza = Carbon::parse($servizio['expiration_at']);
|
$scadenza = Carbon::parse($servizio['expiration_at']);
|
||||||
echo '
|
echo '
|
||||||
<tr>
|
<tr class="'.($scadenza->lessThan(Carbon::now()) ? 'danger' : ($scadenza->lessThan($limite_scadenze) ? 'warning' : '')).'">
|
||||||
<td>'.$servizio['name'].'</td>
|
<td>'.$servizio['name'].'</td>
|
||||||
<td>'.(($servizio['credits'] < 100 && $servizio['credits']) ? '<b><i class="fa fa-icon fa-warning" ></i>' : '').(($servizio['credits']) ? $servizio['credits'] : '-').(($servizio['credits'] < 100 && $servizio['credits']) ? '</b>' : '').'</td>
|
<td>'.(($servizio['credits'] < 100 && $servizio['credits']) ? '<b><i class="fa fa-icon fa-warning" ></i>' : '').(($servizio['credits']) ? $servizio['credits'] : '-').(($servizio['credits'] < 100 && $servizio['credits']) ? '</b>' : '').'</td>
|
||||||
<td>'.((Carbon::now()->diffInDays($scadenza, false)<60 && $scadenza)? '<b><i class="fa fa-icon fa-warning" ></i>': '' ).dateFormat($scadenza).' ('.$scadenza->diffForHumans().')'.((Carbon::now()->diffInDays($scadenza, false)<60 && $scadenza)? '</b>': '' ).'</td>
|
<td>'.((Carbon::now()->diffInDays($scadenza, false) < $days && $scadenza) ? '<b><i class="fa fa-icon fa-warning" ></i>' : '').dateFormat($scadenza).' ('.$scadenza->diffForHumans().')'.((Carbon::now()->diffInDays($scadenza, false) < $days && $scadenza) ? '</b>' : '').'</td>
|
||||||
</tr>';
|
</tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '
|
echo '
|
||||||
</tbody>
|
</tbody>
|
||||||
</table><hr>';
|
</table></div></div>';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//Il servizio Fatturazione Elettronica deve essere presente per visualizzare le Statistiche su Fatture Elettroniche
|
//Il servizio Fatturazione Elettronica deve essere presente per visualizzare le Statistiche su Fatture Elettroniche
|
||||||
if (Services::getRisorseAttive()->where('name', 'Fatturazione Elettronica')->count()) {
|
if (Services::getRisorseAttive()->where('name', 'Fatturazione Elettronica')->count()) {
|
||||||
echo '
|
echo '
|
||||||
|
|
||||||
<div class="panel panel-info">
|
<div class="panel panel-info">
|
||||||
|
<div class="panel-heading" > <i class="fa fa-bar-chart"></i> '.tr('Statistiche su Fatture Elettroniche').'</div>
|
||||||
<div class="panel-heading" > <i class="fa fa-file"></i> '.tr('Statistiche su Fatture Elettroniche').'</div>
|
|
||||||
|
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
|
|
||||||
|
@ -168,7 +173,7 @@ if (Services::isEnabled()) {
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<table class="table table-striped">
|
<table class="box-body table table-striped table-hover table-condensed">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>'.tr('Anno').'</th>
|
<th>'.tr('Anno').'</th>
|
||||||
|
@ -189,7 +194,7 @@ if (Services::isEnabled()) {
|
||||||
</thead>
|
</thead>
|
||||||
|
|
||||||
<tbody id="elenco-fe">
|
<tbody id="elenco-fe">
|
||||||
<tr class="info">
|
<tr style="background-color:#CCCCCC;" >
|
||||||
<td>'.tr('Totale').'</td>
|
<td>'.tr('Totale').'</td>
|
||||||
<td id="fe_numero"></td>
|
<td id="fe_numero"></td>
|
||||||
<td id="fe_spazio"></td>
|
<td id="fe_spazio"></td>
|
||||||
|
@ -203,7 +208,6 @@ if (Services::isEnabled()) {
|
||||||
aggiornaStatisticheFE();
|
aggiornaStatisticheFE();
|
||||||
});
|
});
|
||||||
</script>';
|
</script>';
|
||||||
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
echo '
|
echo '
|
||||||
|
@ -213,9 +217,6 @@ if (Services::isEnabled()) {
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '
|
echo '
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>';
|
</div>';
|
||||||
} else {
|
} else {
|
||||||
/*
|
/*
|
||||||
|
@ -311,7 +312,7 @@ function aggiornaStatisticheFE(){
|
||||||
const data = response.history[i];
|
const data = response.history[i];
|
||||||
if (data["year"] == '.date('Y').'){
|
if (data["year"] == '.date('Y').'){
|
||||||
|
|
||||||
var highlight = "<tr style=\"background-color:#FFFEEE;\" >";
|
var highlight = "<tr class=\"info\" >";
|
||||||
var number = data["number"];
|
var number = data["number"];
|
||||||
|
|
||||||
if (response.maxNumber>0 && response.maxNumber)
|
if (response.maxNumber>0 && response.maxNumber)
|
||||||
|
|
|
@ -34,23 +34,46 @@ class ServicesHook extends Manager
|
||||||
// Elaborazione dei servizi in scadenza
|
// Elaborazione dei servizi in scadenza
|
||||||
$servizi_in_scadenza = Services::getServiziInScadenza($limite_scadenze);
|
$servizi_in_scadenza = Services::getServiziInScadenza($limite_scadenze);
|
||||||
if (!$servizi_in_scadenza->isEmpty()) {
|
if (!$servizi_in_scadenza->isEmpty()) {
|
||||||
$message .= tr('I seguenti servizi sono in scadenza: _LIST_', [
|
$message .= '<i class="fa fa-clock-o text-warning"> </i> ';
|
||||||
'_LIST_' => implode(', ', $servizi_in_scadenza->pluck('nome')->all()),
|
$message .= tr('I seguenti servizi sono in scadenza:<ul><li> _LIST_', [
|
||||||
]).'. ';
|
'_LIST_' => implode('</li><li>', $servizi_in_scadenza->pluck('nome')->all()),
|
||||||
|
]).'</ul>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Elaborazione delle risorse Services scadute
|
||||||
|
$risorse_scadute = Services::getRisorseScadute();
|
||||||
|
if (!$risorse_scadute->isEmpty()) {
|
||||||
|
$message .= '<i class="fa fa-exclamation-triangle text-danger"> </i> ';
|
||||||
|
$message .= tr('Le seguenti risorse sono scadute:<ul><li> _LIST_', [
|
||||||
|
'_LIST_' => implode('</li><li>', $risorse_scadute->pluck('name')->all()),
|
||||||
|
]).'</ul>';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Elaborazione dei servizi scaduti
|
||||||
|
$servizi_scaduti = Services::getServiziScaduti();
|
||||||
|
if (!$servizi_scaduti->isEmpty()) {
|
||||||
|
$message .= '<i class="fa fa-exclamation-triangle text-danger"> </i> ';
|
||||||
|
$message .= tr('I seguenti servizi sono scaduti:<ul><li> _LIST_', [
|
||||||
|
'_LIST_' => implode('</li><li>', $servizi_scaduti->pluck('nome')->all()),
|
||||||
|
]).'</ul>';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Elaborazione delle risorse Services in scadenza
|
// Elaborazione delle risorse Services in scadenza
|
||||||
$risorse_in_scadenza = Services::getRisorseInScadenza($limite_scadenze);
|
$risorse_in_scadenza = Services::getRisorseInScadenza($limite_scadenze);
|
||||||
if (!$risorse_in_scadenza->isEmpty()) {
|
if (!$risorse_in_scadenza->isEmpty()) {
|
||||||
$message .= tr('Le seguenti risorse Services sono in scadenza: _LIST_', [
|
$message .= '<i class="fa fa-clock-o text-warning"> </i> ';
|
||||||
'_LIST_' => implode(', ', $risorse_in_scadenza->pluck('name')->all()),
|
$message .= tr('Le seguenti risorse sono in scadenza:<ul><li> _LIST_', [
|
||||||
]);
|
'_LIST_' => implode('</li><li>', $risorse_in_scadenza->pluck('name')->all()),
|
||||||
|
]).'</ul>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$module = Module::pool('Stato dei servizi');
|
$module = Module::pool('Stato dei servizi');
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'icon' => 'fa fa-refresh text-warning',
|
'icon' => null,
|
||||||
'message' => $message,
|
'message' => $message,
|
||||||
'link' => base_path().'/controller.php?id_module='.$module->id,
|
'link' => base_path().'/controller.php?id_module='.$module->id,
|
||||||
'show' => Services::isEnabled() && !empty($message),
|
'show' => Services::isEnabled() && !empty($message),
|
||||||
|
|
|
@ -21,9 +21,9 @@ namespace Plugins\ImportFE;
|
||||||
|
|
||||||
use Modules;
|
use Modules;
|
||||||
use Modules\Anagrafiche\Anagrafica;
|
use Modules\Anagrafiche\Anagrafica;
|
||||||
use Modules\Banche\Banca;
|
|
||||||
use Modules\Anagrafiche\Nazione;
|
use Modules\Anagrafiche\Nazione;
|
||||||
use Modules\Anagrafiche\Tipo as TipoAnagrafica;
|
use Modules\Anagrafiche\Tipo as TipoAnagrafica;
|
||||||
|
use Modules\Banche\Banca;
|
||||||
use Modules\Fatture\Fattura;
|
use Modules\Fatture\Fattura;
|
||||||
use Modules\Fatture\Stato as StatoFattura;
|
use Modules\Fatture\Stato as StatoFattura;
|
||||||
use Modules\Fatture\Tipo as TipoFattura;
|
use Modules\Fatture\Tipo as TipoFattura;
|
||||||
|
|
|
@ -300,7 +300,6 @@ class FatturaOrdinaria extends FatturaElettronica
|
||||||
$tipo = null;
|
$tipo = null;
|
||||||
$sconto_unitario = null;
|
$sconto_unitario = null;
|
||||||
$obj->save();
|
$obj->save();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ricaricamento della fattura
|
// Ricaricamento della fattura
|
||||||
|
|
|
@ -86,7 +86,21 @@ class Services
|
||||||
return self::getServiziAttivi()
|
return self::getServiziAttivi()
|
||||||
->flatten(1)
|
->flatten(1)
|
||||||
->filter(function ($item) use ($limite_scadenze) {
|
->filter(function ($item) use ($limite_scadenze) {
|
||||||
return (isset($item['data_conclusione']) && Carbon::parse($item['data_conclusione'])->lessThan($limite_scadenze));
|
return isset($item['data_conclusione']) && Carbon::parse($item['expiration_at'])->greaterThan(Carbon::now()) && Carbon::parse($item['data_conclusione'])->lessThan($limite_scadenze);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Restituisce i servizi scaduti.
|
||||||
|
*
|
||||||
|
* @return \Illuminate\Support\Collection
|
||||||
|
*/
|
||||||
|
public static function getServiziScaduti()
|
||||||
|
{
|
||||||
|
return self::getServiziAttivi()
|
||||||
|
->flatten(1)
|
||||||
|
->filter(function ($item) use ($limite_scadenze) {
|
||||||
|
return isset($item['data_conclusione']) && Carbon::parse($item['data_conclusione'])->lessThan(Carbon::now());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,11 +137,27 @@ class Services
|
||||||
{
|
{
|
||||||
return self::getRisorseAttive()
|
return self::getRisorseAttive()
|
||||||
->filter(function ($item) use ($limite_scadenze) {
|
->filter(function ($item) use ($limite_scadenze) {
|
||||||
return (isset($item['expiration_at']) && Carbon::parse($item['expiration_at'])->lessThan($limite_scadenze))
|
return (isset($item['expiration_at']) && Carbon::parse($item['expiration_at'])->greaterThan(Carbon::now()) && Carbon::parse($item['expiration_at'])->lessThan($limite_scadenze))
|
||||||
|| (isset($item['credits']) && $item['credits'] < 100);
|
|| (isset($item['credits']) && $item['credits'] < 100);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Restituisce le risorse scadute per assenza di crediti oppure per data di fine prossima.
|
||||||
|
*
|
||||||
|
* @return \Illuminate\Support\Collection
|
||||||
|
*/
|
||||||
|
public static function getRisorseScadute()
|
||||||
|
{
|
||||||
|
return self::getRisorseAttive()
|
||||||
|
->filter(function ($item) use ($limite_scadenze) {
|
||||||
|
return (isset($item['expiration_at']) && Carbon::parse($item['expiration_at'])->lessThan(Carbon::now()))
|
||||||
|
|| (isset($item['credits']) && $item['credits'] < 0);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Effettua una richiesta a Services.
|
* Effettua una richiesta a Services.
|
||||||
*
|
*
|
||||||
|
|
|
@ -38,6 +38,15 @@ class Upload extends Model
|
||||||
'htm' => 'text/html',
|
'htm' => 'text/html',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
/** @var array Elenco delle estensioni file per mime type */
|
||||||
|
protected static $extension_association = [
|
||||||
|
'image/gif' => 'gif',
|
||||||
|
'image/bmp' => 'bmp',
|
||||||
|
'image/jpg' => 'jpg',
|
||||||
|
'image/jpeg' => 'jpg',
|
||||||
|
'image/png' => 'png',
|
||||||
|
];
|
||||||
|
|
||||||
protected $table = 'zz_files';
|
protected $table = 'zz_files';
|
||||||
|
|
||||||
protected $file_info;
|
protected $file_info;
|
||||||
|
@ -211,6 +220,18 @@ class Upload extends Model
|
||||||
return in_array($this->extension, $list);
|
return in_array($this->extension, $list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public static function getExtensionFromMimeType($file_content)
|
||||||
|
{
|
||||||
|
$finfo = finfo_open();
|
||||||
|
$mime_type = finfo_buffer($finfo, $file_content, FILEINFO_MIME_TYPE);
|
||||||
|
finfo_close($finfo);
|
||||||
|
|
||||||
|
return self::$extension_association[$mime_type];
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -17,6 +17,8 @@
|
||||||
* 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 Symfony\Component\Filesystem\Filesystem as SymfonyFilesystem;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Classe dedicata alla gestione delle procedure di aggiornamento del database del progetto.
|
* Classe dedicata alla gestione delle procedure di aggiornamento del database del progetto.
|
||||||
*
|
*
|
||||||
|
@ -208,6 +210,11 @@ class Update
|
||||||
\Models\Cache::pool('Ultima versione di OpenSTAManager disponibile')->set(null);
|
\Models\Cache::pool('Ultima versione di OpenSTAManager disponibile')->set(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Correzione permessi per le cartelle backup e files
|
||||||
|
$fs = new SymfonyFilesystem();
|
||||||
|
$fs->chmod('backup', 0777, 0000, true);
|
||||||
|
$fs->chmod('files', 0777, 0000, true);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue