NEW Update end of validity date of proposal using the API

Add the ability to update the end of validity date when modifying a proposal
This commit is contained in:
Neil Orley 2017-12-19 12:37:37 +01:00
parent fe8fac9577
commit e90183f4ba

View File

@ -423,6 +423,19 @@ class Proposals extends DolibarrApi
$this->propal->$field = $value;
}
// update end of validity date
if(!empty($this->propal->duree_validite) && !empty($this->propal->date_creation) )
{
$this->propal->fin_validite = $this->propal->date_creation + ($this->propal->duree_validite * 24 * 3600);
}
if(!empty($this->propal->fin_validite))
{
if($this->propal->set_echeance(DolibarrApiAccess::$user, $this->propal->fin_validite)<0)
{
throw new RestException(500, $this->propal->error);
}
}
if ($this->propal->update(DolibarrApiAccess::$user) > 0)
{
return $this->get($id);