Update api_supplier_invoices.class.php

Fix order->invoice and clarify 403 error which is always caused by the invoice already being validated.
This commit is contained in:
Egils Consulting 2020-08-04 21:47:39 +02:00 committed by GitHub
parent 8b5f4fe9a6
commit 3a9021f191
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -293,9 +293,9 @@ class SupplierInvoices extends DolibarrApi
} }
/** /**
* Validate an order * Validate an invoice
* *
* @param int $id Order ID * @param int $id Invoice ID
* @param int $idwarehouse Warehouse ID * @param int $idwarehouse Warehouse ID
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* *
@ -325,7 +325,7 @@ class SupplierInvoices extends DolibarrApi
$result = $this->invoice->validate(DolibarrApiAccess::$user, '', $idwarehouse, $notrigger); $result = $this->invoice->validate(DolibarrApiAccess::$user, '', $idwarehouse, $notrigger);
if ($result == 0) { if ($result == 0) {
throw new RestException(304, 'Error nothing done. May be object is already validated'); throw new RestException(304, 'Error nothing done. The invoice is already validated');
} }
if ($result < 0) { if ($result < 0) {
throw new RestException(500, 'Error when validating Invoice: '.$this->invoice->error); throw new RestException(500, 'Error when validating Invoice: '.$this->invoice->error);