Refactor authorization and token refresh logic; update tax handling and invoice generation

- Changed variable name from `$stmt_service` to `$stmt_refreshkey` for clarity in `authorization.php` and `token_refresh.php`.
- Added null coalescing operator to ensure criteria are set to an empty string if not provided in `products_software_versions.php`.
- Modified SQL script to add `eu` column to `taxes` table and update tax rates based on EU membership.
- Enhanced invoice generation logic in `functions.php` to include VAT notes based on customer country and VAT number.
- Updated email and PDF templates to display VAT notes and percentages correctly.
- Adjusted JavaScript tax calculation logic to handle VAT based on country and VAT number.
- Fixed API URL in `index.php` for token refresh endpoint.
- Updated countries data structure in `countries.php` to include EU membership status.
This commit is contained in:
“VeLiTi”
2026-02-05 15:26:41 +01:00
parent c4cb99b945
commit d7b9b91bb6
10 changed files with 271 additions and 168 deletions

View File

@@ -4,6 +4,8 @@ TRUNCATE TABLE `role_access_permissions`;
TRUNCATE TABLE `user_roles`;
TRUNCATE TABLE `access_elements`;
ALTER TABLE taxes ADD COLUMN eu TINYINT(1) DEFAULT 0;
INSERT INTO access_elements (access_name,access_path,description,is_active,created,createdby,updated,updatedby,access_group) VALUES
('Access Element','access_element','Auto-scanned: access_element',1,'2026-01-18 18:49:49','0','2026-01-18 18:49:49',NULL,'Views'),
('Access Element Manage','access_element_manage','Auto-scanned: access_element_manage',1,'2026-01-18 18:49:49','0','2026-01-18 18:49:49',NULL,'Views'),
@@ -921,5 +923,14 @@ WHERE warranty_date IS NOT NULL;
alter table users add refreshkey varchar(255);
UPDATE taxes SET eu = 1 WHERE country IN (
'Austria', 'Belgium', 'Bulgaria', 'Croatia', 'Cyprus', 'Czech Republic',
'Denmark', 'Estonia', 'Finland', 'France', 'Germany', 'Greece',
'Hungary', 'Ireland', 'Italy', 'Latvia', 'Lithuania', 'Luxembourg',
'Malta', 'Netherlands', 'Poland', 'Portugal', 'Romania', 'Slovakia',
'Slovenia', 'Spain', 'Sweden'
);
UPDATE taxes SET rate = 0.00 WHERE eu = 0 OR eu IS NULL;
SET FOREIGN_KEY_CHECKS=1;