Fix set of due date when invoice created from API

This commit is contained in:
Laurent Destailleur 2019-03-19 12:08:55 +01:00
parent bca10084c5
commit eaaea2c2f9
2 changed files with 2 additions and 2 deletions

View File

@ -227,7 +227,7 @@ class Invoices extends DolibarrApi
$this->invoice->lines = $lines;
}*/
if ($this->invoice->create(DolibarrApiAccess::$user, 0, $request_data["date_lim_reglement"]) < 0) {
if ($this->invoice->create(DolibarrApiAccess::$user, 0, (empty($request_data["date_lim_reglement"]) ? 0 : $request_data["date_lim_reglement"])) < 0) {
throw new RestException(500, "Error creating invoice", array_merge(array($this->invoice->error), $this->invoice->errors));
}
return $this->invoice->id;

View File

@ -286,7 +286,7 @@ class Facture extends CommonInvoice
*
* @param User $user Object user that create
* @param int $notrigger 1=Does not execute triggers, 0 otherwise
* @param int $forceduedate 1=Do not recalculate due date from payment condition but force it with value
* @param int $forceduedate If set, do not recalculate due date from payment condition but force it with value
* @return int <0 if KO, >0 if OK
*/
public function create(User $user, $notrigger = 0, $forceduedate = 0)