diff --git a/modules/contratti/edit.php b/modules/contratti/edit.php
index 00e67cbda..79fb9375b 100755
--- a/modules/contratti/edit.php
+++ b/modules/contratti/edit.php
@@ -342,7 +342,7 @@ if (!$block_edit) {
-
+
{[ "type": "text", "label": "'.tr('Aggiungi un articolo tramite barcode').'", "name": "barcode", "extra": "autocomplete=\"off\"", "icon-before": "", "required": 0 ]}
@@ -350,7 +350,7 @@ if (!$block_edit) {
{[ "type": "select", "label": "'.tr('Articolo').'", "name": "id_articolo", "value": "", "ajax-source": "articoli", "select-options": {"permetti_movimento_a_zero": 1}, "icon-after": "add|'.Modules::get('Articoli')['id'].'" ]}
-
+
@@ -379,6 +379,10 @@ if (!$block_edit) {
+
+
+ {[ "type": "select", "label": "'.tr('Ordinamento').'", "name": "ordinamento", "class": "no-search", "value": "'.($_SESSION['module_'.$id_module]['order_row_desc'] ? 'desc' : 'manuale').'", "values": "list=\"desc\": \"'.tr('Ultima riga inserita').'\", \"manuale\": \"'.tr('Manuale').'\"" ]}
+
';
}
@@ -623,4 +627,16 @@ $(document).ready(function() {
$("#idreferente").selectReset();
});
});
+
+input("ordinamento").on("change", function(){
+ if (input(this).get() == "desc") {
+ session_set("module_'.$id_module.',order_row_desc", 1, "").then(function () {
+ caricaRighe(null);
+ });
+ } else {
+ session_set("module_'.$id_module.',order_row_desc").then(function () {
+ caricaRighe(null);
+ });
+ }
+});
';
diff --git a/modules/contratti/row-list.php b/modules/contratti/row-list.php
index 0d4966225..f80ec7703 100755
--- a/modules/contratti/row-list.php
+++ b/modules/contratti/row-list.php
@@ -20,7 +20,8 @@
include_once __DIR__.'/init.php';
$block_edit = $record['is_completato'];
-$righe = $contratto->getRighe();
+$order_row_desc = $_SESSION['module_'.$id_module]['order_row_desc'];
+$righe = $order_row_desc ? $contratto->getRighe()->sortByDesc('created_at') : $contratto->getRighe();
$direzione = $contratto->direzione;
$colspan = ($block_edit ? '5' : '6');
@@ -177,7 +178,7 @@ foreach ($righe as $riga) {
-
+
';
diff --git a/modules/ddt/edit.php b/modules/ddt/edit.php
index 5d9d2273b..54c371302 100755
--- a/modules/ddt/edit.php
+++ b/modules/ddt/edit.php
@@ -375,7 +375,7 @@ if (!$block_edit) {
-
+
{[ "type": "text", "label": "'.tr('Aggiungi un articolo tramite barcode').'", "name": "barcode", "extra": "autocomplete=\"off\"", "icon-before": "", "required": 0 ]}
@@ -383,7 +383,7 @@ if (!$block_edit) {
{[ "type": "select", "label": "'.tr('Articolo').'", "name": "id_articolo", "value": "", "ajax-source": "articoli", "select-options": {"permetti_movimento_a_zero": '.($dir == 'entrata' ? 0 : 1).', "idsede_partenza": '.intval($ddt->idsede_partenza).', "idsede_destinazione": '.intval($ddt->idsede_destinazione).', "idanagrafica": '.$ddt->idanagrafica.', "dir": "'.$dir.'", "idagente": '.$ddt->idagente.'}, "icon-after": "add|'.Modules::get('Articoli')['id'].'" ]}
-
+
@@ -424,6 +424,10 @@ if (!$block_edit) {
+
+
+ {[ "type": "select", "label": "'.tr('Ordinamento').'", "name": "ordinamento", "class": "no-search", "value": "'.($_SESSION['module_'.$id_module]['order_row_desc'] ? 'desc' : 'manuale').'", "values": "list=\"desc\": \"'.tr('Ultima riga inserita').'\", \"manuale\": \"'.tr('Manuale').'\"" ]}
+
';
}
@@ -648,10 +652,20 @@ if (in_array($record[$field_name], $user->sedi)) {
echo '
';
\ No newline at end of file
diff --git a/modules/ddt/row-list.php b/modules/ddt/row-list.php
index 8b42edf52..c504056d8 100755
--- a/modules/ddt/row-list.php
+++ b/modules/ddt/row-list.php
@@ -20,7 +20,8 @@
include_once __DIR__.'/init.php';
$block_edit = $record['flag_completato'];
-$righe = $ddt->getRighe();
+$order_row_desc = $_SESSION['module_'.$id_module]['order_row_desc'];
+$righe = $order_row_desc ? $ddt->getRighe()->sortByDesc('created_at') : $ddt->getRighe();
$colspan = ($block_edit ? '5' : '6');
$direzione = $ddt->direzione;
@@ -223,7 +224,7 @@ foreach ($righe as $riga) {
-
+
';
diff --git a/modules/fatture/edit.php b/modules/fatture/edit.php
index d44f05129..f7b6db711 100755
--- a/modules/fatture/edit.php
+++ b/modules/fatture/edit.php
@@ -815,7 +815,7 @@ if (!$block_edit) {
-
+
{[ "type": "text", "label": "'.tr('Aggiungi un articolo tramite barcode').'", "name": "barcode", "extra": "autocomplete=\"off\"", "icon-before": "", "required": 0 ]}
@@ -823,7 +823,7 @@ if (!$block_edit) {
{[ "type": "select", "label": "'.tr('Articolo').'", "name": "id_articolo", "value": "", "ajax-source": "articoli", "select-options": {"permetti_movimento_a_zero": '.($dir == 'entrata' ? 0 : 1).', "idsede_partenza": '.intval($fattura->idsede_partenza).', "idsede_destinazione": '.intval($fattura->idsede_destinazione).', "idanagrafica": '.$fattura->idanagrafica.', "dir": "'.$dir.'", "idagente": '.$fattura->idagente.'}, "icon-after": "add|'.Modules::get('Articoli')['id'].'" ]}
-
+
@@ -887,6 +887,10 @@ if (!$block_edit) {
+
+
+ {[ "type": "select", "label": "'.tr('Ordinamento').'", "name": "ordinamento", "class": "no-search", "value": "'.($_SESSION['module_'.$id_module]['order_row_desc'] ? 'desc' : 'manuale').'", "values": "list=\"desc\": \"'.tr('Ultima riga inserita').'\", \"manuale\": \"'.tr('Manuale').'\"" ]}
+
';
}
@@ -1199,4 +1203,16 @@ $("#link_form").bind("keypress", function(e) {
return false;
}
});
+
+input("ordinamento").on("change", function(){
+ if (input(this).get() == "desc") {
+ session_set("module_'.$id_module.',order_row_desc", 1, "").then(function () {
+ caricaRighe(null);
+ });
+ } else {
+ session_set("module_'.$id_module.',order_row_desc").then(function () {
+ caricaRighe(null);
+ });
+ }
+});
';
diff --git a/modules/fatture/row-list.php b/modules/fatture/row-list.php
index 6d53d7d37..7cc8fb6ea 100755
--- a/modules/fatture/row-list.php
+++ b/modules/fatture/row-list.php
@@ -23,7 +23,8 @@ include_once __DIR__.'/init.php';
$direzione = $fattura->direzione;
$block_edit = !empty($note_accredito) || in_array($record['stato'], ['Emessa', 'Pagato', 'Parzialmente pagato']) || !$abilita_genera;
-$righe = $fattura->getRighe();
+$order_row_desc = $_SESSION['module_'.$id_module]['order_row_desc'];
+$righe = $order_row_desc ? $fattura->getRighe()->sortByDesc('created_at') : $fattura->getRighe();
echo '
@@ -284,7 +285,7 @@ foreach ($righe as $riga) {
}
echo '
-
+
';
diff --git a/modules/ordini/edit.php b/modules/ordini/edit.php
index cd37078d8..182768ced 100755
--- a/modules/ordini/edit.php
+++ b/modules/ordini/edit.php
@@ -237,11 +237,11 @@ if (!$block_edit) {
-
+
{[ "type": "text", "label": "'.tr('Aggiungi un articolo tramite barcode').'", "name": "barcode", "extra": "autocomplete=\"off\"", "icon-before": "", "required": 0 ]}
-
+
{[ "type": "select", "label": "'.tr('Articolo').'", "name": "id_articolo", "value": "", "ajax-source": "articoli", "select-options": {"permetti_movimento_a_zero": 1}, "icon-after": "add|'.Modules::get('Articoli')['id'].'" ]}
@@ -292,6 +292,10 @@ if (!$block_edit) {
}
echo '
+
+
+ {[ "type": "select", "label": "'.tr('Ordinamento').'", "name": "ordinamento", "class": "no-search", "value": "'.($_SESSION['module_'.$id_module]['order_row_desc'] ? 'desc' : 'manuale').'", "values": "list=\"desc\": \"'.tr('Ultima riga inserita').'\", \"manuale\": \"'.tr('Manuale').'\"" ]}
+
';
}
@@ -444,6 +448,18 @@ $("#link_form").bind("keypress", function(e) {
return false;
}
});
+
+input("ordinamento").on("change", function(){
+ if (input(this).get() == "desc") {
+ session_set("module_'.$id_module.',order_row_desc", 1, "").then(function () {
+ caricaRighe(null);
+ });
+ } else {
+ session_set("module_'.$id_module.',order_row_desc").then(function () {
+ caricaRighe(null);
+ });
+ }
+});
';
// Collegamenti diretti
diff --git a/modules/ordini/row-list.php b/modules/ordini/row-list.php
index 1833ac9f1..530e9e67b 100755
--- a/modules/ordini/row-list.php
+++ b/modules/ordini/row-list.php
@@ -22,7 +22,8 @@ include_once __DIR__.'/init.php';
use Modules\Articoli\Articolo;
$block_edit = $record['flag_completato'];
-$righe = $ordine->getRighe();
+$order_row_desc = $_SESSION['module_'.$id_module]['order_row_desc'];
+$righe = $order_row_desc ? $ordine->getRighe()->sortByDesc('created_at') : $ordine->getRighe();
$colspan = ($block_edit ? '6' : '7');
$direzione = $ordine->direzione;
@@ -268,7 +269,7 @@ foreach ($righe as $riga) {
-
+
';
diff --git a/modules/preventivi/edit.php b/modules/preventivi/edit.php
index fe482f7eb..ce5744fea 100755
--- a/modules/preventivi/edit.php
+++ b/modules/preventivi/edit.php
@@ -257,7 +257,7 @@ if (!$block_edit) {
-
+
{[ "type": "text", "label": "'.tr('Aggiungi un articolo tramite barcode').'", "name": "barcode", "extra": "autocomplete=\"off\"", "icon-before": "", "required": 0 ]}
@@ -265,7 +265,7 @@ if (!$block_edit) {
{[ "type": "select", "label": "'.tr('Articolo').'", "name": "id_articolo", "value": "", "ajax-source": "articoli", "select-options": {"permetti_movimento_a_zero": 1}, "icon-after": "add|'.Modules::get('Articoli')['id'].'" ]}
-
+
@@ -294,6 +294,10 @@ if (!$block_edit) {
+
+
+ {[ "type": "select", "label": "'.tr('Ordinamento').'", "name": "ordinamento", "class": "no-search", "value": "'.($_SESSION['module_'.$id_module]['order_row_desc'] ? 'desc' : 'manuale').'", "values": "list=\"desc\": \"'.tr('Ultima riga inserita').'\", \"manuale\": \"'.tr('Manuale').'\"" ]}
+
';
}
@@ -519,10 +523,20 @@ if (!empty($elementi)) {
\ No newline at end of file
diff --git a/modules/preventivi/row-list.php b/modules/preventivi/row-list.php
index 1b49a009a..8928b2377 100755
--- a/modules/preventivi/row-list.php
+++ b/modules/preventivi/row-list.php
@@ -20,7 +20,8 @@
include_once __DIR__.'/init.php';
$block_edit = $record['is_completato'];
-$righe = $preventivo->getRighe();
+$order_row_desc = $_SESSION['module_'.$id_module]['order_row_desc'];
+$righe = $order_row_desc ? $preventivo->getRighe()->sortByDesc('created_at') : $preventivo->getRighe();
$colspan = ($block_edit ? '6' : '7');
$direzione = $preventivo->direzione;
@@ -210,7 +211,7 @@ foreach ($righe as $riga) {
-
+
';