1
0
mirror of https://github.com/devcode-it/openstamanager.git synced 2025-06-05 22:09:38 +02:00

Introduzione moduli sperimentali come pacchetti Laravel

This commit is contained in:
Dasc3er
2021-08-02 14:34:10 +02:00
parent 3f46f85751
commit bb5151329e
61 changed files with 10530 additions and 280 deletions

View File

@@ -0,0 +1 @@
preset: laravel

View File

@@ -0,0 +1,8 @@
# Changelog
All notable changes to `Aggiornamenti` will be documented in this file.
## Version 1.0
### Added
- Everything

View File

@@ -0,0 +1,42 @@
{
"name": "devcode-it/aggiornamenti",
"description": ":package_description",
"license": "license",
"authors": [
{
"name": "author name",
"email": "author email",
"homepage": "author homepage"
}
],
"homepage": "https://github.com/devcode-it/aggiornamenti",
"keywords": ["Laravel", "Aggiornamenti"],
"require": {
"erusev/parsedown": "^1.7",
"illuminate/support": "~7|~8"
},
"require-dev": {
"phpunit/phpunit": "~9.0",
"orchestra/testbench": "~5|~6"
},
"autoload": {
"psr-4": {
"DevCode\\Aggiornamenti\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"DevCode\\Aggiornamenti\\Tests\\": "tests"
}
},
"extra": {
"laravel": {
"providers": [
"DevCode\\Aggiornamenti\\ServiceProvider"
],
"aliases": {
"Aggiornamenti": "DevCode\\Aggiornamenti\\Facades\\Aggiornamenti"
}
}
}
}

View File

@@ -0,0 +1,5 @@
<?php
return [
//
];

View File

@@ -0,0 +1,27 @@
# Contributing
Contributions are welcome and will be fully credited.
Contributions are accepted via Pull Requests on [Github](https://github.com/devcode-it/aggiornamenti).
# Things you could do
If you want to contribute but do not know where to start, this list provides some starting points.
- Add license text
- Remove rewriteRules.php
- Set up TravisCI, StyleCI, ScrutinizerCI
- Write a comprehensive ReadMe
## Pull Requests
- **Add tests!** - Your patch won't be accepted if it doesn't have tests.
- **Document any change in behaviour** - Make sure the `readme.md` and any other relevant documentation are kept up-to-date.
- **Consider our release cycle** - We try to follow [SemVer v2.0.0](http://semver.org/). Randomly breaking public APIs is not an option.
- **One pull request per feature** - If you want to do more than one thing, send multiple pull requests.
- **Send coherent history** - Make sure each individual commit in your pull request is meaningful. If you had to make multiple intermediate commits while developing, please [squash them](http://www.git-scm.com/book/en/v2/Git-Tools-Rewriting-History#Changing-Multiple-Commit-Messages) before submitting.
**Happy coding**!

View File

@@ -0,0 +1,5 @@
# The license
Copyright (c) author name <author email>
...Add your license text here...

View File

@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="vendor/autoload.php"
backupGlobals="false"
backupStaticAttributes="false"
colors="true"
verbose="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false">
<testsuites>
<testsuite name="Package">
<directory suffix=".php">./tests/</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory>src/</directory>
</whitelist>
</filter>
</phpunit>

View File

@@ -0,0 +1,57 @@
# Aggiornamenti
[![Latest Version on Packagist][ico-version]][link-packagist]
[![Total Downloads][ico-downloads]][link-downloads]
[![Build Status][ico-travis]][link-travis]
[![StyleCI][ico-styleci]][link-styleci]
This is where your description should go. Take a look at [contributing.md](contributing.md) to see a to do list.
## Installation
Via Composer
``` bash
$ composer require devcode-it/aggiornamenti
```
## Usage
## Change log
Please see the [changelog](changelog.md) for more information on what has changed recently.
## Testing
``` bash
$ composer test
```
## Contributing
Please see [contributing.md](contributing.md) for details and a todolist.
## Security
If you discover any security related issues, please email author email instead of using the issue tracker.
## Credits
- [author name][link-author]
- [All Contributors][link-contributors]
## License
license. Please see the [license file](license.md) for more information.
[ico-version]: https://img.shields.io/packagist/v/devcode-it/aggiornamenti.svg?style=flat-square
[ico-downloads]: https://img.shields.io/packagist/dt/devcode-it/aggiornamenti.svg?style=flat-square
[ico-travis]: https://img.shields.io/travis/devcode-it/aggiornamenti/master.svg?style=flat-square
[ico-styleci]: https://styleci.io/repos/12345678/shield
[link-packagist]: https://packagist.org/packages/devcode-it/aggiornamenti
[link-downloads]: https://packagist.org/packages/devcode-it/aggiornamenti
[link-travis]: https://travis-ci.org/devcode-it/aggiornamenti
[link-styleci]: https://styleci.io/repos/12345678
[link-author]: https://github.com/devcode-it
[link-contributors]: ../../contributors

View File

@@ -0,0 +1,221 @@
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: OpenSTAManager\n"
"POT-Creation-Date: 2021-03-15 16:02+0100\n"
"PO-Revision-Date: 2017-09-06 09:35+0200\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: it_IT\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 2.4.2\n"
"X-Poedit-Basepath: ../../..\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Poedit-SourceCharset: UTF-8\n"
"X-Poedit-KeywordsList: tr\n"
"X-Poedit-SearchPath-0: .\n"
"X-Poedit-SearchPathExcluded-0: .svn\n"
"X-Poedit-SearchPathExcluded-1: assets\n"
"X-Poedit-SearchPathExcluded-2: backup\n"
"X-Poedit-SearchPathExcluded-3: vendor\n"
"X-Poedit-SearchPathExcluded-4: assets\n"
"X-Poedit-SearchPathExcluded-5: bower_components\n"
"X-Poedit-SearchPathExcluded-6: node_modules\n"
"X-Poedit-SearchPathExcluded-7: logs\n"
"X-Poedit-SearchPathExcluded-8: files\n"
"X-Poedit-SearchPathExcluded-9: docs\n"
"X-Poedit-SearchPathExcluded-10: .*\n"
"X-Poedit-SearchPathExcluded-11: *.log\n"
"X-Poedit-SearchPathExcluded-12: *.md\n"
"X-Poedit-SearchPathExcluded-13: *.json\n"
"X-Poedit-SearchPathExcluded-14: *.lock\n"
"X-Poedit-SearchPathExcluded-15: *.phar\n"
"X-Poedit-SearchPathExcluded-16: *.css\n"
"X-Poedit-SearchPathExcluded-17: *.js\n"
"X-Poedit-SearchPathExcluded-18: .git\n"
#: Resources/views/index.blade.php:10
msgid "Personalizzazioni"
msgstr ""
#: Resources/views/index.blade.php:19
msgid "Percorso"
msgstr ""
#: Resources/views/index.blade.php:20
msgid "Cartella personalizzata"
msgstr ""
#: Resources/views/index.blade.php:21
msgid "Database personalizzato"
msgstr ""
#: Resources/views/index.blade.php:27 Resources/views/index.blade.php:28
msgid "Si"
msgstr ""
#: Resources/views/index.blade.php:27 Resources/views/index.blade.php:28
msgid "No"
msgstr ""
#: Resources/views/index.blade.php:33
msgid "Si sconsiglia l'aggiornamento senza il supporto dell'assistenza ufficiale"
msgstr ""
#: Resources/views/index.blade.php:35
msgid "Non ci sono strutture personalizzate"
msgstr ""
#: Resources/views/index.blade.php:41 Resources/views/update.blade.php:41
msgid "Attenzione!"
msgstr ""
#: Resources/views/index.blade.php:41
msgid "Ci sono delle tabelle non previste nella versione standard del gestionale: _LIST_"
msgstr ""
#: Resources/views/index.blade.php:53
msgid "Devi modificare il seguenti parametri del file di configurazione PHP (_FILE_) per poter caricare gli aggiornamenti"
msgstr ""
#: Resources/views/index.blade.php:135
msgid "Carica un aggiornamento"
msgstr ""
#: Resources/views/index.blade.php:147
msgid "Carica"
msgstr ""
#: Resources/views/index.blade.php:158
msgid "Verifica l'integrità dell'intallazione"
msgstr ""
#: Resources/views/index.blade.php:166
msgid "Controlla file"
msgstr ""
#: Resources/views/index.blade.php:170
msgid "Controlla database"
msgstr ""
#: Resources/views/index.blade.php:174
msgid "Controlla gestionale"
msgstr ""
#: Resources/views/index.blade.php:184
msgid "Ricerca aggiornamenti"
msgstr ""
#: Resources/views/index.blade.php:192
msgid "Ricerca"
msgstr ""
#: Resources/views/index.blade.php:197
msgid "Estensione curl non supportata"
msgstr ""
#: Resources/views/index.blade.php:202
msgid "E' stato individuato un nuovo aggiornamento"
msgstr ""
#: Resources/views/index.blade.php:203
msgid "Attenzione: la versione individuata è in fase sperimentale, e pertanto può presentare diversi bug e malfunzionamenti"
msgstr ""
#: Resources/views/index.blade.php:205
msgid "Scaricalo manualmente (_LINK_) oppure in automatico"
msgstr ""
#: Resources/views/index.blade.php:208
msgid "Scarica"
msgstr ""
#: Resources/views/index.blade.php:213
msgid "Nessun aggiornamento presente"
msgstr ""
#: Resources/views/index.blade.php:223
msgid "Requisiti"
msgstr ""
#: Resources/views/update.blade.php:3
msgid "Aggiornamento"
msgstr ""
#: Resources/views/update.blade.php:9
msgid "Informazioni sull'aggiornamento"
msgstr ""
#: Resources/views/update.blade.php:13
msgid "Changelog"
msgstr ""
#: Resources/views/update.blade.php:22
msgid "Il pacchetto selezionato contiene un aggiornamento dell'intero gestionale"
msgstr ""
#: Resources/views/update.blade.php:23
msgid "Si consiglia vivamente di effettuare un backup dell'installazione prima di procedere"
msgstr ""
#: Resources/views/update.blade.php:26
msgid "Crea backup"
msgstr ""
#: Resources/views/update.blade.php:32
msgid "OpenSTAManager versione _VERSION_"
msgstr ""
#: Resources/views/update.blade.php:41
msgid "Verranno aggiornate le sole componenti del pacchetto che non sono già installate e aggiornate"
msgstr ""
#: Resources/views/update.blade.php:45
msgid "Il pacchetto selezionato comprende i seguenti moduli"
msgstr ""
#: Resources/views/update.blade.php:53 Resources/views/update.blade.php:72
msgid "Installato"
msgstr ""
#: Resources/views/update.blade.php:64
msgid "Il pacchetto selezionato comprende i seguenti plugin"
msgstr ""
#: Resources/views/update.blade.php:91
msgid "Nessuna changelog individuabile"
msgstr ""
#: Resources/views/update.blade.php:100
msgid "Annulla"
msgstr ""
#: Resources/views/update.blade.php:106
msgid "Procedi"
msgstr ""
#: Http/Controllers/AggiornamentiController.php:41
msgid "Estensione ZIP"
msgstr ""
#: Http/Controllers/AggiornamentiController.php:41
msgid "da abilitare"
msgstr ""
#: Http/Controllers/AggiornamentiController.php:191
msgid "Accesso negato"
msgstr ""
#: Http/Controllers/AggiornamentiController.php:197
msgid "Il pacchetto contiene una versione precedente del gestionale"
msgstr ""
#: Http/Controllers/AggiornamentiController.php:199
msgid "Il pacchetto contiene solo componenti già installate e aggiornate"
msgstr ""
#: Http/UpdateHook.php:53
msgid "E' disponibile la versione _VERSION_ del gestionale"
msgstr ""

View File

@@ -0,0 +1,232 @@
msgid ""
msgstr ""
"Project-Id-Version: OpenSTAManager\n"
"POT-Creation-Date: 2021-03-15 16:02+0100\n"
"PO-Revision-Date: 2021-03-15 16:03+0100\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: de_DE\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 2.4.2\n"
"X-Poedit-Basepath: ..\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Poedit-SourceCharset: UTF-8\n"
"X-Poedit-KeywordsList: tr\n"
"X-Poedit-SearchPath-0: .\n"
"X-Poedit-SearchPathExcluded-0: .svn\n"
"X-Poedit-SearchPathExcluded-1: assets\n"
"X-Poedit-SearchPathExcluded-2: backup\n"
"X-Poedit-SearchPathExcluded-3: vendor\n"
"X-Poedit-SearchPathExcluded-4: assets\n"
"X-Poedit-SearchPathExcluded-5: bower_components\n"
"X-Poedit-SearchPathExcluded-6: node_modules\n"
"X-Poedit-SearchPathExcluded-7: logs\n"
"X-Poedit-SearchPathExcluded-8: files\n"
"X-Poedit-SearchPathExcluded-9: docs\n"
"X-Poedit-SearchPathExcluded-10: .*\n"
"X-Poedit-SearchPathExcluded-11: *.log\n"
"X-Poedit-SearchPathExcluded-12: *.md\n"
"X-Poedit-SearchPathExcluded-13: *.json\n"
"X-Poedit-SearchPathExcluded-14: *.lock\n"
"X-Poedit-SearchPathExcluded-15: *.phar\n"
"X-Poedit-SearchPathExcluded-16: *.css\n"
"X-Poedit-SearchPathExcluded-17: *.js\n"
"X-Poedit-SearchPathExcluded-18: .git\n"
#: Resources/views/index.blade.php:10
msgid "Personalizzazioni"
msgstr ""
#: Resources/views/index.blade.php:19
msgid "Percorso"
msgstr ""
#: Resources/views/index.blade.php:20
msgid "Cartella personalizzata"
msgstr ""
#: Resources/views/index.blade.php:21
msgid "Database personalizzato"
msgstr ""
#: Resources/views/index.blade.php:27 Resources/views/index.blade.php:28
msgid "Si"
msgstr ""
#: Resources/views/index.blade.php:27 Resources/views/index.blade.php:28
msgid "No"
msgstr ""
#: Resources/views/index.blade.php:33
msgid ""
"Si sconsiglia l'aggiornamento senza il supporto dell'assistenza ufficiale"
msgstr ""
#: Resources/views/index.blade.php:35
msgid "Non ci sono strutture personalizzate"
msgstr ""
#: Resources/views/index.blade.php:41 Resources/views/update.blade.php:41
msgid "Attenzione!"
msgstr ""
#: Resources/views/index.blade.php:41
msgid ""
"Ci sono delle tabelle non previste nella versione standard del gestionale: "
"_LIST_"
msgstr ""
#: Resources/views/index.blade.php:53
msgid ""
"Devi modificare il seguenti parametri del file di configurazione PHP "
"(_FILE_) per poter caricare gli aggiornamenti"
msgstr ""
#: Resources/views/index.blade.php:135
msgid "Carica un aggiornamento"
msgstr ""
#: Resources/views/index.blade.php:147
msgid "Carica"
msgstr ""
#: Resources/views/index.blade.php:158
msgid "Verifica l'integrità dell'intallazione"
msgstr ""
#: Resources/views/index.blade.php:166
msgid "Controlla file"
msgstr ""
#: Resources/views/index.blade.php:170
msgid "Controlla database"
msgstr ""
#: Resources/views/index.blade.php:174
msgid "Controlla gestionale"
msgstr ""
#: Resources/views/index.blade.php:184
msgid "Ricerca aggiornamenti"
msgstr ""
#: Resources/views/index.blade.php:192
msgid "Ricerca"
msgstr ""
#: Resources/views/index.blade.php:197
msgid "Estensione curl non supportata"
msgstr ""
#: Resources/views/index.blade.php:202
msgid "E' stato individuato un nuovo aggiornamento"
msgstr ""
#: Resources/views/index.blade.php:203
msgid ""
"Attenzione: la versione individuata è in fase sperimentale, e pertanto può "
"presentare diversi bug e malfunzionamenti"
msgstr ""
#: Resources/views/index.blade.php:205
msgid "Scaricalo manualmente (_LINK_) oppure in automatico"
msgstr ""
#: Resources/views/index.blade.php:208
msgid "Scarica"
msgstr ""
#: Resources/views/index.blade.php:213
msgid "Nessun aggiornamento presente"
msgstr ""
#: Resources/views/index.blade.php:223
msgid "Requisiti"
msgstr ""
#: Resources/views/update.blade.php:3
msgid "Aggiornamento"
msgstr ""
#: Resources/views/update.blade.php:9
msgid "Informazioni sull'aggiornamento"
msgstr ""
#: Resources/views/update.blade.php:13
msgid "Changelog"
msgstr ""
#: Resources/views/update.blade.php:22
msgid ""
"Il pacchetto selezionato contiene un aggiornamento dell'intero gestionale"
msgstr ""
#: Resources/views/update.blade.php:23
msgid ""
"Si consiglia vivamente di effettuare un backup dell'installazione prima di "
"procedere"
msgstr ""
#: Resources/views/update.blade.php:26
msgid "Crea backup"
msgstr ""
#: Resources/views/update.blade.php:32
msgid "OpenSTAManager versione _VERSION_"
msgstr ""
#: Resources/views/update.blade.php:41
msgid ""
"Verranno aggiornate le sole componenti del pacchetto che non sono già "
"installate e aggiornate"
msgstr ""
#: Resources/views/update.blade.php:45
msgid "Il pacchetto selezionato comprende i seguenti moduli"
msgstr ""
#: Resources/views/update.blade.php:53 Resources/views/update.blade.php:72
msgid "Installato"
msgstr ""
#: Resources/views/update.blade.php:64
msgid "Il pacchetto selezionato comprende i seguenti plugin"
msgstr ""
#: Resources/views/update.blade.php:91
msgid "Nessuna changelog individuabile"
msgstr ""
#: Resources/views/update.blade.php:100
msgid "Annulla"
msgstr ""
#: Resources/views/update.blade.php:106
msgid "Procedi"
msgstr ""
#: Http/Controllers/AggiornamentiController.php:41
msgid "Estensione ZIP"
msgstr ""
#: Http/Controllers/AggiornamentiController.php:41
msgid "da abilitare"
msgstr ""
#: Http/Controllers/AggiornamentiController.php:191
msgid "Accesso negato"
msgstr ""
#: Http/Controllers/AggiornamentiController.php:197
msgid "Il pacchetto contiene una versione precedente del gestionale"
msgstr ""
#: Http/Controllers/AggiornamentiController.php:199
msgid "Il pacchetto contiene solo componenti già installate e aggiornate"
msgstr ""
#: Http/UpdateHook.php:53
msgid "E' disponibile la versione _VERSION_ del gestionale"
msgstr ""

View File

@@ -0,0 +1,4 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore

View File

@@ -0,0 +1,227 @@
@extends('modules.base')
@section('module_content')
@if(!empty($custom) or !empty($tables))
<!-- Personalizzazioni di codice -->
<div class="box box-outline box-warning">
<div class="box-header with-border">
<h3 class="box-title">
<span class="tip" title="{{ tr('Elenco delle personalizzazioni rilevabili dal gestionale') }}.">
<i class="fa fa-edit"></i> {{ tr('Personalizzazioni') }}
</span>
</h3>
</div>
<div class="box-body">
@if(!empty($custom))
<table class="table table-hover table-striped">
<tr>
<th width="10%">{{ tr('Percorso') }}</th>
<th width="15%">{{ tr('Cartella personalizzata') }}</th>
<th width="15%">{{ tr('Database personalizzato') }}</th>
</tr>
@foreach($custom as $element)
<tr>
<td>{{ $element['path'] }}</td>
<td>{{ $element['directory'] ? tr('Si') : tr('No') }}</td>
<td>{{ $element['database'] ? tr('Si') : tr('No') }}</td>
</tr>
@endforeach
</table>
<p><strong>{{ tr("Si sconsiglia l'aggiornamento senza il supporto dell'assistenza ufficiale") }}.</strong></p>
@else
<p>{{ tr('Non ci sono strutture personalizzate') }}.</p>
@endif
@if(!empty($tables))
<div class="alert alert-warning">
<i class="fa fa-warning"></i>
<b>{{ tr('Attenzione!') }}</b> {{ tr('Ci sono delle tabelle non previste nella versione standard del gestionale: _LIST_', [
'_LIST_' => implode(', ', $tables),
]) }}
</div>
@endif
</div>
</div>
@endif
@if(!empty($alerts))
<div class="alert alert-warning">
<p>{{ tr('Devi modificare il seguenti parametri del file di configurazione PHP (_FILE_) per poter caricare gli aggiornamenti', ['_FILE_' => '<b>php.ini</b>']) }}:</p>
<ul>
@foreach($alerts as $key => $value)
<li><b>{{ $key }}</b> = {{ $value }}</li>
@endforeach
</ul>
</div>
@endif
<script>
function update() {
if ($("#blob").val()) {
swal({
title: "{{ tr('Avviare la procedura?') }}",
type: "warning",
showCancelButton: true,
confirmButtonText: "{{ tr('Sì') }}"
}).then(function (result) {
$("#update").submit();
})
} else {
swal({
title: "{{ tr('Selezionare un file!') }}",
type: "error",
})
}
}
function search(button) {
buttonLoading(button);
$.ajax({
url: "{{ route('controllo-versione') }}",
type: "post",
success: function(data){
$("#update-search").addClass("hidden");
if (data === "none" || !data) {
$("#update-none").removeClass("hidden");
} else {
if (data.includes("beta")) {
$("#beta-warning").removeClass("hidden");
}
$("#update-version").text(data);
$("#update-download").removeClass("hidden");
}
}
});
}
function download(button) {
buttonLoading(button);
$("#main_loading").show();
$.ajax({
url: "{{ route('scarica-aggiornamento') }}",
type: "post",
success: function(){
window.location.reload();
}
});
}
function checksum(button) {
openModal("{{ tr('Controllo dei file') }}", "{{ route('checksum') }}");
}
function database(button) {
openModal("{{ tr('Controllo del database') }}", "{{ route('database') }}");
}
function controlli(button) {
openModal("{{ tr('Controlli del gestionale') }}", "{{ route('controlli') }}");
}
</script>
<div class="row">
<div class="col-md-4">
<div class="box box-outline box-success">
<div class="box-header with-border">
<h3 class="box-title">
{{ tr('Carica un aggiornamento') }} <span class="tip" title="{{ tr('Form di caricamento aggiornamenti del gestionale e innesti di moduli e plugin') }}."><i class="fa fa-question-circle-o"></i></span>
</h3>
</div>
<div class="box-body">
<form action="" method="post" enctype="multipart/form-data" id="update">
<input type="hidden" name="op" value="upload">
<input type="hidden" name="backto" value="record-list">
{[ "type": "file", "name": "blob", "required": 1, "accept": ".zip" ]}
<button type="button" class="btn btn-primary float-right" onclick="update()">
<i class="fa fa-upload"></i> {{ tr('Carica') }}
</button>
</form>
</div>
</div>
</div>
<div class="col-md-4">
<div class="box box-warning">
<div class="box-header with-border">
<h3 class="box-title">
{{ tr("Verifica l'integrità dell'intallazione") }}
<span class="tip" title="{{ tr("Verifica l'integrità della tua installazione attraverso un controllo sui checksum dei file e sulla struttura del database") }}.">
<i class="fa fa-question-circle-o"></i>
</span>
</h3>
</div>
<div class="box-body">
<button type="button" class="btn btn-primary btn-block" onclick="checksum(this)">
<i class="fa fa-list-alt"></i> {{ tr('Controlla file') }}
</button>
<button type="button" class="btn btn-info btn-block" onclick="database(this)">
<i class="fa fa-database"></i> {{ tr('Controlla database') }}
</button>
<button type="button" class="btn btn-block" onclick="controlli(this)">
<i class="fa fa-stethoscope"></i> {{ tr('Controlla gestionale') }}
</button>
</div>
</div>
</div>
<div class="col-md-4">
<div class="box box-outline box-info">
<div class="box-header with-border">
<h3 class="box-title">
{{ tr('Ricerca aggiornamenti') }} <span class="tip" title="{{ tr('Controllo automatico della presenza di aggiornamenti per il gestionale') }}."><i class="fa fa-question-circle-o"></i></span>
</h3>
</div>
<div class="box-body">
@if(extension_loaded('curl'))
<div id="update-search">
<button type="button" class="btn btn-info btn-block" onclick="search(this)">
<i class="fa fa-search"></i> {{ tr('Ricerca') }}
</button>
</div>
@else
<button type="button" class="btn btn-warning btn-block disabled" >
<i class="fa fa-warning"></i> {{ tr('Estensione curl non supportata') }}.
</button>
@endif
<div id="update-download" class="hidden">
<p>{{ tr("E' stato individuato un nuovo aggiornamento") }}: <b id="update-version"></b>.</p>
<p id="beta-warning" class="hidden"><b>{{ tr('Attenzione: la versione individuata è in fase sperimentale, e pertanto può presentare diversi bug e malfunzionamenti') }}.</b></p>
<p>{!! tr('Scaricalo manualmente (_LINK_) oppure in automatico', ['_LINK_' => '<a href="https://github.com/devcode-it/openstamanager/releases">https://github.com/devcode-it/openstamanager/releases</a>']) !!}:</p>
<button type="button" class="btn btn-success btn-block" onclick="download(this)">
<i class="fa fa-download"></i> {{ tr('Scarica') }}
</button>
</div>
<div id="update-none" class="hidden">
<p>{{ tr('Nessun aggiornamento presente') }}.</p>
</div>
</div>
</div>
</div>
</div>
<hr>
<div id="requirements">
<h3>{{ tr('Requisiti') }}</h3>
@include('config.requirements-list')
</div>
@endsection

View File

@@ -0,0 +1,137 @@
@extends('layouts.base')
@section('title', tr('Aggiornamento'))
@section('body_class', 'hold-transition login-page')
@section('body')
<div class="card card-outline card-center-large card-warning">
<div class="card-header">
<a class="h5" data-toggle="tab" href="#info">{{ tr("Informazioni sull'aggiornamento") }}</a>
<ul class="nav nav-tabs float-right" id="tabs" role="tablist">
<li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#changelog">{{ tr('Changelog') }}</a>
</li>
</ul>
</div>
<div class="card-body tab-content">
<div id="info" class="tab-pane fade in active">
@if($update->isCoreUpdate())
<p>{{ tr("Il pacchetto selezionato contiene un aggiornamento dell'intero gestionale") }}.</p>
<p>{{ tr("Si consiglia vivamente di effettuare un backup dell'installazione prima di procedere") }}.</p>
<button type="button" class="btn btn-primary float-right" onclick="backup()">
<i class="fa fa-database"></i> {{ tr('Crea backup') }}
</button>
<div class="clearfix"></div>
<hr>
<h3 class="text-center">{{ tr('OpenSTAManager versione _VERSION_')({'_VERSION_': update.getVersion()}) }}</h3>
{% include 'config/list.twig' with {requirements: update.getRequirements()} only %}
@else
@php($elements = $update->componentUpdates())
<div class="alert alert-warning">
<i class="fa fa-warning"></i>
<b>{{ tr('Attenzione!') }}</b> {{ tr('Verranno aggiornate le sole componenti del pacchetto che non sono già installate e aggiornate') }}.
</div>
@if(!empty($elements['modules']))
<p>{{ tr('Il pacchetto selezionato comprende i seguenti moduli') }}:</p>
<ul class="list-group">
@foreach($elements['modules'] as $element)
<li class="list-group-item">
<span class="badge">{{ $element['info']['version'] }}</span>
@if($element['is_installed'])
<span class="badge">{{ tr('Installato') }}</span>
@endif
{{ $element['info']['name'] }}
</li>
@endforeach
</ul>
@endif
@if(!empty($elements['plugins']))
<p>{{ tr('Il pacchetto selezionato comprende i seguenti plugin') }}:</p>
<ul class="list-group">
@foreach($elements['plugins'] as $element)
<li class="list-group-item">
<span class="badge">{{ $element['info']['version'] }}</span>
@if($element['is_installed'])
<span class="badge">{{ tr('Installato') }}</span>
@endif
{{ $element['info']['name'] }}
</li>
@endforeach
</ul>
@endif
@endif
</div>
<div id="changelog" class="tab-pane fade">
@php($changelog = $update->getChangelog())
@if(!empty($changelog))
{!! $changelog !!}
@else
<p>{{ tr('Nessuna changelog individuabile') }}.</p>
@endif
</div>
<hr>
<form action="{{ route('cancella-aggiornamento') }}" method="post" style="display:inline-block">
<button type="submit" class="btn btn-warning">
<i class="fa fa-arrow-left"></i> {{ tr('Annulla') }}
</button>
</form>
<form action="{{ route('completa-aggiornamento') }}" method="post" class="float-right" style="display:inline-block">
<button type="submit" class="btn btn-success">
<i class="fa fa-arrow-right"></i> {{ tr('Procedi') }}
</button>
</form>
</div>
</div>
<script>
function backup(){
swal({
title: "{{ tr('Nuovo backup') }}",
text: "{{ tr('Sei sicuro di voler creare un nuovo backup?') }}",
type: "warning",
showCancelButton: true,
confirmButtonClass: "btn btn-lg btn-success",
confirmButtonText: "{{ tr('Crea') }}",
}).then(function(){
$("#main_loading").show();
$.ajax({
url: "{{ route('module', ['module_id' => module('Backup')->id]) }}",
type: "post",
data: {
op: "backup",
},
success: function(data){
$("#main_loading").fadeOut();
}
});
}, function(){});
}
</script>
@endsection

View File

@@ -0,0 +1,35 @@
<?php
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;
use DevCode\Aggiornamenti\Controllers\AggiornamentiController;
use DevCode\Aggiornamenti\Controllers\ControlliAggiuntiviController;
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/
Route::prefix('aggiornamenti')
->group(function () {
Route::get('', [AggiornamentiController::class, 'index']);
Route::post('controllo-versione', [AggiornamentiController::class, 'check'])
->name('controllo-versione');
Route::post('scarica-aggiornamento', [AggiornamentiController::class, 'download'])
->name('scarica-aggiornamento');
Route::get('checksum', [ControlliAggiuntiviController::class, 'checksum'])
->name('checksum');
Route::get('database', [ControlliAggiuntiviController::class, 'database'])
->name('database');
Route::get('controlli', [ControlliAggiuntiviController::class, 'controlli'])
->name('controlli');
});

View File

@@ -0,0 +1,466 @@
<?php
namespace DevCode\Aggiornamenti;
use Models\Cache;
use Models\Group;
use App\Http\Controllers\RequirementsController as Requirements;
use GuzzleHttp\Client;
use InvalidArgumentException;
use Models\Module;
use Parsedown;
use Symfony\Component\Finder\Finder;
use Update;
use Util\Ini;
use Util\Zip;
class Aggiornamento
{
protected static $client = null;
protected $directory = null;
protected $components = null;
protected $groups = null;
/**
* Crea l'istanza dedicata all'aggiornamento presente nella cartella indicata.
*
* @param string $directory
*
* @throws InvalidArgumentException
*/
public function __construct($directory = null)
{
$this->directory = $directory ?: Zip::getExtractionDirectory();
if (!$this->isCoreUpdate() && empty($this->componentUpdates())) {
throw new InvalidArgumentException();
}
}
/**
* Pulisce la cartella di estrazione.
*/
public function delete()
{
delete($this->directory);
}
/**
* Restituisce il percorso impostato per l'aggiornamento corrente.
*
* @return string
*/
public function getDirectory()
{
return $this->directory;
}
/**
* Controlla se l'aggiornamento è di tipo globale.
*
* @return bool
*/
public function isCoreUpdate()
{
return file_exists($this->directory.'/VERSION');
}
public function getChangelog()
{
if ($this->isCoreUpdate()) {
$changelog = self::readChangelog($this->getDirectory(), Update::getVersion());
} else {
$changelogs = [];
$elements = $this->componentUpdates();
$list = array_merge($elements['modules'], $elements['plugins']);
foreach ($list as $element) {
$changelog = self::readChangelog($element['path'], $element['version']);
if (!empty($changelog)) {
$changelogs[] = '
<h4 class="text-center">'.$element['info']['name'].'<h4>
'.$changelog;
}
}
$changelog = implode('<hr>', $changelogs);
}
return $changelog;
}
public function getRequirements()
{
$file = $this->directory.'/config/requirements.php';
$result = Requirements::getRequirementsList($file);
return $result;
}
public function getVersion()
{
return Update::getFile($this->getDirectory().'/VERSION');
}
/**
* Individua i componenti indipendenti che compongono l'aggiornamento.
*
* @return array
*/
public function componentUpdates()
{
if (!isset($this->components)) {
$finder = Finder::create()
->files()
->ignoreDotFiles(true)
->ignoreVCS(true)
->in($this->directory);
$files = $finder->name('MODULE')->name('PLUGIN');
$results = [];
foreach ($files as $file) {
$is_module = basename($file->getRealPath()) == 'MODULE';
$is_plugin = basename($file->getRealPath()) == 'PLUGIN';
$info = Ini::readFile($file->getRealPath());
$installed = module($info['name']);
if ($is_module) {
$type = 'modules';
} elseif ($is_plugin) {
$type = 'plugins';
}
if (!isset($results[$type])) {
$results[$type] = [];
}
$results[$type][] = [
'path' => dirname($file->getRealPath()),
'config' => $file->getRealPath(),
'is_installed' => !empty($installed),
'current_version' => !empty($installed) ? $installed->version : null,
'info' => $info,
];
}
$this->components = $results;
}
return $this->components;
}
/**
* Effettua l'aggiornamento.
*/
public function execute()
{
if ($this->isCoreUpdate()) {
$this->executeCore();
} else {
$components = $this->componentUpdates();
foreach ((array) $components['modules'] as $module) {
$this->executeModule($module);
}
foreach ((array) $components['plugins'] as $plugin) {
$this->executeModule($plugin);
}
}
$this->delete();
}
/**
* Completa l'aggiornamento globale secondo la procedura apposita.
*/
public function executeCore()
{
// Salva il file di configurazione
$config = file_get_contents(DOCROOT.'/config.inc.php');
// Copia i file dalla cartella temporanea alla root
copyr($this->directory, DOCROOT);
// Ripristina il file di configurazione dell'installazione
file_put_contents(DOCROOT.'/config.inc.php', $config);
}
/**
* Completa l'aggiornamento con le informazioni specifiche per i moduli.
*
* @param array $module
*/
public function executeModule($module)
{
// Informazioni dal file di configurazione
$info = $module['info'];
// Informazioni aggiuntive per il database
$insert = [
'parent' => module($info['parent']),
'icon' => $info['icon'],
];
$id = $this->executeComponent($module['path'], 'modules', 'zz_modules', $insert, $info, $module['is_installed']);
if (!empty($id)) {
// Fix per i permessi di amministratore
$element = Module::find($id);
$element->groups()->syncWithoutDetaching($this->groups());
}
}
/**
* Instanzia un aggiornamento sulla base di uno zip indicato.
* Controlla inoltre che l'aggiornamento sia fattibile.
*
* @param string $file
*
* @throws DowngradeException
* @throws InvalidArgumentException
*
* @return static
*/
public static function make($file)
{
$extraction_dir = Zip::extract($file);
$update = new static($extraction_dir);
if ($update->isCoreUpdate()) {
$version = Update::getFile($update->getDirectory().'/VERSION');
$current = Update::getVersion();
if (version_compare($current, $version) >= 0) {
$update->delete();
throw new DowngradeException();
}
} else {
$components = $update->componentUpdates();
foreach ((array) $components['modules'] as $module) {
if (version_compare($module['current_version'], $module['info']['version']) >= 0) {
delete($module['path']);
}
}
foreach ((array) $components['plugins'] as $plugin) {
if (version_compare($plugin['current_version'], $plugin['info']['version']) >= 0) {
delete($plugin['path']);
}
}
}
// Instanzia nuovamente l'oggetto
return new static($extraction_dir);
}
/**
* Controlla se è disponibile un aggiornamento nella repository GitHub.
*
* @return string|bool
*/
public static function isAvailable()
{
$release = self::getLastRelease();
$version = ltrim($release['tag_name'], 'v');
$current = Update::getVersion();
$result = false;
if (version_compare($current, $version) < 0) {
$result = $version.($release['prerelease'] ? ' (beta)' : '');
}
// Aggiornamento cache dedicata
Cache::pool('Ultima versione di OpenSTAManager disponibile')->set($result);
return $result;
}
/**
* Scarica la release più recente (se presente).
*
* @return static
*/
public static function download()
{
if (self::isAvailable() === false) {
return null;
}
$directory = Zip::getExtractionDirectory();
$file = $directory.'/release.zip';
directory($directory);
$release = self::getLastRelease();
self::getClient()->request('GET', $release['assets'][0]['browser_download_url'], ['sink' => $file]);
$update = self::make($file);
delete($file);
return $update;
}
/**
* Restituisce i contenuti JSON dell'API del progetto.
*
* @return array
*/
public static function checkFiles()
{
$date = date('Y-m-d', filemtime(DOCROOT.'/core.php'));
// Individuazione dei file tramite data di modifica
$files = Finder::create()
->date('<= '.$date)
->sortByName()
->in(DOCROOT)
->exclude([
'node_modules',
'tests',
'tmp',
'vendor',
])
->name('*.php')
->notPath('*custom*')
->files();
return iterator_to_array($files);
}
/**
* Restituisce il changelog presente nel percorso indicato a partire dalla versione specificata.
*
* @param string $path
* @param string $version
*
* @return string
*/
protected static function readChangelog($path, $version = null)
{
$result = file_get_contents($path.'/CHANGELOG.md');
$start = strpos($result, '## ');
$result = substr($result, $start);
if (!empty($version)) {
$last = strpos($result, '## '.$version.' ');
if ($last !== false) {
$result = substr($result, 0, $last);
}
}
$result = Parsedown::instance()->text($result);
$result = str_replace(['h4>', 'h3>', 'h2>'], ['p>', 'b>', 'h4>'], $result);
return $result;
}
/**
* Completa l'aggiornamento del singolo componente come previsto dai parametri indicati.
*
* @param string $directory Percorso di copia dei contenuti
* @param string $table Tabella interessata dall'aggiornamento
* @param array $insert Informazioni per la registrazione
* @param array $info Contenuti della configurazione
* @param bool $is_installed
*
* @return int|null
*/
protected function executeComponent($path, $directory, $table, $insert, $info, $is_installed = false)
{
// Copia dei file nella cartella relativa
copyr($path, DOCROOT.'/'.$directory.'/'.$info['directory']);
// Eventuale registrazione nel database
if (empty($is_installed)) {
$dbo = database();
$dbo->insert($table, array_merge($insert, [
'name' => $info['name'],
'title' => !empty($info['title']) ? $info['title'] : $info['name'],
'directory' => $info['directory'],
'options' => $info['options'],
'version' => $info['version'],
'compatibility' => $info['compatibility'],
'order' => 100,
'default' => 0,
'enabled' => 1,
]));
return $dbo->lastInsertedID();
}
}
/**
* Resituisce i permessi di default da impostare all'installazione del componente.
*
* @return array
*/
protected function groups()
{
if (!isset($this->groups)) {
$groups = Group::where('nome', 'Amministratori')->get();
$result = [];
foreach ($groups as $group) {
$result[$group->id] = [
'permission_level' => 'rw',
];
}
$this->groups = $result;
}
return $this->groups;
}
/**
* Restituisce l'oggetto per la connessione all'API del progetto.
*
* @return Client
*/
protected static function getClient()
{
if (!isset(self::$client)) {
self::$client = new Client([
'base_uri' => 'https://api.github.com/repos/devcode-it/openstamanager/',
'verify' => false,
]);
}
return self::$client;
}
/**
* Restituisce i contenuti JSON dell'API del progetto.
*
* @return array
* @throws \GuzzleHttp\Exception\GuzzleException
*/
protected static function getLastRelease()
{
$response = self::getClient()->request('GET', 'releases');
$body = $response->getBody();
// Impostazione per l'utilizzo o meno di versioni non stabili
$prerelease = intval(setting('Abilita canale pre-release per aggiornamenti'));
// Ricerca dell'ultima release del tipi specificato
$releases = json_decode($body, true) ?: [];
foreach ($releases as $release) {
if ($release['prerelease'] == $prerelease) {
return $release;
}
}
return null;
}
}

View File

@@ -0,0 +1,249 @@
<?php
namespace DevCode\Aggiornamenti\Controllers;
use App\Http\Controllers\RequirementsController;
use Illuminate\Contracts\Support\Renderable;
use Illuminate\Http\Request;
use Illuminate\Routing\Controller;
use InvalidArgumentException;
use DevCode\Aggiornamenti\Aggiornamento;
use DevCode\Aggiornamenti\DowngradeException;
class AggiornamentiController extends Controller
{
/**
* Display a listing of the resource.
* @return Renderable
*/
public function index()
{
try {
$update = new Aggiornamento();
$args = [
'update' => $update,
'update_version' => $update->getVersion(),
'update_requirements' => $update->getRequirements(),
];
return view('aggiornamenti::update', $args);
} catch (InvalidArgumentException $e) {
}
$custom = $this->customComponents();
$tables = $this->customTables();
// Aggiornamenti
$alerts = [];
if (!extension_loaded('zip')) {
$alerts[tr('Estensione ZIP')] = tr('da abilitare');
}
$upload_max_filesize = ini_get('upload_max_filesize');
$upload_max_filesize = str_replace(['k', 'M'], ['000', '000000'], $upload_max_filesize);
// Dimensione minima: 32MB
if ($upload_max_filesize < 32000000) {
$alerts['upload_max_filesize'] = '32MB';
}
$post_max_size = ini_get('post_max_size');
$post_max_size = str_replace(['k', 'M'], ['000', '000000'], $post_max_size);
// Dimensione minima: 32MB
if ($post_max_size < 32000000) {
$alerts['post_max_size'] = '32MB';
}
$args = [
'module' => module('Aggiornamenti'),
'custom' => $custom,
'tables' => $tables,
'alerts' => $alerts,
'enable_updates' => setting('Attiva aggiornamenti'),
'requirements' => RequirementsController::getRequirementsList(),
];
return view('aggiornamenti::index', $args);
}
/**
* Controlla se il database presenta alcune sezioni personalizzate.
*
* @return array
*/
public function customStructure()
{
$results = [];
$dirs = [
'modules',
'templates',
'plugins',
];
// Controlli di personalizzazione fisica
foreach ($dirs as $dir) {
$files = glob(base_dir().'/'.$dir.'/*/custom/*.{php,html}', GLOB_BRACE);
$recursive_files = glob(base_dir().'/'.$dir.'/*/custom/**/*.{php,html}', GLOB_BRACE);
$files = array_merge($files, $recursive_files);
foreach ($files as $file) {
$file = str_replace(base_dir().'/', '', $file);
$result = explode('/custom/', $file)[0];
if (!in_array($result, $results)) {
$results[] = $result;
}
}
}
// Gestione cartella include
$files = glob(base_dir().'/include/custom/*.{php,html}', GLOB_BRACE);
$recursive_files = glob(base_dir().'/include/custom/**/*.{php,html}', GLOB_BRACE);
$files = array_merge($files, $recursive_files);
foreach ($files as $file) {
$file = str_replace(base_dir().'/', '', $file);
$result = explode('/custom/', $file)[0];
if (!in_array($result, $results)) {
$results[] = $result;
}
}
return $results;
}
/**
* Controlla se il database presenta alcune sezioni personalizzate.
*
* @return array
*/
protected function customTables()
{
$tables = include base_dir().'/update/tables.php';
$names = [];
foreach ($tables as $table) {
$names[] = prepare($table);
}
$database = database();
$results = $database->fetchArray('SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = '.prepare($database->getDatabaseName()).' AND TABLE_NAME NOT IN ('.implode(',', $names).") AND TABLE_NAME != 'updates'");
return array_column($results, 'TABLE_NAME');
}
/**
* Controlla se il database presenta alcune sezioni personalizzate.
*
* @return array
*/
protected function customDatabase()
{
$database = database();
$modules = $database->fetchArray("SELECT name, CONCAT('modules/', directory) AS directory FROM zz_modules WHERE options2 != ''");
$plugins = $database->fetchArray("SELECT name, CONCAT('plugins/', directory) AS directory FROM zz_plugins WHERE options2 != ''");
$results = array_merge($modules, $plugins);
return $results;
}
protected function customComponents()
{
$database_check = $this->customDatabase();
$structure_check = $this->customStructure();
$list = [];
foreach ($database_check as $element) {
$pos = array_search($element['directory'], $structure_check);
$list[] = [
'path' => $element['directory'],
'database' => true,
'directory' => $pos !== false,
];
if ($pos !== false) {
unset($structure_check[$pos]);
}
}
foreach ($structure_check as $element) {
$list[] = [
'path' => $element,
'database' => false,
'directory' => true,
];
}
return $list;
}
public function create(Request $request)
{
if (!setting('Attiva aggiornamenti')) {
die(tr('Accesso negato'));
}
try {
$update = Aggiornamento::make($_FILES['blob']['tmp_name']);
} catch (DowngradeException $e) {
flash()->error(tr('Il pacchetto contiene una versione precedente del gestionale'));
} catch (InvalidArgumentException $e) {
flash()->error(tr('Il pacchetto contiene solo componenti già installate e aggiornate'));
}
}
public function check(Request $request)
{
$result = Aggiornamento::isAvailable();
$result = $result === false ? 'none' : $result;
return $result;
}
public function download(Request $request)
{
Aggiornamento::download();
}
public function execute(Request $request)
{
try {
$update = new Aggiornamento();
$update->execute();
} catch (InvalidArgumentException $e) {
}
$route = $this->router->urlFor('module', [
'module_id' => $args['module_id'],
]);
$response = $response->withRedirect($route);
return $response;
}
public function cancel(Request $request)
{
try {
$update = new Aggiornamento();
$update->delete();
} catch (InvalidArgumentException $e) {
}
$route = $this->router->urlFor('module', [
'module_id' => $args['module_id'],
]);
$response = $response->withRedirect($route);
return $response;
}
}

View File

@@ -0,0 +1,14 @@
<?php
namespace DevCode\Aggiornamenti\Controllers;
use App\Http\Controllers\RequirementsController;
use Illuminate\Contracts\Support\Renderable;
use Illuminate\Http\Request;
use Illuminate\Routing\Controller;
use InvalidArgumentException;
use DevCode\Aggiornamenti\Aggiornamento;
class ControlliAggiuntiviController extends Controller
{
}

View File

@@ -0,0 +1,9 @@
<?php
namespace DevCode\Aggiornamenti;
use InvalidArgumentException;
class DowngradeException extends InvalidArgumentException
{
}

View File

@@ -0,0 +1,18 @@
<?php
namespace DevCode\Aggiornamenti\Facades;
use Illuminate\Support\Facades\Facade;
class Aggiornamenti extends Facade
{
/**
* Get the registered name of the component.
*
* @return string
*/
protected static function getFacadeAccessor(): string
{
return 'aggiornamenti';
}
}

View File

@@ -0,0 +1,10 @@
<?php
namespace DevCode\Aggiornamenti;
class Modulo
{
}

View File

@@ -0,0 +1,82 @@
<?php
namespace DevCode\Aggiornamenti;
use Illuminate\Support\ServiceProvider as BaseProvider;
class ServiceProvider extends BaseProvider
{
/**
* Perform post-registration booting of services.
*
* @return void
*/
public function boot(): void
{
// $this->loadTranslationsFrom(__DIR__.'/../resources/lang', 'devcode-it');
$this->loadViewsFrom(__DIR__.'/../resources/views', 'aggiornamenti');
$this->loadMigrationsFrom(__DIR__.'/../database/migrations');
$this->loadRoutesFrom(__DIR__.'/../routes.php');
// Publishing is only necessary when using the CLI.
if ($this->app->runningInConsole()) {
$this->bootForConsole();
}
}
/**
* Register any package services.
*
* @return void
*/
public function register(): void
{
$this->mergeConfigFrom(__DIR__.'/../config/aggiornamenti.php', 'aggiornamenti');
// Register the service the package provides.
$this->app->singleton('aggiornamenti', function ($app) {
return new Modulo();
});
}
/**
* Get the services provided by the provider.
*
* @return array
*/
public function provides()
{
return ['aggiornamenti'];
}
/**
* Console-specific booting.
*
* @return void
*/
protected function bootForConsole(): void
{
// Publishing the configuration file.
$this->publishes([
__DIR__.'/../config/aggiornamenti.php' => config_path('aggiornamenti.php'),
], 'aggiornamenti.config');
// Publishing the views.
/*$this->publishes([
__DIR__.'/../resources/views' => base_path('resources/views/vendor/devcode-it'),
], 'aggiornamenti.views');*/
// Publishing assets.
/*$this->publishes([
__DIR__.'/../resources/assets' => public_path('vendor/devcode-it'),
], 'aggiornamenti.views');*/
// Publishing the translation files.
/*$this->publishes([
__DIR__.'/../resources/lang' => resource_path('lang/vendor/devcode-it'),
], 'aggiornamenti.views');*/
// Registering package commands.
// $this->commands([]);
}
}

View File

@@ -0,0 +1,116 @@
<?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/>.
*/
namespace DevCode\Aggiornamenti;
use GuzzleHttp\Client;
use Hooks\CachedManager;
use Update;
/**
* Hook dedicato all'individuazione di nuove versioni del gestionale, pubblicate sulla repository ufficiale di GitHub.
*/
class UpdateHook extends CachedManager
{
protected static $client = null;
public function getCacheName()
{
return 'Ultima versione di OpenSTAManager disponibile';
}
public function cacheData()
{
return self::isAvailable();
}
public function response()
{
$update = $this->getCache()->content;
if ($update == Update::getVersion()) {
$update = null;
}
$module = module('Aggiornamenti');
$link = base_url().'/controller.php?id_module='.$module->id;
$message = tr("E' disponibile la versione _VERSION_ del gestionale", [
'_VERSION_' => $update,
]);
return [
'icon' => 'fa fa-download text-info',
'link' => $link,
'message' => $message,
'show' => !empty($update),
];
}
/**
* Controlla se è disponibile un aggiornamento nella repository GitHub.
*
* @return array|bool
*/
public static function isAvailable()
{
$api = self::getAPI();
if (!$api['prerelease'] or setting('Abilita canale pre-release per aggiornamenti')) {
$version[0] = ltrim($api['tag_name'], 'v');
$version[1] = !empty($api['prerelease']) ? 'beta' : 'stabile';
$current = Update::getVersion();
if (version_compare($current, $version[0]) < 0) {
return $version;
}
}
return false;
}
/**
* Restituisce l'oggetto per la connessione all'API del progetto.
*
* @return Client
*/
protected static function getClient()
{
if (!isset(self::$client)) {
self::$client = new Client([
'base_uri' => 'https://api.github.com/repos/devcode-it/openstamanager/',
'verify' => false,
]);
}
return self::$client;
}
/**
* Restituisce i contenuti JSON dell'API del progetto.
*
* @return array
*/
protected static function getAPI()
{
$response = self::getClient()->request('GET', 'releases');
$body = $response->getBody();
return json_decode($body, true)[0];
}
}

View File

@@ -0,0 +1 @@
preset: laravel

View File

@@ -0,0 +1,8 @@
# Changelog
All notable changes to `CausaliTrasporto` will be documented in this file.
## Version 1.0
### Added
- Everything

View File

@@ -0,0 +1,41 @@
{
"name": "devcode-it/causali-trasporto",
"description": ":package_description",
"license": "license",
"authors": [
{
"name": "author name",
"email": "author email",
"homepage": "author homepage"
}
],
"homepage": "https://github.com/devcode-it/causali-trasporto",
"keywords": ["Laravel", "CausaliTrasporto"],
"require": {
"illuminate/support": "~7|~8"
},
"require-dev": {
"phpunit/phpunit": "~9.0",
"orchestra/testbench": "~5|~6"
},
"autoload": {
"psr-4": {
"DevCode\\CausaliTrasporto\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"DevCode\\CausaliTrasporto\\Tests\\": "tests"
}
},
"extra": {
"laravel": {
"providers": [
"DevCode\\CausaliTrasporto\\ServiceProvider"
],
"aliases": {
"CausaliTrasporto": "DevCode\\CausaliTrasporto\\Facades\\CausaliTrasporto"
}
}
}
}

View File

@@ -0,0 +1,5 @@
<?php
return [
//
];

View File

@@ -0,0 +1,27 @@
# Contributing
Contributions are welcome and will be fully credited.
Contributions are accepted via Pull Requests on [Github](https://github.com/devcode-it/causali-trasporto).
# Things you could do
If you want to contribute but do not know where to start, this list provides some starting points.
- Add license text
- Remove rewriteRules.php
- Set up TravisCI, StyleCI, ScrutinizerCI
- Write a comprehensive ReadMe
## Pull Requests
- **Add tests!** - Your patch won't be accepted if it doesn't have tests.
- **Document any change in behaviour** - Make sure the `readme.md` and any other relevant documentation are kept up-to-date.
- **Consider our release cycle** - We try to follow [SemVer v2.0.0](http://semver.org/). Randomly breaking public APIs is not an option.
- **One pull request per feature** - If you want to do more than one thing, send multiple pull requests.
- **Send coherent history** - Make sure each individual commit in your pull request is meaningful. If you had to make multiple intermediate commits while developing, please [squash them](http://www.git-scm.com/book/en/v2/Git-Tools-Rewriting-History#Changing-Multiple-Commit-Messages) before submitting.
**Happy coding**!

View File

@@ -0,0 +1,5 @@
# The license
Copyright (c) author name <author email>
...Add your license text here...

View File

@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="vendor/autoload.php"
backupGlobals="false"
backupStaticAttributes="false"
colors="true"
verbose="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false">
<testsuites>
<testsuite name="Package">
<directory suffix=".php">./tests/</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory>src/</directory>
</whitelist>
</filter>
</phpunit>

View File

@@ -0,0 +1,57 @@
# CausaliTrasporto
[![Latest Version on Packagist][ico-version]][link-packagist]
[![Total Downloads][ico-downloads]][link-downloads]
[![Build Status][ico-travis]][link-travis]
[![StyleCI][ico-styleci]][link-styleci]
This is where your description should go. Take a look at [contributing.md](contributing.md) to see a to do list.
## Installation
Via Composer
``` bash
$ composer require devcode-it/causali-trasporto
```
## Usage
## Change log
Please see the [changelog](changelog.md) for more information on what has changed recently.
## Testing
``` bash
$ composer test
```
## Contributing
Please see [contributing.md](contributing.md) for details and a todolist.
## Security
If you discover any security related issues, please email author email instead of using the issue tracker.
## Credits
- [author name][link-author]
- [All Contributors][link-contributors]
## License
license. Please see the [license file](license.md) for more information.
[ico-version]: https://img.shields.io/packagist/v/devcode-it/causali-trasporto.svg?style=flat-square
[ico-downloads]: https://img.shields.io/packagist/dt/devcode-it/causali-trasporto.svg?style=flat-square
[ico-travis]: https://img.shields.io/travis/devcode-it/causali-trasporto/master.svg?style=flat-square
[ico-styleci]: https://styleci.io/repos/12345678/shield
[link-packagist]: https://packagist.org/packages/devcode-it/causali-trasporto
[link-downloads]: https://packagist.org/packages/devcode-it/causali-trasporto
[link-travis]: https://travis-ci.org/devcode-it/causali-trasporto
[link-styleci]: https://styleci.io/repos/12345678
[link-author]: https://github.com/devcode-it
[link-contributors]: ../../contributors

View File

@@ -0,0 +1,221 @@
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: OpenSTAManager\n"
"POT-Creation-Date: 2021-03-15 16:02+0100\n"
"PO-Revision-Date: 2017-09-06 09:35+0200\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: it_IT\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 2.4.2\n"
"X-Poedit-Basepath: ../../..\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Poedit-SourceCharset: UTF-8\n"
"X-Poedit-KeywordsList: tr\n"
"X-Poedit-SearchPath-0: .\n"
"X-Poedit-SearchPathExcluded-0: .svn\n"
"X-Poedit-SearchPathExcluded-1: assets\n"
"X-Poedit-SearchPathExcluded-2: backup\n"
"X-Poedit-SearchPathExcluded-3: vendor\n"
"X-Poedit-SearchPathExcluded-4: assets\n"
"X-Poedit-SearchPathExcluded-5: bower_components\n"
"X-Poedit-SearchPathExcluded-6: node_modules\n"
"X-Poedit-SearchPathExcluded-7: logs\n"
"X-Poedit-SearchPathExcluded-8: files\n"
"X-Poedit-SearchPathExcluded-9: docs\n"
"X-Poedit-SearchPathExcluded-10: .*\n"
"X-Poedit-SearchPathExcluded-11: *.log\n"
"X-Poedit-SearchPathExcluded-12: *.md\n"
"X-Poedit-SearchPathExcluded-13: *.json\n"
"X-Poedit-SearchPathExcluded-14: *.lock\n"
"X-Poedit-SearchPathExcluded-15: *.phar\n"
"X-Poedit-SearchPathExcluded-16: *.css\n"
"X-Poedit-SearchPathExcluded-17: *.js\n"
"X-Poedit-SearchPathExcluded-18: .git\n"
#: Resources/views/index.blade.php:10
msgid "Personalizzazioni"
msgstr ""
#: Resources/views/index.blade.php:19
msgid "Percorso"
msgstr ""
#: Resources/views/index.blade.php:20
msgid "Cartella personalizzata"
msgstr ""
#: Resources/views/index.blade.php:21
msgid "Database personalizzato"
msgstr ""
#: Resources/views/index.blade.php:27 Resources/views/index.blade.php:28
msgid "Si"
msgstr ""
#: Resources/views/index.blade.php:27 Resources/views/index.blade.php:28
msgid "No"
msgstr ""
#: Resources/views/index.blade.php:33
msgid "Si sconsiglia l'aggiornamento senza il supporto dell'assistenza ufficiale"
msgstr ""
#: Resources/views/index.blade.php:35
msgid "Non ci sono strutture personalizzate"
msgstr ""
#: Resources/views/index.blade.php:41 Resources/views/update.blade.php:41
msgid "Attenzione!"
msgstr ""
#: Resources/views/index.blade.php:41
msgid "Ci sono delle tabelle non previste nella versione standard del gestionale: _LIST_"
msgstr ""
#: Resources/views/index.blade.php:53
msgid "Devi modificare il seguenti parametri del file di configurazione PHP (_FILE_) per poter caricare gli aggiornamenti"
msgstr ""
#: Resources/views/index.blade.php:135
msgid "Carica un aggiornamento"
msgstr ""
#: Resources/views/index.blade.php:147
msgid "Carica"
msgstr ""
#: Resources/views/index.blade.php:158
msgid "Verifica l'integrità dell'intallazione"
msgstr ""
#: Resources/views/index.blade.php:166
msgid "Controlla file"
msgstr ""
#: Resources/views/index.blade.php:170
msgid "Controlla database"
msgstr ""
#: Resources/views/index.blade.php:174
msgid "Controlla gestionale"
msgstr ""
#: Resources/views/index.blade.php:184
msgid "Ricerca aggiornamenti"
msgstr ""
#: Resources/views/index.blade.php:192
msgid "Ricerca"
msgstr ""
#: Resources/views/index.blade.php:197
msgid "Estensione curl non supportata"
msgstr ""
#: Resources/views/index.blade.php:202
msgid "E' stato individuato un nuovo aggiornamento"
msgstr ""
#: Resources/views/index.blade.php:203
msgid "Attenzione: la versione individuata è in fase sperimentale, e pertanto può presentare diversi bug e malfunzionamenti"
msgstr ""
#: Resources/views/index.blade.php:205
msgid "Scaricalo manualmente (_LINK_) oppure in automatico"
msgstr ""
#: Resources/views/index.blade.php:208
msgid "Scarica"
msgstr ""
#: Resources/views/index.blade.php:213
msgid "Nessun aggiornamento presente"
msgstr ""
#: Resources/views/index.blade.php:223
msgid "Requisiti"
msgstr ""
#: Resources/views/update.blade.php:3
msgid "Aggiornamento"
msgstr ""
#: Resources/views/update.blade.php:9
msgid "Informazioni sull'aggiornamento"
msgstr ""
#: Resources/views/update.blade.php:13
msgid "Changelog"
msgstr ""
#: Resources/views/update.blade.php:22
msgid "Il pacchetto selezionato contiene un aggiornamento dell'intero gestionale"
msgstr ""
#: Resources/views/update.blade.php:23
msgid "Si consiglia vivamente di effettuare un backup dell'installazione prima di procedere"
msgstr ""
#: Resources/views/update.blade.php:26
msgid "Crea backup"
msgstr ""
#: Resources/views/update.blade.php:32
msgid "OpenSTAManager versione _VERSION_"
msgstr ""
#: Resources/views/update.blade.php:41
msgid "Verranno aggiornate le sole componenti del pacchetto che non sono già installate e aggiornate"
msgstr ""
#: Resources/views/update.blade.php:45
msgid "Il pacchetto selezionato comprende i seguenti moduli"
msgstr ""
#: Resources/views/update.blade.php:53 Resources/views/update.blade.php:72
msgid "Installato"
msgstr ""
#: Resources/views/update.blade.php:64
msgid "Il pacchetto selezionato comprende i seguenti plugin"
msgstr ""
#: Resources/views/update.blade.php:91
msgid "Nessuna changelog individuabile"
msgstr ""
#: Resources/views/update.blade.php:100
msgid "Annulla"
msgstr ""
#: Resources/views/update.blade.php:106
msgid "Procedi"
msgstr ""
#: Http/Controllers/AggiornamentiController.php:41
msgid "Estensione ZIP"
msgstr ""
#: Http/Controllers/AggiornamentiController.php:41
msgid "da abilitare"
msgstr ""
#: Http/Controllers/AggiornamentiController.php:191
msgid "Accesso negato"
msgstr ""
#: Http/Controllers/AggiornamentiController.php:197
msgid "Il pacchetto contiene una versione precedente del gestionale"
msgstr ""
#: Http/Controllers/AggiornamentiController.php:199
msgid "Il pacchetto contiene solo componenti già installate e aggiornate"
msgstr ""
#: Http/UpdateHook.php:53
msgid "E' disponibile la versione _VERSION_ del gestionale"
msgstr ""

View File

@@ -0,0 +1,232 @@
msgid ""
msgstr ""
"Project-Id-Version: OpenSTAManager\n"
"POT-Creation-Date: 2021-03-15 16:02+0100\n"
"PO-Revision-Date: 2021-03-15 16:03+0100\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: de_DE\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 2.4.2\n"
"X-Poedit-Basepath: ..\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Poedit-SourceCharset: UTF-8\n"
"X-Poedit-KeywordsList: tr\n"
"X-Poedit-SearchPath-0: .\n"
"X-Poedit-SearchPathExcluded-0: .svn\n"
"X-Poedit-SearchPathExcluded-1: assets\n"
"X-Poedit-SearchPathExcluded-2: backup\n"
"X-Poedit-SearchPathExcluded-3: vendor\n"
"X-Poedit-SearchPathExcluded-4: assets\n"
"X-Poedit-SearchPathExcluded-5: bower_components\n"
"X-Poedit-SearchPathExcluded-6: node_modules\n"
"X-Poedit-SearchPathExcluded-7: logs\n"
"X-Poedit-SearchPathExcluded-8: files\n"
"X-Poedit-SearchPathExcluded-9: docs\n"
"X-Poedit-SearchPathExcluded-10: .*\n"
"X-Poedit-SearchPathExcluded-11: *.log\n"
"X-Poedit-SearchPathExcluded-12: *.md\n"
"X-Poedit-SearchPathExcluded-13: *.json\n"
"X-Poedit-SearchPathExcluded-14: *.lock\n"
"X-Poedit-SearchPathExcluded-15: *.phar\n"
"X-Poedit-SearchPathExcluded-16: *.css\n"
"X-Poedit-SearchPathExcluded-17: *.js\n"
"X-Poedit-SearchPathExcluded-18: .git\n"
#: Resources/views/index.blade.php:10
msgid "Personalizzazioni"
msgstr ""
#: Resources/views/index.blade.php:19
msgid "Percorso"
msgstr ""
#: Resources/views/index.blade.php:20
msgid "Cartella personalizzata"
msgstr ""
#: Resources/views/index.blade.php:21
msgid "Database personalizzato"
msgstr ""
#: Resources/views/index.blade.php:27 Resources/views/index.blade.php:28
msgid "Si"
msgstr ""
#: Resources/views/index.blade.php:27 Resources/views/index.blade.php:28
msgid "No"
msgstr ""
#: Resources/views/index.blade.php:33
msgid ""
"Si sconsiglia l'aggiornamento senza il supporto dell'assistenza ufficiale"
msgstr ""
#: Resources/views/index.blade.php:35
msgid "Non ci sono strutture personalizzate"
msgstr ""
#: Resources/views/index.blade.php:41 Resources/views/update.blade.php:41
msgid "Attenzione!"
msgstr ""
#: Resources/views/index.blade.php:41
msgid ""
"Ci sono delle tabelle non previste nella versione standard del gestionale: "
"_LIST_"
msgstr ""
#: Resources/views/index.blade.php:53
msgid ""
"Devi modificare il seguenti parametri del file di configurazione PHP "
"(_FILE_) per poter caricare gli aggiornamenti"
msgstr ""
#: Resources/views/index.blade.php:135
msgid "Carica un aggiornamento"
msgstr ""
#: Resources/views/index.blade.php:147
msgid "Carica"
msgstr ""
#: Resources/views/index.blade.php:158
msgid "Verifica l'integrità dell'intallazione"
msgstr ""
#: Resources/views/index.blade.php:166
msgid "Controlla file"
msgstr ""
#: Resources/views/index.blade.php:170
msgid "Controlla database"
msgstr ""
#: Resources/views/index.blade.php:174
msgid "Controlla gestionale"
msgstr ""
#: Resources/views/index.blade.php:184
msgid "Ricerca aggiornamenti"
msgstr ""
#: Resources/views/index.blade.php:192
msgid "Ricerca"
msgstr ""
#: Resources/views/index.blade.php:197
msgid "Estensione curl non supportata"
msgstr ""
#: Resources/views/index.blade.php:202
msgid "E' stato individuato un nuovo aggiornamento"
msgstr ""
#: Resources/views/index.blade.php:203
msgid ""
"Attenzione: la versione individuata è in fase sperimentale, e pertanto può "
"presentare diversi bug e malfunzionamenti"
msgstr ""
#: Resources/views/index.blade.php:205
msgid "Scaricalo manualmente (_LINK_) oppure in automatico"
msgstr ""
#: Resources/views/index.blade.php:208
msgid "Scarica"
msgstr ""
#: Resources/views/index.blade.php:213
msgid "Nessun aggiornamento presente"
msgstr ""
#: Resources/views/index.blade.php:223
msgid "Requisiti"
msgstr ""
#: Resources/views/update.blade.php:3
msgid "Aggiornamento"
msgstr ""
#: Resources/views/update.blade.php:9
msgid "Informazioni sull'aggiornamento"
msgstr ""
#: Resources/views/update.blade.php:13
msgid "Changelog"
msgstr ""
#: Resources/views/update.blade.php:22
msgid ""
"Il pacchetto selezionato contiene un aggiornamento dell'intero gestionale"
msgstr ""
#: Resources/views/update.blade.php:23
msgid ""
"Si consiglia vivamente di effettuare un backup dell'installazione prima di "
"procedere"
msgstr ""
#: Resources/views/update.blade.php:26
msgid "Crea backup"
msgstr ""
#: Resources/views/update.blade.php:32
msgid "OpenSTAManager versione _VERSION_"
msgstr ""
#: Resources/views/update.blade.php:41
msgid ""
"Verranno aggiornate le sole componenti del pacchetto che non sono già "
"installate e aggiornate"
msgstr ""
#: Resources/views/update.blade.php:45
msgid "Il pacchetto selezionato comprende i seguenti moduli"
msgstr ""
#: Resources/views/update.blade.php:53 Resources/views/update.blade.php:72
msgid "Installato"
msgstr ""
#: Resources/views/update.blade.php:64
msgid "Il pacchetto selezionato comprende i seguenti plugin"
msgstr ""
#: Resources/views/update.blade.php:91
msgid "Nessuna changelog individuabile"
msgstr ""
#: Resources/views/update.blade.php:100
msgid "Annulla"
msgstr ""
#: Resources/views/update.blade.php:106
msgid "Procedi"
msgstr ""
#: Http/Controllers/AggiornamentiController.php:41
msgid "Estensione ZIP"
msgstr ""
#: Http/Controllers/AggiornamentiController.php:41
msgid "da abilitare"
msgstr ""
#: Http/Controllers/AggiornamentiController.php:191
msgid "Accesso negato"
msgstr ""
#: Http/Controllers/AggiornamentiController.php:197
msgid "Il pacchetto contiene una versione precedente del gestionale"
msgstr ""
#: Http/Controllers/AggiornamentiController.php:199
msgid "Il pacchetto contiene solo componenti già installate e aggiornate"
msgstr ""
#: Http/UpdateHook.php:53
msgid "E' disponibile la versione _VERSION_ del gestionale"
msgstr ""

View File

@@ -0,0 +1,4 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore

View File

@@ -0,0 +1,38 @@
@extends('modules.base')
@section('module_content')
<form action="" method="post" id="edit-form">
<input type="hidden" name="backto" value="record-edit">
<input type="hidden" name="op" value="update">
<div class="row">
<div class="col-md-6">
<div class="row">
<div class="col-md-12">
{[ "type": "text", "label": "{{ _i('Descrizione') }}", "name": "descrizione", "required": 1, "value": "$descrizione$" ]}
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="panel panel-primary">
<div class="panel-heading">
<h3 class="panel-title">{{ _i('Flags') }}</h3>
</div>
<div class="panel-body">
<div class="col-md-4">
{[ "type": "checkbox", "label": "{{ _i('Causale predefinita') }}", "name": "predefined", "value": "$predefined$", "help":"{{ _i('Impostare questa causale di trasporto come predefinita per i ddt') }}." ]}
</div>
<div class="col-md-4">
{[ "type": "checkbox", "label": "{{ _i('Importabile?') }}", "name": "is_importabile", "value": "$is_importabile$", "help": "{{ _i('I documenti associati a questa causale possono essere importati a livello contabile in altri documenti (per esempio, in Fatture)') }}", "placeholder": "{{ _i('Importabile') }}" ]}
</div>
<div class="col-md-4">
{[ "type": "checkbox", "label": "{{ _i('Abilita storno') }}", "name": "reversed", "value": "$reversed$", "help": "{{ _i('I documenti associati a questa causale possono essere stornati come nota di credito') }}", "placeholder": "{{ _i('Abilita storno') }}" ]}
</div>
</div>
</div>
</div>
</div>
</form>
@endsection

View File

@@ -0,0 +1,38 @@
@extends('modules.base')
@section('module_content')
<form action="" method="post" id="edit-form">
<input type="hidden" name="backto" value="record-edit">
<input type="hidden" name="op" value="update">
<div class="row">
<div class="col-md-6">
<div class="row">
<div class="col-md-12">
{[ "type": "text", "label": "{{ _i('Descrizione') }}", "name": "descrizione", "required": 1, "value": "$descrizione$" ]}
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="panel panel-primary">
<div class="panel-heading">
<h3 class="panel-title">{{ _i('Flags') }}</h3>
</div>
<div class="panel-body">
<div class="col-md-4">
{[ "type": "checkbox", "label": "{{ _i('Causale predefinita') }}", "name": "predefined", "value": "$predefined$", "help":"{{ _i('Impostare questa causale di trasporto come predefinita per i ddt') }}." ]}
</div>
<div class="col-md-4">
{[ "type": "checkbox", "label": "{{ _i('Importabile?') }}", "name": "is_importabile", "value": "$is_importabile$", "help": "{{ _i('I documenti associati a questa causale possono essere importati a livello contabile in altri documenti (per esempio, in Fatture)') }}", "placeholder": "{{ _i('Importabile') }}" ]}
</div>
<div class="col-md-4">
{[ "type": "checkbox", "label": "{{ _i('Abilita storno') }}", "name": "reversed", "value": "$reversed$", "help": "{{ _i('I documenti associati a questa causale possono essere stornati come nota di credito') }}", "placeholder": "{{ _i('Abilita storno') }}" ]}
</div>
</div>
</div>
</div>
</div>
</form>
@endsection

View File

@@ -0,0 +1,24 @@
<?php
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;
use DevCode\CausaliTrasporto\Controllers\CausaliTrasportoController;
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/
Route::prefix('causali-trasporto')
->group(function () {
Route::get('', [CausaliTrasportoController::class, 'index']);
Route::get('/{id}', [CausaliTrasportoController::class, 'dettagli'])
->whereNumber('hook_id');
});

View File

@@ -0,0 +1,44 @@
<?php
namespace DevCode\CausaliTrasporto\Controllers;
use App\Http\Controllers\RequirementsController;
use Illuminate\Contracts\Support\Renderable;
use Illuminate\Http\Request;
use Illuminate\Routing\Controller;
use InvalidArgumentException;
use DevCode\Aggiornamenti\Aggiornamento;
use DevCode\Aggiornamenti\DowngradeException;
class CausaliTrasportoController extends Controller
{
public $module;
public function __construct()
{
$this->module = module('Causali');
}
/**
* Display a listing of the resource.
* @return Renderable
*/
public function index()
{
return view('causali-trasporto::index', [
'module' => $this->module,
]);
}
/**
* Display a listing of the resource.
* @return Renderable
*/
public function dettagli()
{
$args = [
'module' => $this->module,
];
return view('causali-trasporto::dettagli', $args);
}
}

View File

@@ -0,0 +1,18 @@
<?php
namespace DevCode\CausaliTrasporto\Facades;
use Illuminate\Support\Facades\Facade;
class CausaliTrasporto extends Facade
{
/**
* Get the registered name of the component.
*
* @return string
*/
protected static function getFacadeAccessor(): string
{
return 'causali-trasporto';
}
}

View File

@@ -0,0 +1,10 @@
<?php
namespace DevCode\CausaliTrasporto;
class Modulo
{
}

View File

@@ -0,0 +1,77 @@
<?php
namespace DevCode\CausaliTrasporto;
use Illuminate\Support\ServiceProvider as BaseProvider;
class ServiceProvider extends BaseProvider
{
/**
* Perform post-registration booting of services.
*
* @return void
*/
public function boot(): void
{
//$this->loadTranslationsFrom(__DIR__.'/../resources/lang', 'causali-trasporto');
$this->loadViewsFrom(__DIR__.'/../resources/views', 'causali-trasporto');
$this->loadMigrationsFrom(__DIR__.'/../database/migrations');
$this->loadRoutesFrom(__DIR__.'/../routes.php');
// Publishing is only necessary when using the CLI.
if ($this->app->runningInConsole()) {
$this->bootForConsole();
}
}
/**
* Register any package services.
*
* @return void
*/
public function register(): void
{
$this->mergeConfigFrom(__DIR__.'/../config/causali-trasporto.php', 'causali-trasporto');
// Register the service the package provides.
$this->app->singleton('causali-trasporto', function ($app) {
return new CausaliTrasporto;
});
}
/**
* Get the services provided by the provider.
*
* @return array
*/
public function provides()
{
return ['causali-trasporto'];
}
/**
* Console-specific booting.
*
* @return void
*/
protected function bootForConsole(): void
{
// Publishing the configuration file.
$this->publishes([
__DIR__.'/../config/causali-trasporto.php' => config_path('causali-trasporto.php'),
], 'causali-trasporto');
// Publishing assets.
$this->publishes([
__DIR__.'/../resources/assets' => public_path('vendor/devcode-it'),
], 'causali-trasporto');
// Publishing the translation files.
$this->publishes([
__DIR__.'/../resources/lang' => resource_path('lang/vendor/devcode-it'),
], 'causali-trasporto');
// Registering package commands.
// $this->commands([]);
}
}