summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorLester Caine <lester@lsces.co.uk>2026-06-16 08:39:59 +0100
committerLester Caine <lester@lsces.co.uk>2026-06-16 08:39:59 +0100
commit894b67457d9272b3726790fa103332bf250d2a4b (patch)
treeb5bf8901693be98094bbb375e708ac1058a3771a /includes
parent660e448b34944e9cad136a30dbb31a081c4fc153 (diff)
downloadstock-894b67457d9272b3726790fa103332bf250d2a4b.tar.gz
stock-894b67457d9272b3726790fa103332bf250d2a4b.tar.bz2
stock-894b67457d9272b3726790fa103332bf250d2a4b.zip
Fix ref_key not loading on edit; restrict movement type to ORDER/TRANS
Add ref_key (xkey) subquery to StockMovement::load() — it was present in getList() but missing from load(), so the field always appeared blank on edit. Filter edit_movement.php refTypes query to ORDER and TRANS only; REQN and PBLD are created via their own dedicated entry points. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'includes')
-rw-r--r--includes/classes/StockMovement.php3
1 files changed, 3 insertions, 0 deletions
diff --git a/includes/classes/StockMovement.php b/includes/classes/StockMovement.php
index 178944d..a735607 100644
--- a/includes/classes/StockMovement.php
+++ b/includes/classes/StockMovement.php
@@ -109,6 +109,9 @@ class StockMovement extends LibertyContent {
, (SELECT FIRST 1 x.`item` FROM `{$X}liberty_xref` x
WHERE x.`content_id` = lc.`content_id` AND x.`item` IN ('REQN','TRANS','ORDER','PBLD')
ORDER BY x.`xorder`) AS ref_type
+ , (SELECT FIRST 1 x.`xkey` FROM `{$X}liberty_xref` x
+ WHERE x.`content_id` = lc.`content_id` AND x.`item` IN ('REQN','TRANS','ORDER','PBLD')
+ ORDER BY x.`xorder`) AS ref_key
, (SELECT FIRST 1 x.`data` FROM `{$X}liberty_xref` x
WHERE x.`content_id` = lc.`content_id` AND x.`item` IN ('REQN','TRANS','ORDER','PBLD')
ORDER BY x.`xorder`) AS ref_from_data