dolibarr  20.0.0-beta
Public Member Functions | Protected Member Functions | Private Member Functions | List of all members
Proposals Class Reference
Inheritance diagram for Proposals:
Inheritance graph
[legend]
Collaboration diagram for Proposals:
Collaboration graph
[legend]

Public Member Functions

 __construct ()
 Constructor.
 
 get ($id, $contact_list=1)
 Get properties of a commercial proposal object. More...
 
 getByRef ($ref, $contact_list=1)
 Get properties of an proposal object by ref. More...
 
 getByRefExt ($ref_ext, $contact_list=1)
 Get properties of an proposal object by ref_ext. More...
 
 index ($sortfield="t.rowid", $sortorder='ASC', $limit=100, $page=0, $thirdparty_ids='', $sqlfilters='', $properties='')
 List commercial proposals. More...
 
 post ($request_data=null)
 Create commercial proposal object. More...
 
 getLines ($id, $sqlfilters='')
 Get lines of a commercial proposal. More...
 
 postLine ($id, $request_data=null)
 Add a line to given commercial proposal. More...
 
 postLines ($id, $request_data=null)
 Add lines to given commercial proposal. More...
 
 putLine ($id, $lineid, $request_data=null)
 Update a line of given commercial proposal. More...
 
 deleteLine ($id, $lineid)
 Delete a line of given commercial proposal. More...
 
 postContact ($id, $contactid, $type)
 Add a contact type of given commercial proposal. More...
 
 deleteContact ($id, $contactid, $type)
 Delete a contact type of given commercial proposal. More...
 
 put ($id, $request_data=null)
 Update commercial proposal general fields (won't touch lines of commercial proposal) More...
 
 delete ($id)
 Delete commercial proposal. More...
 
 settodraft ($id)
 Set a proposal to draft. More...
 
 validate ($id, $notrigger=0)
 Validate a commercial proposal. More...
 
 close ($id, $status, $note_private='', $notrigger=0)
 Close (Accept or refuse) a quote / commercial proposal. More...
 
 setinvoiced ($id)
 Set a commercial proposal billed. 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
 _checkValForAPI ($field, $value, $object)
 Check and convert a string depending on its type/name. More...
 
 _filterObjectProperties ($object, $properties)
 Filter properties that will be returned on object. More...
 
 _checkFilters ($sqlfilters, &$error='')
 Return if a $sqlfilters parameter is valid Function no more used. More...
 

Private Member Functions

 _fetch ($id, $ref='', $ref_ext='', $contact_list=1)
 Get properties of an proposal object. More...
 
 _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 access by user to a given resource. More...
 
static _forge_criteria_callback ($matches)
 Function to forge a SQL criteria from a Generic filter string. More...
 

Detailed Description

Definition at line 34 of file api_proposals.class.php.

Member Function Documentation

◆ _cleanObjectDatas()

Proposals::_cleanObjectDatas (   $object)
protected

Clean sensible object datas.

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

Reimplemented from DolibarrApi.

Definition at line 976 of file api_proposals.class.php.

References $object.

◆ _fetch()

Proposals::_fetch (   $id,
  $ref = '',
  $ref_ext = '',
  $contact_list = 1 
)
private

Get properties of an proposal object.

Return an array with proposal information

Parameters
int$idID of order
string$refRef of object
string$ref_extExternal reference of object
int$contact_list0: Returned array of contacts/addresses contains all properties, 1: Return array contains just id
Returns
Object Object with cleaned properties
Exceptions
RestException

Definition at line 123 of file api_proposals.class.php.

Referenced by getByRefExt().

◆ _validate()

Proposals::_validate (   $data)
private

Validate fields before create or update object.

Parameters
array$dataArray with data to verify
Returns
array
Exceptions
RestException

Definition at line 956 of file api_proposals.class.php.

◆ close()

Proposals::close (   $id,
  $status,
  $note_private = '',
  $notrigger = 0 
)

Close (Accept or refuse) a quote / commercial proposal.

Parameters
int$idCommercial proposal ID
int$statusMust be 2 (accepted) or 3 (refused) {@min 2}{@max 3}
string$note_privateAdd this mention at end of private note
int$notriggerDisabled triggers
Returns
Object Object with cleaned properties

@url POST {id}/close

Definition at line 870 of file api_proposals.class.php.

◆ delete()

Proposals::delete (   $id)

Delete commercial proposal.

Parameters
int$idCommercial proposal ID
Returns
array

Definition at line 733 of file api_proposals.class.php.

◆ deleteContact()

Proposals::deleteContact (   $id,
  $contactid,
  $type 
)

Delete a contact type of given commercial proposal.

Parameters
int$idId of commercial proposal to update
int$contactidRow key of the contact in the array contact_ids.
string$typeType of the contact (BILLING, SHIPPING, CUSTOMER).
Returns
Object Object with cleaned properties

@url DELETE {id}/contact/{contactid}/{type}

Exceptions
RestException401
RestException404
RestException500 System error

Definition at line 639 of file api_proposals.class.php.

◆ deleteLine()

Proposals::deleteLine (   $id,
  $lineid 
)

Delete a line of given commercial proposal.

Parameters
int$idId of commercial proposal to update
int$lineidId of line to delete
Returns
Object|false Object with cleaned properties

@url DELETE {id}/lines/{lineid}

Exceptions
RestException401
RestException404

Definition at line 555 of file api_proposals.class.php.

◆ get()

Proposals::get (   $id,
  $contact_list = 1 
)

Get properties of a commercial proposal object.

Return an array with commercial proposal information

Parameters
int$idID of commercial proposal
int$contact_list0: Returned array of contacts/addresses contains all properties, 1: Return array contains just id
Returns
Object Object with cleaned properties
Exceptions
RestException

Definition at line 69 of file api_proposals.class.php.

◆ getByRef()

Proposals::getByRef (   $ref,
  $contact_list = 1 
)

Get properties of an proposal object by ref.

Return an array with proposal information

Parameters
string$refRef of object
int$contact_list0: Returned array of contacts/addresses contains all properties, 1: Return array contains just id
Returns
Object Object with cleaned properties

@url GET ref/{ref}

Exceptions
RestException

Definition at line 87 of file api_proposals.class.php.

◆ getByRefExt()

Proposals::getByRefExt (   $ref_ext,
  $contact_list = 1 
)

Get properties of an proposal object by ref_ext.

Return an array with proposal information

Parameters
string$ref_extExternal reference of object
int$contact_list0: Returned array of contacts/addresses contains all properties, 1: Return array contains just id
Returns
Object Object with cleaned properties

@url GET ref_ext/{ref_ext}

Exceptions
RestException

Definition at line 105 of file api_proposals.class.php.

References _fetch().

◆ getLines()

Proposals::getLines (   $id,
  $sqlfilters = '' 
)

Get lines of a commercial proposal.

Parameters
int$idId of commercial proposal
string$sqlfiltersOther criteria to filter answers separated by a comma. d is the alias for proposal lines table, p is the alias for product table. "Syntax example "(p.ref:like:'SO-') AND (d.date_start:<:'20220101')"

@url GET {id}/lines

Returns
array

Definition at line 288 of file api_proposals.class.php.

◆ index()

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

List commercial proposals.

Get a list of commercial proposals

Parameters
string$sortfieldSort field
string$sortorderSort order
int$limitLimit for list
int$pagePage number
string$thirdparty_idsThirdparty ids to filter commercial proposals (example '1' or '1,2,3') {@pattern /^[0-9,]*$/i}
string$sqlfiltersOther criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.datec:<:'2016-01-01')"
string$propertiesRestrict the data returned to these properties. Ignored if empty. Comma separated list of properties names
Returns
array Array of order objects

Definition at line 163 of file api_proposals.class.php.

◆ post()

Proposals::post (   $request_data = null)

Create commercial proposal object.

Parameters
array$request_dataRequest data
Returns
int ID of proposal

Definition at line 247 of file api_proposals.class.php.

◆ postContact()

Proposals::postContact (   $id,
  $contactid,
  $type 
)

Add a contact type of given commercial proposal.

Parameters
int$idId of commercial proposal to update
int$contactidId of contact to add
string$typeType of the contact (BILLING, SHIPPING, CUSTOMER)
Returns
array

@url POST {id}/contact/{contactid}/{type}

Exceptions
RestException401
RestException404

Definition at line 591 of file api_proposals.class.php.

◆ postLine()

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

Add a line to given commercial proposal.

Parameters
int$idId of commercial proposal to update
array$request_dataCommercial proposal line data

@url POST {id}/line

Returns
int

Definition at line 330 of file api_proposals.class.php.

◆ postLines()

Proposals::postLines (   $id,
  $request_data = null 
)

Add lines to given commercial proposal.

Parameters
int$idId of commercial proposal to update
array$request_dataCommercial proposal line data

@url POST {id}/lines

Returns
int

Definition at line 396 of file api_proposals.class.php.

◆ put()

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

Update commercial proposal general fields (won't touch lines of commercial proposal)

Parameters
int$idId of commercial proposal to update
array$request_dataDatas
Returns
Object Object with cleaned properties

Definition at line 677 of file api_proposals.class.php.

◆ putLine()

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

Update a line of given commercial proposal.

Parameters
int$idId of commercial proposal to update
int$lineidId of line to update
array$request_dataCommercial proposal line data
Returns
Object|false Object with cleaned properties

@url PUT {id}/lines/{lineid}

Definition at line 477 of file api_proposals.class.php.

◆ setinvoiced()

Proposals::setinvoiced (   $id)

Set a commercial proposal billed.

Could be also called setbilled

Parameters
int$idCommercial proposal ID
Returns
Object Object with cleaned properties

@url POST {id}/setinvoiced

Definition at line 914 of file api_proposals.class.php.

◆ settodraft()

Proposals::settodraft (   $id)

Set a proposal to draft.

Parameters
int$idOrder ID
Returns
Object Object with cleaned properties

@url POST {id}/settodraft

Definition at line 767 of file api_proposals.class.php.

◆ validate()

Proposals::validate (   $id,
  $notrigger = 0 
)

Validate a commercial proposal.

If you get a bad value for param notrigger check that ou provide this in body { "notrigger": 0 }

Parameters
int$idCommercial proposal ID
int$notrigger1=Does not execute triggers, 0= execute triggers
Returns
Object Object with cleaned properties

@url POST {id}/validate

Exceptions
RestException304
RestException401
RestException404
RestException500 System error

Definition at line 823 of file api_proposals.class.php.


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