SupplierInvoices
class SupplierInvoices extends DolibarrApi (View source)
API class for supplier invoices
Properties
| DoliDB | $db | ||
| Restler | $r | from DolibarrApi | |
| static string[] | $FIELDS | ||
| FactureFournisseur | $invoice |
Methods
Constructor
Check and convert a string depending on its type/name.
Filter properties that will be returned on object
Clean sensible object datas
Check access by user to a given resource
Return if a $sqlfilters parameter is valid Function no more used. Kept for backward compatibility with old APIs of modules
Function to forge a SQL criteria from a Generic filter string.
Get properties of a supplier invoice object
List invoices
Create supplier invoice object
Update supplier invoice
Delete supplier invoice
Validate an invoice
Sets an invoice as draft
Get list of payments of a given supplier invoice
Add payment line to a specific supplier invoice with the remain to pay as amount.
Sets a supplier invoice as paid
Sets a supplier invoice as unpaid
Get lines of a supplier invoice
Add a line to given supplier invoice
Update a line to a given supplier invoice
Deletes a line of a given supplier invoice
Details
__construct()
Constructor
protected string|array<string, mixed>
_checkValForAPI(string $field, string|string[] $value, object $object)
Check and convert a string depending on its type/name.
protected object
_filterObjectProperties(object $object, string $properties)
Filter properties that will be returned on object
protected object
_cleanObjectDatas(object $object)
Clean sensible object datas
static protected bool
_checkAccessToResource(string $resource, int $resource_id = 0, string $dbtablename = '', string $feature2 = '', string $dbt_keyfield = 'fk_soc', string $dbt_select = 'rowid')
Check access by user to a given resource
protected bool|string
_checkFilters(string $sqlfilters, string $error = '')
Return if a $sqlfilters parameter is valid Function no more used. Kept for backward compatibility with old APIs of modules
static protected string
_forge_criteria_callback(string[] $matches)
Function to forge a SQL criteria from a Generic filter string.
Function no more used. Kept for backward compatibility with old APIs of modules
object
get(int $id)
Get properties of a supplier invoice object
Return an array with supplier invoice information
array
index(string $sortfield = "t.rowid", string $sortorder = 'ASC', int $limit = 100, int $page = 0, string $thirdparty_ids = '', string $status = '', string $sqlfilters = '', string $properties = '', bool $pagination_data = false)
List invoices
Get a list of supplier invoices
int
post(array $request_data = null)
Create supplier invoice object
Note: soc_id = dolibarr_order_id
Example: {'ref': 'auto', 'ref_supplier': '7985630', 'socid': 1, 'note': 'Inserted with Python', 'order_supplier': 1, 'date': '2021-07-28'}
object|false
put(int $id, array $request_data = null)
Update supplier invoice
array
delete(int $id)
Delete supplier invoice
array
validate(int $id, int $idwarehouse = 0, int $notrigger = 0)
Validate an invoice
object
settodraft(int $id, int $idwarehouse = -1, int $notrigger = 0)
Sets an invoice as draft
array
getPayments(int $id)
Get list of payments of a given supplier invoice
int
addPayment(int $id, int $datepaye, int $payment_mode_id, string $closepaidinvoices, int $accountid, string $num_payment = '', string $comment = '', string $chqemetteur = '', string $chqbank = '', float $amount = null)
Add payment line to a specific supplier invoice with the remain to pay as amount.
object
settopaid(int $id, string $close_code = '', string $close_note = '')
Sets a supplier invoice as paid
object
settounpaid(int $id)
Sets a supplier invoice as unpaid
array
getLines(int $id)
Get lines of a supplier invoice
int|bool
postLine(int $id, array $request_data = null)
Add a line to given supplier invoice
Note: socid = dolibarr_order_id, pu_ht = net price, remise = discount
Example: {'socid': 1, 'qty': 1, 'pu_ht': 21.0, 'tva_tx': 25.0, 'fk_product': '1189', 'product_type': 0, 'remise_percent': 1.0, 'vat_src_code': None}
object
putLine(int $id, int $lineid, array $request_data = null)
Update a line to a given supplier invoice
array
deleteLine(int $id, int $lineid)
Deletes a line of a given supplier invoice