Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX issue where clonned commandes had their last line moved anywhere #32670

Open
wants to merge 1 commit into
base: 20.0
Choose a base branch
from

Conversation

YannisHoareau
Copy link
Contributor

Cloning a commande would result in a mess of its lines position. When cloning the first time, the last line would become the first one and if a cloned commande was cloned again it would change again some position.

This line is not necessary and led the commande line table to have
duplicates in it and made the clone of the command have the last line at
the first place.
@@ -1706,7 +1706,6 @@ public function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1 = 0, $txlocalt

if ($result > 0) {
$this->db->commit();
$this->lines[] = $this->line;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I you remove this line, if order has 2 lines before adding the line, the order will stil have 2 lines after when it should have 3 lines.
Adding a resorting of lines would be better
For example by using $this->lines = dol_sort_array($this->lines, 'rang')

@eldy eldy added the Discussion Some questions or discussions are opened and wait answers of author or other people to be processed label Jan 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Discussion Some questions or discussions are opened and wait answers of author or other people to be processed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants