diff --git a/htdocs/api/class/api.class.php b/htdocs/api/class/api.class.php index 082e6188379..190e24d326c 100644 --- a/htdocs/api/class/api.class.php +++ b/htdocs/api/class/api.class.php @@ -66,6 +66,7 @@ class DolibarrApi * * @return array */ + /* Disabled, most APIs does not share same signature for method index function index() { return array( @@ -74,7 +75,7 @@ class DolibarrApi 'message' => __class__.' is up and running!' ) ); - } + }*/ /** diff --git a/htdocs/api/class/api_documents.class.php b/htdocs/api/class/api_documents.class.php index eb6380a19e4..e26486981fa 100644 --- a/htdocs/api/class/api_documents.class.php +++ b/htdocs/api/class/api_documents.class.php @@ -36,8 +36,7 @@ class Documents extends DolibarrApi * @var array $DOCUMENT_FIELDS Mandatory fields, checked when create and update object */ static $DOCUMENT_FIELDS = array( - 'modulepart', - 'filename' + 'modulepart' ); /** @@ -49,23 +48,36 @@ class Documents extends DolibarrApi $this->db = $db; } - + /** - * Return a document + * Return list of documents. + * + * @param string $module_part Name of module or area concerned by file download ('facture', ...) + * @param string $ref Reference of object (This will define subdir automatically) + * @param string $subdir Subdirectory (Only if ref not provided) + * @return array List of documents * - * @param string $module_part Module part for file - * @param string $filename File name - * - * @url GET {module_part}/{filename} - * - * @return array Array with data of file * @throws RestException */ - public function get($module_part, $filename) { + public function index($module_part, $ref='', $subdir='') { return array('note'=>'FeatureNotYetAvailable'); } - - + + + /** + * Return a document. + * + * @param int $id ID of document + * @return array Array with data of file + * + * @throws RestException + */ + /* + public function get($id) { + return array('note'=>'xxx'); + }*/ + + /** * Push a file. * Test sample 1: { "filename": "mynewfile.txt", "modulepart": "facture", "ref": "FA1701-001", "subdir": "", "filecontent": "content text", "fileencoding": "", "overwriteifexists": "0" }. diff --git a/htdocs/compta/bank/class/api_bankaccounts.class.php b/htdocs/compta/bank/class/api_bankaccounts.class.php index 7eaf673c2e7..10994d7d525 100644 --- a/htdocs/compta/bank/class/api_bankaccounts.class.php +++ b/htdocs/compta/bank/class/api_bankaccounts.class.php @@ -98,7 +98,8 @@ class BankAccounts extends DolibarrApi if ($result) { $num = $this->db->num_rows($result); - for ($i = 0; $i < min($num, ($limit <= 0 ? $num : $limit)); $i++) { + $minnum = min($num, ($limit <= 0 ? $num : $limit)); + for ($i = 0; $i < $minnum; $i++) { $obj = $this->db->fetch_object($result); $account = new Account($this->db); if ($account->fetch($obj->rowid) > 0) {