dolibarr 25.0.0-alpha
SocialContributions Class Reference
Inheritance diagram for SocialContributions:
Collaboration diagram for SocialContributions:

Public Member Functions

 __construct ()
 Constructor.
 
 get ($id)
 Get properties of a social contribution object.
 
 index ($sortfield="t.rowid", $sortorder='ASC', $limit=100, $page=0, $sqlfilters='', $properties='', $pagination_data=false)
 List social contributions.
 
 post ($request_data=null)
 Create a social contribution.
 
 put ($id, $request_data=null)
 Update a social contribution.
 
 delete ($id)
 Delete a social contribution.
 
 getAllPayments ($sortfield="t.rowid", $sortorder='ASC', $limit=100, $page=0)
 List all social contribution payments.
 
 getPayments ($id)
 Get the list of payments of a given social contribution.
 
 getPayment ($pid)
 Get a given social contribution payment.
 
 addPayment ($id, $request_data=null)
 Add a payment to a social contribution.
 
 deletePayment ($pid)
 Delete a social contribution payment.
 
- Public Member Functions inherited from DolibarrApi
 __construct ($db, $cachedir='', $refreshCache=false)
 Constructor.
 

Protected Member Functions

 _cleanObjectDatas ($object)
 Clean sensitive object data.
 
- Protected Member Functions inherited from DolibarrApi
 _checkValForAPI ($field, $value, $object)
 Check and convert a string depending on its type/name.
 
 _checkValExtrafieldsForAPI ($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

 _validate ($data)
 Validate fields before creating a social contribution.
 
 _validatePayment ($data)
 Validate fields before creating a payment.
 

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', $parenttableforentity='')
 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 35 of file api_socialcontributions.class.php.

Member Function Documentation

◆ _cleanObjectDatas()

SocialContributions::_cleanObjectDatas ( $object)
protected

Clean sensitive object data.

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

Reimplemented from DolibarrApi.

Definition at line 604 of file api_socialcontributions.class.php.

References $object.

Referenced by get(), getAllPayments(), getPayment(), getPayments(), and index().

◆ _validate()

SocialContributions::_validate ( $data)
private

Validate fields before creating a social contribution.

Parameters
?array<string,string>$data Data to validate
Returns
array<string,string>
Exceptions
RestException400 Missing mandatory field

Definition at line 559 of file api_socialcontributions.class.php.

Referenced by post().

◆ _validatePayment()

SocialContributions::_validatePayment ( $data)
private

Validate fields before creating a payment.

Parameters
?array<string,string>$data Data to validate
Returns
array<string,string>
Exceptions
RestException400 Missing mandatory field

Definition at line 582 of file api_socialcontributions.class.php.

Referenced by addPayment().

◆ addPayment()

SocialContributions::addPayment ( $id,
$request_data = null )

Add a payment to a social contribution.

Parameters
int$idID of the social contribution
array$request_dataRequest data (datepaye, amount, paiementtype, accountid if module bank is on, [num_payment], [note], [closepaidcontrib]) @phan-param ?array<string,string> $request_data @phpstan-param ?array<string,string> $request_data
Returns
int ID of the created payment

@url POST {id}/payments

Exceptions
RestException400 Missing mandatory field, bad date, or payment refused
RestException403 Access denied
RestException404 Social contribution not found

Definition at line 457 of file api_socialcontributions.class.php.

References $id, _validatePayment(), dol_stringtotime(), and isModEnabled().

◆ delete()

SocialContributions::delete ( $id)

Delete a social contribution.

Parameters
int$idID of the social contribution
Returns
array @phan-return array{success:array{code:int,message:string}} @phpstan-return array{success:array{code:int,message:string}}
Exceptions
RestException403 Access denied, or social contribution with payments
RestException404 Social contribution not found
RestException500 Error when deleting the social contribution

Definition at line 292 of file api_socialcontributions.class.php.

References $id.

◆ deletePayment()

SocialContributions::deletePayment ( $pid)

Delete a social contribution payment.

Parameters
int$pidID of the payment
Returns
array @phan-return array{success:array{code:int,message:string}} @phpstan-return array{success:array{code:int,message:string}}

@url DELETE payments/{pid}

Exceptions
RestException403 Access denied
RestException404 Payment not found
RestException500 Error when deleting the payment

Definition at line 527 of file api_socialcontributions.class.php.

◆ get()

SocialContributions::get ( $id)

Get properties of a social contribution object.

Parameters
int$idID of the social contribution
Returns
Object Object with cleaned properties
Exceptions
RestException403 Access denied
RestException404 Social contribution not found

Definition at line 75 of file api_socialcontributions.class.php.

References $id, and _cleanObjectDatas().

◆ getAllPayments()

SocialContributions::getAllPayments ( $sortfield = "t.rowid",
$sortorder = 'ASC',
$limit = 100,
$page = 0 )

List all social contribution payments.

Parameters
string$sortfieldSort field
string$sortorderSort order
int$limitLimit for list
int$pagePage number
Returns
array List of PaymentSocialContribution objects @phan-return PaymentSocialContribution[] @phpstan-return PaymentSocialContribution[]

@url GET /payments

Exceptions
RestException403 Access denied
RestException503 Error when retrieving list

Definition at line 337 of file api_socialcontributions.class.php.

References _cleanObjectDatas().

◆ getPayment()

SocialContributions::getPayment ( $pid)

Get a given social contribution payment.

Parameters
int$pidID of the payment
Returns
Object PaymentSocialContribution object with cleaned properties

@url GET payments/{pid}

Exceptions
RestException403 Access denied
RestException404 Payment not found

Definition at line 427 of file api_socialcontributions.class.php.

References _cleanObjectDatas().

◆ getPayments()

SocialContributions::getPayments ( $id)

Get the list of payments of a given social contribution.

Parameters
int$idID of the social contribution
Returns
array List of PaymentSocialContribution objects @phan-return PaymentSocialContribution[] @phpstan-return PaymentSocialContribution[]

@url GET {id}/payments

Exceptions
RestException403 Access denied
RestException503 Error when retrieving list

Definition at line 387 of file api_socialcontributions.class.php.

References $id, and _cleanObjectDatas().

◆ index()

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

List social contributions.

Parameters
string$sortfieldSort field
string$sortorderSort order
int$limitLimit for list
int$pagePage number
string$sqlfiltersOther criteria to filter answers separated by a comma. Syntax example "(t.date_ech:>=:'20240101') and (t.amount:<:100)"
string$propertiesRestrict the data returned to these properties. Ignored if empty. Comma separated list of properties names
bool$pagination_dataIf this parameter is set to true the response will include pagination data. Default value is false. Page starts from 0
Returns
array Array of social contribution objects @phan-return ChargeSociales[]|array{data:ChargeSociales[],pagination:array{total:int,page:int,page_count:int,limit:int}} @phpstan-return ChargeSociales[]|array{data:ChargeSociales[],pagination:array{total:int,page:int,page_count:int,limit:int}}
Exceptions
RestException400 Bad value for sqlfilters
RestException403 Access denied
RestException503 Error when retrieving list

Definition at line 108 of file api_socialcontributions.class.php.

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

◆ post()

SocialContributions::post ( $request_data = null)

Create a social contribution.

Parameters
array$request_dataRequest data @phan-param ?array<string,string> $request_data @phpstan-param ?array<string,string> $request_data
Returns
int ID of the created social contribution
Exceptions
RestException400 Missing mandatory field
RestException403 Access denied
RestException500 Error when creating the social contribution

Definition at line 192 of file api_socialcontributions.class.php.

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

◆ put()

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

Update a social contribution.

Parameters
int$idID of the social contribution
array$request_dataRequest data @phan-param ?array<string,string> $request_data @phpstan-param ?array<string,string> $request_data
Returns
Object Updated object with cleaned properties
Exceptions
RestException403 Access denied
RestException404 Social contribution not found
RestException500 Error when updating the social contribution

Definition at line 237 of file api_socialcontributions.class.php.

References $id, DolibarrApi\_checkValExtrafieldsForAPI(), DolibarrApi\_checkValForAPI(), and sanitizeVal().


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