Skip to content

FIX Rang of lines in contracts - #40219

Open
thomas-Ngr wants to merge 1 commit into
Dolibarr:18.0from
thomas-Ngr:18_fix_rang_contract
Open

FIX Rang of lines in contracts#40219
thomas-Ngr wants to merge 1 commit into
Dolibarr:18.0from
thomas-Ngr:18_fix_rang_contract

Conversation

@thomas-Ngr

Copy link
Copy Markdown
Contributor

FIX Order of lines in a contract

Bug : in some cases, you can't reorder lines of a contract.

Seen from DLB 18.0 up to develop.

To reproduce :

  • create a contract
  • add 3 lines
  • delete the middle line
  • click "down" on the first line : no change. Bug
  • click "down" again on the first line : this time the line goes down.

This is due to the rang of line :

  • add 3 lines (rang of lines => 1,2,3)
  • delete the middle line (rang of lines => 1,3)
  • click "down" on the first line : no change (rang of lines => 2,3 : the order does not change)
  • click "down" again on the first line : this time the line goes down. (rang of lines => 3,2)

The fix recomputes the rang of lines each time a line is deleted.

- Origin import (card.php): use an incremental rang instead of a
  constant $num+1, avoiding all imported lines sharing the same rang.
- Contrat::deleteline(): renumber remaining lines after delete, so a
  removed line never leaves a permanent gap in the rang sequence.
@the-dolibear-bot the-dolibear-bot Bot added the Issue for v18 maintenance Team PR is in a maintenance branch with several approvers. Waiting approval of all of them. label Sep 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Issue for v18 maintenance Team PR is in a maintenance branch with several approvers. Waiting approval of all of them.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant