Fix #37205 pass selectedline to invoice.php addline so supplements attach to parent (#38760)

TakePOS supplement handling needs the rowid of the previously selected
line so the new line can be attached as a child via fk_parent_line.
htdocs/takepos/invoice.php:837 reads $selectedline = GETPOSTINT('selectedline')
and SELECTs FROM facturedet WHERE rowid = $selectedline to find the
parent.

When the JS in htdocs/takepos/index.php:590 dropped the selectedline
query parameter (regression since 19.x), GETPOSTINT returns 0, the
parent lookup matches no row, fk_parent_line stays null and the
supplement is added as a regular standalone line.

Restore the &selectedline= parameter to the AJAX URL.

Signed-off-by: Dolicraft <contact@dolicraft.com>
Co-authored-by: Dolicraft <contact@dolicraft.com>
This commit is contained in:
w3houde 2026-06-13 01:48:23 +02:00 committed by GitHub
parent cf40d4ded2
commit f9712f978d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -587,7 +587,7 @@ function ClickProduct(position, qty = 1) {
return;
}
// Call page invoice.php to generate the section with product lines
$("#poslines").load("invoice.php?action=addline&token=<?php echo newToken(); ?>&place="+place+"&idproduct="+idproduct+"&qty="+qty+"&invoiceid="+invoiceid, function() {
$("#poslines").load("invoice.php?action=addline&token=<?php echo newToken(); ?>&place="+place+"&idproduct="+idproduct+"&selectedline="+selectedline+"&qty="+qty+"&invoiceid="+invoiceid, function() {
<?php if (getDolGlobalString('TAKEPOS_CUSTOMER_DISPLAY')) {
echo "CustomerDisplay();";
}?>