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:
parent
f10f402073
commit
abd4156a88
@ -1542,6 +1542,8 @@ class DeclarationTVA_PDF
|
|||||||
$local_manifest = DOL_DOCUMENT_ROOT.'/custom/declarationtva/templates/manifest.json';
|
$local_manifest = DOL_DOCUMENT_ROOT.'/custom/declarationtva/templates/manifest.json';
|
||||||
if (file_exists($local_manifest)) {
|
if (file_exists($local_manifest)) {
|
||||||
$manifest_content = file_get_contents($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) {
|
if ($manifest_content === false) {
|
||||||
$update_info['error'] = 'Failed to fetch manifest from Gitea and local file not found';
|
$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';
|
$local_template = DOL_DOCUMENT_ROOT.'/custom/declarationtva/templates/declarationtva/ca3_official_template.pdf';
|
||||||
if (file_exists($local_template)) {
|
if (file_exists($local_template)) {
|
||||||
$template_content = file_get_contents($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) {
|
if ($template_content === false) {
|
||||||
$this->error = 'Failed to download template from Gitea and local file not found';
|
$this->error = 'Failed to download template from Gitea and local file not found';
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user