Fix: Bad date init

This commit is contained in:
Laurent Destailleur 2012-01-11 13:47:47 +01:00
parent 83d63aa07b
commit 2b9a118384

View File

@ -108,7 +108,7 @@ class ChargeSociales extends CommonObject
/** /**
* Create a social contribution in database * Create a social contribution into database
* *
* @param User $user User making creation * @param User $user User making creation
* @return int <0 if KO, id if OK * @return int <0 if KO, id if OK
@ -119,7 +119,7 @@ class ChargeSociales extends CommonObject
$newamount=price2num($this->amount,'MT'); $newamount=price2num($this->amount,'MT');
// Validation parametres // Validation parametres
if (! $newamount > 0) if (! $newamount > 0 || empty($this->date_ech) || empty($this->periode))
{ {
$this->error="ErrorBadParameter"; $this->error="ErrorBadParameter";
return -2; return -2;
@ -489,7 +489,7 @@ class ChargeSociales extends CommonObject
$this->paye = 0; $this->paye = 0;
$this->date = time(); $this->date = time();
$this->date_ech=$this->date+3600*24*30; $this->date_ech=$this->date+3600*24*30;
$this->period=$this->date+3600*24*30; $this->periode=$this->date+3600*24*30;
$this->amount=100; $this->amount=100;
$this->lib = 0; $this->lib = 0;
$this->type = 1; $this->type = 1;