dolibarr  7.0.0-beta
Public Member Functions | List of all members
Documents Class Reference

API class for receive files. More...

+ Inheritance diagram for Documents:
+ Collaboration diagram for Documents:

Public Member Functions

 __construct ()
 Constructor.
 
 index ($module_part, $original_file='')
 Download a document. More...
 
 builddoc ($module_part, $original_file='', $doctemplate='', $langcode='')
 Build a document. More...
 
 getDocumentsListByElement ($modulepart, $id=0, $ref='', $sortfield='', $sortorder='')
 Return the list of documents of a dedicated element (from its ID or Ref) More...
 
 _validate_file ($data)
 Validate fields before create or update object. More...
 
- Public Member Functions inherited from DolibarrApi
 __construct ($db, $cachedir='', $refreshCache=false)
 Constructor. More...
 
 _cleanObjectDatas ($object)
 Executed method when API is called without parameter. More...
 
 _checkFilters ($sqlfilters)
 Return if a $sqlfilters parameter is valid. More...
 

Additional Inherited Members

- Static Public 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

API class for receive files.

protected ,external}

Definition at line 33 of file api_documents.class.php.

Member Function Documentation

Documents::_validate_file (   $data)

Validate fields before create or update object.

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

Definition at line 571 of file api_documents.class.php.

Documents::builddoc (   $module_part,
  $original_file = '',
  $doctemplate = '',
  $langcode = '' 
)

Build a document.

Test sample 1: { "module_part": "invoice", "original_file": "FA1701-001/FA1701-001.pdf", "doctemplate": "crabe", "langcode": "fr_FR" }.

Parameters
string$module_partName of module or area concerned by file download ('invoice', 'order', ...).
string$original_fileRelative path with filename, relative to modulepart (for example: IN201701-999/IN201701-999.pdf).
string$doctemplateSet here the doc template to use for document generation (If not set, use the default template).
string$langcodeLanguage code like 'en_US', 'fr_FR', 'es_ES', ... (If not set, use the default language).
Returns
array List of documents
Exceptions
500
501
400
401
404
200PUT /builddoc

Definition at line 130 of file api_documents.class.php.

References dol_check_secure_access_document(), and dol_osencode().

Documents::getDocumentsListByElement (   $modulepart,
  $id = 0,
  $ref = '',
  $sortfield = '',
  $sortorder = '' 
)

Return the list of documents of a dedicated element (from its ID or Ref)

Parameters
string$modulepartName of module or area concerned ('thirdparty', 'member', 'proposal', 'order', 'invoice', 'shipment', 'project', ...)
int$idID of element
string$refRef of element
string$sortfieldSort criteria ('','fullname','relativename','name','date','size')
string$sortorderSort order ('asc' or 'desc')
Returns
array Array of documents with path
Exceptions
200
400
401
404
500GET /

Definition at line 249 of file api_documents.class.php.

References dol_dir_list(), and get_exdir().

Documents::index (   $module_part,
  $original_file = '' 
)

Download a document.

Note that, this API is similar to using the wrapper link "documents.php" to download a file (used for internal HTML links of documents into application), but with no need to have a session cookie (the token is used instead).

Parameters
string$module_partName of module or area concerned by file download ('facture', ...)
string$original_fileRelative path with filename, relative to modulepart (for example: IN201701-999/IN201701-999.pdf)
Returns
array List of documents
Exceptions
400
401
404
200GET /download

Definition at line 70 of file api_documents.class.php.

References dol_check_secure_access_document(), and dol_osencode().


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