dolibarr 20.0.0
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.
 
 getByRef ($ref, $contact_list=1)
 Get properties of an proposal object by ref.
 
 getByRefExt ($ref_ext, $contact_list=1)
 Get properties of an proposal object by ref_ext.
 
 index ($sortfield="t.rowid", $sortorder='ASC', $limit=100, $page=0, $thirdparty_ids='', $sqlfilters='', $properties='')
 List commercial proposals.
 
 post ($request_data=null)
 Create commercial proposal object.
 
 getLines ($id, $sqlfilters='')
 Get lines of a commercial proposal.
 
 postLine ($id, $request_data=null)
 Add a line to given commercial proposal.
 
 postLines ($id, $request_data=null)
 Add lines to given commercial proposal.
 
 putLine ($id, $lineid, $request_data=null)
 Update a line of given commercial proposal.
 
 deleteLine ($id, $lineid)
 Delete a line of given commercial proposal.
 
 postContact ($id, $contactid, $type, $source='external')
 Add a contact type of given commercial proposal.
 
 deleteContact ($id, $contactid, $type)
 Delete a contact type of given commercial proposal.
 
 put ($id, $request_data=null)
 Update commercial proposal general fields (won't touch lines of commercial proposal)
 
 delete ($id)
 Delete commercial proposal.
 
 settodraft ($id)
 Set a proposal to draft.
 
 validate ($id, $notrigger=0)
 Validate a commercial proposal.
 
 close ($id, $status, $note_private='', $notrigger=0)
 Close (Accept or refuse) a quote / commercial proposal.
 
 setinvoiced ($id)
 Set a commercial proposal billed.
 
- Public Member Functions inherited from DolibarrApi
 __construct ($db, $cachedir='', $refreshCache=false)
 Constructor.
 

Protected Member Functions

 _cleanObjectDatas ($object)
 Clean sensible object datas.
 
- Protected Member Functions inherited from DolibarrApi
 _checkValForAPI ($field, $value, $object)
 Check and convert a string depending on its type/name.
 
 _filterObjectProperties ($object, $properties)
 Filter properties that will be returned on object.
 
 _checkFilters ($sqlfilters, &$error='')
 Return if a $sqlfilters parameter is valid Function no more used.
 

Private Member Functions

 _fetch ($id, $ref='', $ref_ext='', $contact_list=1)
 Get properties of an proposal object.
 
 _validate ($data)
 Validate fields before create or update object.
 

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.
 
static _forge_criteria_callback ($matches)
 Function to forge a SQL criteria from a Generic filter string.
 

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

References $object.

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

◆ _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.

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

Referenced by get(), getByRef(), and 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 965 of file api_proposals.class.php.

Referenced by post().

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

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

◆ delete()

Proposals::delete ( $id)

Delete commercial proposal.

Parameters
int$idCommercial proposal ID
Returns
array

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

References DolibarrApi\_checkAccessToResource().

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

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

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

References DolibarrApi\_checkAccessToResource().

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

References _fetch().

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

References _fetch().

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

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

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

References _cleanObjectDatas(), DolibarrApi\_filterObjectProperties(), dol_syslog(), and forgeSQLFromUniversalSearchCriteria().

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

References DolibarrApi\_checkValForAPI(), _validate(), and sanitizeVal().

◆ postContact()

Proposals::postContact ( $id,
$contactid,
$type,
$source = 'external' )

Add a contact type of given commercial proposal.

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

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

Exceptions
RestException401
RestException404

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

References DolibarrApi\_checkAccessToResource().

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

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

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

References DolibarrApi\_checkAccessToResource().

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

References DolibarrApi\_checkAccessToResource(), DolibarrApi\_checkValForAPI(), and sanitizeVal().

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

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

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

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

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

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

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

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


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