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
This commit is contained in:
Frank Cools 2025-10-07 20:20:13 +02:00
parent 6178d9bdb7
commit 96dc421177

View File

@ -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;
}