From 6af890f7f237ae1fd114d1389feaa93c181f1d71 Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Wed, 25 Jun 2025 21:36:36 +0200 Subject: [PATCH] Fix CI --- .../remotestore/class/externalModules.class.php | 2 +- htdocs/api/class/api_documents.class.php | 14 ++++++++------ htdocs/blockedlog/class/blockedlog.class.php | 10 +++------- 3 files changed, 12 insertions(+), 14 deletions(-) diff --git a/htdocs/admin/remotestore/class/externalModules.class.php b/htdocs/admin/remotestore/class/externalModules.class.php index 93d4269c31e..6869d9357a4 100644 --- a/htdocs/admin/remotestore/class/externalModules.class.php +++ b/htdocs/admin/remotestore/class/externalModules.class.php @@ -748,7 +748,7 @@ class ExternalModules /** * Check the status code of the request * - * @param array{status_code:int,response:null|string|array{errors:array{code:int,message:string}[]}} $request Response elements of CURL request + * @param array{status_code:int,response:null|string|array{curl_error_msg:string,errors:array{code:int,message:string}[]}} $request Response elements of CURL request * @return string|null */ protected function checkStatusCode($request) diff --git a/htdocs/api/class/api_documents.class.php b/htdocs/api/class/api_documents.class.php index df0cb7fd6b5..ea52c344559 100644 --- a/htdocs/api/class/api_documents.class.php +++ b/htdocs/api/class/api_documents.class.php @@ -848,6 +848,8 @@ class Documents extends DolibarrApi $modulepart = 'mrp'; require_once DOL_DOCUMENT_ROOT . '/mrp/class/mo.class.php'; $object = new Mo($this->db); + } elseif ($modulepart == 'ecm') { + throw new RestException(500, 'Using a non empty "ref" is not compatible with using modulepart = '.$modulepart); } else { // TODO Implement additional moduleparts throw new RestException(500, 'Modulepart '.$modulepart.' not implemented yet.'); @@ -879,16 +881,16 @@ class Documents extends DolibarrApi } // Test on permissions - if ($modulepart != 'ecm') { - $relativefile = $tmpreldir.dol_sanitizeFileName($object->ref); - $tmp = dol_check_secure_access_document($modulepart, $relativefile, $entity, DolibarrApiAccess::$user, $ref, 'write'); - $upload_dir = $tmp['original_file']; // No dirname here, tmp['original_file'] is already the dir because dol_check_secure_access_document was called with param original_file that is only the dir - } else { + //if ($modulepart != 'ecm') { // Here $modulepart is always != 'ecm' + $relativefile = $tmpreldir.dol_sanitizeFileName($object->ref); + $tmp = dol_check_secure_access_document($modulepart, $relativefile, $entity, DolibarrApiAccess::$user, $ref, 'write'); + $upload_dir = $tmp['original_file']; // No dirname here, tmp['original_file'] is already the dir because dol_check_secure_access_document was called with param original_file that is only the dir + /*} else { if (!DolibarrApiAccess::$user->hasRight('ecm', 'upload')) { throw new RestException(403, 'Missing permission to upload files in ECM module'); } $upload_dir = $conf->medias->multidir_output[$conf->entity]; - } + }*/ if (empty($upload_dir) || $upload_dir == '/') { throw new RestException(500, 'This value of modulepart ('.$modulepart.') does not support yet usage of ref. Check modulepart parameter or try to use subdir parameter instead of ref.'); diff --git a/htdocs/blockedlog/class/blockedlog.class.php b/htdocs/blockedlog/class/blockedlog.class.php index b6cd3910048..bb872233d4a 100644 --- a/htdocs/blockedlog/class/blockedlog.class.php +++ b/htdocs/blockedlog/class/blockedlog.class.php @@ -1101,13 +1101,9 @@ class BlockedLog */ private function buildFirstPartOfKeyForSignature() { - //print_r($this->object_data); - if (((int) $this->object_version) >= 18) { - // Note: $this->amounts can be '0', '1.1', '1.123'; // All 0 at end should have been removed already - return $this->date_creation.'|'.$this->action.'|'.$this->amounts.'|'.$this->ref_object.'|'.$this->date_object.'|'.$this->user_fullname; - } else { - return $this->date_creation.'|'.$this->action.'|'.$this->amounts.'|'.$this->ref_object.'|'.$this->date_object.'|'.$this->user_fullname; - } + // Note: $this->amounts can be '0', '1.1', '1.123'; // All 0 at end should have been removed already + //if (((int) $this->object_version) >= 18) { + return $this->date_creation.'|'.$this->action.'|'.$this->amounts.'|'.$this->ref_object.'|'.$this->date_object.'|'.$this->user_fullname; }