Revision ede4f328
Von Sven Schöling vor etwa 12 Jahren hinzugefügt
SL/Controller/DeliveryPlan.pm | ||
---|---|---|
119 | 119 |
rl.from_table ='oe' AND |
120 | 120 |
rl.to_table = 'delivery_orders' |
121 | 121 |
) |
122 |
|
|
123 |
UNION ALL |
|
124 |
|
|
125 |
-- 5. In case someone deleted a line of the delivery_order there will be a record_link (4 fails) |
|
126 |
-- but there won't be a delivery_order_items to find (3 fails too). Search for orphaned orderitems this way |
|
127 |
SELECT oi.id FROM orderitems AS oi, oe, record_links AS rl |
|
128 |
WHERE |
|
129 |
rl.from_table = 'oe' AND |
|
130 |
rl.to_table = 'delivery_orders' AND |
|
131 |
|
|
132 |
oi.trans_id = rl.from_id AND |
|
133 |
oi.parts_id NOT IN ( |
|
134 |
SELECT doi.parts_id FROM delivery_order_items AS doi WHERE doi.delivery_order_id = rl.to_id |
|
135 |
) AND |
|
136 |
|
|
137 |
oe.id = oi.trans_id AND |
|
138 |
|
|
139 |
oe.customer_id IS NOT NULL AND |
|
140 |
(oe.quotation = 'f' OR oe.quotation IS NULL) AND |
|
141 |
NOT oe.closed |
|
122 | 142 |
" ], |
123 | 143 |
) |
124 | 144 |
]; |
Auch abrufbar als: Unified diff
Gelöschte Positionen in Lieferscheinen im Lieferplaner berücksichtigen
behebt #2018