dolibarr  13.0.2
Public Member Functions | Protected Member Functions | Private Member Functions | List of all members
SupplierInvoices Class Reference
+ Inheritance diagram for SupplierInvoices:
+ Collaboration diagram for SupplierInvoices:

Public Member Functions

 __construct ()
 Constructor.
 
 get ($id)
 Get properties of a supplier invoice object. More...
 
 index ($sortfield="t.rowid", $sortorder= 'ASC', $limit=100, $page=0, $thirdparty_ids= '', $status= '', $sqlfilters= '')
 List invoices. More...
 
 post ($request_data=null)
 Create supplier invoice object. More...
 
 put ($id, $request_data=null)
 Update supplier invoice. More...
 
 delete ($id)
 Delete supplier invoice. More...
 
 validate ($id, $idwarehouse=0, $notrigger=0)
 Validate an invoice. More...
 
 getPayments ($id)
 Get list of payments of a given supplier invoice. More...
 
 addPayment ($id, $datepaye, $payment_mode_id, $closepaidinvoices, $accountid, $num_payment= '', $comment= '', $chqemetteur= '', $chqbank= '')
 Add payment line to a specific supplier invoice with the remain to pay as amount. More...
 
 getLines ($id)
 Get lines of a supplier invoice. More...
 
 postLine ($id, $request_data=null)
 Add a line to given supplier invoice. More...
 
 putLine ($id, $lineid, $request_data=null)
 Update a line to a given supplier invoice. More...
 
 deleteLine ($id, $lineid)
 Deletes a line of a given supplier invoice. More...
 
- Public Member Functions inherited from DolibarrApi
 __construct ($db, $cachedir= '', $refreshCache=false)
 Constructor. More...
 

Protected Member Functions

 _cleanObjectDatas ($object)
 Clean sensible object datas. More...
 
- Protected Member Functions inherited from DolibarrApi
 _cleanObjectDatas ($object)
 Executed method when API is called without parameter. More...
 
 _checkFilters ($sqlfilters)
 Return if a $sqlfilters parameter is valid. More...
 

Private Member Functions

 _validate ($data)
 Validate fields before create or update object. More...
 

Additional Inherited Members

- Static Protected Member Functions inherited from DolibarrApi
static _checkAccessToResource ($resource, $resource_id=0, $dbtablename= '', $feature2= '', $dbt_keyfield= 'fk_soc', $dbt_select= 'rowid')
 Check user access to a resource. More...
 
static _forge_criteria_callback ($matches)
 Function to forge a SQL criteria. More...
 

Detailed Description

Definition at line 31 of file api_supplier_invoices.class.php.

Member Function Documentation

SupplierInvoices::_cleanObjectDatas (   $object)
protected

Clean sensible object datas.

Parameters
Object$objectObject to clean
Returns
Object Object with cleaned properties

Definition at line 683 of file api_supplier_invoices.class.php.

Referenced by get(), getLines(), index(), and putLine().

SupplierInvoices::_validate (   $data)
private

Validate fields before create or update object.

Parameters
array$dataDatas to validate
Returns
array
Exceptions
RestException

Definition at line 705 of file api_supplier_invoices.class.php.

Referenced by post().

SupplierInvoices::addPayment (   $id,
  $datepaye,
  $payment_mode_id,
  $closepaidinvoices,
  $accountid,
  $num_payment = '',
  $comment = '',
  $chqemetteur = '',
  $chqbank = '' 
)

Add payment line to a specific supplier invoice with the remain to pay as amount.

Parameters
int$idId of invoice
string$datepaye{ body} Payment date { timestamp}
int$payment_mode_id{ body} Payment mode ID (look it up via REST GET to /setup/dictionary/payment_types) { 1}
string$closepaidinvoices{ body} Close paid invoices { yes,no}
int$accountid{ body} Bank account ID (look it up via REST GET to /bankaccounts) { 1}
string$num_payment{ body} Payment number (optional)
string$comment{ body} Note (optional)
string$chqemetteur{ body} Payment issuer (mandatory if payment_mode_id corresponds to 'CHQ'-payment type)
string$chqbank{ body} Issuer bank name (optional)

POST {id}/payments

Returns
int Payment ID
Exceptions
RestException400
RestException401
RestException404

Definition at line 402 of file api_supplier_invoices.class.php.

References DolibarrApi\_checkAccessToResource(), db, dol_getIdFromCode(), and price2num().

SupplierInvoices::delete (   $id)

Delete supplier invoice.

Parameters
int$idSupplier invoice ID
Returns
array
Exceptions
RestException401
RestException404
RestException500

Definition at line 268 of file api_supplier_invoices.class.php.

References DolibarrApi\_checkAccessToResource().

SupplierInvoices::deleteLine (   $id,
  $lineid 
)

Deletes a line of a given supplier invoice.

Parameters
int$idId of supplier invoice
int$lineidId of the line to delete

DELETE {id}/lines/{lineid}

Returns
array
Exceptions
RestException400 Bad parameters
RestException401 Not allowed
RestException404 Not found
RestException405 Error

Definition at line 647 of file api_supplier_invoices.class.php.

References DolibarrApi\_checkAccessToResource().

SupplierInvoices::get (   $id)

Get properties of a supplier invoice object.

Return an array with supplier invoice information

Parameters
int$idID of supplier invoice
Returns
array|mixed data without useless information
Exceptions
RestException

Definition at line 66 of file api_supplier_invoices.class.php.

References DolibarrApi\_checkAccessToResource(), and _cleanObjectDatas().

SupplierInvoices::getLines (   $id)

Get lines of a supplier invoice.

Parameters
int$idId of supplier invoice

GET {id}/lines

Returns
array

Definition at line 491 of file api_supplier_invoices.class.php.

References DolibarrApi\_checkAccessToResource(), and _cleanObjectDatas().

SupplierInvoices::getPayments (   $id)

Get list of payments of a given supplier invoice.

Parameters
int$idId of SupplierInvoice

GET {id}/payments

Returns
array
Exceptions
RestException400
RestException401
RestException404
RestException405

Definition at line 355 of file api_supplier_invoices.class.php.

References DolibarrApi\_checkAccessToResource().

SupplierInvoices::index (   $sortfield = "t.rowid",
  $sortorder = 'ASC',
  $limit = 100,
  $page = 0,
  $thirdparty_ids = '',
  $status = '',
  $sqlfilters = '' 
)

List invoices.

Get a list of supplier invoices

Parameters
string$sortfieldSort field
string$sortorderSort order
int$limitLimit for list
int$pagePage number
string$thirdparty_idsThirdparty ids to filter invoices of (example '1' or '1,2,3') { /^[0-9,]*$/i}
string$statusFilter by invoice status : draft | unpaid | paid | cancelled
string$sqlfiltersOther criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.datec:<:'20160101')"
Returns
array Array of invoice objects
Exceptions
RestException

Definition at line 101 of file api_supplier_invoices.class.php.

References DolibarrApi\_checkFilters(), _cleanObjectDatas(), and db.

SupplierInvoices::post (   $request_data = null)

Create supplier invoice object.

Parameters
array$request_dataRequest datas
Returns
int ID of supplier invoice
Exceptions
RestException401
RestException500

Definition at line 199 of file api_supplier_invoices.class.php.

References _validate(), and dol_now().

SupplierInvoices::postLine (   $id,
  $request_data = null 
)

Add a line to given supplier invoice.

Parameters
int$idId of supplier invoice to update
array$request_datasupplier invoice line data

POST {id}/lines

Returns
int|bool

Definition at line 523 of file api_supplier_invoices.class.php.

References DolibarrApi\_checkAccessToResource().

SupplierInvoices::put (   $id,
  $request_data = null 
)

Update supplier invoice.

Parameters
int$idId of supplier invoice to update
array$request_dataDatas
Returns
int
Exceptions
RestException401
RestException404

Definition at line 231 of file api_supplier_invoices.class.php.

References DolibarrApi\_checkAccessToResource().

SupplierInvoices::putLine (   $id,
  $lineid,
  $request_data = null 
)

Update a line to a given supplier invoice.

Parameters
int$idId of supplier invoice to update
int$lineidId of line to update
array$request_dataInvoiceLine data

PUT {id}/lines/{lineid}

Returns
object
Exceptions
RestException401 Not allowed
RestException404 Not found
RestException304 Error

Definition at line 586 of file api_supplier_invoices.class.php.

References DolibarrApi\_checkAccessToResource(), and _cleanObjectDatas().

SupplierInvoices::validate (   $id,
  $idwarehouse = 0,
  $notrigger = 0 
)

Validate an invoice.

Parameters
int$idInvoice ID
int$idwarehouseWarehouse ID
int$notrigger1=Does not execute triggers, 0= execute triggers

POST {id}/validate

Returns
array
Exceptions
RestException304
RestException401
RestException404
RestException405
RestException500

Definition at line 312 of file api_supplier_invoices.class.php.

References DolibarrApi\_checkAccessToResource().


The documentation for this class was generated from the following file: