From 0b9795f34c9e26d5ce519daf06841ce4760e23bd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 31 Oct 2023 10:44:58 +0100 Subject: [PATCH] FIX upload of files src_object_type --- htdocs/api/class/api_documents.class.php | 2 +- htdocs/core/lib/files.lib.php | 2 +- htdocs/install/mysql/tables/llx_ecm_files.sql | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/api/class/api_documents.class.php b/htdocs/api/class/api_documents.class.php index f4232c31d7e13..915768e0ea697 100644 --- a/htdocs/api/class/api_documents.class.php +++ b/htdocs/api/class/api_documents.class.php @@ -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; } diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 06f7babfb6e58..925e9683fd4d9 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -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 { diff --git a/htdocs/install/mysql/tables/llx_ecm_files.sql b/htdocs/install/mysql/tables/llx_ecm_files.sql index 14952d4559477..68a620c3e8192 100644 --- a/htdocs/install/mysql/tables/llx_ecm_files.sql +++ b/htdocs/install/mysql/tables/llx_ecm_files.sql @@ -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,