[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Dolibarr-dev] Error in invoice clone
From: |
Laurent Destailleur (eldy) |
Subject: |
Re: [Dolibarr-dev] Error in invoice clone |
Date: |
Wed, 04 Sep 2013 10:44:42 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130804 Thunderbird/17.0.8 |
Le 04/09/2013 07:32, Sébastien a écrit :
> function __clone()
> {
> // Force a copy of this->lines, otherwise it will point to
> same object.
> for($i=0; $i < count($this->lines); $i++){
> $this->lines[$i] = clone $this->lines[$i];
> }
> }
So we should have this __clone function for all objects that has ->lines
array.
I tried to add into the commonobject.class.php
function __clone()
{
// Force a copy of this->lines, otherwise it will point to same
object.
if (isset($this->lines) && is_array($this->lines))
{
for($i=0; $i < count($this->lines); $i++)
{
$this->lines[$i] = dol_clone($this->lines[$i]);
}
}
}
Is it ok for you ?
--
Eldy (Laurent Destailleur).
EMail: address@hidden
Web: http://www.destailleur.fr
Dolibarr (Project leader): http://www.dolibarr.org
To make a donation for Dolibarr project via Paypal: address@hidden
AWStats (Author) : http://awstats.sourceforge.net
To make a donation for AWStats project via Paypal: address@hidden
AWBot (Author) : http://awbot.sourceforge.net
CVSChangeLogBuilder (Author) : http://cvschangelogb.sourceforge.net