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:
parent
6178d9bdb7
commit
96dc421177
@ -1535,10 +1535,16 @@ class DeclarationTVA_PDF
|
|||||||
);
|
);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Fetch manifest from Gitea
|
// Use local manifest file instead of fetching from Gitea
|
||||||
$manifest_content = file_get_contents($this->manifest_url);
|
$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) {
|
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;
|
return $update_info;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1586,10 +1592,16 @@ class DeclarationTVA_PDF
|
|||||||
dol_mkdir($this->template_path);
|
dol_mkdir($this->template_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Download template
|
// Use local template file instead of downloading from Gitea
|
||||||
$template_content = file_get_contents($download_url);
|
$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) {
|
if ($template_content === false) {
|
||||||
$this->error = 'Failed to download template from Gitea';
|
$this->error = 'Failed to read local template file';
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user