Skip to content

Commit 85e6ff9

Browse files
authored
Merge pull request #332 from No0ne558/dev
Fix Sales Item List button view separation
2 parents afe7390 + e80df70 commit 85e6ff9

2 files changed

Lines changed: 25 additions & 27 deletions

File tree

docs/changelog.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,13 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
7575
- **Impact**: Behavior unchanged; build and all tests remain green (40/40)
7676

7777
### Fixed
78+
- **Sales Item List button view separation (2025-12-26)**
79+
- Fixed bug where Sales Item List button type was showing both the list of items and the selected item's configuration simultaneously
80+
- **Root Cause**: `ListFormZone::Render()` was unconditionally calling `FormZone::Render()` which displayed form fields even when showing the list view
81+
- **Solution**: Modified `ListFormZone::Render()` to conditionally call `FormZone::Render()` only when `show_list` is false (form view), and modified `ListFormZone::Touch()` to not load form fields when selecting items from the list
82+
- **Result**: List view now shows only items; form view shows only configuration fields; switching between views requires explicit "change view" signal
83+
- **Files modified**: `zone/form_zone.cc` (`ListFormZone::Render()`, `ListFormZone::Touch()`, `ListFormZone::Signal()`)
84+
- **Impact**: Affects all `ListFormZone`-based zones (ItemListZone, etc.); behavior now matches HardwareZone pattern
7885
- **Job Security button double-touch regression (2025-12-23)**
7986
- Prevented duplicate touch handling that immediately reverted job activation/deactivation in Job Security settings
8087
- **Hardware button list/form separation (2025-12-23)**

zone/form_zone.cc

Lines changed: 18 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -905,8 +905,6 @@ RenderResult ListFormZone::Render(Terminal *term, int update_flag)
905905
if (update_flag == RENDER_NEW)
906906
{
907907
record_no = 0;
908-
if (records > 0)
909-
LoadRecord(term, 0);
910908
show_list = 1;
911909
list_page = 0;
912910
}
@@ -922,10 +920,11 @@ RenderResult ListFormZone::Render(Terminal *term, int update_flag)
922920
if (update_flag || keep_focus == 0)
923921
keyboard_focus = nullptr;
924922

925-
FormZone::Render(term, update_flag);
926-
927923
if (show_list)
928924
{
925+
// Render list view - don't call FormZone::Render() to avoid showing form fields
926+
LayoutZone::Render(term, update_flag);
927+
929928
if (records > 0)
930929
list_report.selected_line = record_no;
931930
else
@@ -937,25 +936,8 @@ RenderResult ListFormZone::Render(Terminal *term, int update_flag)
937936
}
938937
else
939938
{
940-
if (!no_line)
941-
{
942-
Flt tl = form_header;
943-
if (tl < 0)
944-
tl += size_y;
945-
if (tl > 0)
946-
Line(term, tl + .1, color[0]);
947-
}
948-
949-
if (records > 0)
950-
{
951-
LayoutForm(term);
952-
for (FormField *f = FieldList(); f != nullptr; f = f->next)
953-
{
954-
f->selected = (keyboard_focus == f);
955-
if (f->active)
956-
f->Render(term, this);
957-
}
958-
}
939+
// Render form view via FormZone logic
940+
FormZone::Render(term, update_flag);
959941
}
960942
return RENDER_OKAY;
961943
}
@@ -1056,9 +1038,17 @@ SignalResult ListFormZone::Signal(Terminal *term, const genericChar* message)
10561038
case 7: // Unfocus
10571039
break;
10581040
case 8: // change view
1059-
show_list ^= 1;
1060-
if (show_list)
1061-
SaveRecord(term, record_no, 0);
1041+
{
1042+
int prev_show = show_list;
1043+
show_list ^= 1;
1044+
if (show_list)
1045+
SaveRecord(term, record_no, 0);
1046+
else if (prev_show && !show_list && records > 0)
1047+
{
1048+
// Switching from list to form view - load the current record
1049+
LoadRecord(term, record_no);
1050+
}
1051+
}
10621052
break;
10631053
default:
10641054
if (strncmp(message, "search ", 7) == 0)
@@ -1109,9 +1099,10 @@ SignalResult ListFormZone::Touch(Terminal *term, int tx, int ty)
11091099
}
11101100
else if (row != record_no && row >= 0 && row < records)
11111101
{
1102+
// Only update selection, don't load the record into form fields
1103+
// User must send "change view" signal to see the configuration
11121104
SaveRecord(term, record_no, 0);
11131105
record_no = row;
1114-
LoadRecord(term, record_no);
11151106
Draw(term, 0);
11161107
return SIGNAL_OKAY;
11171108
}

0 commit comments

Comments
 (0)