Skip to content

Commit

Permalink
Update api_documents.class.php
Browse files Browse the repository at this point in the history
  • Loading branch information
frederic34 authored Sep 30, 2024
1 parent a375b50 commit 1b50103
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion htdocs/api/class/api_documents.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -662,6 +662,8 @@ public function get($id) {
* @param string $fileencoding File encoding (''=no encoding, 'base64'=Base 64)
* @param int $overwriteifexists Overwrite file if exists (1 by default)
* @param int $createdirifnotexists Create subdirectories if the doesn't exists (1 by default)
* @param int $position Position
* @param array $array_options array of options
* @return string
*
* @url POST /upload
Expand All @@ -671,7 +673,7 @@ public function get($id) {
* @throws RestException 404 Object not found
* @throws RestException 500 Error on file operationw
*/
public function post($filename, $modulepart, $ref = '', $subdir = '', $filecontent = '', $fileencoding = '', $overwriteifexists = 0, $createdirifnotexists = 1)
public function post($filename, $modulepart, $ref = '', $subdir = '', $filecontent = '', $fileencoding = '', $overwriteifexists = 0, $createdirifnotexists = 1, $position = 0, $array_options = [])

Check warning on line 676 in htdocs/api/class/api_documents.class.php

View workflow job for this annotation

GitHub Actions / phan / Run phan

api_documents.class.php: PhanPluginUnknownArrayMethodParamType: Method \Documents::post has a parameter type of array for $array_options, but does not specify any key types or value types
{
global $conf;

Expand Down Expand Up @@ -939,6 +941,12 @@ public function post($filename, $modulepart, $ref = '', $subdir = '', $fileconte
$moreinfo['src_object_type'] = $object->table_element;
$moreinfo['src_object_id'] = $object->id;
}
if (!empty($array_options)) {
$moreinfo = array_merge($moreinfo, ["array_options" => $array_options]);
}
if (!empty($position)) {
$moreinfo = array_merge($moreinfo, ["position" => $position]);
}

// Move the temporary file at its final emplacement
$result = dol_move($destfiletmp, $dest_file, '0', $overwriteifexists, 1, 1, $moreinfo);
Expand Down

0 comments on commit 1b50103

Please sign in to comment.