Skip to content

Commit

Permalink
FIX upload of files src_object_type
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Oct 31, 2023
1 parent 85d36dd commit 0b9795f
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion htdocs/api/class/api_documents.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -881,7 +881,7 @@ public function post($filename, $modulepart, $ref = '', $subdir = '', $fileconte

$moreinfo = array('note_private' => 'File uploaded using API /documents from IP '.getUserRemoteIP());
if (!empty($object) && is_object($object) && $object->id > 0) {
$moreinfo['src_object_type'] = $modulepartorig;
$moreinfo['src_object_type'] = $object->table_element;
$moreinfo['src_object_id'] = $object->id;
}

Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/lib/files.lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -1038,7 +1038,7 @@ function dol_move($srcfile, $destfile, $newmask = 0, $overwriteifexists = 1, $te
$ecmfile->filename = $filename;
$ecmfile->label = md5_file(dol_osencode($destfile)); // $destfile is a full path to file
$ecmfile->fullpath_orig = $srcfile;
$ecmfile->gen_or_uploaded = 'upload';
$ecmfile->gen_or_uploaded = 'uploaded';
if (!empty($moreinfo) && !empty($moreinfo['description'])) {
$ecmfile->description = $moreinfo['description']; // indexed content
} else {
Expand Down
2 changes: 1 addition & 1 deletion htdocs/install/mysql/tables/llx_ecm_files.sql
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ CREATE TABLE llx_ecm_files
entity integer DEFAULT 1 NOT NULL, -- multi company id
filepath varchar(255) NOT NULL, -- relative to dolibarr document dir. Example module/def
filename varchar(255) NOT NULL, -- file name only without any directory
src_object_type varchar(64), -- Source object type ('proposal', 'invoice', ...)
src_object_type varchar(64), -- Source object type ('proposal', 'invoice', ...) - object->table_element
src_object_id integer, -- Source object id
fullpath_orig varchar(750), -- full path of original filename, when file is uploaded from a local computer
description text,
Expand Down

0 comments on commit 0b9795f

Please sign in to comment.