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

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= '')
 List commercial proposals. More...
 
 post ($request_data=null)
 Create commercial proposal object. More...
 
 getLines ($id)
 Get lines of a commercial proposal. More...
 
 postLine ($id, $request_data=null)
 Add a line 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
 _cleanObjectDatas ($object)
 Executed method when API is called without parameter. More...
 
 _checkFilters ($sqlfilters)
 Return if a $sqlfilters parameter is valid. 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 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_proposals.class.php.

Member Function Documentation

Proposals::_cleanObjectDatas (   $object)
protected

Clean sensible object datas.

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

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

Referenced by _fetch(), close(), deleteContact(), getLines(), index(), putLine(), setinvoiced(), settodraft(), and validate().

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

Get properties of an proposal object.

Return an array with proposal informations

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
array|mixed data without useless information
Exceptions
RestException

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

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

Referenced by get(), getByRef(), and getByRefExt().

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 833 of file api_proposals.class.php.

Referenced by post().

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) { 2}{ 3}
string$note_privateAdd this mention at end of private note
int$notriggerDisabled triggers

POST {id}/close

Returns
array

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

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

Proposals::delete (   $id)

Delete commercial proposal.

Parameters
int$idCommercial proposal ID
Returns
array

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

References DolibarrApi\_checkAccessToResource().

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).

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

Returns
int
Exceptions
RestException401
RestException404
RestException500

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

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

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

DELETE {id}/lines/{lineid}

Returns
int
Exceptions
RestException401
RestException404

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

References DolibarrApi\_checkAccessToResource().

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

Get properties of a commercial proposal object.

Return an array with commercial proposal informations

Parameters
int$idID of commercial proposal
int$contact_list0: Returned array of contacts/addresses contains all properties, 1: Return array contains just id
Returns
array|mixed data without useless information
Exceptions
RestException

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

References _fetch().

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

Get properties of an proposal object by ref.

Return an array with proposal informations

Parameters
string$refRef of object
int$contact_list0: Returned array of contacts/addresses contains all properties, 1: Return array contains just id
Returns
array|mixed data without useless information

GET ref/{ref}

Exceptions
RestException

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

References _fetch().

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

Get properties of an proposal object by ref_ext.

Return an array with proposal informations

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
array|mixed data without useless information

GET ref_ext/{ref_ext}

Exceptions
RestException

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

References _fetch().

Proposals::getLines (   $id)

Get lines of a commercial proposal.

Parameters
int$idId of commercial proposal

GET {id}/lines

Returns
int

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

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

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

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') { /^[0-9,]*$/i}
string$sqlfiltersOther criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.datec:<:'20160101')"
Returns
array Array of order objects

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

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

Proposals::post (   $request_data = null)

Create commercial proposal object.

Parameters
array$request_dataRequest data
Returns
int ID of proposal

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

References _validate().

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)

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

Returns
int
Exceptions
RestException401
RestException404

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

References DolibarrApi\_checkAccessToResource().

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

POST {id}/lines

Returns
int

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

References DolibarrApi\_checkAccessToResource().

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
int

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

References DolibarrApi\_checkAccessToResource().

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

PUT {id}/lines/{lineid}

Returns
object

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

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

Proposals::setinvoiced (   $id)

Set a commercial proposal billed.

Could be also called setbilled

Parameters
int$idCommercial proposal ID

POST {id}/setinvoiced

Returns
array

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

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

Proposals::settodraft (   $id)

Set a proposal to draft.

Parameters
int$idOrder ID

POST {id}/settodraft

Returns
array

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

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

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

POST {id}/validate

Exceptions
RestException304
RestException401
RestException404
RestException500
Returns
array

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

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


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