FIX upload of files src_object_type

This commit is contained in:
Laurent Destailleur
2023-10-31 10:44:58 +01:00
parent 85d36ddc58
commit 0b9795f34c
3 changed files with 3 additions and 3 deletions

View File

@@ -881,7 +881,7 @@ class Documents extends DolibarrApi
$moreinfo = array('note_private' => 'File uploaded using API /documents from IP '.getUserRemoteIP()); $moreinfo = array('note_private' => 'File uploaded using API /documents from IP '.getUserRemoteIP());
if (!empty($object) && is_object($object) && $object->id > 0) { 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; $moreinfo['src_object_id'] = $object->id;
} }

View File

@@ -1038,7 +1038,7 @@ function dol_move($srcfile, $destfile, $newmask = 0, $overwriteifexists = 1, $te
$ecmfile->filename = $filename; $ecmfile->filename = $filename;
$ecmfile->label = md5_file(dol_osencode($destfile)); // $destfile is a full path to file $ecmfile->label = md5_file(dol_osencode($destfile)); // $destfile is a full path to file
$ecmfile->fullpath_orig = $srcfile; $ecmfile->fullpath_orig = $srcfile;
$ecmfile->gen_or_uploaded = 'upload'; $ecmfile->gen_or_uploaded = 'uploaded';
if (!empty($moreinfo) && !empty($moreinfo['description'])) { if (!empty($moreinfo) && !empty($moreinfo['description'])) {
$ecmfile->description = $moreinfo['description']; // indexed content $ecmfile->description = $moreinfo['description']; // indexed content
} else { } else {

View File

@@ -26,7 +26,7 @@ CREATE TABLE llx_ecm_files
entity integer DEFAULT 1 NOT NULL, -- multi company id entity integer DEFAULT 1 NOT NULL, -- multi company id
filepath varchar(255) NOT NULL, -- relative to dolibarr document dir. Example module/def filepath varchar(255) NOT NULL, -- relative to dolibarr document dir. Example module/def
filename varchar(255) NOT NULL, -- file name only without any directory 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 src_object_id integer, -- Source object id
fullpath_orig varchar(750), -- full path of original filename, when file is uploaded from a local computer fullpath_orig varchar(750), -- full path of original filename, when file is uploaded from a local computer
description text, description text,