From c664cdae0f62775af2dd58b8a4a9494b4728d4bc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 14 Mar 2024 12:39:42 +0100 Subject: [PATCH] NEW Init of a module with a website template copy also the preview --- htdocs/core/modules/DolibarrModules.class.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php index 15fbe56aa32..04081ba6a02 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -453,7 +453,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it $err += $this->insert_tabs(); } - // Insert activation of module's parts + // Insert activation of module's parts. Copy website templates into doctemplates. if (!$err) { $err += $this->insert_module_parts(); } @@ -2310,6 +2310,15 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it $this->errors[] = ($errormsg ? $errormsg : $langs->trans('ErrorFailToCreateZip', $dest)); } } + + // Copy also the preview website_xxx.jpg file + $docs = dol_dir_list($srcroot, 'files', 0, 'website_.*\.jpg$'); + foreach ($docs as $cursorfile) { + $src = $srcroot.'/'.$cursorfile['name']; + $dest = DOL_DATA_ROOT.'/doctemplates/websites/'.$cursorfile['name']; + + dol_copy($src, $dest); + } } $entity = $conf->entity; // Reset the current entity