From 96dc4211770e07ac4579e9fec35aae3a26758692 Mon Sep 17 00:00:00 2001 From: Frank Cools Date: Tue, 7 Oct 2025 20:20:13 +0200 Subject: [PATCH] Fix Gitea manifest fetching error in template management - Replace Gitea manifest fetching with local manifest file - Use local template files instead of downloading from Gitea - Fix 'Failed to fetch manifest from Gitea' error in template management tab - Use local files for template updates instead of external Gitea server - Improve reliability by removing external dependencies --- core/class/declarationtva_pdf.class.php | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/core/class/declarationtva_pdf.class.php b/core/class/declarationtva_pdf.class.php index 5369a38..53f98b3 100644 --- a/core/class/declarationtva_pdf.class.php +++ b/core/class/declarationtva_pdf.class.php @@ -1535,10 +1535,16 @@ class DeclarationTVA_PDF ); try { - // Fetch manifest from Gitea - $manifest_content = file_get_contents($this->manifest_url); + // Use local manifest file instead of fetching from Gitea + $local_manifest = DOL_DOCUMENT_ROOT.'/custom/declarationtva/templates/manifest.json'; + if (!file_exists($local_manifest)) { + $update_info['error'] = 'Local manifest file not found'; + return $update_info; + } + + $manifest_content = file_get_contents($local_manifest); if ($manifest_content === false) { - $update_info['error'] = 'Failed to fetch manifest from Gitea'; + $update_info['error'] = 'Failed to read local manifest file'; return $update_info; } @@ -1586,10 +1592,16 @@ class DeclarationTVA_PDF dol_mkdir($this->template_path); } - // Download template - $template_content = file_get_contents($download_url); + // Use local template file instead of downloading from Gitea + $local_template = DOL_DOCUMENT_ROOT.'/custom/declarationtva/templates/declarationtva/ca3_official_template.pdf'; + if (!file_exists($local_template)) { + $this->error = 'Local template file not found'; + return false; + } + + $template_content = file_get_contents($local_template); if ($template_content === false) { - $this->error = 'Failed to download template from Gitea'; + $this->error = 'Failed to read local template file'; return false; }