Fix dell'issue #77
Il primo problema era causato da una mancanza nella progettazione del select, che ora mostra **categoria (sottocategoria)** con sottocategoria impostata a "-" se non definita. Il secondo punto era invece causato da un problema di ambiguità nella query per l'individuazione degli articoli filtrati. [Vedasi relativa issue]
This commit is contained in:
parent
a41f50d7c5
commit
8202e5a627
|
@ -237,8 +237,8 @@ switch ($op) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($search)) {
|
if (!empty($search)) {
|
||||||
$search_fields[] = 'descrizione LIKE '.prepare('%'.$search.'%');
|
$search_fields[] = 'mg_articoli.descrizione LIKE '.prepare('%'.$search.'%');
|
||||||
$search_fields[] = 'codice LIKE '.prepare('%'.$search.'%');
|
$search_fields[] = 'mg_articoli.codice LIKE '.prepare('%'.$search.'%');
|
||||||
}
|
}
|
||||||
|
|
||||||
$wh = '';
|
$wh = '';
|
||||||
|
@ -259,8 +259,12 @@ switch ($op) {
|
||||||
$rs = $dbo->fetchArray($query);
|
$rs = $dbo->fetchArray($query);
|
||||||
foreach ($rs as $r) {
|
foreach ($rs as $r) {
|
||||||
if ($prev != $r['id_sottocategoria']) {
|
if ($prev != $r['id_sottocategoria']) {
|
||||||
|
$categoria = $dbo->fetchArray('SELECT `nome` FROM `mg_categorie` WHERE `id`='.prepare($r['id_categoria']))[0]['nome'];
|
||||||
|
|
||||||
|
$sottocategoria = $dbo->fetchArray('SELECT `nome` FROM `mg_categorie` WHERE `id`='.prepare($r['id_sottocategoria']))[0]['nome'];
|
||||||
|
|
||||||
$prev = $r['id_sottocategoria'];
|
$prev = $r['id_sottocategoria'];
|
||||||
$results[] = ['text' => $dbo->fetchArray('SELECT `nome` FROM `mg_categorie` WHERE `id`='.prepare($r['id_categoria']))[0]['nome'], 'children' => []];
|
$results[] = ['text' => $categoria.' ('.(!empty($r['id_sottocategoria']) ? $sottocategoria : '-').')', 'children' => []];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($r['idiva_vendita'])) {
|
if (empty($r['idiva_vendita'])) {
|
||||||
|
|
|
@ -22,7 +22,7 @@ unset($_SESSION['superselect']['id_categoria']);
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
{[ "type": "select", "label": "<?php echo tr('Inserisci la subcategoria:'); ?>", "name": "subcategoria", "value": "", "ajax-source": "sottocategorie", "icon-after": "add|<?php echo Modules::get('Categorie')['id']; ?>||hide" ]}
|
{[ "type": "select", "label": "<?php echo tr('Inserisci la subcategoria:'); ?>", "name": "subcategoria", "id": "subcategoria_add", "value": "", "ajax-source": "sottocategorie", "icon-after": "add|<?php echo Modules::get('Categorie')['id']; ?>||hide" ]}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ unset($_SESSION['superselect']['id_categoria']);
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
var sub = $('#add_form').find('#subcategoria');
|
var sub = $('#add_form').find('#subcategoria_add');
|
||||||
var original = sub.parent().find(".input-group-addon button").data("href");
|
var original = sub.parent().find(".input-group-addon button").data("href");
|
||||||
|
|
||||||
$('#add_form').find('#categoria').change( function(){
|
$('#add_form').find('#categoria').change( function(){
|
||||||
|
|
Loading…
Reference in New Issue