Improve template management with better fallback messaging

- Add informative messages when using local files due to Gitea inaccessibility
- Provide clear feedback about fallback behavior
- Maintain functionality even when Gitea server is not accessible
- Support both online and offline template management scenarios
This commit is contained in:
Frank Cools 2025-10-07 20:23:52 +02:00
parent f10f402073
commit abd4156a88

View File

@ -1542,6 +1542,8 @@ class DeclarationTVA_PDF
$local_manifest = DOL_DOCUMENT_ROOT.'/custom/declarationtva/templates/manifest.json';
if (file_exists($local_manifest)) {
$manifest_content = file_get_contents($local_manifest);
// Set a note that we're using local manifest
$update_info['error'] = 'Using local manifest (Gitea server not accessible)';
}
if ($manifest_content === false) {
$update_info['error'] = 'Failed to fetch manifest from Gitea and local file not found';
@ -1600,6 +1602,8 @@ class DeclarationTVA_PDF
$local_template = DOL_DOCUMENT_ROOT.'/custom/declarationtva/templates/declarationtva/ca3_official_template.pdf';
if (file_exists($local_template)) {
$template_content = file_get_contents($local_template);
// Note that we're using local template
$this->error = 'Using local template (Gitea server not accessible)';
}
if ($template_content === false) {
$this->error = 'Failed to download template from Gitea and local file not found';