Skip to content

Fix #1305: Enable BOM sorting on part fields (Storage location, Manufacturing status) and fix BOM table query/pagination issues#1338

Open
mkne wants to merge 11 commits intoPart-DB:masterfrom
mkne:fix-#1305
Open

Fix #1305: Enable BOM sorting on part fields (Storage location, Manufacturing status) and fix BOM table query/pagination issues#1338
mkne wants to merge 11 commits intoPart-DB:masterfrom
mkne:fix-#1305

Conversation

@mkne
Copy link
Copy Markdown
Contributor

@mkne mkne commented Apr 4, 2026

This PR refactors ProjectBomEntriesDataTable to use the same robust two-step query strategy as PartsDataTable, resolving multiple query/pagination errors on the BOM page and restoring expected column behavior.

What changed

  • Switched BOM datatable adapter to TwoStepORMAdapter.
  • Added an ID-only filter_query for filtering/sorting/pagination.
  • Added a detail_query for fetching full BOM entities and joins.
  • Kept stable row ordering between filter/detail queries via FieldHelper::addOrderByFieldParam(...).
  • Preserved storage location sorting support with aggregate ordering (NATSORT(MIN(_storelocations.name))).
  • Added explicit sorting for Manufacturing Status (orderField => 'part.manufacturing_status').
  • Aligned datatable entity usage with ProjectBOMEntry.

Why
The previous single-query fetch-join approach caused Doctrine/PgSQL failures such as:

  • non-unique scalar/count query results,
  • grouping errors,
  • and Iterate with fetch join ... PartLot ... not allowed.
    Using TwoStepORMAdapter avoids these fetch-join pagination pitfalls and keeps sorting/filtering functional.

User-visible impact

  • BOM page loads reliably (including repeated loads/callbacks).
  • Manufacturing Status column now displays values again.
  • Manufacturing Status column is now sortable.

Testing performed

  • Verified BOM datatable code path compiles (php -l)
  • Manually validated query setup for normal BOM load
  • tested storage location sorting
  • tested manufacturing status display and sorting

Disclaimer: This description was written by Codex but manually edited and corrected.

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 4, 2026

Codecov Report

❌ Patch coverage is 23.33333% with 46 lines in your changes missing coverage. Please review.
✅ Project coverage is 56.29%. Comparing base (96da2b9) to head (fbd32a2).

Files with missing lines Patch % Lines
src/DataTables/ProjectBomEntriesDataTable.php 23.33% 46 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #1338      +/-   ##
============================================
- Coverage     56.39%   56.29%   -0.11%     
- Complexity     8345     8347       +2     
============================================
  Files           612      612              
  Lines         26801    26846      +45     
============================================
- Hits          15115    15112       -3     
- Misses        11686    11734      +48     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant