Fix: reorder correctly if fk_parent_line
Fix: uniformize code
This commit is contained in:
parent
78a0078906
commit
da05338224
@ -1,9 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2003-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2003-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005-2010 Regis Houssin <regis@dolibarr.fr>
|
* Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr>
|
||||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||||
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -953,7 +953,7 @@ class Commande extends CommonObject
|
|||||||
$rangtouse = $rang;
|
$rangtouse = $rang;
|
||||||
if ($rangtouse == -1)
|
if ($rangtouse == -1)
|
||||||
{
|
{
|
||||||
$rangmax = $this->line_max();
|
$rangmax = $this->line_max($fk_parent_line);
|
||||||
$rangtouse = $rangmax + 1;
|
$rangtouse = $rangmax + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -998,16 +998,19 @@ class Commande extends CommonObject
|
|||||||
$this->line->price=$price;
|
$this->line->price=$price;
|
||||||
$this->line->remise=$remise;
|
$this->line->remise=$remise;
|
||||||
|
|
||||||
$resInsert=$this->line->insert();
|
$result=$this->line->insert();
|
||||||
if ($resInsert > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
|
// Reorder if child line
|
||||||
|
if (! empty($fk_parent_line)) $this->line_order(true,'DESC');
|
||||||
|
|
||||||
// Mise a jour informations denormalisees au niveau de la commande meme
|
// Mise a jour informations denormalisees au niveau de la commande meme
|
||||||
$this->id=$commandeid; // TODO A virer
|
$this->id=$commandeid; // TODO A virer
|
||||||
$result=$this->update_price(1);
|
$result=$this->update_price(1);
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
return $resInsert;
|
return $this->line->rowid;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -2777,7 +2780,7 @@ class OrderLine
|
|||||||
}
|
}
|
||||||
|
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
return $this->rowid;
|
return 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1728,7 +1728,7 @@ class Facture extends CommonObject
|
|||||||
$rangtouse = $rang;
|
$rangtouse = $rang;
|
||||||
if ($rangtouse == -1)
|
if ($rangtouse == -1)
|
||||||
{
|
{
|
||||||
$rangmax = $this->line_max();
|
$rangmax = $this->line_max($fk_parent_line);
|
||||||
$rangtouse = $rangmax + 1;
|
$rangtouse = $rangmax + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1785,6 +1785,9 @@ class Facture extends CommonObject
|
|||||||
$result=$this->line->insert();
|
$result=$this->line->insert();
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
|
// Reorder if child line
|
||||||
|
if (! empty($fk_parent_line)) $this->line_order(true,'DESC');
|
||||||
|
|
||||||
// Mise a jour informations denormalisees au niveau de la facture meme
|
// Mise a jour informations denormalisees au niveau de la facture meme
|
||||||
$this->id=$facid; // TODO To move this we must remove parameter facid into this function declaration
|
$this->id=$facid; // TODO To move this we must remove parameter facid into this function declaration
|
||||||
$result=$this->update_price(1);
|
$result=$this->update_price(1);
|
||||||
@ -3055,6 +3058,8 @@ class FactureLigne
|
|||||||
var $rowid;
|
var $rowid;
|
||||||
//! Id facture
|
//! Id facture
|
||||||
var $fk_facture;
|
var $fk_facture;
|
||||||
|
//! Id parent line
|
||||||
|
var $fk_parent_line;
|
||||||
//! Description ligne
|
//! Description ligne
|
||||||
var $desc;
|
var $desc;
|
||||||
var $fk_product; // Id of predefined product
|
var $fk_product; // Id of predefined product
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user