Compare commits

...

120 Commits

Author SHA1 Message Date
Marco Antonio Mauro 05ca922402
Merge 9a13f4c903 into 901c79edb2 2024-04-13 10:52:09 +02:00
Luca 901c79edb2 Update edit.php 2024-04-12 18:10:45 +02:00
Luca f144877ee1 Update edit.php 2024-04-12 18:05:07 +02:00
Luca 5e66283d09 Update edit.php 2024-04-12 18:04:10 +02:00
Luca d23788ca8b Se non è installato il modulo distinta base elimino il plugin 2024-04-12 18:03:03 +02:00
Pek5892 1e68240070 Aggiornamento CHANGELOG 2024-04-12 17:27:29 +02:00
Pek5892 e0f0fcdd27 Fix per php8.1 2024-04-12 17:12:05 +02:00
Pek5892 c65bbd3f39 Fix php8.1 2024-04-12 16:59:19 +02:00
Pek5892 9f0e319a03 Fix php8.1 2024-04-12 16:47:34 +02:00
Pek5892 8ffe852c19 Fix per php8.1 2024-04-12 16:25:04 +02:00
Pek5892 fc495377d6 Fix minori 2024-04-12 15:53:58 +02:00
Pek5892 c4e3c2f484 Fix riferimenti 2024-04-12 13:22:14 +02:00
Pek5892 c9f007db16 Fix per php8.1 2024-04-12 10:54:05 +02:00
Pek5892 9858c371c6 Fix minore 2024-04-12 10:22:56 +02:00
Pek5892 ec940b82f2 Fix stampa con php8.1 2024-04-12 10:17:30 +02:00
Pek5892 c8c5f59abf Formattazione codice 2024-04-12 09:53:02 +02:00
Pek5892 2ebb059b3e Fix stampa pdf per php8.1 2024-04-12 09:35:30 +02:00
Pek5892 f98ae71340 Fix per emissione fatture con php8.1 2024-04-12 09:12:45 +02:00
Pek5892 7b8018c68a Fix per php8.1 2024-04-11 17:55:49 +02:00
Pek5892 95f7840a44 Fix verifica numero ddt 2024-04-11 16:24:29 +02:00
Pek5892 8a018f8606 Fix minore 2024-04-11 16:16:35 +02:00
Pek5892 519c7219cd Fix minore 2024-04-11 14:53:46 +02:00
Pek5892 9b9744b134 Fix redirect per php8.1 2024-04-11 12:26:12 +02:00
Pek5892 072c2e615a Fix minori 2024-04-11 12:21:13 +02:00
Pek5892 95b0fc5b1a Fix contratti 2024-04-11 11:46:38 +02:00
Pek5892 6809ca0ce3 Fix per php8.1 2024-04-11 11:17:03 +02:00
Pek5892 97a3c0ef47 Fix per php8.1 2024-04-11 11:16:47 +02:00
Pek5892 b4d2fec82b Fix minore 2024-04-10 17:43:54 +02:00
Matteo edda7c38e2 Fix per api cleanup checklist 2024-04-10 17:15:20 +02:00
Pek5892 c1f86dace3 Fix #1463 2024-04-10 16:12:02 +02:00
Pek5892 b975cbc24e Fix caricamento promemoria da pianificare in dashboard 2024-04-10 14:53:26 +02:00
Pek5892 6172a7c89b Fix aggiunta attività con php8.1 2024-04-10 12:43:32 +02:00
Pek5892 ce8ac0f846 Fix redirect 2024-04-10 10:32:23 +02:00
Pek5892 eb15f24ac9 Fix per php8.1 2024-04-10 10:28:30 +02:00
Pek5892 c20ba3eeee Fix backup 2024-04-10 10:09:24 +02:00
Pek5892 f373036f15 Ottimizzazione 2024-04-10 09:49:42 +02:00
Pek5892 025dc5dcd3 Fix reindirizzamento 2024-04-09 17:08:35 +02:00
Pek5892 2700b0c0f8 Miglioria aggiornamento 2.5 2024-04-09 14:56:20 +02:00
Pek5892 4da98e49d0 Fix minore 2024-04-09 14:53:15 +02:00
Pek5892 5ac04f4a01 Aggiornamento versione mysql 2024-04-09 14:45:37 +02:00
Pek5892 982f029f43 Fix minore 2024-04-09 14:26:58 +02:00
Pek5892 bc43765546 Fix controllo database 2024-04-09 14:21:57 +02:00
Pek5892 fedf455b1f Aggiornamento dipendenza php-cs-fixer 2024-04-09 12:18:08 +02:00
Pek5892 6c6fb4fd24 Fix minori 2024-04-09 11:53:02 +02:00
Pek5892 6bf644e45d Aggiunta chiavi esterne con zz_langs 2024-04-09 11:11:26 +02:00
Pek5892 e4b2fceda2 Fix per php8.1 2024-04-09 10:55:08 +02:00
Pek5892 3419d5fcaa Fix minore 2024-04-09 09:10:45 +02:00
Luca 1bb6311339 Rinomino plugin Sedi in Anagrafica 2024-04-08 18:33:05 +02:00
Pek5892 6873ec686a Fix minore 2024-04-08 16:29:13 +02:00
Pek5892 477a56e953 Ottimizzazione file con php8.1 2024-04-08 15:57:28 +02:00
Pek5892 de4759fd5b Fix minore 2024-04-08 15:49:53 +02:00
Pek5892 6369cb466e Ottimizzazione file con php8.1 2024-04-08 15:44:33 +02:00
Pek5892 00baaa0788 Fix upload template 2024-04-05 16:07:27 +02:00
Pek5892 cd80a18bca Fix upload plugins 2024-04-05 15:46:33 +02:00
Pek5892 783fd1a9c6 Fix upload moduli 2024-04-05 14:32:29 +02:00
Pek5892 60282b2007 Fix upload allegati 2024-04-05 09:47:28 +02:00
Pek5892 2d03b1b173 Fix #1457 2024-04-05 09:01:55 +02:00
Pek5892 62137f0da7 Fix stampe contabili 2024-04-04 17:29:26 +02:00
Luca e4a7fa2cf0 Sposto impostazione sotto sezione Aggiornamenti 2024-04-04 16:00:01 +02:00
Pek5892 df3ce50315 Fix vari 2024-04-04 11:47:36 +02:00
Pek5892 76fde27116 Fix selezione anagrafiche clienti-fornitori 2024-04-03 17:32:56 +02:00
Pek5892 1eb711d873 Fix vari 2024-04-03 17:28:18 +02:00
MatteoPistorello 247ad030ca Merge branch 'master' of https://github.com/devcode-it/openstamanager 2024-04-03 17:21:35 +02:00
MatteoPistorello 9f57920975 Visualizzazione checklist impianti in stampa Attività 2024-04-03 17:21:32 +02:00
Pek5892 9b4cccf2fe Fix minore 2024-04-03 16:21:14 +02:00
Matteo 982829ca88 Fix azione di gruppo allegati download file zip 2024-04-03 16:18:09 +02:00
Pek5892 d7822c33bf Fix minori 2024-04-02 17:33:12 +02:00
Pek5892 728c30d5a2 Fix minore 2024-04-02 16:53:36 +02:00
Pek5892 d853766ff7 Fix 2024-04-02 16:28:55 +02:00
Pek5892 37517ce0b9 Fix vari 2024-04-02 16:12:14 +02:00
Pek5892 4a7db72004 Aggiunta classe PagamentoLang 2024-04-02 15:07:03 +02:00
Pek5892 2f56ddcfb2 Fix add scadenze in scadenzario 2024-04-02 14:38:02 +02:00
Pek5892 8c02c99132 Fix vista scadenzario e plugin 2024-04-02 14:37:43 +02:00
Pek5892 6d0f6ba3ac Fix vari query 2024-04-02 12:32:38 +02:00
FabioL 7b9811bd69 Fix visualizzazione info dispositivo 2024-04-02 11:11:59 +02:00
Pek5892 450633b863 Miglioria procedura di aggiornamento 2024-04-02 10:26:49 +02:00
loviuz 317884b8ea Aggiunta user-agent nei log di accesso 2024-04-01 23:09:37 +02:00
loviuz 3d85b76a93 Ripristinata la verifica query della vista 2024-03-31 01:35:10 +01:00
loviuz b72dce21dc Fix classe per salvataggio vista 2024-03-31 01:17:33 +01:00
loviuz 62d372df0a Fix salvataggio nome vista e migliorie minori 2024-03-31 01:06:03 +01:00
loviuz 22edea5520 Riordino css e miglioria sfondo login 2024-03-31 00:37:00 +01:00
Luca 0ace49cec3 Update tables.php 2024-03-29 10:56:48 +01:00
Pek5892 ab2f83fbf0 Aggiornamento CHANGELOG 2024-03-28 16:55:49 +01:00
Pek5892 cd1cb11198 Fix lingua inglese 2024-03-28 16:38:03 +01:00
Pek5892 41f75cf19f Fix per fatture di vendita lingua inglese 2024-03-28 13:03:21 +01:00
Pek5892 847177a0ec Fix modulo ddt lingua inglese 2024-03-28 12:10:13 +01:00
Pek5892 a6faefaa99 Fix per lingua inglese 2024-03-28 11:39:26 +01:00
Pek5892 0459dd2e4a Fix configurazione per lingua inglese 2024-03-28 10:42:22 +01:00
Pek5892 1535abf4a6 Fix vista Segmenti inglese 2024-03-28 10:27:13 +01:00
Pek5892 e506e4b18a Fix getTipo() anagrafica in inglese 2024-03-28 09:50:31 +01:00
Pek5892 ed056e060d Fix viste tradotte in inglese 2024-03-28 09:50:12 +01:00
Pek5892 9ff3022deb Ottmizzazione con funzione getPredefined() 2024-03-28 09:26:26 +01:00
Pek5892 71cacecf75 Fix per aggiunta anagrafica da aggiunta attività da dashboard in inglese 2024-03-28 09:16:13 +01:00
loviuz 126949a16c Fix traduzione 2024-03-28 00:55:13 +01:00
loviuz 6f4ca17fb7 Aggiornamenti minori delle traduzioni 2024-03-28 00:19:31 +01:00
loviuz 0f9c5e71dd Aggiornamento parziale traduzioni inglese 2024-03-27 23:50:59 +01:00
Luca 365bdf5551 Update 2_5.php 2024-03-27 19:40:57 +01:00
Luca 22cec86092 Fix minori 2024-03-27 19:14:26 +01:00
Pek5892 8072aaf537 Formattazione codice 2024-03-27 16:59:46 +01:00
Pek5892 72f569659a Miglioria 2024-03-27 16:43:30 +01:00
Pek5892 9fda45c411 Allineamento 2024-03-27 16:30:53 +01:00
Pek5892 da0999dd84 Aggiornamento traduzioni 2024-03-27 16:01:22 +01:00
Pek5892 cd12fb6e4d Fix minore 2024-03-27 15:38:39 +01:00
Pek5892 4e2f399a59 Merge branch 'master' of https://github.com/devcode-it/openstamanager 2024-03-27 15:34:03 +01:00
Pek5892 f3126950c4 Ottimizzazione lingue 2024-03-27 15:34:01 +01:00
Beppe caa2b4bd44 Esclusioni default in preventivi 2024-03-27 15:18:09 +01:00
Pek5892 d4866e4ce4 Fix import preventivi 2024-03-27 11:47:35 +01:00
Pek5892 529cf6f5c5 Fix import impianti 2024-03-27 11:38:10 +01:00
Pek5892 88ba7311b3 Aggiunta tabella my_impianti_categorie_lang 2024-03-27 11:07:15 +01:00
Pek5892 c3338c78a9 Fix importazione articoli 2024-03-27 10:37:57 +01:00
Pek5892 a864b251b2 Fix upload csv 2024-03-27 10:17:27 +01:00
Pek5892 dfedb4b512 Fix upload allegati 2024-03-27 10:03:36 +01:00
FabioL 700b67a3d2 Fix larghezza automatica colonne datatables 2024-03-26 19:25:27 +01:00
Pek5892 e1c7781c8b Fix download fe 2024-03-26 18:43:55 +01:00
Pek5892 5ecaf54c12 Fix varie 2024-03-26 18:05:18 +01:00
Pek5892 1b8c632d69 Fix spostamento tra sedi 2024-03-26 17:22:40 +01:00
Luca 9fce000535 Update 2_5.sql 2024-03-26 16:42:34 +01:00
Pek5892 e71ede0641 Fix newsletter 2024-03-26 16:06:18 +01:00
Pek5892 d451464911 Fix per traduzione in oggetti vuoti 2024-03-26 15:43:52 +01:00
Marco Antonio Mauro 9a13f4c903
Fix issue #1450 2024-03-22 15:04:56 +01:00
440 changed files with 17671 additions and 9586 deletions

View File

@ -4,7 +4,8 @@ Tutti i maggiori cambiamenti di questo progetto saranno documentati in questo fi
Il formato utilizzato è basato sulle linee guida di [Keep a Changelog](http://keepachangelog.com/), e il progetto segue il [Semantic Versioning](http://semver.org/) per definire le versioni delle release.
- [2.5 (2024-03-22)](#25-2024-03-22)
- [2.5.1 (2024-04-12)](#251-2024-04-12)
- [2.5 (2024-03-28)](#25-2024-03-28)
- [2.4.54 (2024-02-02)](#2454-2024-02-02)
- [2.4.53 (2024-01-05)](#2453-2024-01-05)
- [2.4.52 (2023-12-08)](#2452-2023-12-08)
@ -66,7 +67,30 @@ Il formato utilizzato è basato sulle linee guida di [Keep a Changelog](http://k
- [2.2 (2016-11-10)](#22-2016-11-10)
- [2.1 (2015-04-02)](#21-2015-04-02)
## 2.5 (2024-03-22)
## 2.5.1 (2024-04-12)
### Aggiunto (Added)
- Aggiunto user-agent nei log di accesso
- Aggiunta la visualizzazione delle checklist impianti in stampa Attività
### Modificato (Changed)
- Ottimizzato il codice per renderlo compatibile con php8.1
- Migliorata la procedura di aggiornamento
- Rinominato il plugin **Sedi** in **Sedi aggiuntive**
### Fixed
- Corretto il salvataggio nome in **Viste**
- Ripristinata la verifica query in **Viste**
- Corretta la gestione degli allegati
- Corretta l'azione di gruppo per il download degli allegati
- Corretta la selezione anagrafiche clienti-fornitori
- Corrette le stampe contabili
- Corretti gli upload di moduli, plugins e template
- Corretta l'aggiunta attività
- Corretta la gestione degli automezzi per tecnico
- Corretto il caricamento dei promemoria da pianificare in dashboard
- Corretta l'emissione di fatture
## 2.5 (2024-03-28)
### Aggiunto (Added)
- Aggiunte le tabelle '_lang' per la gestione delle traduzioni dei dati presenti a database
- Aggiunta log rimozione sessioni per velocizzare la sincronizzazione dell'app
@ -134,6 +158,8 @@ Il formato utilizzato è basato sulle linee guida di [Keep a Changelog](http://k
- Corretta la ricerca articoli escludendo gli articoli eliminati
- Corretta la visualizzazione della password in impostazione
- Corretto l'ordinamento dei promemoria in **Dashboard**
- Corretta la versione di pdfjs viewer
- Corretta la larghezza automatica delle colonne nelle tabelle
## 2.4.54 (2024-02-02)
### Aggiunto (Added)

View File

@ -63,7 +63,7 @@ L'installazione del gestionale richiede la presenza di un server web con abilita
| PHP | EOL | Supportato |
|-----|-----|:----------:|
| 8.1 | 25/11/2024 | |
| 8.1 | 25/11/2024 | ✔️ |
| 8.0 | 26/11/2023 | ✔️ |
| 7.4 | 28/11/2022 | ✔️ |
| 7.3 | 06/12/2021 | ✔️ |
@ -74,7 +74,10 @@ L'installazione del gestionale richiede la presenza di un server web con abilita
| MYSQL | EOL | Supportato |
|-----|-----|:----------:|
| 8.0 | 01/04/2026 | ✔️ |
| 8.3 | 30/04/2024 | ✔️ |
| 8.2 | 31/01/2024 | ✔️ |
| 8.1 | 25/10/2023 | ✔️ |
| 8.0 | 30/04/2026 | ✔️ |
| 5.7 | 21/10/2023 | ✔️ |
| 5.6 | 05/02/2021 | ❌ |

View File

@ -67,7 +67,7 @@ if (filter('op') == 'aggiungi-allegato' || filter('op') == 'rimuovi-allegato') {
$upload = Uploads::upload($_FILES['upload'], [
'name' => filter('nome_allegato'),
'category' => filter('categoria'),
'id_module' => (new Module())->getByField('name', 'Gestione documentale'),
'id_module' => (new Module())->getByField('name', 'Gestione documentale', Models\Locale::getPredefined()->id),
'id_record' => $id_record,
]);
@ -197,10 +197,10 @@ elseif (filter('op') == 'download-zip-allegati') {
$src = basename($allegato->filepath);
$dst = basename($allegato->original_name);
$file = slashes($module->upload_directory.'/'.$src);
$dest = slashes($dir.'tmp/'.$dst);
$file_content = $allegato->get_contents();
$result = copy($file, $dest);
$dest = slashes($dir.'tmp/'.$dst);
file_put_contents($dest, $file_content);
}
// Creazione zip

View File

@ -78,7 +78,7 @@ switch (filter('op')) {
case 'active_users':
$posizione = get('id_module');
if (isset($id_record)) {
if (!empty($id_record)) {
$posizione .= ', '.get('id_record');
}

View File

@ -573,77 +573,6 @@ input.small-width {
height: auto;
}
@media (max-width: 480px) {
#main_loading>div>i {
font-size: 160px;
margin-top: -80px;
}
}
@media screen and (max-width: 767px) {
.navbar-left {
display: inline-block;
}
.navbar-left ul>li:last-child {
display: none;
}
.box-center,
.box-center-large {
width: 90%;
margin-top: 20px
}
.main-header .logo {
display: none;
}
/*
.content-wrapper,
.right-side,
.left-side,
.main-sidebar {
padding-top: 50px;
}*/
}
@media screen and (min-width: 768px) and (max-width: 1024px) {
.signature-pad {
margin: 10%;
}
}
@media screen and (max-width: 992px) {
.table-bordered>thead>tr>th,
.table-bordered>tbody>tr>th,
.table-bordered>tfoot>tr>th,
.table-bordered>thead>tr>td,
.table-bordered>tbody>tr>td,
.table-bordered>tfoot>tr>td {
word-break: break-all;
}
}
@media screen and (max-width: 1024px) {
.push {
position: static;
}
.signature-pad {
top: 0;
left: 0;
right: 0;
bottom: 0;
width: auto;
height: auto;
min-width: 250px;
min-height: 140px;
margin: 5%;
}
}
.callout a {
text-decoration: none;
}
@ -722,13 +651,6 @@ input.small-width {
flex: 1
}
@media (min-width: 1140px) {
.modal-lg {
width: 60vw;
}
}
/* Interventi da pianificare in Dashboard */
#external-events .fc-event {
@ -1090,26 +1012,6 @@ div.tip {
color: #888;
}
@media screen and (min-width: 1140px) {
.with-control-sidebar {
margin-right: 230px;
}
.control-sidebar-open {
right: 0;
display: block !important;
}
.control-sidebar.control-sidebar-open,
.control-sidebar.control-sidebar-open+.control-sidebar-bg {
right: 0;
}
.control-sidebar-toggle {
/*display: none !important;*/
}
}
/* Fix stile */
.skin-default .nav.navbar-nav li a {
color: #FFFFFF;
@ -1171,27 +1073,6 @@ div.tip {
margin-bottom: 0px;
}
/*
* Component: Sidebar Mini
*/
@media (min-width: 768px) {
.sidebar-mini:not(.sidebar-mini-expand-feature).sidebar-collapse .sidebar-menu>li:hover>a>span:not(.pull-right),
.sidebar-mini:not(.sidebar-mini-expand-feature).sidebar-collapse .sidebar-menu>li:hover>.treeview-menu {
width: 220px;
}
.sidebar-mini:not(.sidebar-mini-expand-feature).sidebar-collapse .sidebar-menu>li:hover>a>.pull-right-container {
left: 220px !important;
}
html body.sidebar-mini.sidebar-mini.sidebar-collapse i.fa.fa-user-circle-o.fa-3x.pull-left {
font-size: 2.4em;
}
}
/*
* Colore help icon
*/
@ -1274,4 +1155,127 @@ kbd{
.login-box .form-control-feedback{
pointer-events: all;
}
}
.login-page{
background: #ccc;
background: radial-gradient(circle, rgba(255,255,255,1) 0%, rgba(229,229,229,1) 34%, rgba(204,204,204,1) 100%);
}
@media (max-width: 480px) {
#main_loading>div>i {
font-size: 160px;
margin-top: -80px;
}
}
@media screen and (max-width: 767px) {
.navbar-left {
display: inline-block;
}
.navbar-left ul>li:last-child {
display: none;
}
.box-center,
.box-center-large {
width: 90%;
margin-top: 20px
}
.main-header .logo {
display: none;
}
}
@media screen and (min-width: 768px) and (max-width: 1024px) {
.signature-pad {
margin: 10%;
}
}
@media screen and (max-width: 992px) {
.table-bordered>thead>tr>th,
.table-bordered>tbody>tr>th,
.table-bordered>tfoot>tr>th,
.table-bordered>thead>tr>td,
.table-bordered>tbody>tr>td,
.table-bordered>tfoot>tr>td {
word-break: break-all;
}
}
@media screen and (max-width: 1024px) {
.push {
position: static;
}
.signature-pad {
top: 0;
left: 0;
right: 0;
bottom: 0;
width: auto;
height: auto;
min-width: 250px;
min-height: 140px;
margin: 5%;
}
.login-page{
background: #ddd;
}
}
@media (min-width: 1140px) {
.modal-lg {
width: 60vw;
}
}
@media screen and (min-width: 1140px) {
.with-control-sidebar {
margin-right: 230px;
}
.control-sidebar-open {
right: 0;
display: block !important;
}
.control-sidebar.control-sidebar-open,
.control-sidebar.control-sidebar-open+.control-sidebar-bg {
right: 0;
}
.control-sidebar-toggle {
/*display: none !important;*/
}
}
/*
* Component: Sidebar Mini
*/
@media (min-width: 768px) {
.sidebar-mini:not(.sidebar-mini-expand-feature).sidebar-collapse .sidebar-menu>li:hover>a>span:not(.pull-right),
.sidebar-mini:not(.sidebar-mini-expand-feature).sidebar-collapse .sidebar-menu>li:hover>.treeview-menu {
width: 220px;
}
.sidebar-mini:not(.sidebar-mini-expand-feature).sidebar-collapse .sidebar-menu>li:hover>a>.pull-right-container {
left: 220px !important;
}
html body.sidebar-mini.sidebar-mini.sidebar-collapse i.fa.fa-user-circle-o.fa-3x.pull-left {
font-size: 2.4em;
}
}

View File

@ -410,6 +410,11 @@ function drawCallback(settings) {
}).select();
}
});
// Fix larghezza colonne datatables
setTimeout( function(){
datatable.columns.adjust()
}, 100);
}
function footerCallback(row, data, start, end, display) {

View File

@ -15,7 +15,7 @@
}],
"type": "project",
"require": {
"php": "^7.4|^8.0",
"php": "^7.4|^8.1",
"ext-curl": "*",
"ext-dom": "*",
"ext-fileinfo": "*",
@ -52,7 +52,7 @@
"owasp/csrf-protector-php": "^1.0",
"phpmailer/phpmailer": "^6.0",
"respect/validation": "^2.0",
"servo/fluidxml": "^1.21",
"servo/fluidxml": "^2.0",
"slim/flash": "^0.4.0",
"spipu/html2pdf": "^5.0.0",
"symfony/filesystem": "^5.0",
@ -67,7 +67,8 @@
"willdurand/geocoder": "^4.2"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.10.0"
"friendsofphp/php-cs-fixer": "^3.53",
"rector/rector": "^1.0"
},
"autoload": {
"psr-4": {
@ -147,7 +148,7 @@
"prefer-stable": true,
"platform-check": false,
"platform": {
"php": "8.0.29"
"php": "8.1.27"
},
"allow-plugins": {
"kylekatarnls/update-helper": true

View File

@ -17,6 +17,8 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
use Models\Plugin;
include_once __DIR__.'/core.php';
if (!empty($id_record) && !empty($id_module)) {
@ -51,13 +53,13 @@ echo '
</a>
</li>';
$plugins = $dbo->fetchArray('SELECT `zz_plugins`.`id`,`title` FROM `zz_plugins` LEFT JOIN `zz_plugins_lang` ON (`zz_plugins`.`id` = `zz_plugins_lang`.`id_record` AND `zz_plugins_lang`.`id_lang` = '.prepare(Models\Locale::getDefault()->id).') WHERE `idmodule_to`='.prepare($id_module)." AND `position`='tab_main' AND `enabled` = 1");
$plugins = Plugin::where('idmodule_to', $id_module)->where('position', 'tab_main')->where('enabled', 1)->get();
// Tab dei plugin
foreach ($plugins as $plugin) {
echo '
<li>
<a data-toggle="tab" href="#tab_'.$plugin['id'].'" id="link-tab_'.$plugin['id'].'">'.$plugin['title'].'</a>
<a data-toggle="tab" href="#tab_'.$plugin->id.'" id="link-tab_'.$plugin->id.'">'.$plugin->title.'</a>
</li>';
}
@ -77,9 +79,9 @@ foreach ($plugins as $plugin) {
$record = $module_record;
echo '
<div id="tab_'.$plugin['id'].'" class="tab-pane">';
<div id="tab_'.$plugin->id.'" class="tab-pane">';
$id_plugin = $plugin['id'];
$id_plugin = $plugin->id;
include base_dir().'/include/manager.php';
@ -93,7 +95,7 @@ echo '
</div>
</div>';
redirectOperation($id_module, isset($id_parent) ? $id_parent : $id_record);
redirectOperation($id_module, !empty($id_parent) ? $id_parent : $id_record);
// Interfaccia per la modifica dell'ordine e della visibilità delle colonne (Amministratore)
if ($user->is_admin && string_contains($module['option'], '|select|')) {

View File

@ -164,7 +164,6 @@ $formatter = !empty($config['formatter']) ? $config['formatter'] : [];
$translator = trans();
$translator->addLocalePath(base_dir().'/locale');
$translator->addLocalePath(base_dir().'/modules/*/locale');
$translator->setLocale($lang, $formatter);
// Individuazione di versione e revisione del progetto
$version = Update::getVersion();
@ -249,8 +248,8 @@ if (!API\Response::isAPIRequest()) {
$plugin = Plugins::getCurrent();
$structure = isset($plugin) ? $plugin : $module;
$id_module = $module ? $module['id'] : null;
$id_plugin = $plugin ? $plugin['id'] : null;
$id_module = $module ? $module->id : null;
$id_plugin = $plugin ? $plugin->id : null;
$user = Auth::user();
@ -308,6 +307,8 @@ foreach ($list as $file) {
if (database()->tableExists('zz_settings') && database()->tableExists('zz_langs')) {
$id_lang = setting('Lingua');
Models\Locale::setDefault($id_lang);
Models\Locale::setPredefined();
$lang = Models\Locale::find($id_lang)->language_code;
$translator->setLocale($lang, $formatter);
}

View File

@ -61,13 +61,13 @@ $handler->setFormatter($formatter);
$logger->pushHandler($handler);
// Lettura della cache
$ultima_esecuzione = Cache::find((new Cache())->getByField('name', 'Ultima esecuzione del cron'));
$ultima_esecuzione = Cache::find((new Cache())->getByField('name', 'Ultima esecuzione del cron', Models\Locale::getPredefined()->id));
$data = $ultima_esecuzione->content;
$in_esecuzione = Cache::find((new Cache())->getByField('name', 'Cron in esecuzione'));
$cron_id = Cache::find((new Cache())->getByField('name', 'ID del cron'));
$in_esecuzione = Cache::find((new Cache())->getByField('name', 'Cron in esecuzione', Models\Locale::getPredefined()->id));
$cron_id = Cache::find((new Cache())->getByField('name', 'ID del cron', Models\Locale::getPredefined()->id));
$disattiva = Cache::find((new Cache())->getByField('name', 'Disabilita cron'));
$disattiva = Cache::find((new Cache())->getByField('name', 'Disabilita cron', Models\Locale::getPredefined()->id));
if ($disattiva->content || (in_array($_SERVER['HTTP_HOST'], ['localhost', '127.0.0.1']) && !$forza_cron_localhost)) {
return;
}

View File

@ -173,7 +173,7 @@ if (empty($record) || !$has_access) {
{( "name": "button", "type": "email", "id_module": "'.$id_module.'", "id_plugin": "'.$id_plugin.'", "id_record": "'.$id_record.'" )}';
if (Module::find((new Module())->getByField('name', 'Account SMS'))) {
if (Module::find((new Module())->getByField('name', 'Account SMS', Models\Locale::getPredefined()->id))) {
echo '
{( "name": "button", "type": "sms", "id_module": "'.$id_module.'", "id_plugin": "'.$id_plugin.'", "id_record": "'.$id_record.'" )}';
}
@ -438,7 +438,7 @@ if (empty($record) || !$has_access) {
</div>';
}
redirectOperation($id_module, isset($id_parent) ? $id_parent : $id_record);
redirectOperation($id_module, !empty($id_parent) ? $id_parent : $id_record);
// Widget in basso
echo '{( "name": "widgets", "id_module": "'.$id_module.'", "id_record": "'.$id_record.'", "position": "right", "place": "editor" )}';

View File

@ -122,7 +122,8 @@ const JS = gulp.parallel(() => {
'bootstrap-maxlength/dist/bootstrap-maxlength.js',
'leaflet/dist/leaflet.js',
'leaflet-gesture-handling/dist/leaflet-gesture-handling.min.js',
'ismobilejs/dist/isMobile.min.js'
'ismobilejs/dist/isMobile.min.js',
'ua-parser-js/dist/ua-parser.min.js',
];
for (const i in vendor) {

View File

@ -17,7 +17,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
$result['idarticolo'] = isset($result['idarticolo']) ? $result['idarticolo'] : null;
$result['idarticolo'] ??= null;
$qta_minima = 0;
$id_listino = $dbo->selectOne('an_anagrafiche', 'id_listino', ['idanagrafica' => $options['idanagrafica']])['id_listino'];
@ -30,7 +30,7 @@ $articolo = $database->fetchOne('SELECT
IFNULL(`mg_fornitore_articolo`.`descrizione`, `mg_articoli_lang`.`name`) AS descrizione,
IFNULL(`mg_fornitore_articolo`.`qta_minima`, 0) AS qta_minima
FROM `mg_articoli`
LEFT JOIN `mg_articoli_lang` ON (`mg_articoli_lang`.`id_record` = `mg_articoli`.`id` AND `mg_articoli_lang`.`id_lang` = "'.prepare(Models\Locale::getDefault()->id).')
LEFT JOIN `mg_articoli_lang` ON (`mg_articoli_lang`.`id_record` = `mg_articoli`.`id` AND `mg_articoli_lang`.`id_lang` = '.prepare(Models\Locale::getDefault()->id).')
LEFT JOIN `mg_fornitore_articolo` ON `mg_fornitore_articolo`.`id_articolo` = `mg_articoli`.`id` AND `mg_fornitore_articolo`.`id` = '.prepare($result['id_dettaglio_fornitore']).'
WHERE
`mg_articoli`.`id` = '.prepare($result['idarticolo']));

View File

@ -36,7 +36,7 @@ if ($module->getTranslation('name') == 'Preventivi' && $options['op'] == 'manage
echo '
<div class="row">
<div class="col-md-6">
{[ "type": "checkbox", "label": "'.tr('Utilizza come titolo del gruppo').'", "name": "is_titolo", "value": '.json_encode($result['is_titolo']).', "help": "'.tr('').'" ]}
{[ "type": "checkbox", "label": "'.tr('Utilizza come titolo del gruppo').'", "name": "is_titolo", "value": '.json_encode($result['is_titolo']).', "help": "'.tr(' ').'" ]}
</div>
</div>';
}

View File

@ -17,8 +17,6 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
$result['id'] = isset($result['id']) ? $result['id'] : null;
// Form di inserimento riga documento
echo '
<form action="'.base_path().'/editor.php?id_module='.$id_module.'&id_record='.$id_record.'" method="post" id="submit-form">

View File

@ -21,6 +21,7 @@ use Models\Module;
use Modules\Contratti\Stato as StatoContratto;
use Modules\DDT\Stato;
use Modules\Fatture\Stato as StatoFattura;
use Modules\Fatture\Tipo as Tipofattura;
use Modules\Ordini\Stato as StatoOrdine;
use Plugins\ListinoFornitori\DettaglioFornitore;
@ -33,22 +34,25 @@ if (empty($documento)) {
// Informazioni utili
$dir = $documento->direzione;
$original_module = Module::find((new Module())->getByField('name', $documento->module));
$original_module = Module::find((new Module())->getByField('name', $documento->module, Models\Locale::getPredefined()->id));
$name = !empty($documento_finale) ? $documento_finale->module : $options['module'];
$final_module = Module::find((new Module())->getByField('name', $name));
$final_module = Module::find((new Module())->getByField('name', $name, Models\Locale::getPredefined()->id));
$id_segment = $_SESSION['module_'.$final_module->id]['id_segment'];
// IVA predefinita
$id_iva = $id_iva ?: setting('Iva predefinita');
$righe_totali = $documento->getRighe();
if ($final_module->getTranslation('name') == 'Interventi') {
$id_module_interventi = (new Module())->getByField('name', 'Interventi', Models\Locale::getPredefined()->id);
$id_module_ordini_f = (new Module())->getByField('name', 'Ordini fornitore', Models\Locale::getPredefined()->id);
if ($final_module->id == $id_module_interventi) {
$righe = $righe_totali->where('is_descrizione', '=', 0)
->where('qta_rimanente', '>', 0);
$righe_evase = $righe_totali->where('is_descrizione', '=', 0)
->where('qta_rimanente', '=', 0);
} elseif ($final_module->getTranslation('name') == 'Ordini fornitore') {
} elseif ($final_module->id == $id_module_ordini_f) {
$righe = $righe_totali;
$righe_evase = collect();
} else {
@ -92,20 +96,28 @@ if (!empty($options['create_document'])) {
</div>';
// Opzioni aggiuntive per le Fatture
if (in_array($final_module->getTranslation('name'), ['Fatture di vendita', 'Fatture di acquisto'])) {
$stato_predefinito = (new StatoFattura())->getByField('name', 'Bozza');
$id_module_fatt_vendita = (new Module())->getByField('name', 'Fatture di vendita', Models\Locale::getPredefined()->id);
$id_module_fatt_acquisto = (new Module())->getByField('name', 'Fatture di acquisto', Models\Locale::getPredefined()->id);
$id_module_ddt_vendita = (new Module())->getByField('name', 'Ddt di vendita', Models\Locale::getPredefined()->id);
$id_module_ddt_acquisto = (new Module())->getByField('name', 'Ddt di acquisto', Models\Locale::getPredefined()->id);
if (in_array($final_module->id, [$id_module_fatt_vendita, $id_module_fatt_acquisto])) {
$stato_predefinito = (new StatoFattura())->getByField('name', 'Bozza', Models\Locale::getPredefined()->id);
$fatt_differita_acquisto = (new Tipofattura())->getByField('name', 'Fattura differita di acquisto', Models\Locale::getPredefined()->id);
$fatt_differita_vendita = (new Tipofattura())->getByField('name', 'Fattura differita di vendita', Models\Locale::getPredefined()->id);
if (!empty($options['reversed'])) {
$idtipodocumento = database()->fetchOne('SELECT `co_tipidocumento`.`id` FROM `co_tipidocumento` LEFT JOIN `co_tipidocumento_lang` ON (`co_tipidocumento_lang`.`id_record` = `co_tipidocumento`.`id` AND `co_tipidocumento_lang`.`id_lang` = '.prepare(Models\Locale::getDefault()->id).') WHERE `name` = "Nota di credito" AND `dir` = \''.$dir.'\'')['id'];
} elseif (in_array($original_module->getTranslation('name'), ['Ddt di vendita', 'Ddt di acquisto'])) {
$idtipodocumento = database()->fetchOne('SELECT `co_tipidocumento`.`id` FROM `co_tipidocumento` LEFT JOIN `co_tipidocumento_lang` ON (`co_tipidocumento_lang`.`id_record` = `co_tipidocumento`.`id` AND `co_tipidocumento_lang`.`id_lang` = '.prepare(Models\Locale::getDefault()->id).') WHERE `name` = '.($dir == 'uscita' ? 'Fattura differita di acquisto' : 'Fattura differita di vendita').' AND `dir` = \''.$dir.'\'')['id'];
} elseif (in_array($original_module->id, [$id_module_ddt_vendita, $id_module_ddt_acquisto])) {
$idtipodocumento = database()->fetchOne('SELECT `co_tipidocumento`.`id` FROM `co_tipidocumento` LEFT JOIN `co_tipidocumento_lang` ON (`co_tipidocumento_lang`.`id_record` = `co_tipidocumento`.`id` AND `co_tipidocumento_lang`.`id_lang` = '.prepare(Models\Locale::getDefault()->id).') WHERE `co_tipidocumento`.`id` = '.($dir == 'uscita' ? $fatt_differita_acquisto : $fatt_differita_vendita).' AND `dir` = \''.$dir.'\'')['id'];
} else {
$idtipodocumento = database()->fetchOne('SELECT `co_tipidocumento`.`id` FROM `co_tipidocumento` LEFT JOIN `co_tipidocumento_lang` ON (`co_tipidocumento_lang`.`id_record` = `co_tipidocumento`.`id` AND `co_tipidocumento_lang`.`id_lang` = '.prepare(Models\Locale::getDefault()->id).') WHERE `dir` = \''.$dir.'\' AND `predefined` = 1')['id'];
}
$id_bozza = (new StatoFattura())->getByField('name', 'Bozza', Models\Locale::getPredefined()->id);
$id_emessa = (new StatoFattura())->getByField('name', 'Emessa', Models\Locale::getPredefined()->id);
echo '
<div class="col-md-6">
{[ "type": "select", "label": "'.tr('Stato').'", "name": "id_stato", "required": 1, "values": "query=SELECT `co_statidocumento`.`id` as id, `co_statidocumento_lang`.`name` as descrizione FROM `co_statidocumento` LEFT JOIN `co_statidocumento_lang` ON (`co_statidocumento`.`id` = `co_statidocumento_lang`.`id_record` AND `co_statidocumento_lang`.`id_lang` = '.prepare(Models\Locale::getDefault()->id).') WHERE `name` IN (\'Emessa\', \'Bozza\')", "value": "'.$stato_predefinito.'"]}
{[ "type": "select", "label": "'.tr('Stato').'", "name": "id_stato", "required": 1, "values": "query=SELECT `co_statidocumento`.`id` as id, `co_statidocumento_lang`.`name` as descrizione FROM `co_statidocumento` LEFT JOIN `co_statidocumento_lang` ON (`co_statidocumento`.`id` = `co_statidocumento_lang`.`id_record` AND `co_statidocumento_lang`.`id_lang` = '.prepare(Models\Locale::getDefault()->id).') WHERE `co_statidocumento`.`id` IN ('.$id_bozza.', '.$id_emessa.')", "value": "'.$stato_predefinito.'"]}
</div>
<div class="col-md-6">
@ -131,7 +143,7 @@ if (!empty($options['create_document'])) {
// Opzioni aggiuntive per i Contratti
elseif ($final_module->getTranslation('name') == 'Contratti') {
$stato_predefinito = (new StatoContratto())->getByField('name', 'Bozza');
$stato_predefinito = (new StatoContratto())->getByField('name', 'Bozza', Models\Locale::getPredefined()->id);
echo '
<div class="col-md-6">
@ -141,21 +153,21 @@ if (!empty($options['create_document'])) {
// Opzioni aggiuntive per i DDT
elseif (in_array($final_module->getTranslation('name'), ['Ddt di vendita', 'Ddt di acquisto'])) {
$stato_predefinito = (new Stato())->getByField('name', 'Bozza');
$stato_predefinito = (new Stato())->getByField('name', 'Bozza', Models\Locale::getPredefined()->id);
echo '
<div class="col-md-6">
{[ "type": "select", "label": "'.tr('Stato').'", "name": "id_stato", "required": 1, "values": "query=SELECT * FROM `dt_statiddt` LEFT JOIN `dt_statiddt_lang` ON (`dt_statiddt`.`id` = `dt_statiddt_lang`.`id_record` AND `dt_statiddt_lang`.`id_lang` = '.prepare(Models\Locale::getDefault()->id).')", "value": "'.$stato_predefinito.'" ]}
{[ "type": "select", "label": "'.tr('Stato').'", "name": "id_stato", "required": 1, "values": "query=SELECT `dt_statiddt`.*, `dt_statiddt_lang`.`name` AS descrizione FROM `dt_statiddt` LEFT JOIN `dt_statiddt_lang` ON (`dt_statiddt`.`id` = `dt_statiddt_lang`.`id_record` AND `dt_statiddt_lang`.`id_lang` = '.prepare(Models\Locale::getDefault()->id).')", "value": "'.$stato_predefinito.'" ]}
</div>
<div class="col-md-6">
{[ "type": "select", "label": "'.tr('Causale trasporto').'", "name": "id_causale_trasporto", "required": 1, "ajax-source": "causali", "icon-after": "add|'.(new Module())->getByField('name', 'Causali').'", "help": "'.tr('Definisce la causale del trasporto').'" ]}
{[ "type": "select", "label": "'.tr('Causale trasporto').'", "name": "id_causale_trasporto", "required": 1, "ajax-source": "causali", "icon-after": "add|'.(new Module())->getByField('name', 'Causali', Models\Locale::getPredefined()->id).'", "help": "'.tr('Definisce la causale del trasporto').'" ]}
</div>';
}
// Opzioni aggiuntive per gli Ordini
elseif (in_array($final_module->getTranslation('name'), ['Ordini cliente', 'Ordini fornitore'])) {
$stato_predefinito = (new StatoOrdine())->getByField('name', 'Bozza');
$stato_predefinito = (new StatoOrdine())->getByField('name', 'Bozza', Models\Locale::getPredefined()->id);
echo '
<div class="col-md-6">
@ -170,7 +182,7 @@ if (!empty($options['create_document'])) {
echo '
<div class="col-md-6">
{[ "type": "select", "label": "'.$tipo_anagrafica.'", "name": "idanagrafica", "required": 1, "ajax-source": "'.$ajax.'", "icon-after": "add|'.(new Module())->getByField('name', 'Anagrafiche').'|tipoanagrafica='.$tipo_anagrafica.'" ]}
{[ "type": "select", "label": "'.$tipo_anagrafica.'", "name": "idanagrafica", "required": 1, "ajax-source": "'.$ajax.'", "icon-after": "add|'.(new Module())->getByField('name', 'Anagrafiche', Models\Locale::getPredefined()->id).'|tipoanagrafica='.$tipo_anagrafica.'" ]}
</div>';
}

View File

@ -45,7 +45,7 @@ echo '
// Unità di misura
echo '
<div class="col-md-'.$width.'">
{[ "type": "select", "label": "'.tr('Unità di misura').'", "icon-after": "add|'.(new Module())->getByField('name', 'Unità di misura').'", "name": "um", "value": "'.$result['um'].'", "ajax-source": "misure" ]}
{[ "type": "select", "label": "'.tr('Unità di misura').'", "icon-after": "add|'.(new Module())->getByField('name', 'Unità di misura', Models\Locale::getPredefined()->id).'", "name": "um", "value": "'.$result['um'].'", "ajax-source": "misure" ]}
</div>';
// Unità di misura

View File

@ -28,11 +28,13 @@ if (Update::isUpdateAvailable() || !$dbo->isInstalled()) {
return;
}
$id_tipo_azienda = Tipo::find((new Tipo())->getByField('name', 'Azienda', Models\Locale::getPredefined()->id))->id;
$has_azienda = $dbo->fetchNum('SELECT `an_anagrafiche`.`idanagrafica` FROM `an_anagrafiche`
LEFT JOIN `an_tipianagrafiche_anagrafiche` ON `an_anagrafiche`.`idanagrafica`=`an_tipianagrafiche_anagrafiche`.`idanagrafica`
LEFT JOIN `an_tipianagrafiche` ON `an_tipianagrafiche`.`id`=`an_tipianagrafiche_anagrafiche`.`idtipoanagrafica`
LEFT JOIN `an_tipianagrafiche_lang` ON (`an_tipianagrafiche`.`id`=`an_tipianagrafiche_lang`.`id_record` AND `an_tipianagrafiche_lang`.`id_lang`='.prepare(Models\Locale::getDefault()->id).")
WHERE `an_tipianagrafiche_lang`.`name` = 'Azienda' AND `an_anagrafiche`.`deleted_at` IS NULL") != 0;
LEFT JOIN `an_tipianagrafiche_lang` ON (`an_tipianagrafiche`.`id`=`an_tipianagrafiche_lang`.`id_record` AND `an_tipianagrafiche_lang`.`id_lang`='.prepare(Models\Locale::getDefault()->id).')
WHERE `an_tipianagrafiche`.`id` = '.$id_tipo_azienda.' AND `an_anagrafiche`.`deleted_at` IS NULL') != 0;
$has_user = $dbo->fetchNum('SELECT `id` FROM `zz_users`') != 0;
$settings = [
@ -72,7 +74,7 @@ if (post('action') == 'init') {
// Azienda predefinita
if (!$has_azienda) {
Filter::set('post', 'op', 'add');
$id_module = (new Module())->getByField('name', 'Anagrafiche');
$id_module = (new Module())->getByField('name', 'Anagrafiche', Models\Locale::getPredefined()->id);
include base_dir().'/modules/anagrafiche/actions.php';
// Logo stampe
@ -97,7 +99,7 @@ if (post('action') == 'init') {
'password' => Auth::hashPassword(post('admin_password')),
'email' => post('admin_email'),
'idgruppo' => $admin['id'],
'idanagrafica' => isset($id_record) ? $id_record : 0,
'idanagrafica' => $id_record ?? 0,
'enabled' => 1,
]);
@ -172,7 +174,7 @@ if (!$has_azienda) {
<div class="panel-body" id="bs-popup">';
$idtipoanagrafica = (new Tipo())->getByField('name', 'Azienda');
$idtipoanagrafica = (new Tipo())->getByField('name', 'Azienda', Models\Locale::getPredefined()->id);
$readonly_tipo = true;
ob_start();

View File

@ -84,7 +84,7 @@ foreach ($modules as $name => $values) {
$status = isset($available_modules) ? in_array($name, $available_modules) : $_SERVER[$values['server']] == 'On';
if ($name == 'mod_mime' && $php_interface != 'apache') {
$headers = get_headers((!empty($config['redirectHTTPS']) && !isHTTPS(true)) ? 'https://' : 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'], 1);
$headers = get_headers((!empty($config['redirectHTTPS']) && !isHTTPS(true)) ? 'https://' : 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'], true);
if (isset($headers['Content-Type'])) {
$status = 1;
} else {
@ -106,7 +106,7 @@ $settings = [
'type' => 'version',
'description' => '7.3.x - 8.0.x, consigliato almeno 7.4.x',
'minimum' => '7.3.0',
'maximum' => '8.0.99',
'maximum' => '8.1.99',
],
'zip' => [
@ -251,7 +251,7 @@ if ($database->isInstalled()) {
'warning' => $database->isMySQL() ? false : true,
'description' => $database->isMySQL() ? '5.7.x - 8.0.x' : '10.x',
'minimum' => $database->isMySQL() ? '5.7.0' : '10.1.0',
'maximum' => $database->isMySQL() ? '8.0.99' : '10.6.99',
'maximum' => $database->isMySQL() ? '8.3.99' : '10.6.99',
],
'sort_buffer_size' => [
@ -431,11 +431,11 @@ foreach ($config_to_check as $name => $values) {
if ($type == 'value') {
$description = tr('Valore consigliato: _SUGGESTED_ (Valore attuale: _ACTUAL_)', [
'_SUGGESTED_' => $values['suggested_value'],
'_ACTUAL_' => (!empty($values['section']) ? ${$values['section']}[$name] : $$name),
'_ACTUAL_' => (!empty($values['section']) ? ${$values['section']}[$name] : ${$name}),
]);
}
$status = ($values['operator'](!empty($values['section']) ? ${$values['section']}[$name] : $$name, $values['value_to_check']) ? 1 : 0);
$status = ($values['operator'](!empty($values['section']) ? ${$values['section']}[$name] : ${$name}, $values['value_to_check']) ? 1 : 0);
$config[] = [
'name' => $name,

View File

@ -99,7 +99,7 @@ if (!empty($type) && $type != 'menu' && $type != 'custom') {
$_SESSION['module_'.$id_module]['selected'] = [];
$selezione = array_keys($_SESSION['module_'.$id_module]['selected']);
$table_id = 'main_'.rand(0, 99);
$table_id = 'main_'.random_int(0, 99);
echo '
<table data-idmodule="'.$id_module.'" data-idplugin="'.$id_plugin.'" data-idparent="'.$id_record.'" data-selected="'.implode(';', $selezione).'" id="'.$table_id.'" width="100%" class="main-records'.(!empty($id_plugin) ? '-plugins' : '').' table table-condensed table-bordered">
<thead>

View File

@ -33,7 +33,7 @@ if (sizeof($id_allegati) == 1) {
$allegato = Upload::find($id_allegati[0]);
echo '
<div class="col-md-6">
{[ "type": "text", "label": "'.tr('Nome').'", "name": "nome_allegato", "value": "'.$allegato->getTranslation('name').'" ]}
{[ "type": "text", "label": "'.tr('Nome').'", "name": "nome_allegato", "value": "'.$allegato->name.'" ]}
</div>
<div class="col-md-6">
{[ "type": "text", "label": "'.tr('Categoria').'", "name": "categoria_allegato", "value": "'.$allegato->category.'", "disabled": "'.intval(in_array($allegato->category, ['Fattura Elettronica'])).'" ]}

View File

@ -54,7 +54,7 @@ $direzione_richiesta = $source->getDocument()->direzione == 'entrata' ? 'uscita'
// Individuazione DDT disponibili
$ddt = DDT::whereHas('stato', function ($query) {
$id_stato = (new StatoDDT())->getByField('name', 'Bozza');
$id_stato = (new StatoDDT())->getByField('name', 'Bozza', Models\Locale::getPredefined()->id);
$query->where('id', '!=', $id_stato);
})->whereHas('tipo', function ($query) use ($direzione_richiesta) {
$query->where('dir', '=', $direzione_richiesta);
@ -70,7 +70,7 @@ foreach ($ddt as $elemento) {
// Individuazione ordini disponibili
$tipo_ordini = $direzione_richiesta == 'entrata' ? 'cliente' : 'fornitore';
$ordini = Ordine::whereHas('stato', function ($query) {
$id_stato = (new StatoOrdine())->getByField('name', 'Bozza');
$id_stato = (new StatoOrdine())->getByField('name', 'Bozza', Models\Locale::getPredefined()->id);
$query->where('id', '!=', $id_stato);
})->whereHas('tipo', function ($query) use ($direzione_richiesta) {
$query->where('dir', '=', $direzione_richiesta);

View File

@ -47,7 +47,7 @@ echo '<!DOCTYPE html>
if (file_exists(base_dir().'/manifest.json')) {
echo '
<link rel="manifest" href="'.base_path().'/manifest.json?r='.rand().'">';
<link rel="manifest" href="'.base_path().'/manifest.json?r='.random_int(0, mt_getrandmax()).'">';
}
// CSS
@ -238,7 +238,7 @@ if (Auth::check()) {
{ name: "tools", items : [ "Maximize", "ShowBlocks" ] },
{ name: "about", items: [ "About" ] }
],
order_manager_id: "'.($dbo->isInstalled() ? (new Module())->getByField('name', 'Stato dei servizi') : '').'",
order_manager_id: "'.($dbo->isInstalled() ? (new Module())->getByField('name', 'Stato dei servizi', Models\Locale::getPredefined()->id) : '').'",
dataload_page_buffer: '.setting('Lunghezza in pagine del buffer Datatables').',
tempo_attesa_ricerche: '.setting('Tempo di attesa ricerche in secondi').',
restrict_summables_to_selected: '.setting('Totali delle tabelle ristretti alla selezione').',

View File

@ -236,7 +236,7 @@ function translateTemplate()
];
$template = replace($template, $replaces);
$template = HTMLBuilder::replace($template);
$template = $template ? HTMLBuilder::replace($template) : $template;
$template = replace($template, $replaces);
// Informazioni estese sulle azioni dell'utente
@ -297,7 +297,7 @@ function slashes($string)
*/
function isAjaxRequest()
{
return Whoops\Util\Misc::isAjaxRequest() && filter('ajax') !== null;
return Whoops\Util\Misc::isAjaxRequest() && filter('ajax') !== null && filter('ajax') !== '';
}
/**
@ -339,7 +339,7 @@ function redirectOperation($id_module, $id_record)
*/
function prepareToField($string)
{
return str_replace('"', '&quot;', $string);
return $string ? str_replace('"', '&quot;', $string) : $string;
}
/**
@ -442,7 +442,7 @@ function session_get($name, $default = null)
$session = &$session[$piece];
}
return isset($session) ? $session : $default;
return $session ?? $default;
}
/**

View File

@ -38,9 +38,7 @@ if (!function_exists('array_column')) {
*/
function array_column($array, $key)
{
return array_map(function ($v) use ($key) {
return is_object($v) ? $v->$key : $v[$key];
}, $array);
return array_map(fn ($v) => is_object($v) ? $v->$key : $v[$key], $array);
}
}
@ -55,9 +53,7 @@ if (!function_exists('array_clean')) {
function array_clean($array)
{
if (!empty($array)) {
return array_unique(array_values(array_filter($array, function ($value) {
return !empty($value);
})));
return array_unique(array_values(array_filter($array, fn ($value) => !empty($value))));
}
}
}
@ -448,8 +444,8 @@ if (!function_exists('color_inverse')) {
$R2 = 255;
$G2 = 255;
$B2 = 255;
$L1 = 0.2126 * pow($R1 / 255, 2.2) + 0.7152 * pow($G1 / 255, 2.2) + 0.0722 * pow($B1 / 255, 2.2);
$L2 = 0.2126 * pow($R2 / 255, 2.2) + 0.7152 * pow($G2 / 255, 2.2) + 0.0722 * pow($B2 / 255, 2.2);
$L1 = 0.2126 * ($R1 / 255) ** 2.2 + 0.7152 * ($G1 / 255) ** 2.2 + 0.0722 * ($B1 / 255) ** 2.2;
$L2 = 0.2126 * ($R2 / 255) ** 2.2 + 0.7152 * ($G2 / 255) ** 2.2 + 0.0722 * ($B2 / 255) ** 2.2;
if ($L1 > $L2) {
$lum = ($L1 + 0.05) / ($L2 + 0.05);
} else {
@ -602,6 +598,6 @@ if (!function_exists('adjustBrightness')) {
$color = str_pad(dechex($color + $adjustAmount), 2, '0', STR_PAD_LEFT);
}
return '#'.implode($hexCode);
return '#'.implode('', $hexCode);
}
}

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

58
log.php
View File

@ -17,6 +17,8 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
use Carbon\Carbon;
include_once __DIR__.'/core.php';
$pageTitle = tr('Log');
@ -34,10 +36,11 @@ echo '
<table class="datatables table table-hover">
<thead>
<tr>
<th>'.tr('Username').'</th>
<th>'.tr('Data').'</th>
<th>'.tr('Stato').'</th>
<th>'.tr('Indirizzo IP').'</th>
<th width="200">'.tr('Username').'</th>
<th width="150">'.tr('Data').'</th>
<th width="100">'.tr('Indirizzo IP').'</th>
<th>'.tr('Dispositivo').'</th>
<th width="180">'.tr('Stato').'</th>
</tr>
</thead>
<tbody>';
@ -50,25 +53,19 @@ if (Auth::admin()) {
} else {
$q = 'SELECT * FROM `zz_logs` WHERE `id_utente`='.prepare(Auth::user()['id']).' ORDER BY `created_at` DESC LIMIT 0, 100';
}
$rs = $dbo->fetchArray($q);
$n = sizeof($rs);
$logs = $dbo->fetchArray($q);
for ($i = 0; $i < $n; ++$i) {
$id = $rs[$i]['id'];
$id_utente = $rs[$i]['id_utente'];
$username = $rs[$i]['username'];
$ip = $rs[$i]['ip'];
$timestamp = Translator::timestampToLocale($rs[$i]['created_at']);
foreach ($logs as $log) {
$timestamp = Translator::timestampToLocale($log['created_at']);
$status = Auth::getStatus();
if ($rs[$i]['stato'] == $status['success']['code']) {
if ($log['stato'] == $status['success']['code']) {
$type = 'success';
$stato = $status['success']['message'];
} elseif ($rs[$i]['stato'] == $status['disabled']['code']) {
} elseif ($log['stato'] == $status['disabled']['code']) {
$type = 'warning';
$stato = $status['disabled']['message'];
} elseif ($rs[$i]['stato'] == $status['unauthorized']['code']) {
} elseif ($log['stato'] == $status['unauthorized']['code']) {
$type = 'warning';
$stato = $status['unauthorized']['message'];
} else {
@ -76,12 +73,15 @@ for ($i = 0; $i < $n; ++$i) {
$stato = $status['failed']['message'];
}
$created_at = new Carbon($log['created_at']);
echo '
<tr class="'.$type.'">
<td>'.$username.'</td>
<td>'.$timestamp.'</td>
<td>'.$log['username'].'</td>
<td class="tip" title="'.$created_at->format('d/m/Y H:i:s').'">'.$created_at->diffForHumans().'</td>
<td>'.$log['ip'].'</td>
<td class="user-agent tip" title="'.strip_tags($log['user_agent']).'">'.$log['user_agent'].'</td>
<td><span class="label label-'.$type.'">'.$stato.'</span></td>
<td>'.$ip.'</td>
</tr>';
}
@ -93,5 +93,25 @@ echo '
<!-- /.box-body -->
</div>
<!-- /.box -->';
?>
<script>
$(document).ready(function() {
var parser = new UAParser();
$('tr').each(function(){
user_agent_cell = $(this).find('.user-agent');
user_agent = user_agent_cell.text();
if (user_agent !== '') {
parser.setUA(user_agent);
device = parser.getResult();
user_agent_cell.html('<strong>' + (device.browser.name || '') + '</strong> ' + (device.browser.version || '') + ' | <strong>' + (device.os.name || '') + '</strong> ' + (device.os.version || ''));
}
})
})
</script>
<?php
include_once App::filepath('include|custom|', 'bottom.php');

View File

@ -164,7 +164,7 @@ if ($smtp['pec'] == 1 && $module->getTranslation('name') == 'Fatture di vendita'
echo '
<div class="col-md-6">
{[ "type": "select", "multiple": "1", "label": "'.tr('Allegati').'", "name": "uploads[]", "value": "'.implode(',', $uploads).'", "help": "'.tr('Allegati del documento o caricati nell\'anagrafica dell\'azienda.').'", "values": "query=SELECT `id`, `name` AS text FROM `zz_files` WHERE `id_module` = '.prepare($id_module).' AND `id_record` = '.prepare($id_record).' UNION SELECT `id`, CONCAT(`name`, \' (Azienda)\') AS text FROM `zz_files` WHERE `id_module` = '.(new Module())->getByField('name', 'Anagrafiche').' AND `id_record` = (SELECT `valore` FROM `zz_settings` WHERE `name` = \'Azienda predefinita\')", "link": "allegato" ]}
{[ "type": "select", "multiple": "1", "label": "'.tr('Allegati').'", "name": "uploads[]", "value": "'.implode(',', $uploads).'", "help": "'.tr('Allegati del documento o caricati nell\'anagrafica dell\'azienda.').'", "values": "query=SELECT `id`, `name` AS text FROM `zz_files` WHERE `id_module` = '.prepare($id_module).' AND `id_record` = '.prepare($id_record).' UNION SELECT `id`, CONCAT(`name`, \' (Azienda)\') AS text FROM `zz_files` WHERE `id_module` = '.(new Module())->getByField('name', 'Anagrafiche', Models\Locale::getPredefined()->id).' AND `id_record` = (SELECT `valore` FROM `zz_settings` WHERE `name` = \'Azienda predefinita\')", "link": "allegato" ]}
</div>
</div>';

View File

@ -25,7 +25,7 @@ switch (filter('op')) {
case 'add':
$adapter = new FileAdapter();
$adapter->setTranslation('name', post('name'));
$adapter->name = post('name');
$adapter->class = '\\Modules\\FileAdapters\\Adapters\\'.post('class');
$adapter->save();
@ -37,10 +37,14 @@ switch (filter('op')) {
break;
case 'update':
$adapter->setTranslation('name', post('name'));
$adapter->name = post('name');
$adapter->class = '\\Modules\\FileAdapters\\Adapters\\'.post('class');
$adapter->options = post('options');
$adapter->is_default = post('is_default');
if (post('is_default') == 1) {
$dbo->query('UPDATE `zz_storage_adapters` SET `is_default` = 0');
$adapter->is_default = post('is_default');
}
$adapter->save();

View File

@ -34,7 +34,7 @@ include_once __DIR__.'/../../core.php';
</div>
<div class="col-md-2">
{[ "type": "checkbox", "label": "<?php echo tr('Predefinito'); ?>", "name": "is_default", "value": "$is_default$" ]}
{[ "type": "checkbox", "label": "<?php echo tr('Predefinito'); ?>", "name": "is_default", "value": "$is_default$", "extra": "<?php echo $record['is_default'] == 1 ? 'readonly' : ''; ?>" ]}
</div>
</div>

View File

@ -21,7 +21,7 @@ include_once __DIR__.'/../../core.php';
use Modules\FileAdapters\FileAdapter;
if (isset($id_record)) {
if (!empty($id_record)) {
$adapter = FileAdapter::find($id_record);
$record = $dbo->fetchOne('SELECT * FROM `zz_storage_adapters` WHERE `id`='.prepare($id_record));

View File

@ -39,7 +39,7 @@ switch (filter('op')) {
}
// Salvataggio della versione nella cache
Cache::find((new Cache())->getByField('name', 'Ultima esecuzione del cron'))->set($versione);
Cache::find((new Cache())->getByField('name', 'Ultima esecuzione del cron', Models\Locale::getPredefined()->id))->set($versione);
echo $versione;
break;

View File

@ -260,7 +260,7 @@ if (!empty($results) || !empty($results_settings) || !empty($results_settings_ad
'.$key.'
</td>
<td>
'.($setting['current'] ? $setting['current'] : '⚠️ Impostazione mancante').'
'.($setting['current'] ?: '⚠️ Impostazione mancante').'
</td>
<td>
'.$setting['expected'].'

View File

@ -156,7 +156,7 @@ function database(button) {
}
function controlli(button) {
openModal("'.tr('Controlli del gestionale').'", "'.$module->fileurl('controlli.php').'?id_module='.$id_module.'");
openModal("'.tr('Controlli del gestionale').'", "'.$module->fileurl('controlli.php').'?id_module='.$id_module. '");
}
function search(button) {
@ -171,9 +171,9 @@ function search(button) {
},
success: function(data){
if (data === "none" || !data) {
$("#update-search").html("'.tr('Nessun aggiornamento disponibile').'.");
$("#update-search").html("<i class=\"fa fa-check-circle text-success\" aria-hidden=\"true\"></i> '.tr('Nessun aggiornamento disponibile'). '.");
} else {
let beta_warning = data.includes("beta") ? "<br><b>'.tr('Attenzione: la versione individuata è in fase sperimentale, e pertanto può presentare diversi bug e malfunzionamenti').'.</b>" : "";
let beta_warning = data.includes("beta") ? "<br><i class=\"fa-exclamation-triangle text-danger\" aria-hidden=\"true\"></i> <b class=\"text-danger\">'.tr('Attenzione: la versione individuata è in fase sperimentale e potrebbe pertanto presentare diversi malfunzionamenti. Se ne sconsiglia l\'aggiornamento in installazioni di produzione').'.</b>" : "";
$("#update-search").html("'.tr("E' stato individuato un nuovo aggiornamento").': " + data + "." + beta_warning + "<br>'.tr('Scaricalo ora: _LINK_', [
'_LINK_' => "<a target='_blank' href='https://github.com/devcode-it/openstamanager/releases'>https://github.com/devcode-it/openstamanager/releases</a>",
]).'");

View File

@ -47,7 +47,7 @@ class UpdateHook extends CachedManager
$update = null;
}
$module = Module::find((new Module())->getByField('name', 'Aggiornamenti'));
$module = Module::find((new Module())->getByField('name', 'Aggiornamenti', \Models\Locale::getPredefined()->id));
$link = base_path().'/controller.php?id_module='.$module->id;
$message = tr("E' disponibile la versione _VERSION_ del gestionale", [

View File

@ -54,7 +54,7 @@ if (file_exists($extraction_dir.'/VERSION')) {
->ignoreVCS(true)
->in($extraction_dir);
$files_module = $finder->getTranslation('name')('MODULE');
$files_module = $finder->name('MODULE');
foreach ($files_module as $file) {
// Informazioni dal file di configurazione
@ -69,8 +69,6 @@ if (file_exists($extraction_dir.'/VERSION')) {
$table = 'zz_modules';
$installed = Module::find((new Module())->getByField('name', $info['name']));
$insert['parent'] = (new Module())->getByField('name', $info['parent']);
$insert['icon'] = $info['icon'];
}
// Copia dei file nella cartella relativa
@ -86,6 +84,8 @@ if (file_exists($extraction_dir.'/VERSION')) {
'order' => 100,
'default' => 0,
'enabled' => 1,
'icon' => $info['icon'],
'parent' => (new Module())->getByField('name', $info['parent']),
]));
$id_record = $dbo->lastInsertedID();
$dbo->insert($table.'_lang', array_merge($insert, [
@ -107,7 +107,7 @@ if (file_exists($extraction_dir.'/VERSION')) {
->ignoreVCS(true)
->in($extraction_dir);
$files_plugin_template = $finder->getTranslation('name')('PLUGIN')->getTranslation('name')('TEMPLATES');
$files_plugin_template = $finder->name('PLUGIN')->name('TEMPLATES');
foreach ($files_plugin_template as $file) {
// Informazioni dal file di configurazione
@ -115,6 +115,7 @@ if (file_exists($extraction_dir.'/VERSION')) {
// Informazioni aggiuntive per il database
$insert = [];
$insert_lang = [];
// Plugin
if (basename($file->getRealPath()) == 'PLUGIN') {
@ -135,7 +136,7 @@ if (file_exists($extraction_dir.'/VERSION')) {
$installed = Prints::getPrints()[$info['name']];
$insert['id_module'] = (new Module())->getByField('name', $info['module']);
$insert['is_record'] = $info['is_record'];
$insert['filename'] = $info['filename'];
$insert_lang['filename'] = $info['filename'];
$insert['icon'] = $info['icon'];
}
@ -154,7 +155,7 @@ if (file_exists($extraction_dir.'/VERSION')) {
'enabled' => 1,
]));
$id_record = $dbo->lastInsertedID();
$dbo->insert($table.'_lang', array_merge($insert, [
$dbo->insert($table.'_lang', array_merge($insert_lang, [
'name' => $info['name'],
'title' => !empty($info['title']) ? $info['title'] : $info['name'],
'id_record' => $id_record,

View File

@ -242,9 +242,13 @@ switch (post('op')) {
echo json_encode(['id' => $id_record, 'text' => $anagrafica->ragione_sociale]);
}
$descrizioni_tipi = $anagrafica->tipi()->get()->pluck('name')->toArray();
$descrizioni_tipi = $anagrafica->tipi()->get();
foreach ($descrizioni_tipi as $tipo) {
$tipi[] = $tipo->getTranslation('name');
}
flash()->info(tr('Aggiunta nuova anagrafica di tipo _TYPE_', [
'_TYPE_' => '"'.implode(', ', $descrizioni_tipi).'"',
'_TYPE_' => '"'.implode(', ', $tipi).'"',
]));
// Controllo che il Codice Fiscale non sia già presente
@ -348,7 +352,7 @@ switch (post('op')) {
// Operazioni aggiuntive per il logo e filigrana stampe
if (filter('op') == 'aggiungi-allegato' || filter('op') == 'modifica-allegato') {
$nome = $upload->getTranslation('name');
$nome = $upload->name;
$logo_stampe = ['logo stampe', 'logo_stampe', 'logo stampe.jpg', 'logo stampe.png'];
if (in_array(strtolower($nome), $logo_stampe)) {

View File

@ -18,13 +18,17 @@
*/
use Modules\Anagrafiche\Nazione;
use Modules\Anagrafiche\Tipo;
include_once __DIR__.'/../../core.php';
$id_nazione_italia = (new Nazione())->getByField('name', 'Italia');
$id_nazione_italia = (new Nazione())->getByField('name', 'Italia', Models\Locale::getPredefined()->id);
$tipo = get('tipoanagrafica');
$id_tipo = (new Tipo())->getByField('name', $tipo, Models\Locale::getPredefined()->id);
$id_tipo_azienda = (new Tipo())->getByField('name', 'Azienda', Models\Locale::getPredefined()->id);
if (!empty($tipo)) {
$rs = $dbo->fetchArray('SELECT `an_tipianagrafiche`.`id`, `an_tipianagrafiche_lang`.`name` as descrizione FROM `an_tipianagrafiche` LEFT JOIN `an_tipianagrafiche_lang` ON (`an_tipianagrafiche`.`id` = `an_tipianagrafiche_lang`.`id_record` AND `an_tipianagrafiche_lang`.`id_lang` = '.prepare(Models\Locale::getDefault()->id).') WHERE `name`='.prepare($tipo));
$rs = $dbo->fetchArray('SELECT `an_tipianagrafiche`.`id`, `an_tipianagrafiche_lang`.`name` as descrizione FROM `an_tipianagrafiche` LEFT JOIN `an_tipianagrafiche_lang` ON (`an_tipianagrafiche`.`id` = `an_tipianagrafiche_lang`.`id_record` AND `an_tipianagrafiche_lang`.`id_lang` = '.prepare(Models\Locale::getDefault()->id).') WHERE `an_tipianagrafiche`.`id`='.prepare($id_tipo));
$idtipoanagrafica = $rs[0]['id'];
}
@ -39,7 +43,7 @@ echo '
</div>
<div class="col-md-6">
{[ "type": "select", "label": "'.tr('Tipo di anagrafica').'", "name": "idtipoanagrafica[]", "id": "idtipoanagrafica_add", "multiple": "1", "required": 1, "values": "query=SELECT `an_tipianagrafiche`.`id`, `name` as descrizione FROM `an_tipianagrafiche` LEFT JOIN `an_tipianagrafiche_lang` ON (`an_tipianagrafiche`.`id` = `an_tipianagrafiche_lang`.`id_record` AND `an_tipianagrafiche_lang`.`id_lang` = '.prepare(Models\Locale::getDefault()->id).') WHERE `an_tipianagrafiche`.`id` NOT IN (SELECT DISTINCT(`x`.`idtipoanagrafica`) FROM `an_tipianagrafiche_anagrafiche` x INNER JOIN `an_tipianagrafiche` t ON `x`.`idtipoanagrafica` = `t`.`id` LEFT JOIN `an_tipianagrafiche_lang` ON (`t`.`id` = `an_tipianagrafiche_lang`.`id_record` AND `an_tipianagrafiche_lang`.`id_lang` = '.prepare(Models\Locale::getDefault()->id).') INNER JOIN `an_anagrafiche` ON `an_anagrafiche`.`idanagrafica` = `x`.`idanagrafica` WHERE `an_tipianagrafiche_lang`.`name` = \'Azienda\' AND `deleted_at` IS NULL) ORDER BY `name`", "value": "'.(isset($idtipoanagrafica) ? $idtipoanagrafica : null).'", "readonly": '.(!empty(get('readonly_tipo')) ? 1 : 0).' ]}
{[ "type": "select", "label": "'.tr('Tipo di anagrafica').'", "name": "idtipoanagrafica[]", "id": "idtipoanagrafica_add", "multiple": "1", "required": 1, "values": "query=SELECT `an_tipianagrafiche`.`id`, `name` as descrizione FROM `an_tipianagrafiche` LEFT JOIN `an_tipianagrafiche_lang` ON (`an_tipianagrafiche`.`id` = `an_tipianagrafiche_lang`.`id_record` AND `an_tipianagrafiche_lang`.`id_lang` = '.prepare(Models\Locale::getDefault()->id).') WHERE `an_tipianagrafiche`.`id` NOT IN (SELECT DISTINCT(`x`.`idtipoanagrafica`) FROM `an_tipianagrafiche_anagrafiche` x INNER JOIN `an_tipianagrafiche` t ON `x`.`idtipoanagrafica` = `t`.`id` LEFT JOIN `an_tipianagrafiche_lang` ON (`t`.`id` = `an_tipianagrafiche_lang`.`id_record` AND `an_tipianagrafiche_lang`.`id_lang` = '.prepare(Models\Locale::getDefault()->id).') INNER JOIN `an_anagrafiche` ON `an_anagrafiche`.`idanagrafica` = `x`.`idanagrafica` WHERE `an_tipianagrafiche`.`id` = '.prepare($id_tipo_azienda).' AND `deleted_at` IS NULL) ORDER BY `name`", "value": "'.($idtipoanagrafica ?? null).'", "readonly": '.(!empty(get('readonly_tipo')) ? 1 : 0).' ]}
</div>
</div>

View File

@ -24,7 +24,7 @@ use Models\Module;
Anagrafiche
*/
$link_id = (new Module())->getByField('name', 'Anagrafiche');
$link_id = (new Module())->getByField('name', 'Anagrafiche', Models\Locale::getPredefined()->id);
$fields = [
'Codice' => 'codice',

View File

@ -18,12 +18,14 @@
*/
include_once __DIR__.'/../../../core.php';
use Modules\Anagrafiche\Tipo;
$filter_agente = Auth::user()['gruppo'] == 'Agenti';
switch ($resource) {
case 'clienti':
$id_azienda = setting('Azienda predefinita');
$tipologia = Tipo::find((new Tipo())->getByField('name', 'Cliente', Models\Locale::getPredefined()->id))->id;
$query = "SELECT
`an_anagrafiche`.`idanagrafica` AS id,
@ -64,7 +66,7 @@ switch ($resource) {
$filter[] = '`an_anagrafiche`.`idanagrafica`='.prepare($element);
}
$where[] = "`an_tipianagrafiche_lang`.`name`='Cliente'";
$where[] = '`an_tipianagrafiche`.`id`= '.prepare($tipologia);
if (empty($filter)) {
$where[] = '`an_anagrafiche`.`deleted_at` IS NULL';
@ -101,6 +103,7 @@ switch ($resource) {
case 'fornitori':
$id_azienda = setting('Azienda predefinita');
$tipologia = Tipo::find((new Tipo())->getByField('name', 'Fornitore', Models\Locale::getPredefined()->id))->id;
$query = "SELECT
`an_anagrafiche`.`idanagrafica` AS id,
@ -128,7 +131,7 @@ switch ($resource) {
}
if (empty($filter)) {
$where[] = "`an_tipianagrafiche_lang`.`name` = 'Fornitore'";
$where[] = '`an_tipianagrafiche`.`id`= '.prepare($tipologia);
$where[] = '`an_anagrafiche`.`deleted_at` IS NULL';
}
@ -144,13 +147,15 @@ switch ($resource) {
break;
case 'vettori':
$tipologia = Tipo::find((new Tipo())->getByField('name', 'Vettore', Models\Locale::getPredefined()->id))->id;
$query = "SELECT `an_anagrafiche`.`idanagrafica` AS id, CONCAT(`ragione_sociale`, IF(`citta` IS NULL OR `citta` = '', '', CONCAT(' (', `citta`, ')')), IF(`an_anagrafiche`.`deleted_at` IS NULL, '', ' (".tr('eliminata').")'),' - ', `an_anagrafiche`.`codice`) AS descrizione, `idtipointervento_default` AS idtipointervento FROM `an_anagrafiche` INNER JOIN (`an_tipianagrafiche_anagrafiche` INNER JOIN `an_tipianagrafiche` ON `an_tipianagrafiche_anagrafiche`.`idtipoanagrafica`=`an_tipianagrafiche`.`id` LEFT JOIN `an_tipianagrafiche_lang` ON (`an_tipianagrafiche`.`id` = `an_tipianagrafiche_lang`.`id_record` AND `an_tipianagrafiche_lang`.`id_lang` = ".prepare(Models\Locale::getDefault()->id).')) ON `an_anagrafiche`.`idanagrafica`=`an_tipianagrafiche_anagrafiche`.`idanagrafica` |where| ORDER BY `ragione_sociale`';
foreach ($elements as $element) {
$filter[] = '`an_anagrafiche`.`idanagrafica`='.prepare($element);
}
$where[] = "`name`='Vettore'";
$where[] = '`an_tipianagrafiche`.`id`= '.prepare($tipologia);
if (empty($filter)) {
$where[] = '`an_anagrafiche`.`deleted_at` IS NULL';
}
@ -171,13 +176,15 @@ switch ($resource) {
* - idanagrafica
*/
case 'agenti':
$tipologia = Tipo::find((new Tipo())->getByField('name', 'Agente', Models\Locale::getPredefined()->id))->id;
$query = "SELECT `an_anagrafiche`.`idanagrafica` AS id, CONCAT(`ragione_sociale`, IF(`citta` IS NULL OR `citta` = '', '', CONCAT(' (', `citta`, ')')), IF(`an_anagrafiche`.`deleted_at` IS NULL, '', ' (".tr('eliminata').")'),' - ', `an_anagrafiche`.`codice`) AS descrizione, `idtipointervento_default` FROM `an_anagrafiche` INNER JOIN (`an_tipianagrafiche_anagrafiche` INNER JOIN `an_tipianagrafiche` ON `an_tipianagrafiche_anagrafiche`.`idtipoanagrafica`=`an_tipianagrafiche`.`id` LEFT JOIN `an_tipianagrafiche_lang` ON (`an_tipianagrafiche`.`id` = `an_tipianagrafiche_lang`.`id_record` AND `an_tipianagrafiche_lang`.`id_lang` = ".prepare(Models\Locale::getDefault()->id).')) ON `an_anagrafiche`.`idanagrafica`=`an_tipianagrafiche_anagrafiche`.`idanagrafica` |where| ORDER BY `ragione_sociale`';
foreach ($elements as $element) {
$filter[] = '`an_anagrafiche`.`idanagrafica`='.prepare($element);
}
$where[] = "`name`='Agente'";
$where[] = '`an_tipianagrafiche`.`id`= '.prepare($tipologia);
if (empty($filter)) {
$where[] = '`an_anagrafiche`.`deleted_at` IS NULL';
}
@ -209,13 +216,15 @@ switch ($resource) {
break;
case 'tecnici':
$tipologia = Tipo::find((new Tipo())->getByField('name', 'Tecnico', Models\Locale::getPredefined()->id))->id;
$query = "SELECT `an_anagrafiche`.`idanagrafica` AS id, CONCAT(`ragione_sociale`, IF(`citta` IS NULL OR `citta` = '', '', CONCAT(' (', `citta`, ')')), IF(`an_anagrafiche`.`deleted_at` IS NULL, '', ' (".tr('eliminata').")'),' - ', `an_anagrafiche`.`codice`) AS descrizione, `idtipointervento_default` FROM `an_anagrafiche` INNER JOIN (`an_tipianagrafiche_anagrafiche` INNER JOIN `an_tipianagrafiche` ON `an_tipianagrafiche_anagrafiche`.`idtipoanagrafica`=`an_tipianagrafiche`.`id` LEFT JOIN `an_tipianagrafiche_lang` ON (`an_tipianagrafiche`.`id` = `an_tipianagrafiche_lang`.`id_record` AND `an_tipianagrafiche_lang`.`id_lang` = ".prepare(Models\Locale::getDefault()->id).')) ON `an_anagrafiche`.`idanagrafica`=`an_tipianagrafiche_anagrafiche`.`idanagrafica` |where| ORDER BY `ragione_sociale`';
foreach ($elements as $element) {
$filter[] = '`an_anagrafiche`.`idanagrafica`='.prepare($element);
}
$where[] = "`name`='Tecnico'";
$where[] = '`an_tipianagrafiche`.`id`= '.prepare($tipologia);
if (empty($filter)) {
$where[] = '`an_anagrafiche`.`deleted_at` IS NULL';
@ -241,6 +250,10 @@ switch ($resource) {
break;
case 'clienti_fornitori':
$id_cliente = Tipo::find((new Tipo())->getByField('name', 'Cliente', Models\Locale::getPredefined()->id))->id;
$id_fornitore = Tipo::find((new Tipo())->getByField('name', 'Fornitore', Models\Locale::getPredefined()->id))->id;
$id_azienda = Tipo::find((new Tipo())->getByField('name', 'Azienda', Models\Locale::getPredefined()->id))->id;
$query = "SELECT `an_anagrafiche`.`idanagrafica` AS id, CONCAT_WS('', `ragione_sociale`, IF(`citta` !='' OR `provincia` != '', CONCAT(' (', `citta`, IF(`provincia`!='', CONCAT(' ', `provincia`), ''), ')'), ''), IF(`an_anagrafiche`.`deleted_at` IS NULL, '', ' (".tr('eliminata').")'),' - ', `an_anagrafiche`.`codice`) AS descrizione, `an_tipianagrafiche_lang`.`name` AS optgroup, `idtipointervento_default`, `an_tipianagrafiche`.`id` as id_tipo FROM `an_tipianagrafiche` LEFT JOIN `an_tipianagrafiche_lang` ON (`an_tipianagrafiche`.`id` = `an_tipianagrafiche_lang`.`id_record` AND `an_tipianagrafiche_lang`.`id_lang` = ".prepare(Models\Locale::getDefault()->id).') INNER JOIN `an_tipianagrafiche_anagrafiche` ON `an_tipianagrafiche`.`id`=`an_tipianagrafiche_anagrafiche`.`idtipoanagrafica` INNER JOIN `an_anagrafiche` ON `an_anagrafiche`.`idanagrafica`=`an_tipianagrafiche_anagrafiche`.`idanagrafica` |where| ORDER BY `optgroup` ASC, `ragione_sociale` ASC';
foreach ($elements as $element) {
@ -250,7 +263,7 @@ switch ($resource) {
$where = [];
if (empty($filter)) {
$where[] = '`an_anagrafiche`.`deleted_at` IS NULL';
$where[] = '`an_tipianagrafiche_anagrafiche`.`idtipoanagrafica` IN (SELECT `an_tipianagrafiche`.`id` FROM `an_tipianagrafiche` LEFT JOIN `an_tipianagrafiche_lang` ON (`an_tipianagrafiche`.`id` = `an_tipianagrafiche_lang`.`id_record` AND `an_tipianagrafiche_lang`.`id_lang` = '.prepare(Models\Locale::getDefault()->id).") WHERE `name` = 'Cliente' OR `name` = 'Fornitore' OR `name` = 'Azienda')";
$where[] = '`an_tipianagrafiche`.`id` IN ('.prepare($id_azienda).', '.prepare($id_fornitore).', '.prepare($id_cliente).')';
}
if (!empty($search)) {
@ -347,9 +360,9 @@ switch ($resource) {
*
FROM
(SELECT '0' AS id, (SELECT `lat` FROM `an_anagrafiche` |where|) AS lat, (SELECT `lng` FROM `an_anagrafiche` |where|) AS lng, (SELECT `idzona` FROM `an_anagrafiche` |where|) AS idzona, CONCAT_WS(' - ', \"".tr('Sede legale')."\" , (SELECT CONCAT (`citta`, IF(`indirizzo`!='',CONCAT(' (', `indirizzo`, ')'), ''), ' (',`ragione_sociale`,')') FROM `an_anagrafiche` |where|)) AS descrizione
UNION
SELECT
`id`,
`lat`,

View File

@ -32,45 +32,45 @@ if (in_array($id_cliente, $tipi_anagrafica) or in_array($id_fornitore, $tipi_ana
// Aggiunta utente per i tecnici
if (in_array($id_tecnico, $tipi_anagrafica)) {
echo '
<li><a data-toggle="modal" data-title="'.tr('Aggiungi utente').'" data-href="modules/utenti/user.php?id_module='.(new Module())->getByField('name', 'Utenti e permessi')->id_record.'&id_record='.(new Group())->getByField('name', 'Tecnici').'&idanagrafica='.$record['idanagrafica'].'"><i class="fa fa-user"></i>'.tr('Nuovo utente').'
<li><a data-toggle="modal" data-title="'.tr('Aggiungi utente').'" data-href="modules/utenti/user.php?id_module='.(new Module())->getByField('name', 'Utenti e permessi', Models\Locale::getPredefined()->id)->id_record.'&id_record='.(new Group())->getByField('name', 'Tecnici', Models\Locale::getPredefined()->id).'&idanagrafica='.$record['idanagrafica'].'"><i class="fa fa-user"></i>'.tr('Nuovo utente').'
</a></li>';
}
if (in_array($id_cliente, $tipi_anagrafica)) {
echo '
<li><a data-toggle="modal" data-title="'.tr('Aggiungi attività').'" data-href="add.php?id_module='.(new Module())->getByField('name', 'Interventi').'&idanagrafica='.$record['idanagrafica'].'"><i class="fa fa-wrench"></i>'.tr('Nuova attività').'
<li><a data-toggle="modal" data-title="'.tr('Aggiungi attività').'" data-href="add.php?id_module='.(new Module())->getByField('name', 'Interventi', Models\Locale::getPredefined()->id).'&idanagrafica='.$record['idanagrafica'].'"><i class="fa fa-wrench"></i>'.tr('Nuova attività').'
</a></li>
<li><a data-toggle="modal" data-title="'.tr('Aggiungi preventivo').'" data-href="add.php?id_module='.(new Module())->getByField('name', 'Preventivi').'&idanagrafica='.$record['idanagrafica'].'"><i class="fa fa-file-text"></i>'.tr('Nuovo preventivo').'
<li><a data-toggle="modal" data-title="'.tr('Aggiungi preventivo').'" data-href="add.php?id_module='.(new Module())->getByField('name', 'Preventivi', Models\Locale::getPredefined()->id).'&idanagrafica='.$record['idanagrafica'].'"><i class="fa fa-file-text"></i>'.tr('Nuovo preventivo').'
</a></li>
<li><a data-toggle="modal" data-title="'.tr('Aggiungi contratto').'" data-href="add.php?id_module='.(new Module())->getByField('name', 'Contratti').'&idanagrafica='.$record['idanagrafica'].'"><i class="fa fa-file-text-o"></i>'.tr('Nuovo contratto').'
<li><a data-toggle="modal" data-title="'.tr('Aggiungi contratto').'" data-href="add.php?id_module='.(new Module())->getByField('name', 'Contratti', Models\Locale::getPredefined()->id).'&idanagrafica='.$record['idanagrafica'].'"><i class="fa fa-file-text-o"></i>'.tr('Nuovo contratto').'
</a></li>
<li><a data-toggle="modal" data-title="'.tr('Aggiungi ordine cliente').'" data-href="add.php?id_module='.(new Module())->getByField('name', 'Ordini cliente').'&idanagrafica='.$record['idanagrafica'].'"><i class="fa fa-file-o"></i>'.tr('Nuovo ordine cliente').'
<li><a data-toggle="modal" data-title="'.tr('Aggiungi ordine cliente').'" data-href="add.php?id_module='.(new Module())->getByField('name', 'Ordini cliente', Models\Locale::getPredefined()->id).'&idanagrafica='.$record['idanagrafica'].'"><i class="fa fa-file-o"></i>'.tr('Nuovo ordine cliente').'
</a></li>
<li><a data-toggle="modal" data-title="'.tr('Aggiungi ddt uscita').'" data-href="add.php?id_module='.(new Module())->getByField('name', 'Ddt di vendita').'&idanagrafica='.$record['idanagrafica'].'"><i class="fa fa-truck"></i>'.tr('Nuovo ddt in uscita').'
<li><a data-toggle="modal" data-title="'.tr('Aggiungi ddt uscita').'" data-href="add.php?id_module='.(new Module())->getByField('name', 'Ddt di vendita', Models\Locale::getPredefined()->id).'&idanagrafica='.$record['idanagrafica'].'"><i class="fa fa-truck"></i>'.tr('Nuovo ddt in uscita').'
</a></li>
<li><a data-toggle="modal" data-title="'.tr('Aggiungi fattura di vendita').'" data-href="add.php?id_module='.(new Module())->getByField('name', 'Fatture di vendita').'&idanagrafica='.$record['idanagrafica'].'"><i class="fa fa-file"></i>'.tr('Nuova fattura di vendita').'
<li><a data-toggle="modal" data-title="'.tr('Aggiungi fattura di vendita').'" data-href="add.php?id_module='.(new Module())->getByField('name', 'Fatture di vendita', Models\Locale::getPredefined()->id).'&idanagrafica='.$record['idanagrafica'].'"><i class="fa fa-file"></i>'.tr('Nuova fattura di vendita').'
</a></li>
<li><a data-toggle="modal" data-title="'.tr('Aggiungi registrazione contabile').'" data-href="add.php?id_module='.(new Module())->getByField('name', 'Prima nota').'&id_anagrafica='.$record['idanagrafica'].'"><i class="fa fa-euro"></i>'.tr('Nuova registrazione contabile (cliente)').'
<li><a data-toggle="modal" data-title="'.tr('Aggiungi registrazione contabile').'" data-href="add.php?id_module='.(new Module())->getByField('name', 'Prima nota', Models\Locale::getPredefined()->id).'&id_anagrafica='.$record['idanagrafica'].'"><i class="fa fa-euro"></i>'.tr('Nuova registrazione contabile (cliente)').'
</a></li>';
}
if (in_array($id_fornitore, $tipi_anagrafica)) {
echo '<li><a data-toggle="modal" data-title="'.tr('Aggiungi ordine fornitore').'" data-href="add.php?id_module='.(new Module())->getByField('name', 'Ordini fornitore').'&idanagrafica='.$record['idanagrafica'].'"><i class="fa fa-file-o fa-flip-horizontal"></i>'.tr('Nuovo ordine fornitore').'
echo '<li><a data-toggle="modal" data-title="'.tr('Aggiungi ordine fornitore').'" data-href="add.php?id_module='.(new Module())->getByField('name', 'Ordini fornitore', Models\Locale::getPredefined()->id).'&idanagrafica='.$record['idanagrafica'].'"><i class="fa fa-file-o fa-flip-horizontal"></i>'.tr('Nuovo ordine fornitore').'
</a></li>
<li><a data-toggle="modal" data-title="'.tr('Aggiungi ddt entrata').'" data-href="add.php?id_module='.(new Module())->getByField('name', 'Ddt di acquisto').'&idanagrafica='.$record['idanagrafica'].'"><i class="fa fa-truck fa-flip-horizontal"></i>'.tr('Nuovo ddt in entrata').'
<li><a data-toggle="modal" data-title="'.tr('Aggiungi ddt entrata').'" data-href="add.php?id_module='.(new Module())->getByField('name', 'Ddt di acquisto', Models\Locale::getPredefined()->id).'&idanagrafica='.$record['idanagrafica'].'"><i class="fa fa-truck fa-flip-horizontal"></i>'.tr('Nuovo ddt in entrata').'
</a></li>
<li><a data-toggle="modal" data-title="'.tr('Aggiungi fattura di acquisto').'" data-href="add.php?id_module='.(new Module())->getByField('name', 'Fatture di acquisto').'&idanagrafica='.$record['idanagrafica'].'"><i class="fa fa-file fa-flip-horizontal"></i>'.tr('Nuova fattura di acquisto').'
<li><a data-toggle="modal" data-title="'.tr('Aggiungi fattura di acquisto').'" data-href="add.php?id_module='.(new Module())->getByField('name', 'Fatture di acquisto', Models\Locale::getPredefined()->id).'&idanagrafica='.$record['idanagrafica'].'"><i class="fa fa-file fa-flip-horizontal"></i>'.tr('Nuova fattura di acquisto').'
</a></li>
<li><a data-toggle="modal" data-title="'.tr('Aggiungi registrazione contabile').'" data-href="add.php?id_module='.(new Module())->getByField('name', 'Prima nota').'&id_anagrafica='.$record['idanagrafica'].'"><i class="fa fa-euro"></i>'.tr('Nuova registrazione contabile (fornitore)').'
<li><a data-toggle="modal" data-title="'.tr('Aggiungi registrazione contabile').'" data-href="add.php?id_module='.(new Module())->getByField('name', 'Prima nota', Models\Locale::getPredefined()->id).'&id_anagrafica='.$record['idanagrafica'].'"><i class="fa fa-euro"></i>'.tr('Nuova registrazione contabile (fornitore)').'
</a></li>';
}

View File

@ -32,9 +32,9 @@ $is_agente = in_array($id_agente, $tipi_anagrafica);
$is_azienda = in_array($id_azienda, $tipi_anagrafica);
if (!$is_cliente && !$is_fornitore && !$is_azienda && $is_tecnico) {
$ignore = Plugin::where('id', '=', (new Plugin())->getByField('name', 'Sedi'))
->orWhere('id', '=', (new Plugin())->getByField('name', 'Referenti'))
->orWhere('id', '=', (new Plugin())->getByField('name', 'Dichiarazioni d\'intento'))
$ignore = Plugin::where('id', '=', (new Plugin())->getByField('name', 'Sedi', Models\Locale::getPredefined()->id))
->orWhere('id', '=', (new Plugin())->getByField('name', 'Referenti', Models\Locale::getPredefined()->id))
->orWhere('id', '=', (new Plugin())->getByField('name', 'Dichiarazioni d\'intento', Models\Locale::getPredefined()->id))
->get();
foreach ($ignore as $plugin) {
@ -46,9 +46,9 @@ if (!$is_cliente && !$is_fornitore && !$is_azienda && $is_tecnico) {
}
if (!$is_cliente) {
$ignore = Plugin::where('id', '=', (new Plugin())->getByField('name', 'Impianti del cliente'))
->orWhere('id', '=', (new Plugin())->getByField('name', 'Contratti del cliente'))
->orWhere('id', '=', (new Plugin())->getByField('name', 'Ddt del cliente'))
$ignore = Plugin::where('id', '=', (new Plugin())->getByField('name', 'Impianti del cliente', Models\Locale::getPredefined()->id))
->orWhere('id', '=', (new Plugin())->getByField('name', 'Contratti del cliente', Models\Locale::getPredefined()->id))
->orWhere('id', '=', (new Plugin())->getByField('name', 'Ddt del cliente', Models\Locale::getPredefined()->id))
->get();
foreach ($ignore as $plugin) {
@ -231,7 +231,7 @@ if (in_array($id_azienda, $tipi_anagrafica)) {
</div>
<div class="col-md-4">
{[ "type": "select", "label": "<?php echo tr('Zona'); ?>", "name": "idzona", "values": "query=SELECT id, CONCAT_WS( ' - ', nome, descrizione) AS descrizione FROM an_zone ORDER BY descrizione ASC", "value": "$idzona$", "placeholder": "<?php echo tr('Nessuna zona'); ?>", "icon-after": "add|<?php echo (new Module())->getByField('name', 'Zone'); ?>" ]}
{[ "type": "select", "label": "<?php echo tr('Zona'); ?>", "name": "idzona", "values": "query=SELECT id, CONCAT_WS( ' - ', nome, descrizione) AS descrizione FROM an_zone ORDER BY descrizione ASC", "value": "$idzona$", "placeholder": "<?php echo tr('Nessuna zona'); ?>", "icon-after": "add|<?php echo (new Module())->getByField('name', 'Zone', Models\Locale::getPredefined()->id); ?>" ]}
</div>
<div class="col-md-4">
@ -460,7 +460,7 @@ if ($is_cliente or $is_fornitore or $is_tecnico) {
</div>
<div class="col-md-3">
{[ "type": "select", "label": "'.tr('Relazione').'", "name": "idrelazione", "ajax-source": "relazioni", "value": "$idrelazione$", "icon-after": "add|'.(new Module())->getByField('name', 'Relazioni').'" ]}
{[ "type": "select", "label": "'.tr('Relazione').'", "name": "idrelazione", "ajax-source": "relazioni", "value": "$idrelazione$", "icon-after": "add|'.(new Module())->getByField('name', 'Relazioni', Models\Locale::getPredefined()->id).'" ]}
</div>
<div class="col-md-9">
@ -473,10 +473,8 @@ if ($is_cliente or $is_fornitore or $is_tecnico) {
</div>';
$banche = Banca::where('id_anagrafica', $anagrafica->id)->get();
$banca_predefinita = $banche->first(function ($item) {
return !empty($item['predefined']);
});
$modulo_banche = (new Module())->getByField('name', 'Banche');
$banca_predefinita = $banche->first(fn ($item) => !empty($item['predefined']));
$modulo_banche = (new Module())->getByField('name', 'Banche', Models\Locale::getPredefined()->id);
if (!$banche->isEmpty()) {
echo '
<div class="row">
@ -505,7 +503,7 @@ if ($is_cliente or $is_fornitore or $is_tecnico) {
<div class="tab-pane '.(!$is_cliente ? 'hide' : 'active').'" id="cliente">
<div class="row">
<div class="col-md-6">
{[ "type": "select", "label": "'.tr('Provenienza cliente').'", "name": "id_provenienza", "ajax-source": "provenienze", "value": "$id_provenienza$", "icon-after": "add|'.(new Module())->getByField('name', 'Provenienze').'" ]}
{[ "type": "select", "label": "'.tr('Provenienza cliente').'", "name": "id_provenienza", "ajax-source": "provenienze", "value": "$id_provenienza$", "icon-after": "add|'.(new Module())->getByField('name', 'Provenienze', Models\Locale::getPredefined()->id).'" ]}
</div>
<div class="col-md-6">
@ -695,7 +693,7 @@ if ($is_cliente or $is_fornitore or $is_tecnico) {
<div class="row">
<div class="col-md-3">
{[ "type": "select", "label": "<?php echo tr('Settore merceologico'); ?>", "name": "id_settore", "ajax-source": "settori", "value": "$id_settore$", "icon-after": "add|<?php echo (new Module())->getByField('name', 'Settori'); ?>" ]}
{[ "type": "select", "label": "<?php echo tr('Settore merceologico'); ?>", "name": "id_settore", "ajax-source": "settori", "value": "$id_settore$", "icon-after": "add|<?php echo (new Module())->getByField('name', 'Settori', Models\Locale::getPredefined()->id); ?>" ]}
</div>
<div class="col-md-3">

View File

@ -25,7 +25,7 @@ use Modules\Anagrafiche\Tipo;
$rs = Tipo::get();
foreach ($rs as $riga) {
${'id_'.strtolower($riga->getTranslation('name'))} = $riga->id;
${'id_'.strtolower($riga->getTranslation('name', Models\Locale::getPredefined()->id))} = $riga->id;
}
if (!empty($id_record)) {

View File

@ -26,8 +26,8 @@ use Models\PrintTemplate;
$id_record = filter('id_record');
$dir = filter('dir');
$nome_stampa = filter('nome_stampa');
$id_print = (new PrintTemplate())->getByField('name', $nome_stampa);
$id_module = (new Module())->getByField('name', 'Stampe contabili');
$id_print = (new PrintTemplate())->getByField('name', $nome_stampa, Models\Locale::getPredefined()->id);
$id_module = (new Module())->getByField('name', 'Stampe contabili', Models\Locale::getPredefined()->id);
$year = (new Carbon($_SESSION['period_end']))->format('Y');

View File

@ -60,53 +60,53 @@ if (empty($_GET['visualizza_allegati'])) {
}
// Interventi dell'anagrafica
if ($user->is_admin || in_array((new Module())->getByField('name', 'Interventi'), $permessi)) {
$interventi = $dbo->fetcharray('SELECT '.prepare((new Module())->getByField('name', 'Interventi'))." AS id_module, `id` AS id_record, CONCAT('Intervento num. ',codice,' del ',DATE_FORMAT(`data_richiesta`,'%d/%m/%Y')) AS descrizione FROM `in_interventi` WHERE `idanagrafica`=".prepare($id_record));
if ($user->is_admin || in_array((new Module())->getByField('name', 'Interventi', Models\Locale::getPredefined()->id), $permessi)) {
$interventi = $dbo->fetcharray('SELECT '.prepare((new Module())->getByField('name', 'Interventi', Models\Locale::getPredefined()->id))." AS id_module, `id` AS id_record, CONCAT('Intervento num. ',codice,' del ',DATE_FORMAT(`data_richiesta`,'%d/%m/%Y')) AS descrizione FROM `in_interventi` WHERE `idanagrafica`=".prepare($id_record));
$documenti = array_merge($documenti, $interventi);
}
// Preventivi dell'anagrafica
if ($user->is_admin || in_array((new Module())->getByField('name', 'Preventivi'), $permessi)) {
$preventivi = $dbo->fetcharray('SELECT '.prepare((new Module())->getByField('name', 'Preventivi'))." AS id_module, id AS id_record, CONCAT('Preventivo num. ',numero,' del ',DATE_FORMAT(data_bozza,'%d/%m/%Y')) AS descrizione FROM co_preventivi WHERE idanagrafica=".prepare($id_record));
if ($user->is_admin || in_array((new Module())->getByField('name', 'Preventivi', Models\Locale::getPredefined()->id), $permessi)) {
$preventivi = $dbo->fetcharray('SELECT '.prepare((new Module())->getByField('name', 'Preventivi', Models\Locale::getPredefined()->id))." AS id_module, id AS id_record, CONCAT('Preventivo num. ',numero,' del ',DATE_FORMAT(data_bozza,'%d/%m/%Y')) AS descrizione FROM co_preventivi WHERE idanagrafica=".prepare($id_record));
$documenti = array_merge($documenti, $preventivi);
}
// Contratti dell'anagrafica
if ($user->is_admin || in_array((new Module())->getByField('name', 'Contratti'), $permessi)) {
$contratti = $dbo->fetcharray('SELECT '.prepare((new Module())->getByField('name', 'Contratti'))." AS id_module, id AS id_record, CONCAT('Preventivo num. ',numero,' del ',DATE_FORMAT(data_bozza,'%d/%m/%Y')) AS descrizione FROM co_contratti WHERE idanagrafica=".prepare($id_record));
if ($user->is_admin || in_array((new Module())->getByField('name', 'Contratti', Models\Locale::getPredefined()->id), $permessi)) {
$contratti = $dbo->fetcharray('SELECT '.prepare((new Module())->getByField('name', 'Contratti', Models\Locale::getPredefined()->id))." AS id_module, id AS id_record, CONCAT('Preventivo num. ',numero,' del ',DATE_FORMAT(data_bozza,'%d/%m/%Y')) AS descrizione FROM co_contratti WHERE idanagrafica=".prepare($id_record));
$documenti = array_merge($documenti, $contratti);
}
// DDT dell'anagrafica
if ($user->is_admin || in_array((new Module())->getByField('name', 'Ddt di vendita'), $permessi)) {
$ddt_vendita = $dbo->fetcharray('SELECT '.prepare((new Module())->getByField('name', 'Ddt di vendita'))." AS id_module, id AS id_record, CONCAT('Ddt di vendita num. ',IFNULL(numero_esterno,numero),' del ',DATE_FORMAT(data,'%d/%m/%Y')) AS descrizione FROM dt_ddt WHERE idanagrafica=".prepare($id_record));
if ($user->is_admin || in_array((new Module())->getByField('name', 'Ddt di vendita', Models\Locale::getPredefined()->id), $permessi)) {
$ddt_vendita = $dbo->fetcharray('SELECT '.prepare((new Module())->getByField('name', 'Ddt di vendita', Models\Locale::getPredefined()->id))." AS id_module, id AS id_record, CONCAT('Ddt di vendita num. ',IFNULL(numero_esterno,numero),' del ',DATE_FORMAT(data,'%d/%m/%Y')) AS descrizione FROM dt_ddt WHERE idanagrafica=".prepare($id_record));
$documenti = array_merge($documenti, $ddt_vendita);
}
if ($user->is_admin || in_array((new Module())->getByField('name', 'Ddt di acquisto'), $permessi)) {
$ddt_acquisto = $dbo->fetcharray('SELECT '.prepare((new Module())->getByField('name', 'Ddt di acquisto'))." AS id_module, id AS id_record, CONCAT('Ddt di acquisto num. ',IFNULL(numero_esterno,numero),' del ',DATE_FORMAT(data,'%d/%m/%Y')) AS descrizione FROM dt_ddt WHERE idanagrafica=".prepare($id_record));
if ($user->is_admin || in_array((new Module())->getByField('name', 'Ddt di acquisto', Models\Locale::getPredefined()->id), $permessi)) {
$ddt_acquisto = $dbo->fetcharray('SELECT '.prepare((new Module())->getByField('name', 'Ddt di acquisto', Models\Locale::getPredefined()->id))." AS id_module, id AS id_record, CONCAT('Ddt di acquisto num. ',IFNULL(numero_esterno,numero),' del ',DATE_FORMAT(data,'%d/%m/%Y')) AS descrizione FROM dt_ddt WHERE idanagrafica=".prepare($id_record));
$documenti = array_merge($documenti, $ddt_acquisto);
}
// Fatture dell'anagrafica
if ($user->is_admin || in_array((new Module())->getByField('name', 'Fatture di vendita'), $permessi)) {
$fatture_vendita = $dbo->fetcharray('SELECT '.prepare((new Module())->getByField('name', 'Fatture di vendita'))." AS id_module, id AS id_record, CONCAT('Fattura di vendita num. ',IFNULL(numero_esterno,numero),' del ',DATE_FORMAT(data_registrazione,'%d/%m/%Y')) AS descrizione FROM co_documenti WHERE idanagrafica=".prepare($id_record));
if ($user->is_admin || in_array((new Module())->getByField('name', 'Fatture di vendita', Models\Locale::getPredefined()->id), $permessi)) {
$fatture_vendita = $dbo->fetcharray('SELECT '.prepare((new Module())->getByField('name', 'Fatture di vendita', Models\Locale::getPredefined()->id))." AS id_module, id AS id_record, CONCAT('Fattura di vendita num. ',IFNULL(numero_esterno,numero),' del ',DATE_FORMAT(data_registrazione,'%d/%m/%Y')) AS descrizione FROM co_documenti WHERE idanagrafica=".prepare($id_record));
$documenti = array_merge($documenti, $fatture_vendita);
}
if ($user->is_admin || in_array((new Module())->getByField('name', 'Fatture di acquisto'), $permessi)) {
$fatture_acquisto = $dbo->fetcharray('SELECT '.prepare((new Module())->getByField('name', 'Fatture di acquisto'))." AS id_module, id AS id_record, CONCAT('Fattura di acquisto num. ',IFNULL(numero_esterno,numero),' del ',DATE_FORMAT(data_registrazione,'%d/%m/%Y')) AS descrizione FROM co_documenti WHERE idanagrafica=".prepare($id_record));
if ($user->is_admin || in_array((new Module())->getByField('name', 'Fatture di acquisto', Models\Locale::getPredefined()->id), $permessi)) {
$fatture_acquisto = $dbo->fetcharray('SELECT '.prepare((new Module())->getByField('name', 'Fatture di acquisto', Models\Locale::getPredefined()->id))." AS id_module, id AS id_record, CONCAT('Fattura di acquisto num. ',IFNULL(numero_esterno,numero),' del ',DATE_FORMAT(data_registrazione,'%d/%m/%Y')) AS descrizione FROM co_documenti WHERE idanagrafica=".prepare($id_record));
$documenti = array_merge($documenti, $fatture_acquisto);
}
// Ordini dell'anagrafica
if ($user->is_admin || in_array((new Module())->getByField('name', 'Ordini cliente'), $permessi)) {
$ordini_vendita = $dbo->fetcharray('SELECT '.prepare((new Module())->getByField('name', 'Ordini cliente'))." AS id_module, id AS id_record, CONCAT('Ordine cliente num. ',IFNULL(numero_esterno,numero),' del ',DATE_FORMAT(data,'%d/%m/%Y')) AS descrizione FROM or_ordini WHERE idanagrafica=".prepare($id_record));
if ($user->is_admin || in_array((new Module())->getByField('name', 'Ordini cliente', Models\Locale::getPredefined()->id), $permessi)) {
$ordini_vendita = $dbo->fetcharray('SELECT '.prepare((new Module())->getByField('name', 'Ordini cliente', Models\Locale::getPredefined()->id))." AS id_module, id AS id_record, CONCAT('Ordine cliente num. ',IFNULL(numero_esterno,numero),' del ',DATE_FORMAT(data,'%d/%m/%Y')) AS descrizione FROM or_ordini WHERE idanagrafica=".prepare($id_record));
$documenti = array_merge($documenti, $ordini_vendita);
}
if ($user->is_admin || in_array((new Module())->getByField('name', 'Ordini fornitore'), $permessi)) {
$ordini_acquisto = $dbo->fetcharray('SELECT '.prepare((new Module())->getByField('name', 'Ordini fornitore'))." AS id_module, id AS id_record, CONCAT('Ordine fornitore num. ',IFNULL(numero_esterno,numero),' del ',DATE_FORMAT(data,'%d/%m/%Y')) AS descrizione FROM or_ordini WHERE idanagrafica=".prepare($id_record));
if ($user->is_admin || in_array((new Module())->getByField('name', 'Ordini fornitore', Models\Locale::getPredefined()->id), $permessi)) {
$ordini_acquisto = $dbo->fetcharray('SELECT '.prepare((new Module())->getByField('name', 'Ordini fornitore', Models\Locale::getPredefined()->id))." AS id_module, id AS id_record, CONCAT('Ordine fornitore num. ',IFNULL(numero_esterno,numero),' del ',DATE_FORMAT(data,'%d/%m/%Y')) AS descrizione FROM or_ordini WHERE idanagrafica=".prepare($id_record));
$documenti = array_merge($documenti, $ordini_acquisto);
}

View File

@ -156,7 +156,7 @@ class Anagrafica extends Model
public function setTipologieAttribute(array $tipologie)
{
if ($this->isAzienda()) {
$tipologie[] = (new TipoAnagrafica())->getByField('name', 'Azienda');
$tipologie[] = (new TipoAnagrafica())->getByField('name', 'Azienda', \Models\Locale::getPredefined()->id);
}
$tipologie = array_clean($tipologie);
@ -192,9 +192,7 @@ class Anagrafica extends Model
*/
public function isTipo($type)
{
return $this->tipi()->get()->search(function ($item, $key) use ($type) {
return TipoAnagrafica::find($item->id)->getTranslation('name') == $type;
}) !== false;
return $this->tipi()->get()->search(fn ($item, $key) => TipoAnagrafica::find($item->id)->getTranslation('name', \Models\Locale::getPredefined()->id) == $type) !== false;
}
public function delete()

View File

@ -280,7 +280,7 @@ class CSV extends CSVImporter
// Fix per campi con contenuti derivati da query implicite
if (!empty($record['id_nazione'])) {
$record['id_nazione'] = (new Nazione())->getByField('name', 'Italia');
$record['id_nazione'] = (new Nazione())->getByField('name', 'Italia', \Models\Locale::getPredefined()->id);
} else {
unset($record['id_nazione']);
}

View File

@ -46,11 +46,11 @@ $aliquota_predefinita = floatval(Aliquota::find($iva_predefinita)->percentuale);
</div>
<div class="col-md-6">
{[ "type": "select", "label": "<?php echo tr('Categoria'); ?>", "name": "categoria", "required": 0, "ajax-source": "categorie", "icon-after": "add|<?php echo (new Module())->getByField('name', 'Categorie articoli'); ?>" ]}
{[ "type": "select", "label": "<?php echo tr('Categoria'); ?>", "name": "categoria", "required": 0, "ajax-source": "categorie", "icon-after": "add|<?php echo (new Module())->getByField('name', 'Categorie articoli', Models\Locale::getPredefined()->id); ?>" ]}
</div>
<div class="col-md-6">
{[ "type": "select", "label": "<?php echo tr('Sottocategoria'); ?>", "name": "subcategoria", "id": "subcategoria_add", "ajax-source": "sottocategorie", "icon-after": "add|<?php echo (new Module())->getByField('name', 'Categorie articoli'); ?>||hide" ]}
{[ "type": "select", "label": "<?php echo tr('Sottocategoria'); ?>", "name": "subcategoria", "id": "subcategoria_add", "ajax-source": "sottocategorie", "icon-after": "add|<?php echo (new Module())->getByField('name', 'Categorie articoli', Models\Locale::getPredefined()->id); ?>||hide" ]}
</div>
</div>
@ -104,7 +104,7 @@ $aliquota_predefinita = floatval(Aliquota::find($iva_predefinita)->percentuale);
<div class="row">
<div class="col-md-4">
{[ "type": "select", "label": "<?php echo tr('Unità di misura'); ?>", "name": "um", "value": "", "ajax-source": "misure", "icon-after": "add|<?php echo (new Module())->getByField('name', 'Unità di misura articoli'); ?>" ]}
{[ "type": "select", "label": "<?php echo tr('Unità di misura'); ?>", "name": "um", "value": "", "ajax-source": "misure", "icon-after": "add|<?php echo (new Module())->getByField('name', 'Unità di misura articoli', Models\Locale::getPredefined()->id); ?>" ]}
</div>
<div class="col-md-4">
{[ "type": "select", "label": "<?php echo tr('U.m. secondaria'); ?>", "name": "um_secondaria", "value": "", "ajax-source": "misure", "help": "<?php echo tr("Unità di misura da utilizzare nelle stampe di Ordini fornitori in relazione all'articolo"); ?>" ]}

View File

@ -272,7 +272,7 @@ switch ($resource) {
}
// Ultimo prezzo al cliente
$ultimo_prezzo = $dbo->fetchArray('SELECT '.($prezzi_ivati ? '(`prezzo_unitario_ivato`-`sconto_unitario_ivato`)' : '(`prezzo_unitario`-`sconto_unitario`)').' AS prezzo_ultimo FROM `co_righe_documenti` INNER JOIN `co_documenti` ON `co_documenti`.`id`=`co_righe_documenti`.`iddocumento` INNER JOIN `co_tipidocumento` ON `co_tipidocumento`.`id`=`co_documenti`.`idtipodocumento` WHERE `idarticolo`='.prepare($id_articolo).' AND `idanagrafica`='.prepare($id_anagrafica).' AND `co_tipidocumento`.`dir`='.prepare($direzione).') ORDER BY `data` DESC LIMIT 0,1');
$ultimo_prezzo = $dbo->fetchArray('SELECT '.($prezzi_ivati ? '(`prezzo_unitario_ivato`-`sconto_unitario_ivato`)' : '(`prezzo_unitario`-`sconto_unitario`)').' AS prezzo_ultimo FROM `co_righe_documenti` INNER JOIN `co_documenti` ON `co_documenti`.`id`=`co_righe_documenti`.`iddocumento` INNER JOIN `co_tipidocumento` ON `co_tipidocumento`.`id`=`co_documenti`.`idtipodocumento` WHERE `idarticolo`='.prepare($id_articolo).' AND `idanagrafica`='.prepare($id_anagrafica).' AND `co_tipidocumento`.`dir`='.prepare($direzione).' ORDER BY `data` DESC LIMIT 0,1');
$results = array_merge($prezzi, $listino, $listini_sempre_visibili, $prezzo_articolo, $ultimo_prezzo);

View File

@ -20,7 +20,7 @@
include_once __DIR__.'/../../../core.php';
use Models\Module;
$link_id = (new Module())->getByField('name', 'Articoli');
$link_id = (new Module())->getByField('name', 'Articoli', Models\Locale::getPredefined()->id);
$prezzi_ivati = setting('Utilizza prezzi di vendita comprensivi di IVA');
$show_prezzi = Auth::user()['gruppo'] != 'Tecnici' || (Auth::user()['gruppo'] == 'Tecnici' && setting('Mostra i prezzi al tecnico'));

View File

@ -31,7 +31,7 @@ use Plugins\ListinoClienti\DettaglioPrezzo;
include_once __DIR__.'/../../core.php';
// Segmenti
$id_preventivi = (new Module())->getByField('name', 'Preventivi');
$id_preventivi = (new Module())->getByField('name', 'Preventivi', Models\Locale::getPredefined()->id);
$id_segment = $_SESSION['module_'.$id_preventivi]['id_segment'];
switch (post('op')) {

View File

@ -53,11 +53,11 @@ use Modules\Iva\Aliquota;
<div class="col-md-6">
<?php echo (!empty($record['id_categoria'])) ?
Modules::link('Categorie articoli', $record['id_categoria'], null, null, 'class="pull-right"') : ''; ?>
{[ "type": "select", "label": "<?php echo tr('Categoria'); ?>", "name": "categoria", "required": 0, "value": "$id_categoria$", "ajax-source": "categorie", "icon-after": "add|<?php echo (new Module())->getByField('name', 'Categorie articoli'); ?>" ]}
{[ "type": "select", "label": "<?php echo tr('Categoria'); ?>", "name": "categoria", "required": 0, "value": "$id_categoria$", "ajax-source": "categorie", "icon-after": "add|<?php echo (new Module())->getByField('name', 'Categorie articoli', Models\Locale::getPredefined()->id); ?>" ]}
</div>
<div class="col-md-6">
{[ "type": "select", "label": "<?php echo tr('Sottocategoria'); ?>", "name": "subcategoria", "value": "$id_sottocategoria$", "ajax-source": "sottocategorie", "select-options": <?php echo json_encode(['id_categoria' => $record['id_categoria']]); ?>, "icon-after": "add|<?php echo (new Module())->getByField('name', 'Categorie articoli'); ?>|id_original=<?php echo $record['id_categoria']; ?>" ]}
{[ "type": "select", "label": "<?php echo tr('Sottocategoria'); ?>", "name": "subcategoria", "value": "$id_sottocategoria$", "ajax-source": "sottocategorie", "select-options": <?php echo json_encode(['id_categoria' => $record['id_categoria']]); ?>, "icon-after": "add|<?php echo (new Module())->getByField('name', 'Categorie articoli', Models\Locale::getPredefined()->id); ?>|id_original=<?php echo $record['id_categoria']; ?>" ]}
</div>
</div>
</div>
@ -86,7 +86,7 @@ use Modules\Iva\Aliquota;
</div>
<div class="col-md-4">
{[ "type": "select", "label": "<?php echo tr('Unità di misura'); ?>", "name": "um", "value": "$um$", "ajax-source": "misure", "icon-after": "add|<?php echo (new Module())->getByField('name', 'Unità di misura'); ?>" ]}
{[ "type": "select", "label": "<?php echo tr('Unità di misura'); ?>", "name": "um", "value": "$um$", "ajax-source": "misure", "icon-after": "add|<?php echo (new Module())->getByField('name', 'Unità di misura', Models\Locale::getPredefined()->id); ?>" ]}
</div>
</div>

View File

@ -21,7 +21,7 @@ include_once __DIR__.'/../../core.php';
use Modules\Articoli\Articolo;
if (isset($id_record)) {
if (!empty($id_record)) {
$articolo = Articolo::withTrashed()->find($id_record);
$record = $dbo->fetchOne('SELECT *, `mg_articoli_lang`.`name` as descrizione, (SELECT COUNT(id) FROM `mg_prodotti` WHERE `id_articolo` = `mg_articoli`.`id`) AS serial FROM `mg_articoli` LEFT JOIN `mg_articoli_lang` ON (`mg_articoli_lang`.`id_record` = `mg_articoli`.`id` AND `mg_articoli_lang`.`id_lang` = '.prepare(Models\Locale::getDefault()->id).') WHERE `mg_articoli`.`id`='.prepare($id_record));

View File

@ -32,19 +32,19 @@ if (!function_exists('aggiorna_sedi_movimenti')) {
$idsede = ($rs[0]['dir'] == 'uscita') ? $rs[0]['idsede_destinazione'] : $rs[0]['idsede_partenza'];
$dbo->query('UPDATE `mg_movimenti` SET `idsede`='.prepare($idsede).' WHERE `reference_type`='.prepare('Modules\DDT\DDT').' AND `reference_id`='.prepare($id));
$dbo->query('UPDATE `mg_movimenti` SET `idsede`='.prepare($idsede).' WHERE `reference_type`='.prepare(Modules\DDT\DDT::class).' AND `reference_id`='.prepare($id));
} elseif ($module == 'documenti') {
$rs = $dbo->fetchArray('SELECT `idsede_partenza`, `idsede_destinazione`, `dir` FROM `co_documenti` INNER JOIN `co_tipidocumento` ON `co_tipidocumento`.`id` = `co_documenti`.`idtipodocumento` WHERE `co_documenti`.`id`='.prepare($id));
$idsede = ($rs[0]['dir'] == 'uscita') ? $rs[0]['idsede_destinazione'] : $rs[0]['idsede_partenza'];
$dbo->query('UPDATE mg_movimenti SET idsede='.prepare($idsede).' WHERE reference_type='.prepare('Modules\Fatture\Fattura').' AND reference_id='.prepare($id));
$dbo->query('UPDATE mg_movimenti SET idsede='.prepare($idsede).' WHERE reference_type='.prepare(Modules\Fatture\Fattura::class).' AND reference_id='.prepare($id));
} elseif ($module == 'interventi') {
$rs = $dbo->fetchArray('SELECT idsede_partenza, idsede_destinazione FROM in_interventi WHERE in_interventi.id='.prepare($id));
$idsede = $rs[0]['idsede_partenza'];
$dbo->query('UPDATE mg_movimenti SET idsede='.prepare($idsede).' WHERE reference_type='.prepare('Modules\Interventi\Intervento').' AND reference_id='.prepare($id));
$dbo->query('UPDATE mg_movimenti SET idsede='.prepare($idsede).' WHERE reference_type='.prepare(Modules\Interventi\Intervento::class).' AND reference_id='.prepare($id));
}
}
}

View File

@ -49,7 +49,7 @@ echo '
<div class="pull-right">';
echo '
<a class="btn btn-warning btn-xs" onclick="openModal(\''.tr('Movimenta articolo').'\', \''.base_path().'/modules/articoli/modals/add_movimento.php?id_module='.(new Module())->getByField('name', 'Movimenti').'&id_articolo='.$id_record.'\');">
<a class="btn btn-warning btn-xs" onclick="openModal(\''.tr('Movimenta articolo').'\', \''.base_path().'/modules/articoli/modals/add_movimento.php?id_module='.(new Module())->getByField('name', 'Movimenti', Models\Locale::getPredefined()->id).'&id_articolo='.$id_record.'\');">
<i class="fa fa-truck"></i>
'.tr('Movimenta articolo').'
</a>';
@ -69,7 +69,7 @@ if (empty($_GET['movimentazione_completa'])) {
}
echo '
<a class="btn btn-warning btn-xs" href="'.base_path().'/controller.php?id_module='.(new Module())->getByField('name', 'Movimenti').'&search_Articolo='.($articolo->codice.' - '.$articolo->getTranslation('name')).'">
<a class="btn btn-warning btn-xs" href="'.base_path().'/controller.php?id_module='.(new Module())->getByField('name', 'Movimenti', Models\Locale::getPredefined()->id).'&search_Articolo='.($articolo->codice.' - '.$articolo->getTranslation('name')).'">
<i class="fa fa-external-link"></i>
'.tr('Visualizza dettagli').'
</a>';
@ -149,7 +149,7 @@ if (!empty($movimenti)) {
// Data
$utente = $dbo->table('zz_users')->where('id', $movimento->idutente)->first();
$data = ($movimento->data ? $movimento->data : $movimento->data_movimento);
$data = ($movimento->data ?: $movimento->data_movimento);
echo '
<td class="text-center">'.dateFormat($data).' <span class="tip" title="'.tr('Creazione movimento: _DATE_ <br>Creatore movimento: _USER_', [
'_DATE_' => timestampFormat($movimento->data_movimento),

View File

@ -82,7 +82,7 @@ class Articoli extends Resource implements RetrieveInterface, UpdateInterface, C
$data = $request['data'];
// Gestione categoria
list($categoria, $sottocategoria) = $this->gestioneCategorie($data['categoria'], $data['sottocategoria']);
[$categoria, $sottocategoria] = $this->gestioneCategorie($data['categoria'], $data['sottocategoria']);
$articolo = Articolo::build($data['codice'], $categoria, $sottocategoria);
$articolo->setPrezzoVendita($data['prezzo_vendita'], $articolo->idiva_vendita);
@ -99,7 +99,7 @@ class Articoli extends Resource implements RetrieveInterface, UpdateInterface, C
$data = $request['data'];
$articolo = Articolo::find($request['id']);
list($categoria, $sottocategoria) = $this->gestioneCategorie($data['categoria'], $data['sottocategoria']);
[$categoria, $sottocategoria] = $this->gestioneCategorie($data['categoria'], $data['sottocategoria']);
// Gestione categoria
if (!empty($categoria)) {

View File

@ -207,7 +207,7 @@ class Articolo extends Model
return null;
}
$module = Module::find((new Module())->getByField('name', $this->module));
$module = Module::find((new Module())->getByField('name', $this->module, \Models\Locale::getPredefined()->id));
$fileinfo = \Uploads::fileInfo($this->immagine);
$directory = '/'.$module->upload_directory.'/';
@ -296,9 +296,7 @@ class Articolo extends Model
}
$movimenti = $movimenti->get()
->mapToGroups(function ($item, $key) {
return [$item->idsede => (float) $item->attributes['qta']];
})
->mapToGroups(fn ($item, $key) => [$item->idsede => (float) $item->attributes['qta']])
->toArray();
return $movimenti;

View File

@ -106,21 +106,19 @@ class CSV extends CSVImporter
],
],
[
'field' => 'id_categoria',
'field' => 'categoria',
'label' => 'Categoria',
'names' => [
'Categoria',
'categoria',
'idcategoria',
],
],
[
'field' => 'id_sottocategoria',
'field' => 'sottocategoria',
'label' => 'Sottocategoria',
'names' => [
'Sottocategoria',
'sottocategoria',
'idsottocategoria',
],
],
[
@ -277,22 +275,23 @@ class CSV extends CSVImporter
// Gestione categoria e sottocategoria
$categoria = null;
$sottocategoria = null;
if (!empty($record['id_categoria'])) {
if (!empty($record['categoria'])) {
// Categoria
$categoria = Categoria::where('nome', strtolower($record['id_categoria']))->first();
$categoria = Categoria::where('id', '=', (new Categoria())->getByField('name', strtolower($record['categoria'])))->first();
if (empty($categoria)) {
$categoria = Categoria::build($record['id_categoria']);
$categoria = Categoria::build();
$categoria->setTranslation('name', $record['categoria']);
$categoria->save();
}
// Sotto-categoria
if (!empty($record['id_sottocategoria'])) {
$sottocategoria = Categoria::where('nome', $record['id_sottocategoria'])
->where('parent', $categoria->id)
->first();
if (!empty($record['sottocategoria'])) {
$sottocategoria = Categoria::where('id', '=', (new Categoria())->getByField('name', strtolower($record['sottocategoria'])))->first();
if (empty($sottocategoria)) {
$sottocategoria = Categoria::build($record['id_sottocategoria']);
$sottocategoria = Categoria::build();
$sottocategoria->setTranslation('name', $record['sottocategoria']);
$sottocategoria->parent()->associate($categoria);
$sottocategoria->save();
}
@ -368,7 +367,7 @@ class CSV extends CSVImporter
if (!empty($file_content)) {
if ($record['import_immagine'] == 2 || $record['import_immagine'] == 4) {
\Uploads::deleteLinked([
'id_module' => (new Module())->getByField('name', 'Articoli'),
'id_module' => (new Module())->getByField('name', 'Articoli', \Models\Locale::getPredefined()->id),
'id_record' => $articolo->id,
]);
@ -385,7 +384,7 @@ class CSV extends CSVImporter
'name' => 'Immagine',
'category' => 'Immagini',
'original_name' => $name,
'id_module' => (new Module())->getByField('name', 'Articoli'),
'id_module' => (new Module())->getByField('name', 'Articoli', \Models\Locale::getPredefined()->id),
'id_record' => $articolo->id,
], [
'thumbnails' => true,
@ -410,8 +409,8 @@ class CSV extends CSVImporter
$articolo->fill($record);
$articolo->fill([
'id_categoria' => $categoria->id ?: $articolo['id_categoria'],
'id_sottocategoria' => $sottocategoria->id ?: $articolo['id_sottocategoria'],
'categoria' => $categoria->id ?: $articolo['categoria'],
'sottocategoria' => $sottocategoria->id ?: $articolo['sottocategoria'],
]);
// Prezzo di vendita

View File

@ -85,11 +85,7 @@ class Movimento extends Model
public function getQtaAttribute()
{
if (isset($this->qta_documento)) {
return $this->qta_documento;
}
return $this->qta;
return $this->qta_documento ?? $this->qta;
}
public function articolo()

View File

@ -21,7 +21,7 @@ include_once __DIR__.'/../../core.php';
use Modules\AttributiCombinazioni\Attributo;
if (isset($id_record)) {
if (!empty($id_record)) {
$attributo = Attributo::find($id_record);
$record = $attributo->toArray();

View File

@ -48,15 +48,15 @@ switch (post('op')) {
case 'addtech':
$idtecnico = post('idtecnico');
$data_inizio = post('data_inizio');
$data_fine = null;
$data_fine = post('data_fine');
// Controllo sull'effettivo inserimento di una data di fine successiva a quella di inizio
if (!empty(post('data_fine'))) {
if (!empty($data_fine)) {
if (new DateTime(post('data_fine')) >= new DateTime($data_inizio)) {
$data_fine = post('data_fine');
}
}
$data_fine = isset($data_fine) ? $data_fine : '0000-00-00';
$data_fine ??= '0000-00-00';
// Inserisco il tecnico
$dbo->insert('an_sedi_tecnici', [
@ -74,17 +74,17 @@ switch (post('op')) {
$errors = 0;
foreach (post('data_inizio') as $idautomezzotecnico => $data) {
$idautomezzotecnico = $idautomezzotecnico;
$idtecnico = post('idtecnico')[$idautomezzotecnico];
$data_inizio = post('data_inizio')[$idautomezzotecnico];
$data_fine = null;
$data_fine = post('data_fine')[$idautomezzotecnico];
// Controllo sull'effettivo inserimento di una data di fine successiva a quella di inizio
if (!empty(post('data_fine')[$idautomezzotecnico])) {
if (new DateTime(post('data_fine')[$idautomezzotecnico]) >= new DateTime($data_inizio)) {
$data_fine = post('data_fine')[$idautomezzotecnico];
if (!empty($data_fine)) {
if (new DateTime($data_fine) < new DateTime($data_inizio)) {
$data_fine = null;
}
}
$data_fine = isset($data_fine) ? $data_fine : '0000-00-00';
$data_fine ??= '0000-00-00';
$dbo->update('an_sedi_tecnici', [
'idtecnico' => $idtecnico,

View File

@ -17,7 +17,7 @@ if (!empty($idarticolo) && !empty($idautomezzo)) {
Form di inserimento riga documento
*/
echo '
<form id="link_form" action="'.$rootdir.'/editor.php?id_module='.(new Module())->getByField('name', 'Automezzi').'&id_record='.$idautomezzo.'" method="post">
<form id="link_form" action="'.$rootdir.'/editor.php?id_module='.(new Module())->getByField('name', 'Automezzi', Models\Locale::getPredefined()->id).'&id_record='.$idautomezzo.'" method="post">
<input type="hidden" name="op" value="'.$op.'">
<input type="hidden" name="backto" value="record-edit">
<input type="hidden" name="id_record" value="'.$idautomezzo.'">';

View File

@ -7,7 +7,7 @@ $id_record = get('idautomezzo');
// Form di inserimento responsabili automezzo
echo '
<form action="'.$rootdir.'/editor.php?id_module='.(new Module())->getByField('name', 'Automezzi').'&id_record='.$id_record.'" method="post">
<form action="'.$rootdir.'/editor.php?id_module='.(new Module())->getByField('name', 'Automezzi', Models\Locale::getPredefined()->id).'&id_record='.$id_record.'" method="post">
<input type="hidden" name="op" value="addtech">
<input type="hidden" name="backto" value="record-edit">
<input type="hidden" name="id_record" value="'.$id_record.'">

View File

@ -3,7 +3,7 @@
include_once __DIR__.'/../../../core.php';
use Models\Module;
$link_id = (new Module())->getByField('name', 'Automezzi');
$link_id = (new Module())->getByField('name', 'Automezzi', Models\Locale::getPredefined()->id);
$fields = [
'Nome' => 'nome',

View File

@ -52,7 +52,7 @@ unset($_SESSION['superselect']['idautomezzo']);
<div class="panel-body">
<div class="row">
<div class="col-md-12" >
<form action="<?php echo $rootdir; ?>/editor.php?id_module=<?php echo (new Module())->getByField('name', 'Automezzi'); ?>&id_record=<?php echo $id_record; ?>" id="updatetech-form" method="post" role="form">
<form action="<?php echo $rootdir; ?>/editor.php?id_module=<?php echo (new Module())->getByField('name', 'Automezzi', Models\Locale::getPredefined()->id); ?>&id_record=<?php echo $id_record; ?>" id="updatetech-form" method="post" role="form">
<input type="hidden" name="backto" value="record-edit">
<input type="hidden" name="id_record" value="<?php echo $id_record; ?>">
<input type="hidden" name="op" value="">

View File

@ -2,6 +2,6 @@
include_once __DIR__.'/../../core.php';
if (isset($id_record)) {
if (!empty($id_record)) {
$record = $dbo->fetchOne('SELECT * FROM an_sedi WHERE an_sedi.id='.prepare($id_record));
}

View File

@ -24,7 +24,7 @@ if (!empty($rs_art)) {
echo '
<tr>
<td>
<input type="hidden" name="idautomezzotecnico[]" value="'.$r['id'].'">
<input type="hidden" name="idtecnico['.$r['id'].']" value="'.$r['idtecnico'].'">
'.$r['ragione_sociale'].'
</td>';
@ -37,7 +37,7 @@ if (!empty($rs_art)) {
// Data di fine
echo '
<td>
{[ "type": "date", "name": "data_fine['.$r['id'].']", "required": 1, "value": "'.$r['data_fine'].'", "min-date": "'.$r['data_inizio'].'" ]}
{[ "type": "date", "name": "data_fine['.$r['id'].']", "value": "'.$r['data_fine'].'", "min-date": "'.$r['data_inizio'].'" ]}
</td>';
// Pulsanti per aggiornamento date tecnici

View File

@ -98,10 +98,11 @@ if (filter('op') == 'restore') {
return;
}
if (filter('number') == null) {
$number = filter('number');
if ($number === null) {
$path = $_FILES['blob']['tmp_name'];
} else {
$number = filter('number');
$number != '' ? $number : 0;
$number = intval($number);
$backups = Backup::getList();

View File

@ -21,7 +21,7 @@ use Modules\Banche\Banca;
include_once __DIR__.'/../../core.php';
if (isset($id_record)) {
if (!empty($id_record)) {
$banca = Banca::find($id_record);
if (!empty($banca)) {

View File

@ -82,7 +82,7 @@ class Banca extends Model
protected function fixPredefined()
{
$predefined = isset($this->predefined) ? $this->predefined : false;
$predefined = $this->predefined ?? false;
// Selezione automatica per primo record
$count = self::where('id_anagrafica', $this->id_anagrafica)

View File

@ -23,8 +23,8 @@ switch (post('op')) {
case 'update':
$descrizione = post('descrizione');
if ($dbo->fetchNum('SELECT * FROM `dt_aspettobeni` LEFT JOIN `dt_aspettobeni_lang` ON (`dt_aspettobeni`.`id`=`dt_aspettobeni_lang`.`id_record` AND `dt_aspettobeni_lang`.`lang`='.prepare(Models\Locale::getDefault()->id).') WHERE `name`='.prepare($descrizione).' AND `dt_aspettobeni`.`id`!='.prepare($id_record)) == 0) {
$dbo->query('UPDATE `dt_aspettobeni_lang` SET `name`='.prepare($descrizione).' WHERE `id_record`='.prepare($id_record)).' AND `lang`='.prepare(Models\Locale::getDefault()->id);
if (empty($dbo->fetchArray('SELECT * FROM `dt_aspettobeni` LEFT JOIN `dt_aspettobeni_lang` ON (`dt_aspettobeni`.`id`=`dt_aspettobeni_lang`.`id_record` AND `dt_aspettobeni_lang`.`id_lang`='.prepare(Models\Locale::getDefault()->id).') WHERE `name`='.prepare($descrizione).' AND `dt_aspettobeni`.`id`!='.prepare($id_record)))) {
$dbo->query('UPDATE `dt_aspettobeni_lang` SET `name`='.prepare($descrizione).' WHERE `id_record`='.prepare($id_record)).' AND `id_lang`='.prepare(Models\Locale::getDefault()->id);
flash()->info(tr('Salvataggio completato.'));
} else {
flash()->error(tr("E' già presente un aspetto beni con questa descrizione."));
@ -34,7 +34,7 @@ switch (post('op')) {
case 'add':
$descrizione = post('descrizione');
if ($dbo->fetchNum('SELECT * FROM `dt_aspettobeni_lang` WHERE `name`='.prepare($descrizione)) == 0) {
if (empty($dbo->fetchArray('SELECT * FROM `dt_aspettobeni` LEFT JOIN `dt_aspettobeni_lang` ON (`dt_aspettobeni`.`id`=`dt_aspettobeni_lang`.`id_record` AND `dt_aspettobeni_lang`.`id_lang`='.prepare(Models\Locale::getDefault()->id).') WHERE `name`='.prepare($descrizione)))) {
$dbo->query('INSERT INTO `dt_aspettobeni` (`created_at`) VALUES (NOW())');
$id_record = $dbo->lastInsertedID();
@ -54,7 +54,7 @@ switch (post('op')) {
case 'delete':
$documenti = $dbo->fetchNum('SELECT `id` FROM `dt_ddt` WHERE `idaspettobeni`='.prepare($id_record).' UNION SELECT `id` FROM `co_documenti` WHERE `idaspettobeni`='.prepare($id_record));
if (isset($id_record) && empty($documenti)) {
if ((!empty($id_record)) && empty($documenti)) {
$dbo->query('DELETE FROM `dt_aspettobeni` WHERE `id`='.prepare($id_record));
flash()->info(tr('Aspetto beni eliminato con successo.'));
} else {

View File

@ -19,6 +19,6 @@
include_once __DIR__.'/../../core.php';
if (isset($id_record)) {
if (!empty($id_record)) {
$record = $dbo->fetchOne('SELECT * FROM `dt_aspettobeni` LEFT JOIN `dt_aspettobeni_lang` ON (`dt_aspettobeni`.`id`=`dt_aspettobeni_lang`.`id_record` AND `dt_aspettobeni_lang`.`id_lang`='.prepare(Models\Locale::getDefault()->id).') WHERE `dt_aspettobeni`.`id`='.prepare($id_record));
}

View File

@ -21,7 +21,7 @@ include_once __DIR__.'/../../core.php';
$id_original = filter('id_original');
if (isset($id_record)) {
if (!empty($id_record)) {
include __DIR__.'/init.php';
}
@ -29,7 +29,7 @@ if (isset($id_record)) {
if (isset($id_original)) {
echo base_path().'/controller.php?id_module='.$id_module;
if (isset($id_record)) {
if (!empty($id_record)) {
echo '&id_record='.$id_record;
}
}
@ -40,7 +40,7 @@ if (isset($id_original)) {
<div class="row">
<div class="col-md-8">
{[ "type": "text", "label": "<?php echo tr('Nome'); ?>", "name": "nome", "required": 1, "value": "<?php echo $categoria->getTranslation('name'); ?>" ]}
{[ "type": "text", "label": "<?php echo tr('Nome'); ?>", "name": "nome", "required": 1, "value": "$name$" ]}
</div>
<div class="col-md-4">
@ -58,7 +58,7 @@ if (isset($id_original)) {
<div class="row">
<div class="col-md-12 text-right">
<?php
if (isset($id_record)) {
if (!empty($id_record)) {
?>
<button type="submit" class="btn btn-success"><i class="fa fa-save"></i> <?php echo tr('Salva'); ?></button>
<?php

View File

@ -20,7 +20,7 @@
include_once __DIR__.'/../../core.php';
use Modules\Articoli\Categoria;
if (isset($id_record)) {
if (!empty($id_record)) {
$record = $dbo->fetchOne('SELECT * FROM `mg_categorie` LEFT JOIN `mg_categorie_lang` ON (`mg_categorie`.`id`=`mg_categorie_lang`.`id_record` AND `mg_categorie_lang`.`id_lang`='.prepare(Models\Locale::getDefault()->id).') WHERE `mg_categorie`.`id`='.prepare($id_record));
$categoria = Categoria::find($id_record);

View File

@ -37,7 +37,7 @@ if ($record['doc_associati'] > 0) {
</div>
<div class="col-md-3">
{[ "type": "select", "label": "<?php echo tr('Gruppi abilitati'); ?>", "name": "permessi[]", "value": "$permessi$", "values": "query=SELECT `zz_groups`.`id`, `zz_groups_lang`.`name` AS text FROM `zz_groups`", "multiple": 1 ]}
{[ "type": "select", "label": "<?php echo tr('Gruppi abilitati'); ?>", "name": "permessi[]", "value": "$permessi$", "values": "query=SELECT `zz_groups`.`id`, `zz_groups_lang`.`name` AS text FROM `zz_groups` LEFT JOIN `zz_groups_lang` ON (`zz_groups`.`id` = `zz_groups_lang`.`id_record` AND `zz_groups_lang`.`id_lang` = <?php echo prepare(Models\Locale::getDefault()->id); ?>)", "multiple": 1 ]}
</div>
</div>
</form>

View File

@ -21,7 +21,7 @@ include_once __DIR__.'/../../core.php';
use Modules\CategorieDocumentali\Categoria;
if (isset($id_record)) {
if (!empty($id_record)) {
$categoria = Categoria::find($id_record);
$record = $dbo->fetchOne('SELECT *,

View File

@ -21,8 +21,9 @@ include_once __DIR__.'/../../core.php';
use Models\Module;
use Modules\Checklists\Check;
use Modules\Impianti\Categoria;
$modulo_impianti = (new Module())->getByField('name', 'Impianti');
$modulo_impianti = (new Module())->getByField('name', 'Impianti', Models\Locale::getPredefined()->id);
switch (filter('op')) {
case 'update':
@ -32,13 +33,11 @@ switch (filter('op')) {
$id_original = filter('id_original') ?: null;
if (isset($nome) && isset($nota) && isset($colore)) {
$database->table('my_impianti_categorie')
->where('id', '=', $id_record)
->update([
'nome' => $nome,
'nota' => $nota,
'colore' => $colore,
]);
$categoria->nota = $nota;
$categoria->colore = $colore;
$categoria->parent = $id_original ?: null;
$categoria->setTranslation('name', $nome);
$categoria->save();
flash()->info(tr('Salvataggio completato!'));
} else {
@ -61,32 +60,26 @@ switch (filter('op')) {
$id_original = filter('id_original') ?: null;
// Ricerca corrispondenze con stesso nome
$corrispondenze = $database->table('my_impianti_categorie')
->where('nome', '=', $nome);
$categoria_new = Categoria::where('id', '=', (new Categoria())->getByField('name', $nome));
if (!empty($id_original)) {
$corrispondenze = $corrispondenze->where('parent', '=', $id_original);
$categoria_new = $categoria_new->where('parent', '=', $id_original);
} else {
$corrispondenze = $corrispondenze->whereNull('parent');
$categoria_new = $categoria_new->whereNull('parent');
}
$corrispondenze = $corrispondenze->get();
$categoria_new = $categoria_new->first();
// Eventuale creazione del nuovo record
if ($corrispondenze->count() == 0) {
$id_record = $database->table('my_impianti_categorie')
->insertGetId([
'nome' => $nome,
'nota' => $nota,
'colore' => $colore,
'parent' => $id_original,
]);
if (!empty($categoria_new)) {
flash()->error(tr('Questo nome è già stato utilizzato per un altra categoria.'));
} else {
$categoria = Categoria::build($nota, $colore);
$id_record = $dbo->lastInsertedID();
$categoria->parent = $id_original;
$categoria->setTranslation('name', $nome);
$categoria->save();
flash()->info(tr('Aggiunta nuova tipologia di _TYPE_', [
'_TYPE_' => 'categoria',
]));
} else {
$id_record = $corrispondenze->first()->id;
flash()->error(tr('Esiste già una categoria con lo stesso nome!'));
}
if (isAjaxRequest()) {
@ -106,7 +99,7 @@ switch (filter('op')) {
$id = $id_record;
}
if ($dbo->fetchNum('SELECT * FROM `my_impianti` WHERE (`id_categoria`='.prepare($id).' OR `id_sottocategoria`='.prepare($id).' OR `id_sottocategoria` IN (SELECT id FROM `my_impianti_categorie` WHERE `parent`='.prepare($id).')) AND `deleted_at` IS NULL') == 0) {
if (empty($dbo->fetchArray('SELECT * FROM `my_impianti` WHERE (`id_categoria`='.prepare($id).' OR `id_sottocategoria`='.prepare($id).' OR `id_sottocategoria` IN (SELECT `id` FROM `my_impianti_categorie` WHERE `parent`='.prepare($id).'))'))) {
$dbo->query('DELETE FROM `my_impianti_categorie` WHERE `id`='.prepare($id));
flash()->info(tr('_TYPE_ eliminata con successo!', [
@ -121,7 +114,7 @@ switch (filter('op')) {
case 'sync_checklist':
// Azzeramento checklist impianti della categoria
database()->query('DELETE FROM `zz_checks` WHERE `id_module` = '.prepare($modulo_impianti['id']).' AND `id_record` IN(SELECT `id` FROM `my_impianti` WHERE `id_categoria` = '.prepare($id_record).')');
$checks_categoria = $dbo->fetchArray('SELECT * FROM zz_checks WHERE id_module = '.prepare($id_module).' AND id_record = '.prepare($id_record));
$impianti = $dbo->select('my_impianti', '*', [], ['id_categoria' => $id_record]);

View File

@ -21,7 +21,7 @@ include_once __DIR__.'/../../core.php';
$id_original = filter('id_original');
if (isset($id_record)) {
if (!empty($id_record)) {
include __DIR__.'/init.php';
}
@ -29,7 +29,7 @@ if (isset($id_record)) {
if (isset($id_original)) {
echo base_path().'/controller.php?id_module='.$id_module;
if (isset($id_record)) {
if (!empty($id_record)) {
echo '&id_record='.$id_record;
}
}
@ -58,7 +58,7 @@ if (isset($id_original)) {
<div class="row">
<div class="col-md-12 text-right">
<?php
if (isset($id_record)) {
if (!empty($id_record)) {
?>
<button type="submit" class="btn btn-success"><i class="fa fa-save"></i> <?php echo tr('Salva'); ?></button>
<?php

View File

@ -34,7 +34,7 @@ use Models\Module;
<div class="panel-body">
<div class="row">
<div class="col-md-8">
{[ "type": "text", "label": "<?php echo tr('Nome'); ?>", "name": "nome", "required": 1, "value": "$nome$" ]}
{[ "type": "text", "label": "<?php echo tr('Nome'); ?>", "name": "nome", "required": 1, "value": "$name$" ]}
</div>
<div class="col-md-4">
@ -94,7 +94,7 @@ use Models\Module;
<?php
$elementi = $dbo->fetchArray('SELECT `my_impianti`.`id`, `my_impianti`.`matricola`, `my_impianti`.`nome` FROM `my_impianti` WHERE (`id_categoria`='.prepare($id_record).' OR `id_sottocategoria`='.prepare($id_record).' OR `id_sottocategoria` IN (SELECT id FROM `my_impianti_categorie` WHERE `parent`='.prepare($id_record).'))');
$elementi = $dbo->fetchArray('SELECT `my_impianti`.`id`, `my_impianti`.`matricola`, `my_impianti`.`nome` FROM `my_impianti` WHERE (`id_categoria`='.prepare($id_record).' OR `id_sottocategoria`='.prepare($id_record).' OR `id_sottocategoria` IN (SELECT `id` FROM `my_impianti_categorie` WHERE `parent`='.prepare($id_record).'))');
if (!empty($elementi)) {
echo '

View File

@ -18,7 +18,10 @@
*/
include_once __DIR__.'/../../core.php';
use Modules\Impianti\Categoria;
if (isset($id_record)) {
$record = $dbo->fetchOne('SELECT * FROM `my_impianti_categorie` WHERE id='.prepare($id_record));
if (!empty($id_record)) {
$record = $dbo->fetchOne('SELECT * FROM `my_impianti_categorie` LEFT JOIN `my_impianti_categorie_lang` ON (`my_impianti_categorie`.`id`=`my_impianti_categorie_lang`.`id_record` AND `my_impianti_categorie_lang`.`id_lang` = '.prepare(Models\Locale::getDefault()->id).') WHERE `my_impianti_categorie`.`id`='.prepare($id_record));
$categoria = Categoria::find($id_record);
}

View File

@ -18,19 +18,20 @@
*/
include_once __DIR__.'/../../core.php';
use Modules\Impianti\Categoria;
$subcategorie = $dbo->fetchArray('SELECT * FROM `my_impianti_categorie` WHERE `parent`='.prepare($id_record).' ORDER BY nome ASC ');
$subcategorie = Categoria::where('parent', '=', $id_record)->get();
foreach ($subcategorie as $sub) {
$n_impianti = $dbo->fetchNum('SELECT * FROM `my_impianti` WHERE `id_sottocategoria`='.prepare($sub['id']).' AND deleted_at IS NULL');
$n_impianti = $dbo->fetchNum('SELECT * FROM `my_impianti` WHERE `id_sottocategoria`='.prepare($sub->id).' AND deleted_at IS NULL');
echo '
<tr>
<td>'.$sub['nome'].'</td>
<td>'.$sub['colore'].'</td>
<td>'.$sub['nota'].'</td>
<td>'.$sub->getTranslation('name').'</td>
<td>'.$sub->colore.'</td>
<td>'.$sub->nota.'</td>
<td>
<a class="btn btn-warning btn-sm" title="Modifica riga" onclick="launch_modal(\''.tr('Modifica sottocategoria').'\', \''.base_path().'/add.php?id_module='.$id_module.'&id_record='.$sub['id'].'&id_original='.$id_record.'\');"><i class="fa fa-edit"></i></a>
<a class="btn btn-sm btn-danger ask '.(($n_impianti > 0) ? 'disabled tip' : '').'" data-backto="record-edit" data-id="'.$sub['id'].'" title="'.(($n_impianti > 0) ? 'Sottocategoria collegata a '.$n_impianti.' articoli' : '').'">
<a class="btn btn-warning btn-sm" title="Modifica riga" onclick="launch_modal(\''.tr('Modifica sottocategoria').'\', \''.base_path().'/add.php?id_module='.$id_module.'&id_record='.$sub->id.'&id_original='.$id_record.'\');"><i class="fa fa-edit"></i></a>
<a class="btn btn-sm btn-danger ask '.(($n_impianti > 0) ? 'disabled tip' : '').'" data-backto="record-edit" data-id="'.$sub->id.'" title="'.(($n_impianti > 0) ? 'Sottocategoria collegata a '.$n_impianti.' articoli' : '').'">
<i class="fa fa-trash"></i>
</a>
</td>

View File

@ -25,7 +25,7 @@ switch (filter('op')) {
$predefined = post('predefined');
if (isset($descrizione)) {
if ($dbo->fetchNum('SELECT * FROM `dt_causalet` LEFT JOIN `dt_causalet_lang` ON (`dt_causalet`.`id` = `dt_causalet_lang`.`id_record` AND `dt_causalet_lang`.`id_lang` ='.prepare(Models\Locale::getDefault()->id).') WHERE `deleted_at` IS NULL AND `name`='.prepare($descrizione).' AND `dt_causalet`.`id`!='.prepare($id_record)) == 0) {
if (empty($dbo->fetchArray('SELECT * FROM `dt_causalet` LEFT JOIN `dt_causalet_lang` ON (`dt_causalet`.`id` = `dt_causalet_lang`.`id_record` AND `dt_causalet_lang`.`id_lang` ='.prepare(Models\Locale::getDefault()->id).') WHERE `deleted_at` IS NULL AND `name`='.prepare($descrizione).' AND `dt_causalet`.`id`!='.prepare($id_record)))) {
if (!empty($predefined)) {
$dbo->query('UPDATE dt_causalet SET predefined = 0');
}
@ -55,7 +55,7 @@ switch (filter('op')) {
$descrizione = filter('descrizione');
if (isset($descrizione)) {
if ($dbo->fetchNum('SELECT * FROM `dt_causalet` LEFT JOIN `dt_causalet_lang` ON (`dt_causalet`.`id` = `dt_causalet_lang`.`id_record` AND `dt_causalet_lang`.`id_lang` ='.prepare(Models\Locale::getDefault()->id).') WHERE `deleted_at` IS NULL AND `name`='.prepare($descrizione)) == 0) {
if (empty($dbo->fetchArray('SELECT * FROM `dt_causalet` LEFT JOIN `dt_causalet_lang` ON (`dt_causalet`.`id` = `dt_causalet_lang`.`id_record` AND `dt_causalet_lang`.`id_lang` ='.prepare(Models\Locale::getDefault()->id).') WHERE `deleted_at` IS NULL AND `name`='.prepare($descrizione)))) {
$dbo->insert('dt_causalet', [
'is_importabile' => 1,
]);
@ -83,7 +83,7 @@ switch (filter('op')) {
case 'delete':
$documenti = $dbo->fetchNum('SELECT `id` FROM `dt_ddt` WHERE `idcausalet`='.prepare($id_record).' UNION SELECT `id` FROM `co_documenti` WHERE `idcausalet`='.prepare($id_record));
if (isset($id_record) && empty($documenti)) {
if ((!empty($id_record)) && empty($documenti)) {
$dbo->query('DELETE FROM `dt_causalet` WHERE `id`='.prepare($id_record));
} else {
$dbo->update('dt_causalet', [

View File

@ -19,6 +19,6 @@
include_once __DIR__.'/../../core.php';
if (isset($id_record)) {
if (!empty($id_record)) {
$record = $dbo->fetchOne('SELECT * FROM `dt_causalet` LEFT JOIN `dt_causalet_lang` ON (`dt_causalet`.`id` = `dt_causalet_lang`.`id_record` AND `dt_causalet_lang`.`id_lang` ='.prepare(Models\Locale::getDefault()->id).') WHERE `dt_causalet`.`id`='.prepare($id_record));
}

View File

@ -21,7 +21,7 @@ include_once __DIR__.'/../../core.php';
switch (filter('op')) {
case 'update':
if (isset($id_record)) {
if (!empty($id_record)) {
$database->update('mg_causali_movimenti', [
'tipo_movimento' => post('tipo_movimento'),
], ['id' => $id_record]);
@ -49,7 +49,7 @@ switch (filter('op')) {
break;
case 'delete':
if (isset($id_record)) {
if (!empty($id_record)) {
$dbo->query('DELETE FROM `mg_causali_movimenti` WHERE `id`='.prepare($id_record));
flash()->info(tr('Tipologia di _TYPE_ eliminata con successo!', [

View File

@ -19,6 +19,6 @@
include_once __DIR__.'/../../core.php';
if (isset($id_record)) {
if (!empty($id_record)) {
$record = $dbo->fetchOne('SELECT * FROM `mg_causali_movimenti` LEFT JOIN `mg_causali_movimenti_lang` ON (`mg_causali_movimenti`.`id` = `mg_causali_movimenti_lang`.`id_record` AND `mg_causali_movimenti_lang`.`id_lang` = '.prepare(Models\Locale::getDefault()->id).') WHERE `mg_causali_movimenti`.`id`='.prepare($id_record));
}

View File

@ -37,7 +37,7 @@ switch (post('op')) {
break;
case 'update':
$record->setTranslation('name', post('name'));
$record->name = post('name');
$record->id_module = post('module') ?: null;
$record->id_plugin = post('plugin') ?: null;

View File

@ -26,7 +26,7 @@ $list = [];
foreach ($checklists as $checklist) {
$list[] = [
'id' => $checklist->id,
'text' => $checklist->getTranslation('name'),
'text' => $checklist->name,
];
}

View File

@ -64,6 +64,7 @@ if ($main_check) {
$.post('<?php echo $rootdir; ?>/modules/checklists/ajax.php', {
op: "edit_check",
id_module: globals.id_module,
id_record: "<?php echo $id_record; ?>",
content: input('content_edit').get(),
is_titolo: input('is_titolo').get(),

View File

@ -41,7 +41,7 @@ echo '
</div>
<div class="col-md-3">
{[ "type": "select", "label": "'.tr('Plugin del template').'", "name": "plugin", "values": "query=SELECT `zz_plugins`.`id`, `zz_plugins_lang`.`title` AS descrizione, `zz_modules_lang`.`name` AS optgroup FROM zz_plugins INNER JOIN `zz_modules` ON `zz_plugins`.`id_module_to` = `zz_modules`.`id` LEFT JOIN `zz_modules_lang` ON (`zz_modules`.`id` = `zz_modules_lang`.`id_record` AND `zz_modules_lang`.`id_lang` = '.prepare(Models\Locale::getDefault()->id).') LEFT JOIN `zz_plugins_lang` ON (`zz_plugins`.`id` = `zz_plugins_lang`.`id_record` AND `zz_plugins_lang`.`id_lang` = '.prepare(Models\Locale::getDefault()->id).') WHERE `enabled` = 1", "value": "'.$record->id_plugin.'", "disabled": "'.!empty($record->id_module).'" ]}
{[ "type": "select", "label": "'.tr('Plugin del template').'", "name": "plugin", "values": "query=SELECT `zz_plugins`.`id`, `zz_plugins_lang`.`title` AS descrizione, `zz_modules_lang`.`name` AS optgroup FROM zz_plugins INNER JOIN `zz_modules` ON `zz_plugins`.`idmodule_to` = `zz_modules`.`id` LEFT JOIN `zz_modules_lang` ON (`zz_modules`.`id` = `zz_modules_lang`.`id_record` AND `zz_modules_lang`.`id_lang` = '.prepare(Models\Locale::getDefault()->id).') LEFT JOIN `zz_plugins_lang` ON (`zz_plugins`.`id` = `zz_plugins_lang`.`id_record` AND `zz_plugins_lang`.`id_lang` = '.prepare(Models\Locale::getDefault()->id).') WHERE `zz_plugins`.`enabled` = 1", "value": "'.$record->id_plugin.'", "disabled": "'.!empty($record->id_module).'" ]}
</div>
</div>
</div>
@ -211,6 +211,8 @@ function delete_check(id){
op: "delete_check",
id: id,
main_check: 1,
id_module: globals.id_module,
id_record: id,
}, function(){
location.reload();
});

View File

@ -22,8 +22,8 @@ include_once __DIR__.'/../../core.php';
use Models\Module;
use Modules\Checklists\Checklist;
$checklist_module = Module::find((new Module())->getByField('name', 'Checklists'));
$checklist_module = Module::find((new Module())->getByField('name', 'Checklists', Models\Locale::getPredefined()->id));
if (isset($id_record)) {
if (!empty($id_record)) {
$record = Checklist::find($id_record);
}

View File

@ -42,7 +42,7 @@ class Checklist extends Model
{
$model = new static();
$model->setTranslation('name', $nome);
$model->name = $nome;
$model->save();
return $model;

View File

@ -21,8 +21,8 @@ switch (filter('op')) {
}
$combinazione->setTranslation('name', $nome);
$combinazione->codice = post('codice');
$combinazione->id_categoria = post('id_categoria');
$combinazione->id_sottocategoria = post('id_sottocategoria');
$combinazione->id_categoria = post('id_categoria')?: null;
$combinazione->id_sottocategoria = post('id_sottocategoria')?: null;
$combinazione->save();
$id_record = $combinazione->id;

View File

@ -22,7 +22,7 @@ echo '
<div class="row">
<div class="col-md-6">
{[ "type": "select", "label": "'.tr('Categoria').'", "name": "id_categoria", "required": 0, "value": "$id_categoria$", "ajax-source": "categorie", "icon-after": "add|'.(new Module())->getByField('name', 'Categorie articoli').'" ]}
{[ "type": "select", "label": "'.tr('Categoria').'", "name": "id_categoria", "required": 0, "value": "$id_categoria$", "ajax-source": "categorie", "icon-after": "add|'.(new Module())->getByField('name', 'Categorie articoli', Models\Locale::getPredefined()->id).'" ]}
</div>
<div class="col-md-6">

View File

@ -22,7 +22,7 @@ echo '
</div>
<div class="col-md-6">
{[ "type": "text", "label": "'.tr('Nome').'", "name": "nome", "value": "'.$combinazione->getTranslation('name.').'", "required": 1, "help": "'.tr('Nome univoco della combinazione').'" ]}
{[ "type": "text", "label": "'.tr('Nome').'", "name": "nome", "value": "'.$combinazione->getTranslation('name').'", "required": 1, "help": "'.tr('Nome univoco della combinazione').'" ]}
</div>
</div>
@ -33,7 +33,7 @@ if (!empty($combinazione->id_categoria)) {
'.Modules::link('Categorie articoli', $combinazione->id_categoria, null, null, 'class="pull-right"');
}
echo '
{[ "type": "select", "label": "'.tr('Categoria').'", "name": "id_categoria", "required": 0, "value": "$id_categoria$", "ajax-source": "categorie", "icon-after": "add|'.(new Module())->getByField('name', 'Categorie articoli').'" ]}
{[ "type": "select", "label": "'.tr('Categoria').'", "name": "id_categoria", "required": 0, "value": "$id_categoria$", "ajax-source": "categorie", "icon-after": "add|'.(new Module())->getByField('name', 'Categorie articoli', Models\Locale::getPredefined()->id).'" ]}
</div>
<div class="col-md-6">

View File

@ -73,9 +73,7 @@ class Combinazione extends Model
$result = parent::save($options);
// Sincronizzazione dei campi condivisi con la Combinazione
$sincro = collect($this->toArray())->filter(function ($value, $key) {
return in_array($key, self::$campi_combinazione);
});
$sincro = collect($this->toArray())->filter(fn ($value, $key) => in_array($key, self::$campi_combinazione));
$this->sincronizzaCampi($sincro->toArray());
return $result;
@ -178,9 +176,7 @@ class Combinazione extends Model
return;
}
$sincro = collect($articolo->toArray())->filter(function ($value, $key) {
return in_array($key, self::$campi_varianti);
});
$sincro = collect($articolo->toArray())->filter(fn ($value, $key) => in_array($key, self::$campi_varianti));
$combinazione->sincronizzaCampi($sincro->toArray());
}
@ -219,9 +215,7 @@ class Combinazione extends Model
->update($values);
// Filtro campi combinazioni
$combo = collect($values)->filter(function ($value, $key) {
return in_array($key, self::$campi_combinazione);
});
$combo = collect($values)->filter(fn ($value, $key) => in_array($key, self::$campi_combinazione));
// Aggiornamento dati combinazioni
database()->table('mg_combinazioni')

View File

@ -110,8 +110,11 @@ switch (post('op')) {
$contratto->save();
$dbo->query('DELETE FROM my_impianti_contratti WHERE idcontratto='.prepare($id_record));
foreach ((array) post('matricolaimpianto') as $matricolaimpianto) {
$dbo->query('INSERT INTO my_impianti_contratti(idcontratto,idimpianto) VALUES('.prepare($id_record).', '.prepare($matricolaimpianto).')');
$matricola = post('matricolaimpianto');
if ($matricola) {
foreach ([$matricola] as $matricolaimpianto) {
$dbo->query('INSERT INTO my_impianti_contratti(idcontratto,idimpianto) VALUES('.prepare($id_record).', '.prepare($matricolaimpianto).')');
}
}
// Salvataggio costi attività unitari del contratto
@ -146,7 +149,7 @@ switch (post('op')) {
$new = $contratto->replicate(['idcontratto_prev']);
$new->numero = Contratto::getNextNumero($contratto->data_bozza, $contratto->id_segment);
$stato = (new Stato())->getByField('name', 'Bozza');
$stato = (new Stato())->getByField('name', 'Bozza', Models\Locale::getPredefined()->id);
$new->stato()->associate($stato);
$new->save();
@ -317,7 +320,7 @@ switch (post('op')) {
// Scollegamento intervento da contratto
case 'unlink':
if (get('idcontratto') !== null && get('idintervento') !== null) {
if (!empty(get('idcontratto')) && !empty(get('idintervento'))) {
$idcontratto = get('idcontratto');
$idintervento = get('idintervento');
@ -353,10 +356,10 @@ switch (post('op')) {
FROM
`co_documenti`
INNER JOIN `co_tipidocumento` ON `co_tipidocumento`.`id` = `co_documenti`.`idtipodocumento`
LEFT JOIN `co_tipidocumento_lang` ON (`co_tipidocumento`lang`.`id_record` = `co_tipidocumento`.`id` AND `co_tipidocumento_lang`.`id_lang` = '.prepare(Models\Locale::getDefault()->id).')
LEFT JOIN `co_tipidocumento_lang` ON (`co_tipidocumento_lang`.`id_record` = `co_tipidocumento`.`id` AND `co_tipidocumento_lang`.`id_lang` = '.prepare(Models\Locale::getDefault()->id).')
INNER JOIN co_righe_documenti ON `co_righe_documenti`.`iddocumento` = `co_documenti`.`id`
WHERE
`co_righe_documenti`.`idcontratto` = '.prepare($id_record).')'.'
`co_righe_documenti`.`idcontratto` = '.prepare($id_record).'
UNION
SELECT
`in_interventi`.`codice` AS `codice`,
@ -401,7 +404,7 @@ switch (post('op')) {
$new_contratto->data_bozza = Carbon::now();
$new_contratto->numero = Contratto::getNextNumero($new_contratto->data_bozza, $new_contratto->id_segment);
$stato = (new Stato())->getByField('name', 'Bozza');
$stato = (new Stato())->getByField('name', 'Bozza', Models\Locale::getPredefined()->id);
$new_contratto->stato()->associate($stato);
$new_contratto->save();
@ -452,7 +455,7 @@ switch (post('op')) {
foreach ($allegati as $allegato) {
$allegato->copia([
'id_module' => $id_module,
'id_plugin' => (new Plugin())->getByField('name', 'Pianificazione interventi'),
'id_plugin' => (new Plugin())->getByField('name', 'Pianificazione interventi', Models\Locale::getPredefined()->id),
'id_record' => $id_promemoria,
]);
}

View File

@ -25,7 +25,7 @@ $id_anagrafica = !empty(get('idanagrafica')) ? get('idanagrafica') : '';
$stati = get('pianificabile') ? 'SELECT `co_staticontratti`.`id`, `name` AS descrizione FROM `co_staticontratti` LEFT JOIN `co_staticontratti_lang` ON (`co_staticontratti`.`id` = `co_staticontratti_lang`.`id_record` AND `co_staticontratti_lang`.`id_lang` = '.prepare(Models\Locale::getDefault()->id).') WHERE `is_pianificabile`=1' : 'SELECT `co_staticontratti`.`id`, `name` AS descrizione FROM `co_staticontratti` LEFT JOIN `co_staticontratti_lang` ON (`co_staticontratti`.`id` = `co_staticontratti_lang`.`id_record` AND `co_staticontratti_lang`.`id_lang` = '.prepare(Models\Locale::getDefault()->id).')';
$stato = (new Stato())->getByField('name', 'Bozza');
$stato = (new Stato())->getByField('name', 'Bozza', Models\Locale::getPredefined()->id);
echo '
<form action="" method="post" id="add-form">
@ -33,7 +33,7 @@ echo '
<input type="hidden" name="backto" value="record-edit">
<!-- Fix creazione da Anagrafica -->
<input type="hidden" name="id_record" value="">
<input type="hidden" name="id_record" value="0">
<div class="row">
<div class="col-md-6">
@ -41,7 +41,7 @@ echo '
</div>
<div class="col-md-6">
{[ "type": "select", "label": "'.tr('Cliente').'", "name": "idanagrafica", "required": 1, "value": "'.$id_anagrafica.'", "ajax-source": "clienti", "icon-after": "add|'.(new Module())->getByField('name', 'Anagrafiche').'|tipoanagrafica=Cliente&readonly_tipo=1", "readonly": "'.((empty(get('idanagrafica'))) ? 0 : 1).'" ]}
{[ "type": "select", "label": "'.tr('Cliente').'", "name": "idanagrafica", "required": 1, "value": "'.$id_anagrafica.'", "ajax-source": "clienti", "icon-after": "add|'.(new Module())->getByField('name', 'Anagrafiche', Models\Locale::getPredefined()->id).'|tipoanagrafica=Cliente&readonly_tipo=1", "readonly": "'.((empty(get('idanagrafica'))) ? 0 : 1).'" ]}
</div>
</div>

View File

@ -31,10 +31,10 @@ use Modules\Fatture\Tipo;
use Plugins\PianificazioneInterventi\Promemoria;
// Segmenti
$id_fatture = (new Module())->getByField('name', 'Fatture di vendita');
$id_fatture = (new Module())->getByField('name', 'Fatture di vendita', Models\Locale::getPredefined()->id);
if (!isset($_SESSION['module_'.$id_fatture]['id_segment'])) {
$segments = Modules::getSegments($id_fatture);
$_SESSION['module_'.$id_fatture]['id_segment'] = isset($segments[0]['id']) ? $segments[0]['id'] : null;
$_SESSION['module_'.$id_fatture]['id_segment'] = $segments[0]['id'] ?? null;
}
$id_segment = $_SESSION['module_'.$id_fatture]['id_segment'];
$idconto = setting('Conto predefinito fatture di vendita');
@ -52,7 +52,7 @@ switch (post('op')) {
// Informazioni della fattura
$tipo_documento = Tipo::where('id', post('idtipodocumento'))->first();
$stato_documenti_accodabili = (new Stato())->getByField('name', 'Bozza'->id_record);
$stato_documenti_accodabili = (new Stato())->getByField('name', 'Bozza', Models\Locale::getPredefined()->id);
$accodare = post('accodare');
$data = date('Y-m-d');
@ -77,13 +77,9 @@ switch (post('op')) {
// Ricerca fattura per anagrafica tra le registrate
$id_sede = $raggruppamento == 'sede' ? $documento_import->idsede : 0;
if ($raggruppamento == 'sede') {
$fattura = $documenti->first(function ($item, $key) use ($id_anagrafica, $id_sede) {
return $item->anagrafica->id == $id_anagrafica && $item->idsede_destinazione == $id_sede;
});
$fattura = $documenti->first(fn ($item, $key) => $item->anagrafica->id == $id_anagrafica && $item->idsede_destinazione == $id_sede);
} else {
$fattura = $documenti->first(function ($item, $key) use ($id_anagrafica) {
return $item->anagrafica->id == $id_anagrafica;
});
$fattura = $documenti->first(fn ($item, $key) => $item->anagrafica->id == $id_anagrafica);
}
// Ricerca fattura per anagrafica se l'impostazione di accodamento è selezionata
@ -123,7 +119,7 @@ switch (post('op')) {
// Fix per idconto righe fattura
$articolo = ArticoloOriginale::find($copia->idarticolo);
$copia->id_conto = ($articolo->idconto_vendita ? $articolo->idconto_vendita : $idconto);
$copia->id_conto = ($articolo->idconto_vendita ?: $idconto);
// Aggiornamento seriali dalla riga dell'ordine
if ($copia->isArticolo()) {
@ -165,7 +161,7 @@ switch (post('op')) {
$new_contratto->data_conclusione = $new_contratto->data_accettazione->copy()->add($diff);
$new_contratto->data_bozza = Carbon::now();
$stato = (new StatoContratto())->getByField('name', 'Bozza');
$stato = (new StatoContratto())->getByField('name', 'Bozza', Models\Locale::getPredefined()->id);
$new_contratto->stato()->associate($stato);
$new_contratto->save();
@ -216,7 +212,7 @@ switch (post('op')) {
foreach ($allegati as $allegato) {
$allegato->copia([
'id_module' => $id_module,
'id_plugin' => (new Plugin())->getByField('name', 'Pianificazione interventi'),
'id_plugin' => (new Plugin())->getByField('name', 'Pianificazione interventi', Models\Locale::getPredefined()->id),
'id_record' => $id_promemoria,
]);
}
@ -271,7 +267,7 @@ $operations['crea_fattura'] = [
'title' => tr('Fatturare i _TYPE_ selezionati?', ['_TYPE_' => strtolower($module->getTranslation('name'))]),
'msg' => '{[ "type": "checkbox", "label": "<small>'.tr('Aggiungere alle fatture di vendita non ancora emesse?').'</small>", "placeholder": "'.tr('Aggiungere alle fatture esistenti non ancora emesse?').'", "name": "accodare" ]}<br>
{[ "type": "select", "label": "'.tr('Sezionale').'", "name": "id_segment", "required": 1, "ajax-source": "segmenti", "select-options": '.json_encode(['id_module' => $id_fatture, 'is_sezionale' => 1]).', "value": "'.$id_segment.'", "select-options-escape": true ]}<br>
{[ "type": "select", "label": "'.tr('Tipo documento').'", "name": "idtipodocumento", "required": 1, "values": "query=SELECT `co_tipidocumento`.`id`, CONCAT(`codice_tipo_documento_fe`, \' - \', `name`) AS descrizione FROM `co_tipidocumento` LEFT JOIN ` co_tipidocumento_lang` ON (`co_tipidocumento`.`id` = `co_tipidocumento_lang`.`id_record` AND `co_tipidocumento_lang`.`id_lang` = '.prepare(Models\Locale::getDefault()->id).') WHERE `enabled` = 1 AND `dir` =\'entrata\' ORDER BY `codice_tipo_documento_fe`", "value": "'.$idtipodocumento.'" ]}<br>
{[ "type": "select", "label": "'.tr('Tipo documento').'", "name": "idtipodocumento", "required": 1, "values": "query=SELECT `co_tipidocumento`.`id`, CONCAT(`codice_tipo_documento_fe`, \' - \', `name`) AS descrizione FROM `co_tipidocumento` LEFT JOIN `co_tipidocumento_lang` ON (`co_tipidocumento`.`id` = `co_tipidocumento_lang`.`id_record` AND `co_tipidocumento_lang`.`id_lang` = '.prepare(Models\Locale::getDefault()->id).') WHERE `enabled` = 1 AND `dir` =\'entrata\' ORDER BY `codice_tipo_documento_fe`", "value": "'.$idtipodocumento.'" ]}<br>
{[ "type": "select", "label": "'.tr('Raggruppa per').'", "name": "raggruppamento", "required": 1, "values": "list=\"cliente\":\"Cliente\",\"sede\":\"Sede\"" ]}',
'button' => tr('Procedi'),
'class' => 'btn btn-lg btn-warning',
@ -294,7 +290,7 @@ $operations['cambia_stato'] = [
'text' => '<span><i class="fa fa-refresh"></i> '.tr('Cambia stato'),
'data' => [
'title' => tr('Vuoi davvero aggiornare lo stato di questi contratti?'),
'msg' => '<br>{[ "type": "select", "label": "'.tr('Stato').'", "name": "id_stato", "required": 1, "values": "query=SELECT `co_staticontratti`.`id`, `name` AS descrizione, `colore` as _bgcolor_ FROM `co_staticontratti` LEFT JOIN `co_staticontratti_lang ON (`co_staticontratti`.`id` = `co_staticontratti_lang`.`id_record` AND `co_staticontratti_lang`.`id_lang` = '.prepare(Models\Locale::getDefault()->id).') ORDER BY `name`" ]}',
'msg' => '<br>{[ "type": "select", "label": "'.tr('Stato').'", "name": "id_stato", "required": 1, "values": "query=SELECT `co_staticontratti`.`id`, `name` AS descrizione, `colore` as _bgcolor_ FROM `co_staticontratti` LEFT JOIN `co_staticontratti_lang` ON (`co_staticontratti`.`id` = `co_staticontratti_lang`.`id_record` AND `co_staticontratti_lang`.`id_lang` = '.prepare(Models\Locale::getDefault()->id).') ORDER BY `name`" ]}',
'button' => tr('Procedi'),
'class' => 'btn btn-lg btn-warning',
'blank' => false,

Some files were not shown because too many files have changed in this diff Show More