API callers like api_proposals.php postLine forward $request_data->rang unset, so null reaches addline. The '== -1' check does not match null and $ranktouse stays null, persisted as 0 - all lines then share rang=0 and the order propagates through createFromProposal / createFromOrder. Accept null and 0 alongside -1 so the auto-rank branch fires. Signed-off-by: Dolicraft <contact@dolicraft.com> Co-authored-by: Dolicraft <contact@dolicraft.com>
This commit is contained in:
parent
ae99530e25
commit
35db492be1
3 changed files with 3 additions and 3 deletions
|
|
@ -783,7 +783,7 @@ class Propal extends CommonObject
|
|||
|
||||
// Rang to use
|
||||
$ranktouse = $rang;
|
||||
if ($ranktouse == -1) {
|
||||
if (empty($ranktouse) || $ranktouse == -1) {
|
||||
$rangmax = $this->line_max($fk_parent_line);
|
||||
$ranktouse = $rangmax + 1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1763,7 +1763,7 @@ class Commande extends CommonOrder
|
|||
// Rang to use
|
||||
$ranktouse = $rang;
|
||||
|
||||
if ($ranktouse == -1) {
|
||||
if (empty($ranktouse) || $ranktouse == -1) {
|
||||
$rangmax = $this->line_max($fk_parent_line);
|
||||
$ranktouse = $rangmax + 1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4397,7 +4397,7 @@ class Facture extends CommonInvoice
|
|||
|
||||
// Rank to use
|
||||
$ranktouse = $rang;
|
||||
if ($ranktouse == -1) {
|
||||
if (empty($ranktouse) || $ranktouse == -1) {
|
||||
$rangmax = $this->line_max($fk_parent_line);
|
||||
$ranktouse = $rangmax + 1;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue