3 Commits

Author SHA1 Message Date
“VeLiTi”
3131c2c5b2 Refactor invoice PDF generation and VAT validation
- Updated PDF template to display a fixed software code instead of "SOFTWARE".
- Changed VAT label to include tax label dynamically and set to 0% for certain conditions.
- Enhanced JavaScript for VAT number validation with asynchronous checks against the VIES database.
- Implemented debounce for VAT number input to optimize validation calls.
- Updated country settings to include country codes for VAT validation.
- Modified email sending functions in webhook handlers to use dynamic attachment names for invoices.
2026-02-06 16:02:56 +01:00
“VeLiTi”
4b83f596f1 Refactor RBAC migration scripts and update configuration handling
- Removed old migration scripts for profiles and users to RBAC.
- Updated config redirector to utilize environment variables for configuration loading.
- Added .gitignore files to firmware, log, and marketing directories to prevent unnecessary file tracking.
- Introduced new configuration files for acceptance, development, and production environments with relevant settings.
- Enhanced settings files to include exception lists, security keys, and database settings.
2026-02-06 13:34:54 +01:00
“VeLiTi”
4564a4a04b Add session regeneration after token refresh to enhance security 2026-02-05 16:38:19 +01:00
28 changed files with 1119 additions and 708 deletions

BIN
.DS_Store vendored

Binary file not shown.

23
.gitignore vendored
View File

@@ -1,24 +1,5 @@
dev.php
test.php
migration.php
log_21.txt
log_22.txt
marketing/
firmware/
log/
assets/images/products/
settings/settings.php
settings/config.php
variable_scan.php
settings/soveliti/soveliti_config.php
settings/soveliti/soveliti_settings.php
assets/database/dev_schema.sql
assets/database/migration.sql
assets/database/prod_schema.sql
.htaccess
migration.sql
assets/database/migration_triggers.sql
assets/database/migration_v2.sql
assets/database/migration_v3.sql
.DS_Store
api/.DS_Store
api/v1/.DS_Store
@@ -26,5 +7,3 @@ api/v2/.DS_Store
api/.DS_Store
assets/.DS_Store
assets/images/.DS_Store
assets/database/ManualUpdates.sql
assets/database/migration_users_to_rbac.sql

86
api/v2/post/vat_check.php Normal file
View File

@@ -0,0 +1,86 @@
<?php
defined($security_key) or exit;
//------------------------------------------
// VAT Number Validation (VIES Proxy)
//------------------------------------------
// CONTENT FROM API (POST)
$post_content = json_decode($input, true);
// Validate input
if (empty($post_content['countryCode']) || empty($post_content['vatNumber'])) {
http_response_code(400);
echo json_encode([
'error' => 'Missing required parameters: countryCode and vatNumber'
]);
exit;
}
$countryCode = strtoupper(trim($post_content['countryCode']));
$vatNumber = $post_content['vatNumber'];
// Remove all whitespace from VAT number
$vatNumber = preg_replace('/\s+/', '', $vatNumber);
// Remove country code prefix if included in VAT number
if (strpos($vatNumber, $countryCode) === 0) {
$vatNumber = substr($vatNumber, strlen($countryCode));
}
// VIES API endpoint
$viesUrl = 'https://ec.europa.eu/taxation_customs/vies/rest-api/check-vat-number';
// Prepare request data
$requestData = json_encode([
'countryCode' => $countryCode,
'vatNumber' => $vatNumber
]);
// Initialize cURL
$ch = curl_init($viesUrl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $requestData);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Content-Type: application/json',
'Accept: application/json'
]);
curl_setopt($ch, CURLOPT_TIMEOUT, 10); // 10 second timeout
// Execute request
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
$curlError = curl_error($ch);
curl_close($ch);
// Check for cURL errors
if ($curlError) {
http_response_code(500);
echo json_encode([
'error' => 'Failed to connect to VIES service',
'details' => $curlError
]);
exit;
}
// Parse VIES response regardless of HTTP code
$viesData = json_decode($response, true);
// If we can't parse JSON, return an error
if (json_last_error() !== JSON_ERROR_NONE) {
http_response_code(500);
echo json_encode([
'error' => 'Invalid response from VIES service',
'httpCode' => $httpCode,
'response' => $response
]);
exit;
}
// Always return 200 OK to the client with the VIES data
// The client will check the 'valid' field in the response
http_response_code(200);
echo json_encode($viesData);
?>

View File

@@ -590,7 +590,6 @@ INSERT INTO taxes (country,rate) VALUES
('Tunisia',19.00),
('Algeria',19.00);
INSERT INTO taxes (country,rate) VALUES
('Egypt',14.00),
('Ethiopia',15.00),
('Tanzania',18.00),
('Uganda',18.00),
@@ -923,6 +922,8 @@ WHERE warranty_date IS NOT NULL;
alter table users add refreshkey varchar(255);
alter table taxes add country_code varchar(10);
UPDATE taxes SET eu = 1 WHERE country IN (
'Austria', 'Belgium', 'Bulgaria', 'Croatia', 'Cyprus', 'Czech Republic',
'Denmark', 'Estonia', 'Finland', 'France', 'Germany', 'Greece',
@@ -933,4 +934,146 @@ UPDATE taxes SET eu = 1 WHERE country IN (
UPDATE taxes SET rate = 0.00 WHERE eu = 0 OR eu IS NULL;
UPDATE taxes SET country_code = 'AT' WHERE country = 'Austria';
UPDATE taxes SET country_code = 'BE' WHERE country = 'Belgium';
UPDATE taxes SET country_code = 'BG' WHERE country = 'Bulgaria';
UPDATE taxes SET country_code = 'HR' WHERE country = 'Croatia';
UPDATE taxes SET country_code = 'CY' WHERE country = 'Cyprus';
UPDATE taxes SET country_code = 'CZ' WHERE country = 'Czech Republic';
UPDATE taxes SET country_code = 'DK' WHERE country = 'Denmark';
UPDATE taxes SET country_code = 'EE' WHERE country = 'Estonia';
UPDATE taxes SET country_code = 'FI' WHERE country = 'Finland';
UPDATE taxes SET country_code = 'FR' WHERE country = 'France';
UPDATE taxes SET country_code = 'DE' WHERE country = 'Germany';
UPDATE taxes SET country_code = 'GR' WHERE country = 'Greece';
UPDATE taxes SET country_code = 'HU' WHERE country = 'Hungary';
UPDATE taxes SET country_code = 'IE' WHERE country = 'Ireland';
UPDATE taxes SET country_code = 'IT' WHERE country = 'Italy';
UPDATE taxes SET country_code = 'LV' WHERE country = 'Latvia';
UPDATE taxes SET country_code = 'LT' WHERE country = 'Lithuania';
UPDATE taxes SET country_code = 'LU' WHERE country = 'Luxembourg';
UPDATE taxes SET country_code = 'MT' WHERE country = 'Malta';
UPDATE taxes SET country_code = 'NL' WHERE country = 'Netherlands';
UPDATE taxes SET country_code = 'PL' WHERE country = 'Poland';
UPDATE taxes SET country_code = 'PT' WHERE country = 'Portugal';
UPDATE taxes SET country_code = 'RO' WHERE country = 'Romania';
UPDATE taxes SET country_code = 'SK' WHERE country = 'Slovakia';
UPDATE taxes SET country_code = 'SI' WHERE country = 'Slovenia';
UPDATE taxes SET country_code = 'ES' WHERE country = 'Spain';
UPDATE taxes SET country_code = 'SE' WHERE country = 'Sweden';
UPDATE taxes SET country_code = 'GB' WHERE country = 'United Kingdom';
UPDATE taxes SET country_code = 'CH' WHERE country = 'Switzerland';
UPDATE taxes SET country_code = 'NO' WHERE country = 'Norway';
UPDATE taxes SET country_code = 'IS' WHERE country = 'Iceland';
UPDATE taxes SET country_code = 'AL' WHERE country = 'Albania';
UPDATE taxes SET country_code = 'RS' WHERE country = 'Serbia';
UPDATE taxes SET country_code = 'MK' WHERE country = 'North Macedonia';
UPDATE taxes SET country_code = 'BA' WHERE country = 'Bosnia and Herzegovina';
UPDATE taxes SET country_code = 'ME' WHERE country = 'Montenegro';
UPDATE taxes SET country_code = 'MD' WHERE country = 'Moldova';
UPDATE taxes SET country_code = 'UA' WHERE country = 'Ukraine';
UPDATE taxes SET country_code = 'BY' WHERE country = 'Belarus';
UPDATE taxes SET country_code = 'TR' WHERE country = 'Turkey';
UPDATE taxes SET country_code = 'AD' WHERE country = 'Andorra';
UPDATE taxes SET country_code = 'AU' WHERE country = 'Australia';
UPDATE taxes SET country_code = 'NZ' WHERE country = 'New Zealand';
UPDATE taxes SET country_code = 'JP' WHERE country = 'Japan';
UPDATE taxes SET country_code = 'CN' WHERE country = 'China';
UPDATE taxes SET country_code = 'IN' WHERE country = 'India';
UPDATE taxes SET country_code = 'KR' WHERE country = 'South Korea';
UPDATE taxes SET country_code = 'SG' WHERE country = 'Singapore';
UPDATE taxes SET country_code = 'ID' WHERE country = 'Indonesia';
UPDATE taxes SET country_code = 'TH' WHERE country = 'Thailand';
UPDATE taxes SET country_code = 'VN' WHERE country = 'Vietnam';
UPDATE taxes SET country_code = 'PH' WHERE country = 'Philippines';
UPDATE taxes SET country_code = 'MY' WHERE country = 'Malaysia';
UPDATE taxes SET country_code = 'TW' WHERE country = 'Taiwan';
UPDATE taxes SET country_code = 'PK' WHERE country = 'Pakistan';
UPDATE taxes SET country_code = 'BD' WHERE country = 'Bangladesh';
UPDATE taxes SET country_code = 'LK' WHERE country = 'Sri Lanka';
UPDATE taxes SET country_code = 'NP' WHERE country = 'Nepal';
UPDATE taxes SET country_code = 'KH' WHERE country = 'Cambodia';
UPDATE taxes SET country_code = 'MM' WHERE country = 'Myanmar';
UPDATE taxes SET country_code = 'LA' WHERE country = 'Laos';
UPDATE taxes SET country_code = 'MN' WHERE country = 'Mongolia';
UPDATE taxes SET country_code = 'KZ' WHERE country = 'Kazakhstan';
UPDATE taxes SET country_code = 'UZ' WHERE country = 'Uzbekistan';
UPDATE taxes SET country_code = 'AM' WHERE country = 'Armenia';
UPDATE taxes SET country_code = 'GE' WHERE country = 'Georgia';
UPDATE taxes SET country_code = 'AZ' WHERE country = 'Azerbaijan';
UPDATE taxes SET country_code = 'FJ' WHERE country = 'Fiji';
UPDATE taxes SET country_code = 'PG' WHERE country = 'Papua New Guinea';
UPDATE taxes SET country_code = 'WS' WHERE country = 'Samoa';
UPDATE taxes SET country_code = 'TO' WHERE country = 'Tonga';
UPDATE taxes SET country_code = 'VU' WHERE country = 'Vanuatu';
UPDATE taxes SET country_code = 'BT' WHERE country = 'Bhutan';
UPDATE taxes SET country_code = 'SA' WHERE country = 'Saudi Arabia';
UPDATE taxes SET country_code = 'AE' WHERE country = 'United Arab Emirates';
UPDATE taxes SET country_code = 'BH' WHERE country = 'Bahrain';
UPDATE taxes SET country_code = 'KW' WHERE country = 'Kuwait';
UPDATE taxes SET country_code = 'OM' WHERE country = 'Oman';
UPDATE taxes SET country_code = 'QA' WHERE country = 'Qatar';
UPDATE taxes SET country_code = 'IL' WHERE country = 'Israel';
UPDATE taxes SET country_code = 'JO' WHERE country = 'Jordan';
UPDATE taxes SET country_code = 'LB' WHERE country = 'Lebanon';
UPDATE taxes SET country_code = 'EG' WHERE country = 'Egypt';
UPDATE taxes SET country_code = 'ZA' WHERE country = 'South Africa';
UPDATE taxes SET country_code = 'NG' WHERE country = 'Nigeria';
UPDATE taxes SET country_code = 'KE' WHERE country = 'Kenya';
UPDATE taxes SET country_code = 'GH' WHERE country = 'Ghana';
UPDATE taxes SET country_code = 'MA' WHERE country = 'Morocco';
UPDATE taxes SET country_code = 'TN' WHERE country = 'Tunisia';
UPDATE taxes SET country_code = 'DZ' WHERE country = 'Algeria';
UPDATE taxes SET country_code = 'ET' WHERE country = 'Ethiopia';
UPDATE taxes SET country_code = 'TZ' WHERE country = 'Tanzania';
UPDATE taxes SET country_code = 'UG' WHERE country = 'Uganda';
UPDATE taxes SET country_code = 'ZW' WHERE country = 'Zimbabwe';
UPDATE taxes SET country_code = 'ZM' WHERE country = 'Zambia';
UPDATE taxes SET country_code = 'BW' WHERE country = 'Botswana';
UPDATE taxes SET country_code = 'MU' WHERE country = 'Mauritius';
UPDATE taxes SET country_code = 'NA' WHERE country = 'Namibia';
UPDATE taxes SET country_code = 'RW' WHERE country = 'Rwanda';
UPDATE taxes SET country_code = 'SN' WHERE country = 'Senegal';
UPDATE taxes SET country_code = 'CI' WHERE country = 'Ivory Coast';
UPDATE taxes SET country_code = 'CM' WHERE country = 'Cameroon';
UPDATE taxes SET country_code = 'AO' WHERE country = 'Angola';
UPDATE taxes SET country_code = 'MZ' WHERE country = 'Mozambique';
UPDATE taxes SET country_code = 'MG' WHERE country = 'Madagascar';
UPDATE taxes SET country_code = 'ML' WHERE country = 'Mali';
UPDATE taxes SET country_code = 'BF' WHERE country = 'Burkina Faso';
UPDATE taxes SET country_code = 'NE' WHERE country = 'Niger';
UPDATE taxes SET country_code = 'BJ' WHERE country = 'Benin';
UPDATE taxes SET country_code = 'TG' WHERE country = 'Togo';
UPDATE taxes SET country_code = 'GN' WHERE country = 'Guinea';
UPDATE taxes SET country_code = 'MW' WHERE country = 'Malawi';
UPDATE taxes SET country_code = 'GA' WHERE country = 'Gabon';
UPDATE taxes SET country_code = 'MR' WHERE country = 'Mauritania';
UPDATE taxes SET country_code = 'LS' WHERE country = 'Lesotho';
UPDATE taxes SET country_code = 'SZ' WHERE country = 'Eswatini';
UPDATE taxes SET country_code = 'LR' WHERE country = 'Liberia';
UPDATE taxes SET country_code = 'CA' WHERE country = 'Canada';
UPDATE taxes SET country_code = 'US' WHERE country = 'United States';
UPDATE taxes SET country_code = 'MX' WHERE country = 'Mexico';
UPDATE taxes SET country_code = 'AR' WHERE country = 'Argentina';
UPDATE taxes SET country_code = 'BR' WHERE country = 'Brazil';
UPDATE taxes SET country_code = 'CL' WHERE country = 'Chile';
UPDATE taxes SET country_code = 'CO' WHERE country = 'Colombia';
UPDATE taxes SET country_code = 'PE' WHERE country = 'Peru';
UPDATE taxes SET country_code = 'EC' WHERE country = 'Ecuador';
UPDATE taxes SET country_code = 'UY' WHERE country = 'Uruguay';
UPDATE taxes SET country_code = 'PY' WHERE country = 'Paraguay';
UPDATE taxes SET country_code = 'BO' WHERE country = 'Bolivia';
UPDATE taxes SET country_code = 'VE' WHERE country = 'Venezuela';
UPDATE taxes SET country_code = 'CR' WHERE country = 'Costa Rica';
UPDATE taxes SET country_code = 'PA' WHERE country = 'Panama';
UPDATE taxes SET country_code = 'GT' WHERE country = 'Guatemala';
UPDATE taxes SET country_code = 'HN' WHERE country = 'Honduras';
UPDATE taxes SET country_code = 'SV' WHERE country = 'El Salvador';
UPDATE taxes SET country_code = 'NI' WHERE country = 'Nicaragua';
UPDATE taxes SET country_code = 'DO' WHERE country = 'Dominican Republic';
UPDATE taxes SET country_code = 'JM' WHERE country = 'Jamaica';
UPDATE taxes SET country_code = 'TT' WHERE country = 'Trinidad and Tobago';
UPDATE taxes SET country_code = 'BB' WHERE country = 'Barbados';
UPDATE taxes SET country_code = 'BS' WHERE country = 'Bahamas';
SET FOREIGN_KEY_CHECKS=1;

View File

@@ -1,114 +0,0 @@
-- Marketing System Database Tables
-- Run this script to create the necessary tables for the marketing file management system
--
-- Usage: Import this file into your MySQL database or run the commands individually
-- Make sure to select the correct database before running these commands
-- Disable foreign key checks temporarily to avoid constraint errors
SET FOREIGN_KEY_CHECKS = 0;
-- Create marketing_folders table
CREATE TABLE IF NOT EXISTS `marketing_folders` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`folder_name` varchar(255) NOT NULL,
`parent_id` int(11) DEFAULT NULL,
`description` text DEFAULT NULL,
`created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`createdby` varchar(100) DEFAULT NULL,
`updated` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
`updatedby` varchar(100) DEFAULT NULL,
`accounthierarchy` text DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `parent_id` (`parent_id`),
KEY `accounthierarchy_idx` (`accounthierarchy`(100))
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- Create marketing_files table
CREATE TABLE IF NOT EXISTS `marketing_files` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`title` varchar(255) NOT NULL,
`original_filename` varchar(255) NOT NULL,
`file_path` varchar(500) NOT NULL,
`thumbnail_path` varchar(500) DEFAULT NULL,
`file_type` varchar(10) NOT NULL,
`file_size` bigint(20) NOT NULL DEFAULT 0,
`folder_id` int(11) DEFAULT NULL,
`tags` json DEFAULT NULL,
`created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`createdby` varchar(100) DEFAULT NULL,
`updated` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
`updatedby` varchar(100) DEFAULT NULL,
`accounthierarchy` text DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `folder_id` (`folder_id`),
KEY `file_type` (`file_type`),
KEY `accounthierarchy_idx` (`accounthierarchy`(100)),
KEY `created_idx` (`created`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- Create marketing_tags table
CREATE TABLE IF NOT EXISTS `marketing_tags` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`tag_name` varchar(100) NOT NULL,
`created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `tag_name` (`tag_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- Create marketing_file_tags junction table
CREATE TABLE IF NOT EXISTS `marketing_file_tags` (
`file_id` int(11) NOT NULL,
`tag_id` int(11) NOT NULL,
PRIMARY KEY (`file_id`, `tag_id`),
KEY `file_id` (`file_id`),
KEY `tag_id` (`tag_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- Add foreign key constraints after all tables are created
ALTER TABLE `marketing_folders`
ADD CONSTRAINT `fk_marketing_folders_parent`
FOREIGN KEY (`parent_id`) REFERENCES `marketing_folders`(`id`) ON DELETE CASCADE;
ALTER TABLE `marketing_files`
ADD CONSTRAINT `fk_marketing_files_folder`
FOREIGN KEY (`folder_id`) REFERENCES `marketing_folders`(`id`) ON DELETE SET NULL;
ALTER TABLE `marketing_file_tags`
ADD CONSTRAINT `fk_marketing_file_tags_file`
FOREIGN KEY (`file_id`) REFERENCES `marketing_files`(`id`) ON DELETE CASCADE;
ALTER TABLE `marketing_file_tags`
ADD CONSTRAINT `fk_marketing_file_tags_tag`
FOREIGN KEY (`tag_id`) REFERENCES `marketing_tags`(`id`) ON DELETE CASCADE;
-- Re-enable foreign key checks
SET FOREIGN_KEY_CHECKS = 1;
-- Insert some default sample data (optional)
-- Uncomment the lines below if you want to start with sample folders and tags
-- INSERT INTO `marketing_folders` (`folder_name`, `description`, `createdby`) VALUES
-- ('Product Brochures', 'Marketing brochures and product information', 'system'),
-- ('Technical Specifications', 'Technical documentation and specifications', 'system'),
-- ('Images', 'Product images and photos', 'system'),
-- ('Videos', 'Product videos and demonstrations', 'system');
-- INSERT INTO `marketing_tags` (`tag_name`) VALUES
-- ('brochure'),
-- ('specification'),
-- ('manual'),
-- ('image'),
-- ('video'),
-- ('product'),
-- ('marketing'),
-- ('technical');
-- Create upload directories (Note: This requires manual creation on file system)
-- Create the following directories in your web server:
-- - ./marketing/uploads/
-- - ./marketing/uploads/thumbs/
--
-- Linux/macOS commands:
-- mkdir -p marketing/uploads/thumbs
-- chmod 755 marketing/uploads
-- chmod 755 marketing/uploads/thumbs

View File

@@ -1,222 +0,0 @@
-- ===================================================
-- PROFILE TO RBAC MIGRATION SCRIPT
-- Date: 2025-01-22
-- Description: Migrate from settingsprofiles.php to user_roles RBAC system
-- Note: Uses existing access_elements table (already populated)
-- ===================================================
START TRANSACTION;
-- ===================================================
-- PHASE 1: CREATE ROLES (matching existing profiles)
-- ===================================================
INSERT INTO `user_roles` (`name`, `description`, `is_active`, `created`, `createdby`) VALUES
('Standard', 'Basic user access - view equipment, history, service reports', 1, NOW(), 1),
('Superuser', 'Extended access - manage equipment, products, users', 1, NOW(), 1),
('Admin', 'Administrative access - full management capabilities', 1, NOW(), 1),
('AdminPlus', 'System administrator - complete system access', 1, NOW(), 1),
('Build', 'Build tool access only', 1, NOW(), 1),
('Commerce', 'E-commerce and catalog management', 1, NOW(), 1),
('Distribution', 'Distribution partner access', 1, NOW(), 1),
('Firmware', 'Firmware/software update access only', 1, NOW(), 1),
('Garage', 'Car testing and diagnostics', 1, NOW(), 1),
('Interface', 'API/Interface access', 1, NOW(), 1),
('Service', 'Service technician access', 1, NOW(), 1),
('Other', 'Miscellaneous access level', 1, NOW(), 1)
ON DUPLICATE KEY UPDATE `description` = VALUES(`description`);
-- ===================================================
-- PHASE 2: CREATE ROLE_ACCESS_PERMISSIONS MAPPINGS
-- ===================================================
-- Get role IDs
SET @role_standard = (SELECT rowID FROM user_roles WHERE name = 'Standard' LIMIT 1);
SET @role_superuser = (SELECT rowID FROM user_roles WHERE name = 'Superuser' LIMIT 1);
SET @role_admin = (SELECT rowID FROM user_roles WHERE name = 'Admin' LIMIT 1);
SET @role_adminplus = (SELECT rowID FROM user_roles WHERE name = 'AdminPlus' LIMIT 1);
SET @role_build = (SELECT rowID FROM user_roles WHERE name = 'Build' LIMIT 1);
SET @role_commerce = (SELECT rowID FROM user_roles WHERE name = 'Commerce' LIMIT 1);
SET @role_distribution = (SELECT rowID FROM user_roles WHERE name = 'Distribution' LIMIT 1);
SET @role_firmware = (SELECT rowID FROM user_roles WHERE name = 'Firmware' LIMIT 1);
SET @role_garage = (SELECT rowID FROM user_roles WHERE name = 'Garage' LIMIT 1);
SET @role_interface = (SELECT rowID FROM user_roles WHERE name = 'Interface' LIMIT 1);
SET @role_service = (SELECT rowID FROM user_roles WHERE name = 'Service' LIMIT 1);
SET @role_other = (SELECT rowID FROM user_roles WHERE name = 'Other' LIMIT 1);
-- ===================================================
-- STANDARD ROLE PERMISSIONS (Read-only)
-- Profile: application,firmwaretool,histories,history,servicereport,servicereports,dashboard,profile,equipment,equipments,products_software
-- ===================================================
INSERT INTO `role_access_permissions` (`role_id`, `access_id`, `can_create`, `can_read`, `can_update`, `can_delete`)
SELECT @role_standard, rowID, 0, 1, 0, 0 FROM access_elements WHERE access_path IN (
'application', 'firmwaretool', 'histories', 'history', 'servicereport', 'servicereports',
'dashboard', 'profile', 'equipment', 'equipments', 'products_software'
)
ON DUPLICATE KEY UPDATE can_read = 1;
-- ===================================================
-- SUPERUSER ROLE PERMISSIONS (Create, Read, Update)
-- Profile: application,assets,firmwaretool,histories,history,history_manage,marketing,partner,partners,
-- servicereport,servicereports,admin,dashboard,profile,equipment,equipment_manage,
-- equipment_manage_edit,equipments,equipments_mass_update,product,product_manage,products,
-- products_software,products_versions,user,user_manage,users
-- ===================================================
INSERT INTO `role_access_permissions` (`role_id`, `access_id`, `can_create`, `can_read`, `can_update`, `can_delete`)
SELECT @role_superuser, rowID, 1, 1, 1, 0 FROM access_elements WHERE access_path IN (
'application', 'firmwaretool', 'histories', 'history', 'history_manage',
'marketing', 'partner', 'partners', 'servicereport', 'servicereports',
'dashboard', 'profile', 'equipment', 'equipment_manage',
'equipments', 'equipments_mass_update', 'product', 'product_manage', 'products',
'products_software', 'products_versions', 'user', 'users'
)
ON DUPLICATE KEY UPDATE can_create = 1, can_read = 1, can_update = 1;
-- ===================================================
-- ADMIN ROLE PERMISSIONS (Full CRUD)
-- ===================================================
INSERT INTO `role_access_permissions` (`role_id`, `access_id`, `can_create`, `can_read`, `can_update`, `can_delete`)
SELECT @role_admin, rowID, 1, 1, 1, 1 FROM access_elements WHERE access_path IN (
'application', 'buildtool', 'cartest', 'cartest_manage', 'cartests',
'changelog', 'communication', 'communication_send', 'communications', 'firmwaretool',
'histories', 'history', 'history_manage', 'marketing', 'partner', 'partners',
'servicereport', 'servicereports', 'software_available', 'software_download',
'software_update', 'softwaretool', 'account', 'accounts', 'dashboard', 'profile',
'contract', 'contract_manage', 'contracts', 'equipment', 'equipment_data',
'equipment_healthindex', 'equipment_history', 'equipment_manage',
'equipments', 'equipments_mass_update', 'product', 'product_manage', 'products',
'products_software', 'products_software_assignment', 'products_software_assignments',
'products_software_licenses', 'products_versions', 'report_build',
'report_contracts_billing', 'report_healthindex', 'rma', 'rma_history',
'rma_manage', 'rmas', 'user', 'users'
)
ON DUPLICATE KEY UPDATE can_create = 1, can_read = 1, can_update = 1, can_delete = 1;
-- ===================================================
-- ADMINPLUS ROLE PERMISSIONS (Full access to everything)
-- ===================================================
INSERT INTO `role_access_permissions` (`role_id`, `access_id`, `can_create`, `can_read`, `can_update`, `can_delete`)
SELECT @role_adminplus, rowID, 1, 1, 1, 1 FROM access_elements WHERE is_active = 1
ON DUPLICATE KEY UPDATE can_create = 1, can_read = 1, can_update = 1, can_delete = 1;
-- ===================================================
-- BUILD ROLE PERMISSIONS
-- Profile: application,buildtool,firmwaretool,dashboard,profile,products_software
-- ===================================================
INSERT INTO `role_access_permissions` (`role_id`, `access_id`, `can_create`, `can_read`, `can_update`, `can_delete`)
SELECT @role_build, rowID, 1, 1, 1, 0 FROM access_elements WHERE access_path IN (
'application', 'buildtool', 'firmwaretool', 'dashboard', 'profile', 'products_software'
)
ON DUPLICATE KEY UPDATE can_create = 1, can_read = 1, can_update = 1;
-- ===================================================
-- COMMERCE ROLE PERMISSIONS
-- ===================================================
INSERT INTO `role_access_permissions` (`role_id`, `access_id`, `can_create`, `can_read`, `can_update`, `can_delete`)
SELECT @role_commerce, rowID, 1, 1, 1, 1 FROM access_elements WHERE access_path IN (
'application', 'catalog', 'categories', 'category', 'checkout', 'discount', 'discounts',
'identity', 'invoice', 'media', 'media_manage', 'order', 'orders', 'partner', 'partners',
'placeorder', 'pricelists', 'pricelists_items', 'pricelists_manage', 'shipping',
'shipping_manage', 'shopping_cart', 'taxes', 'transactions', 'transactions_items',
'translation_manage', 'translations', 'translations_details', 'uploader',
'dashboard', 'profile', 'product', 'product_manage', 'products', 'products_attributes',
'products_attributes_items', 'products_attributes_manage', 'products_categories',
'products_configurations', 'products_media', 'products_software', 'products_versions',
'user', 'users'
)
ON DUPLICATE KEY UPDATE can_create = 1, can_read = 1, can_update = 1, can_delete = 1;
-- ===================================================
-- DISTRIBUTION ROLE PERMISSIONS
-- ===================================================
INSERT INTO `role_access_permissions` (`role_id`, `access_id`, `can_create`, `can_read`, `can_update`, `can_delete`)
SELECT @role_distribution, rowID, 1, 1, 1, 0 FROM access_elements WHERE access_path IN (
'application', 'firmwaretool', 'histories', 'history', 'history_manage',
'marketing', 'partner', 'partners', 'servicereport', 'servicereports',
'dashboard', 'profile', 'equipment', 'equipment_manage',
'equipments', 'equipments_mass_update', 'product', 'product_manage', 'products',
'products_software', 'products_versions', 'user', 'users'
)
ON DUPLICATE KEY UPDATE can_create = 1, can_read = 1, can_update = 1;
-- ===================================================
-- FIRMWARE ROLE PERMISSIONS
-- Profile: application,software_available,software_download,software_update,softwaretool,
-- transactions,transactions_items,products_software_versions
-- ===================================================
INSERT INTO `role_access_permissions` (`role_id`, `access_id`, `can_create`, `can_read`, `can_update`, `can_delete`)
SELECT @role_firmware, rowID, 0, 1, 1, 0 FROM access_elements WHERE access_path IN (
'application', 'software_available', 'software_download', 'software_update',
'softwaretool', 'transactions', 'transactions_items', 'products_software_versions'
)
ON DUPLICATE KEY UPDATE can_read = 1, can_update = 1;
-- ===================================================
-- GARAGE ROLE PERMISSIONS
-- Profile: application,cartest,cartest_manage,cartests,dashboard,profile,products_versions
-- ===================================================
INSERT INTO `role_access_permissions` (`role_id`, `access_id`, `can_create`, `can_read`, `can_update`, `can_delete`)
SELECT @role_garage, rowID, 1, 1, 1, 0 FROM access_elements WHERE access_path IN (
'application', 'cartest', 'cartest_manage', 'cartests', 'dashboard', 'profile', 'products_versions'
)
ON DUPLICATE KEY UPDATE can_create = 1, can_read = 1, can_update = 1;
-- ===================================================
-- INTERFACE ROLE PERMISSIONS
-- Profile: application,firmwaretool,invoice,payment,transactions,transactions_items,
-- contract,contracts,equipment_manage,equipments,products_software,products_versions,users
-- ===================================================
INSERT INTO `role_access_permissions` (`role_id`, `access_id`, `can_create`, `can_read`, `can_update`, `can_delete`)
SELECT @role_interface, rowID, 1, 1, 1, 0 FROM access_elements WHERE access_path IN (
'application', 'firmwaretool', 'invoice', 'payment', 'transactions', 'transactions_items',
'contract', 'contracts', 'equipment_manage', 'equipments', 'products_software',
'products_versions', 'users'
)
ON DUPLICATE KEY UPDATE can_create = 1, can_read = 1, can_update = 1;
-- ===================================================
-- SERVICE ROLE PERMISSIONS
-- Profile: application,assets,firmwaretool,histories,history,history_manage,marketing,partner,partners,
-- servicereport,servicereports,admin,dashboard,profile,equipment,equipment_manage,equipments,
-- products_software,user,user_manage,users
-- ===================================================
INSERT INTO `role_access_permissions` (`role_id`, `access_id`, `can_create`, `can_read`, `can_update`, `can_delete`)
SELECT @role_service, rowID, 1, 1, 1, 0 FROM access_elements WHERE access_path IN (
'application', 'firmwaretool', 'histories', 'history', 'history_manage',
'marketing', 'partner', 'partners', 'servicereport', 'servicereports',
'dashboard', 'profile', 'equipment', 'equipment_manage', 'equipments', 'products_software',
'user', 'users'
)
ON DUPLICATE KEY UPDATE can_create = 1, can_read = 1, can_update = 1;
-- ===================================================
-- OTHER ROLE PERMISSIONS
-- Profile: application,assets,firmwaretool,histories,history,history_manage,marketing,partner,partners,
-- servicereport,servicereports,admin,dashboard,profile,equipment,equipment_manage,equipments,products_software
-- ===================================================
INSERT INTO `role_access_permissions` (`role_id`, `access_id`, `can_create`, `can_read`, `can_update`, `can_delete`)
SELECT @role_other, rowID, 0, 1, 1, 0 FROM access_elements WHERE access_path IN (
'application', 'firmwaretool', 'histories', 'history', 'history_manage',
'marketing', 'partner', 'partners', 'servicereport', 'servicereports',
'dashboard', 'profile', 'equipment', 'equipment_manage', 'equipments', 'products_software'
)
ON DUPLICATE KEY UPDATE can_read = 1, can_update = 1;
-- ===================================================
-- VERIFICATION QUERIES
-- ===================================================
-- Check roles created
SELECT rowID, name, description, is_active FROM user_roles ORDER BY rowID;
-- Check permissions per role
SELECT ur.name as role_name, COUNT(rap.rowID) as permission_count
FROM user_roles ur
LEFT JOIN role_access_permissions rap ON ur.rowID = rap.role_id
GROUP BY ur.rowID, ur.name
ORDER BY ur.rowID;
-- ===================================================
-- Change ROLLBACK to COMMIT when ready to apply
-- ===================================================
COMMIT;

View File

@@ -1,141 +0,0 @@
-- ===================================================
-- USER TO RBAC ROLE ASSIGNMENT MIGRATION SCRIPT
-- Date: 2025-01-22
-- Description: Migrate users from settings/view fields to user_role_assignments
-- Prerequisites: Run migration_profiles_to_rbac.sql first to create roles
-- ===================================================
START TRANSACTION;
-- ===================================================
-- MAPPING REFERENCE:
--
-- users.settings field values -> role names:
-- 'admin_profile' or view=4 -> TSS_Admin
-- 'distribution' -> Distribution
-- 'service' -> Service
-- 'firmware' -> Software_Tool
-- 'interface' -> Interface
-- 'superuser_profile' or view=1 -> Service
-- All others (including empty/NULL) -> Service
--
-- IGNORED/REMOVED PROFILES:
-- 'standard_profile', 'adminplus_profile', 'build', 'commerce',
-- 'garage', 'other'
-- ===================================================
-- Get role IDs
SET @role_tss_admin = (SELECT rowID FROM user_roles WHERE name = 'TSS_Admin' LIMIT 1);
SET @role_distribution = (SELECT rowID FROM user_roles WHERE name = 'Distribution' LIMIT 1);
SET @role_service = (SELECT rowID FROM user_roles WHERE name = 'Service' LIMIT 1);
SET @role_software_tool = (SELECT rowID FROM user_roles WHERE name = 'Software_Tool' LIMIT 1);
SET @role_interface = (SELECT rowID FROM user_roles WHERE name = 'Interface' LIMIT 1);
-- ===================================================
-- PHASE 1: MIGRATE USERS BY SETTINGS FIELD (profile name)
-- ===================================================
-- Users with 'admin_profile' setting -> TSS_Admin
INSERT INTO `user_role_assignments` (`user_id`, `role_id`, `is_active`, `assigned_by`, `assigned_at`, `created`, `createdby`)
SELECT id, @role_tss_admin, 1, 'migration_script', NOW(), NOW(), 1
FROM users
WHERE settings = 'admin_profile'
ON DUPLICATE KEY UPDATE updated = NOW();
-- Users with 'distribution' setting -> Distribution
INSERT INTO `user_role_assignments` (`user_id`, `role_id`, `is_active`, `assigned_by`, `assigned_at`, `created`, `createdby`)
SELECT id, @role_distribution, 1, 'migration_script', NOW(), NOW(), 1
FROM users
WHERE settings = 'distribution'
ON DUPLICATE KEY UPDATE updated = NOW();
-- Users with 'service' setting -> Service
INSERT INTO `user_role_assignments` (`user_id`, `role_id`, `is_active`, `assigned_by`, `assigned_at`, `created`, `createdby`)
SELECT id, @role_service, 1, 'migration_script', NOW(), NOW(), 1
FROM users
WHERE settings = 'service'
ON DUPLICATE KEY UPDATE updated = NOW();
-- Users with 'firmware' setting -> Software_Tool
INSERT INTO `user_role_assignments` (`user_id`, `role_id`, `is_active`, `assigned_by`, `assigned_at`, `created`, `createdby`)
SELECT id, @role_software_tool, 1, 'migration_script', NOW(), NOW(), 1
FROM users
WHERE settings = 'firmware'
ON DUPLICATE KEY UPDATE updated = NOW();
-- Users with 'interface' setting -> Interface
INSERT INTO `user_role_assignments` (`user_id`, `role_id`, `is_active`, `assigned_by`, `assigned_at`, `created`, `createdby`)
SELECT id, @role_interface, 1, 'migration_script', NOW(), NOW(), 1
FROM users
WHERE settings = 'interface'
ON DUPLICATE KEY UPDATE updated = NOW();
-- Users with 'superuser_profile' setting -> Service
INSERT INTO `user_role_assignments` (`user_id`, `role_id`, `is_active`, `assigned_by`, `assigned_at`, `created`, `createdby`)
SELECT id, @role_service, 1, 'migration_script', NOW(), NOW(), 1
FROM users
WHERE settings = 'superuser_profile'
ON DUPLICATE KEY UPDATE updated = NOW();
-- ===================================================
-- PHASE 2: MIGRATE USERS WITH EMPTY/NULL SETTINGS (use view field)
-- Only for users not already assigned a role
-- ===================================================
-- Users with view=4 (Admin) and no settings -> TSS_Admin
INSERT INTO `user_role_assignments` (`user_id`, `role_id`, `is_active`, `assigned_by`, `assigned_at`, `created`, `createdby`)
SELECT u.id, @role_tss_admin, 1, 'migration_script', NOW(), NOW(), 1
FROM users u
LEFT JOIN user_role_assignments ura ON u.id = ura.user_id AND ura.is_active = 1
WHERE (u.settings IS NULL OR u.settings = '')
AND u.view = '4'
AND ura.rowID IS NULL
ON DUPLICATE KEY UPDATE updated = NOW();
-- ===================================================
-- PHASE 3: CATCH-ALL - Any remaining users without role -> Service
-- ===================================================
INSERT INTO `user_role_assignments` (`user_id`, `role_id`, `is_active`, `assigned_by`, `assigned_at`, `created`, `createdby`)
SELECT u.id, @role_service, 1, 'migration_script', NOW(), NOW(), 1
FROM users u
LEFT JOIN user_role_assignments ura ON u.id = ura.user_id AND ura.is_active = 1
WHERE ura.rowID IS NULL
ON DUPLICATE KEY UPDATE updated = NOW();
-- ===================================================
-- VERIFICATION QUERIES
-- ===================================================
-- Check migration results: users per role
SELECT
ur.name as role_name,
COUNT(ura.user_id) as user_count
FROM user_roles ur
LEFT JOIN user_role_assignments ura ON ur.rowID = ura.role_id AND ura.is_active = 1
GROUP BY ur.rowID, ur.name
ORDER BY user_count DESC;
-- Check for users without role assignments (should be 0)
SELECT COUNT(*) as users_without_role
FROM users u
LEFT JOIN user_role_assignments ura ON u.id = ura.user_id AND ura.is_active = 1
WHERE ura.rowID IS NULL;
-- Compare old vs new: show users with their old settings and new role
SELECT
u.id,
u.username,
u.settings as old_profile,
u.view as old_view_level,
ur.name as new_role
FROM users u
LEFT JOIN user_role_assignments ura ON u.id = ura.user_id AND ura.is_active = 1
LEFT JOIN user_roles ur ON ura.role_id = ur.rowID
ORDER BY u.id
LIMIT 50;
-- ===================================================
-- Change ROLLBACK to COMMIT when ready to apply
-- ===================================================
COMMIT;

View File

@@ -1735,7 +1735,8 @@ function getProfile($profile, $permission){
'software_download' => 'R',
'software_available' => 'R',
'history' => 'RU',
'payment' => 'RU'
'payment' => 'RU',
'vat_check' => 'RU'
];
// 1. Check if basic_permission_level is 4 (System-admin+) - always allow
@@ -5725,7 +5726,7 @@ function generateSoftwareInvoice($invoice_data, $order_id, $language = 'US') {
$lbl_quantity = $translations['quantity'] ?? 'Quantity';
$lbl_price = $translations['price'] ?? 'Price';
$lbl_subtotal = $translations['subtotal'] ?? 'Subtotal';
$lbl_tax = $translations['tax'] ?? 'Tax';
$lbl_tax = $translations['tax'] ?? 'Vat';
$lbl_shipping = $translations['shipping'] ?? 'Shipping';
$lbl_discount = $translations['discount'] ?? 'Discount';
$lbl_total = $translations['total'] ?? 'Total';
@@ -5865,7 +5866,8 @@ function generateCountriesFile($token){
$countries[$tax['id']] = [
'country' => $tax['country'] ?? '',
'taxes' => $tax['rate'] ?? 0,
'eu' => $tax['eu'] ?? 0
'eu' => $tax['eu'] ?? 0,
'country_code' => $tax['country_code'] ?? ''
];
}
@@ -5875,7 +5877,7 @@ function generateCountriesFile($token){
$fileContent .= "// Generated on: " . date('Y-m-d H:i:s') . "\n\n";
$fileContent .= "\$countries = [\n";
foreach($countries as $id => $data){
$fileContent .= " " . $id . " => ['country' => '" . addslashes($data['country']) . "', 'taxes' => " . $data['taxes'] . ",'eu' => " . $data['eu'] . "],\n";
$fileContent .= " " . $id . " => ['country' => '" . addslashes($data['country']) . "', 'taxes' => " . $data['taxes'] . ",'eu' => " . $data['eu'] . ", 'country_code' => '" . addslashes($data['country_code']) . "'],\n";
}
$fileContent .= "];\n";

View File

@@ -70,7 +70,7 @@ $message = '
<td style="padding: 3px 0;">' . htmlspecialchars($order_id) . '</td>
</tr>
<tr>
<td style="padding: 3px 0;"><strong>Payment Methodr:</strong></td>
<td style="padding: 3px 0;"><strong>Payment Method:</strong></td>
<td style="padding: 3px 0;">' . (${$payment_method} ?? $invoice_data['header']['payment_method'] ). '</td>
</tr>
</table>
@@ -94,7 +94,7 @@ $message = '
foreach ($items as $item) {
$line_total = $item['price'] * $item['quantity'];
$message .= '<tr>
<td style="padding: 10px 8px; border-bottom: 1px solid #dddddd; font-size: 13px;">SOFTWARE</td>
<td style="padding: 10px 8px; border-bottom: 1px solid #dddddd; font-size: 13px;">110.600.000</td>
<td style="padding: 10px 8px; border-bottom: 1px solid #dddddd; font-size: 13px;">' . htmlspecialchars($item['name']);
if ($item['serial_number'] !== 'N/A') {
@@ -132,7 +132,7 @@ if ($tax_amount > 0) {
<td style="text-align: right; padding: 5px 0;">€ ' . number_format($tax_amount, 2) . '</td>
</tr>';
} else {
$vat_label = 'VAT';
$vat_label = htmlspecialchars($lbl_tax) . ' (0%)';
if (!empty($vat_note)) {
$vat_label .= ' <small style="font-size: 11px; color: #888;">(' . htmlspecialchars($vat_note) . ')</small>';
}

View File

@@ -271,7 +271,7 @@ $pdf = '<!DOCTYPE html>
foreach ($items as $item) {
$line_total = $item['price'] * $item['quantity'];
$pdf .= '<tr>
<td>SOFTWARE</td>
<td>110.600.000</td>
<td>' . htmlspecialchars($item['name']);
if ($item['serial_number'] !== 'N/A') {
@@ -308,7 +308,7 @@ $pdf .= '</tbody>
<div class="total-amount">€ ' . number_format($tax_amount, 2) . '</div>
</div>';
} else {
$vat_label = 'VAT';
$vat_label = htmlspecialchars($lbl_tax) . ' (0%)';
if (!empty($vat_note)) {
$vat_label .= ' <small style="font-size: 9px; color: #666;">(' . htmlspecialchars($vat_note) . ')</small>';
}

View File

@@ -1482,6 +1482,48 @@ function showPaymentModal(option) {
modal.appendChild(modalContent);
document.body.appendChild(modal);
// VAT number validation state
let vatValidationInProgress = false;
let vatValidationResult = null;
// Function to check VAT number against VIES database (via server-side proxy)
async function checkVATNumber(countryCode, vatNumber) {
if (!countryCode || !vatNumber) {
return null;
}
// Use server-side proxy to avoid CORS issues
const serviceToken = document.getElementById("servicetoken")?.innerHTML || '';
const url = link + '/v2/vat_check';
try {
const response = await fetch(url, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer ' + serviceToken
},
body: JSON.stringify({
countryCode: countryCode,
vatNumber: vatNumber
})
});
if (!response.ok) {
console.warn('VAT check HTTP error:', response.status);
return null;
}
const data = await response.json();
console.log('VIES response:', data);
return data;
} catch (error) {
console.error('Error checking VAT:', error);
return null;
}
}
// Function to calculate and update tax
function updateTaxDisplay() {
const selectedCountry = document.getElementById("paymentCountry").value;
@@ -1500,12 +1542,12 @@ function showPaymentModal(option) {
// Netherlands: always take the tax percentage
taxRate = countryTaxRate;
} else if (isEU) {
if (vatNumber) {
// EU with VAT number: 0% VAT, reverse charge
if (vatNumber && vatValidationResult && vatValidationResult.valid === true) {
// EU with VALID VAT number: 0% VAT, reverse charge
taxRate = 0;
vatNote = 'Reverse charge VAT';
} else {
// EU without VAT number: use country VAT
// EU without VAT number or invalid VAT: use country VAT
taxRate = countryTaxRate;
vatNote = 'Local VAT';
}
@@ -1564,9 +1606,112 @@ function showPaymentModal(option) {
}
}
// Debounce timer for VAT validation
let vatValidationTimeout = null;
// Function to validate VAT number with visual feedback
async function validateVATNumber() {
const selectedCountry = document.getElementById("paymentCountry").value;
const vatNumber = document.getElementById("paymentVatNumber").value.trim();
const vatInput = document.getElementById("paymentVatNumber");
// Reset validation state
vatValidationResult = null;
vatInput.style.borderColor = '';
// Remove any existing validation message
const existingMessage = document.getElementById('vatValidationMessage');
if (existingMessage) {
existingMessage.remove();
}
if (!vatNumber) {
updateTaxDisplay();
return;
}
if (!selectedCountry || typeof COUNTRIES === 'undefined' || !COUNTRIES) {
updateTaxDisplay();
return;
}
const countryData = Object.values(COUNTRIES).find(c => c.country === selectedCountry);
if (!countryData || countryData.eu !== 1 || !countryData.country_code) {
updateTaxDisplay();
return;
}
// For Netherlands, don't validate VAT (always apply VAT)
if (selectedCountry === 'Netherlands') {
updateTaxDisplay();
return;
}
// Show validating state
vatInput.style.borderColor = '#ffc107';
vatValidationInProgress = true;
const validationMsg = document.createElement('div');
validationMsg.id = 'vatValidationMessage';
validationMsg.style.cssText = 'margin-top: 5px; font-size: 12px; color: #ffc107;';
validationMsg.innerHTML = '<i class="fa-solid fa-spinner fa-spin"></i> Validating VAT number...';
vatInput.parentNode.appendChild(validationMsg);
// Call VIES API
const result = await checkVATNumber(countryData.country_code, vatNumber);
vatValidationInProgress = false;
if (result && result.valid === true) {
// VAT number is valid
vatValidationResult = result;
vatInput.style.borderColor = '#28a745';
validationMsg.style.color = '#28a745';
validationMsg.innerHTML = '<i class="fa-solid fa-check-circle"></i> Valid VAT number';
// Format VAT number as CountryCode + VatNumber (e.g., DE115235681)
const formattedVAT = result.countryCode + result.vatNumber;
if (vatInput.value !== formattedVAT) {
vatInput.value = formattedVAT;
}
} else {
// VAT number is invalid or check failed
vatValidationResult = null;
vatInput.style.borderColor = '#dc3545';
validationMsg.style.color = '#dc3545';
validationMsg.innerHTML = '<i class="fa-solid fa-times-circle"></i> Invalid VAT number or validation failed';
}
// Update tax display with new validation result
updateTaxDisplay();
}
// Add event listeners to country select and VAT number to update tax
document.getElementById("paymentCountry").addEventListener('change', updateTaxDisplay);
document.getElementById("paymentVatNumber").addEventListener('input', updateTaxDisplay);
document.getElementById("paymentCountry").addEventListener('change', () => {
vatValidationResult = null;
const vatInput = document.getElementById("paymentVatNumber");
vatInput.style.borderColor = '';
const existingMessage = document.getElementById('vatValidationMessage');
if (existingMessage) {
existingMessage.remove();
}
updateTaxDisplay();
// Validate VAT if already entered
if (vatInput.value.trim()) {
if (vatValidationTimeout) {
clearTimeout(vatValidationTimeout);
}
vatValidationTimeout = setTimeout(validateVATNumber, 500);
}
});
document.getElementById("paymentVatNumber").addEventListener('input', () => {
// Debounce VAT validation
if (vatValidationTimeout) {
clearTimeout(vatValidationTimeout);
}
vatValidationTimeout = setTimeout(validateVATNumber, 1000);
});
// Close modal on cancel
document.getElementById("cancelPayment").onclick = () => {

2
firmware/.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
*
!.gitignore

View File

@@ -63,6 +63,8 @@ if (!isset($_SESSION['authorization']['userkey']) ||
if (isset($responses['userkey']) && isset($responses['token_valid'])) {
// Update session with complete response (same as login.php)
$_SESSION['authorization'] = $responses;
session_regenerate_id(true); // Resets the session ID and timer to avoid user needs to relogin
} else {
// Token refresh failed - redirect to login
session_destroy();

2
log/.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
*
!.gitignore

2
marketing/.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
*
!.gitignore

View File

@@ -4,8 +4,9 @@ defined(page_security_key) or exit;
//=============================
// Configuration file
//=============================
$domain = getDomainName($_SERVER['SERVER_NAME']);
$file = ((file_exists(dirname(__FILE__).'/custom/'.$domain.'/settings/'.$domain.'_config.php')) ? dirname(__FILE__).'/custom/'.$domain.'/settings/'.$domain.'_config.php' : dirname(__FILE__).'/settings/config.php');
$env = getenv('APP_ENV') ?: 'development';
$file = ((file_exists(dirname(__FILE__).'/custom/'.$env.'/settings/'.$env.'_config.php')) ? dirname(__FILE__).'/custom/'.$env.'/settings/'.$env.'_config.php' : dirname(__FILE__).'/settings/'.$env.'_config.php');
//Check if allowed
if (isAllowed('settings',$_SESSION['authorization']['permissions'],$_SESSION['authorization']['permission'],'R') === 0){

BIN
settings/.DS_Store vendored

Binary file not shown.

View File

@@ -0,0 +1,83 @@
<?php
require 'settingsprofiles.php';
// This will change the title on the website
define('site_name','Customer Portal - TEST');
define('site_name_footer','Total Safety Solutions - TEST');
// This will change the title on browser TAB
define('site_title','Total Safety Solutions - TEST');
//Scriptversion
define('script_version','v5');
//Enable VeLiTi-issue mgt
define('veliti_cim',false);
//Enable VeLiTi-analytics
define('veliti_analytics',false);
//Rewrite rule
define('rewrite_url',true);
define('news','');
//maintenance_mode
define('maintenance_mode_communication',true);
define('maintenance_mode_notification','Notice: This is a test instance and can go on and offline without notice.');
define('maintenance_mode',false);
define('maintenance_mode_user','veliti_admin');
define('maintenance_mode_text','System in maintenance.');
define('debug',false);
define('debug_id','114');
/*Business_Rules*/
//Business rules
define('WARRANTY_MONTHS','12');
define('WARRANTY_ELIGIBILITY_WINDOW','3');
define('WARRANTY_EXTENDED_MONTH','24');
define('SERVICE_MONTHS','12');
//Prevent downgrade from paid to free software versions
define('PREVENT_PAID_VERSION_DOWNGRADE',true);
/*Security*/
// Page security
define('page_security_key','secure_admin_342642');
define('cronjob_number','25');
define('header_security',false);
/* Email */
// The from email that will appear on the customer's order details email
define('mail_from','CustomerPortal');
// Your email
define('email','CustomerPortal@veliti.nl');
//Additional phpmailer-settings
define('email_host_name','veliti.nl');
define('email_reply_to','info@gewoonlekkerspaans.nl');
define('email_outgoing_pw','306yc%X5f');
define('email_outgoing_port','465');
define('email_outgoing_security','ssl');
// Enable automatice invoice forward to bookkeeping software
define('invoice_bookkeeping',true);
// Email of bookkeeping software
define('email_bookkeeping','finance@totalsafetysolutions.nl');
/* Payment options */
// Mollie
define('mollie_enabled',true);
define('mollie_api_key','test_jFHqrt9KCSvaBwb4En9ttAM9MTrp9W'); //live_WhsBD8qv3ygR9WVKF3KnCvz9zzNaxh
// PayPal
define('paypal_enabled',true);
define('PAYPAL_URL','https://api-m.sandbox.paypal.com');
define('PAYPAL_WEBHOOK_ID','0SA327855M129725W');
define('PAYPAL_WEBHOOK','https://acc.veliti.nl/webhook_paypal.php');
define('PAYPAL_CLIENT_ID','ASz3ae7Fx3kFxTe6dCfMP1KkLN2YnfjkuifHT9Lan4nlRjUuUeqlLtYN4qrwUCCGTIRUCAyJ78e2m4Wx');
define('PAYPAL_CLIENT_SECRET','EHLzDaAMMpRUgD0FNL6vMfktaYww-tuhafQwVGV0P-gBIZ9Wb0_VcBiGyRpp0mhYBVx6hULUW5vxc5Ub');
define('pay_on_delivery_enabled',false);
/*Appearance*/
//Icon
define('icon_image','/assets/images/TSS-logo3.png');
define('color','#005655c2');
define('color_accent','#2FAC66');
define('emaillogo','/assets/images/TSSemail.png');
/*Default Users*/
define('software_update_user','EMP-updater');
define('software_update_pw','EMP-updater');
define('interface_user','interface@test.nl');
define('interface_pw','test1234');

View File

@@ -0,0 +1,111 @@
<?php
//------------------------------------------
//EXCEPTION LIST
//------------------------------------------
$serialnumber_exceptions = array("221100XX");
//------------------------------------------
// Security
//------------------------------------------
$security_key = 'secure_34563$52';
//------------------------------------------
// Base color
//------------------------------------------
$color = '#005655';//'#0b1054';
$color_accent = '#2FAC66'; //'#ececec';
//------------------------------------------
// Database settings
//------------------------------------------
require '/var/www/vhosts/veliti.nl/settings/portalsettings-test.php';
//------------------------------------------
// Menusetup & settings
//------------------------------------------
require 'settingsmenu.php';
//------------------------------------------
// API BaseUrl
//------------------------------------------
$baseurl = 'https://'.$_SERVER['SERVER_NAME'].'/api.php'; //URL of API
$portalURL = $_SERVER['SERVER_NAME'];
//------------------------------------------
// Equipmentdetails
//------------------------------------------
$servicedate = date("Y-m-d", strtotime("-365 days"));
$warrantydate = date("Y-m-d", strtotime("-365 days"));
$warranty_extended = date("Y-m-d", strtotime("+365 days"));
$date = date('Y-m-d H:i:s');
$curYear = date("Y", time());
$curMonth = date("m", time());
$curQuarter = (int)ceil($curMonth / 3);
$curdateObj = DateTime::createFromFormat('!m', $curMonth);
$curMonth_name = $curdateObj->format('F');
//------------------------------------------
//History Type
//------------------------------------------
$type1 = 'General';
$type2 = 'Customer';
$type3 = 'Service';
$type4 = 'Testing';
$type5 = 'Data';
$type6 = 'Other';
$type7 = 'Internal';
$type8 = 'Ignore';
$type9 = 'Warranty';
$type10 = 'Contract';
$type11 = 'Warranty-Expired';
$type12 = 'Contract-Expired';
$type13 = "Order";
$type14 = "ServiceReport";
$type15 = "SRIncluded";
$type16 = "Notes";
$type17 = "Visual";
$HistoryType_1 = 'Bootloader';
$HistoryType_2 = 'Firmware';
$HistoryType_3 = 'SerialNumber';
$HistoryType_4 = 'Visual_Test';
$HistoryType_5 = 'Maintenance_Test';
$HistoryType_6 = 'Assembly_Test';
$HistoryType_7 = 'ProductNumber';
$HistoryType_8 = 'Visual';
$HistoryType_9 = 'ServiceReport';
//------------------------------------------
//Permissions CRUD
//------------------------------------------
$permission_4 = 'CRUD'; //Admin+
$permission_3 = 'CRUD'; //Admin
$permission_2 = 'CRU'; //SuperUser
$permission_1 = 'CRU'; //CreateUpdate
$permission_0 = 'R'; //Readonly
$permissionlabel1 = 'Permission';
$permission1 = 'Superuser'; #1
$permission2 = 'Create & Update'; #2
$permission3 = 'read-only'; // #3
$permission4 = 'Admin'; //#4
$permission5 = 'Admin+'; // #5
$settingslabel1 = 'profile';
$setting1 = 'firmware'; //Fix
$setting2 = 'service';
$setting3 = 'build'; //Fix
$setting4 = 'distribution';
$setting5 = '';
$setting6 = '';
$setting7 = ''; //Fix
$setting8 = 'interface';
//------------------------------------------
//Partners
//------------------------------------------
$partnertype1 = 'SalesID';
$partnertype2 = 'SoldTo';
$partnertype3 = 'ShipTo';
$partnertype4 = 'Location';
$partnertype5 = 'Section';

View File

@@ -1,31 +1,11 @@
<?php
//=========================================
//REDIRECTOR TO CONFIG FILE BASED ON DOMAIN
//=========================================
function getDomain($hostname) {
// Extract the domain parts
$parts = explode('.', $hostname);
$count = count($parts);
//======================================================================
//REDIRECTOR TO CONFIG FILE BASED ON .htacces - SetEnv APP_ENV development
//======================================================================
$env = getenv('APP_ENV') ?: 'development';
// For hostnames with enough parts to have a subdomain (at least 3 parts)
if ($count >= 3) {
// Return the second-to-last and third-to-last parts
return $parts[$count - 2];
}
// For hostnames with just domain and TLD (2 parts)
else if ($count == 2) {
// Return just the domain part (without the TLD)
return $parts[0];
}
// If it's a single part hostname
else {
return $hostname;
}
}
$domain = getDomain($_SERVER['SERVER_NAME']);
$config_location = ((file_exists(dirname(__FILE__,2).'/custom/'.$domain.'/settings/'.$domain.'_config.php')) ? dirname(__FILE__,2).'/custom/'.$domain.'/settings/'.$domain.'_config.php' : dirname(__FILE__).'/config.php');
$config_location = ((file_exists(dirname(__FILE__,2).'/custom/'.$env.'/settings/'.$env.'_config.php')) ? dirname(__FILE__,2).'/custom/'.$env.'/settings/'.$env.'_config.php' : dirname(__FILE__).'/'.$env.'_config.php');
include $config_location;
?>

View File

@@ -3,146 +3,146 @@
// Generated on: 2026-02-05 14:44:35
$countries = [
1 => ['country' => 'Austria', 'taxes' => 20.00,'eu' => 1],
2 => ['country' => 'Belgium', 'taxes' => 21.00,'eu' => 1],
3 => ['country' => 'Bulgaria', 'taxes' => 20.00,'eu' => 1],
4 => ['country' => 'Croatia', 'taxes' => 25.00,'eu' => 1],
5 => ['country' => 'Cyprus', 'taxes' => 19.00,'eu' => 1],
6 => ['country' => 'Czech Republic', 'taxes' => 21.00,'eu' => 1],
7 => ['country' => 'Denmark', 'taxes' => 25.00,'eu' => 1],
8 => ['country' => 'Estonia', 'taxes' => 24.00,'eu' => 1],
9 => ['country' => 'Finland', 'taxes' => 25.50,'eu' => 1],
10 => ['country' => 'France', 'taxes' => 20.00,'eu' => 1],
11 => ['country' => 'Germany', 'taxes' => 19.00,'eu' => 1],
12 => ['country' => 'Greece', 'taxes' => 24.00,'eu' => 1],
13 => ['country' => 'Hungary', 'taxes' => 27.00,'eu' => 1],
14 => ['country' => 'Ireland', 'taxes' => 23.00,'eu' => 1],
15 => ['country' => 'Italy', 'taxes' => 22.00,'eu' => 1],
16 => ['country' => 'Latvia', 'taxes' => 21.00,'eu' => 1],
17 => ['country' => 'Lithuania', 'taxes' => 21.00,'eu' => 1],
18 => ['country' => 'Luxembourg', 'taxes' => 16.00,'eu' => 1],
19 => ['country' => 'Malta', 'taxes' => 18.00,'eu' => 1],
20 => ['country' => 'Netherlands', 'taxes' => 21.00,'eu' => 1],
21 => ['country' => 'Poland', 'taxes' => 23.00,'eu' => 1],
22 => ['country' => 'Portugal', 'taxes' => 23.00,'eu' => 1],
23 => ['country' => 'Romania', 'taxes' => 19.00,'eu' => 1],
24 => ['country' => 'Slovakia', 'taxes' => 23.00,'eu' => 1],
25 => ['country' => 'Slovenia', 'taxes' => 22.00,'eu' => 1],
26 => ['country' => 'Spain', 'taxes' => 21.00,'eu' => 1],
27 => ['country' => 'Sweden', 'taxes' => 25.00,'eu' => 1],
28 => ['country' => 'United Kingdom', 'taxes' => 0.00,'eu' => 0],
29 => ['country' => 'Switzerland', 'taxes' => 0.00,'eu' => 0],
30 => ['country' => 'Norway', 'taxes' => 0.00,'eu' => 0],
31 => ['country' => 'Iceland', 'taxes' => 0.00,'eu' => 0],
32 => ['country' => 'Albania', 'taxes' => 0.00,'eu' => 0],
33 => ['country' => 'Serbia', 'taxes' => 0.00,'eu' => 0],
34 => ['country' => 'North Macedonia', 'taxes' => 0.00,'eu' => 0],
35 => ['country' => 'Bosnia and Herzegovina', 'taxes' => 0.00,'eu' => 0],
36 => ['country' => 'Montenegro', 'taxes' => 0.00,'eu' => 0],
37 => ['country' => 'Moldova', 'taxes' => 0.00,'eu' => 0],
38 => ['country' => 'Ukraine', 'taxes' => 0.00,'eu' => 0],
39 => ['country' => 'Belarus', 'taxes' => 0.00,'eu' => 0],
40 => ['country' => 'Turkey', 'taxes' => 0.00,'eu' => 0],
41 => ['country' => 'Andorra', 'taxes' => 0.00,'eu' => 0],
42 => ['country' => 'Australia', 'taxes' => 0.00,'eu' => 0],
43 => ['country' => 'New Zealand', 'taxes' => 0.00,'eu' => 0],
44 => ['country' => 'Japan', 'taxes' => 0.00,'eu' => 0],
45 => ['country' => 'China', 'taxes' => 0.00,'eu' => 0],
46 => ['country' => 'India', 'taxes' => 0.00,'eu' => 0],
47 => ['country' => 'South Korea', 'taxes' => 0.00,'eu' => 0],
48 => ['country' => 'Singapore', 'taxes' => 0.00,'eu' => 0],
49 => ['country' => 'Indonesia', 'taxes' => 0.00,'eu' => 0],
50 => ['country' => 'Thailand', 'taxes' => 0.00,'eu' => 0],
51 => ['country' => 'Vietnam', 'taxes' => 0.00,'eu' => 0],
52 => ['country' => 'Philippines', 'taxes' => 0.00,'eu' => 0],
53 => ['country' => 'Malaysia', 'taxes' => 0.00,'eu' => 0],
54 => ['country' => 'Taiwan', 'taxes' => 0.00,'eu' => 0],
55 => ['country' => 'Pakistan', 'taxes' => 0.00,'eu' => 0],
56 => ['country' => 'Bangladesh', 'taxes' => 0.00,'eu' => 0],
57 => ['country' => 'Sri Lanka', 'taxes' => 0.00,'eu' => 0],
58 => ['country' => 'Nepal', 'taxes' => 0.00,'eu' => 0],
59 => ['country' => 'Cambodia', 'taxes' => 0.00,'eu' => 0],
60 => ['country' => 'Myanmar', 'taxes' => 0.00,'eu' => 0],
61 => ['country' => 'Laos', 'taxes' => 0.00,'eu' => 0],
62 => ['country' => 'Mongolia', 'taxes' => 0.00,'eu' => 0],
63 => ['country' => 'Kazakhstan', 'taxes' => 0.00,'eu' => 0],
64 => ['country' => 'Uzbekistan', 'taxes' => 0.00,'eu' => 0],
65 => ['country' => 'Armenia', 'taxes' => 0.00,'eu' => 0],
66 => ['country' => 'Georgia', 'taxes' => 0.00,'eu' => 0],
67 => ['country' => 'Azerbaijan', 'taxes' => 0.00,'eu' => 0],
68 => ['country' => 'Fiji', 'taxes' => 0.00,'eu' => 0],
69 => ['country' => 'Papua New Guinea', 'taxes' => 0.00,'eu' => 0],
70 => ['country' => 'Samoa', 'taxes' => 0.00,'eu' => 0],
71 => ['country' => 'Tonga', 'taxes' => 0.00,'eu' => 0],
72 => ['country' => 'Vanuatu', 'taxes' => 0.00,'eu' => 0],
73 => ['country' => 'Bhutan', 'taxes' => 0.00,'eu' => 0],
74 => ['country' => 'Saudi Arabia', 'taxes' => 0.00,'eu' => 0],
75 => ['country' => 'United Arab Emirates', 'taxes' => 0.00,'eu' => 0],
76 => ['country' => 'Bahrain', 'taxes' => 0.00,'eu' => 0],
77 => ['country' => 'Kuwait', 'taxes' => 0.00,'eu' => 0],
78 => ['country' => 'Oman', 'taxes' => 0.00,'eu' => 0],
79 => ['country' => 'Qatar', 'taxes' => 0.00,'eu' => 0],
80 => ['country' => 'Israel', 'taxes' => 0.00,'eu' => 0],
81 => ['country' => 'Jordan', 'taxes' => 0.00,'eu' => 0],
82 => ['country' => 'Lebanon', 'taxes' => 0.00,'eu' => 0],
83 => ['country' => 'Egypt', 'taxes' => 0.00,'eu' => 0],
85 => ['country' => 'South Africa', 'taxes' => 0.00,'eu' => 0],
86 => ['country' => 'Nigeria', 'taxes' => 0.00,'eu' => 0],
87 => ['country' => 'Kenya', 'taxes' => 0.00,'eu' => 0],
88 => ['country' => 'Ghana', 'taxes' => 0.00,'eu' => 0],
89 => ['country' => 'Morocco', 'taxes' => 0.00,'eu' => 0],
90 => ['country' => 'Tunisia', 'taxes' => 0.00,'eu' => 0],
91 => ['country' => 'Algeria', 'taxes' => 0.00,'eu' => 0],
92 => ['country' => 'Egypt', 'taxes' => 0.00,'eu' => 0],
93 => ['country' => 'Ethiopia', 'taxes' => 0.00,'eu' => 0],
94 => ['country' => 'Tanzania', 'taxes' => 0.00,'eu' => 0],
95 => ['country' => 'Uganda', 'taxes' => 0.00,'eu' => 0],
96 => ['country' => 'Zimbabwe', 'taxes' => 0.00,'eu' => 0],
97 => ['country' => 'Zambia', 'taxes' => 0.00,'eu' => 0],
98 => ['country' => 'Botswana', 'taxes' => 0.00,'eu' => 0],
99 => ['country' => 'Mauritius', 'taxes' => 0.00,'eu' => 0],
100 => ['country' => 'Namibia', 'taxes' => 0.00,'eu' => 0],
101 => ['country' => 'Rwanda', 'taxes' => 0.00,'eu' => 0],
102 => ['country' => 'Senegal', 'taxes' => 0.00,'eu' => 0],
103 => ['country' => 'Ivory Coast', 'taxes' => 0.00,'eu' => 0],
104 => ['country' => 'Cameroon', 'taxes' => 0.00,'eu' => 0],
105 => ['country' => 'Angola', 'taxes' => 0.00,'eu' => 0],
106 => ['country' => 'Mozambique', 'taxes' => 0.00,'eu' => 0],
107 => ['country' => 'Madagascar', 'taxes' => 0.00,'eu' => 0],
108 => ['country' => 'Mali', 'taxes' => 0.00,'eu' => 0],
109 => ['country' => 'Burkina Faso', 'taxes' => 0.00,'eu' => 0],
110 => ['country' => 'Niger', 'taxes' => 0.00,'eu' => 0],
111 => ['country' => 'Benin', 'taxes' => 0.00,'eu' => 0],
112 => ['country' => 'Togo', 'taxes' => 0.00,'eu' => 0],
113 => ['country' => 'Guinea', 'taxes' => 0.00,'eu' => 0],
114 => ['country' => 'Malawi', 'taxes' => 0.00,'eu' => 0],
115 => ['country' => 'Gabon', 'taxes' => 0.00,'eu' => 0],
116 => ['country' => 'Mauritania', 'taxes' => 0.00,'eu' => 0],
117 => ['country' => 'Lesotho', 'taxes' => 0.00,'eu' => 0],
118 => ['country' => 'Eswatini', 'taxes' => 0.00,'eu' => 0],
119 => ['country' => 'Liberia', 'taxes' => 0.00,'eu' => 0],
120 => ['country' => 'Canada', 'taxes' => 0.00,'eu' => 0],
121 => ['country' => 'United States', 'taxes' => 0.00,'eu' => 0],
122 => ['country' => 'Mexico', 'taxes' => 0.00,'eu' => 0],
123 => ['country' => 'Argentina', 'taxes' => 0.00,'eu' => 0],
124 => ['country' => 'Brazil', 'taxes' => 0.00,'eu' => 0],
125 => ['country' => 'Chile', 'taxes' => 0.00,'eu' => 0],
126 => ['country' => 'Colombia', 'taxes' => 0.00,'eu' => 0],
127 => ['country' => 'Peru', 'taxes' => 0.00,'eu' => 0],
128 => ['country' => 'Ecuador', 'taxes' => 0.00,'eu' => 0],
129 => ['country' => 'Uruguay', 'taxes' => 0.00,'eu' => 0],
130 => ['country' => 'Paraguay', 'taxes' => 0.00,'eu' => 0],
131 => ['country' => 'Bolivia', 'taxes' => 0.00,'eu' => 0],
132 => ['country' => 'Venezuela', 'taxes' => 0.00,'eu' => 0],
133 => ['country' => 'Costa Rica', 'taxes' => 0.00,'eu' => 0],
134 => ['country' => 'Panama', 'taxes' => 0.00,'eu' => 0],
135 => ['country' => 'Guatemala', 'taxes' => 0.00,'eu' => 0],
136 => ['country' => 'Honduras', 'taxes' => 0.00,'eu' => 0],
137 => ['country' => 'El Salvador', 'taxes' => 0.00,'eu' => 0],
138 => ['country' => 'Nicaragua', 'taxes' => 0.00,'eu' => 0],
139 => ['country' => 'Dominican Republic', 'taxes' => 0.00,'eu' => 0],
140 => ['country' => 'Jamaica', 'taxes' => 0.00,'eu' => 0],
141 => ['country' => 'Trinidad and Tobago', 'taxes' => 0.00,'eu' => 0],
142 => ['country' => 'Barbados', 'taxes' => 0.00,'eu' => 0],
143 => ['country' => 'Bahamas', 'taxes' => 0.00,'eu' => 0],
1 => ['country' => 'Austria', 'taxes' => 20.00,'eu' => 1, 'country_code' => 'AT'],
2 => ['country' => 'Belgium', 'taxes' => 21.00,'eu' => 1, 'country_code' => 'BE'],
3 => ['country' => 'Bulgaria', 'taxes' => 20.00,'eu' => 1, 'country_code' => 'BG'],
4 => ['country' => 'Croatia', 'taxes' => 25.00,'eu' => 1, 'country_code' => 'HR'],
5 => ['country' => 'Cyprus', 'taxes' => 19.00,'eu' => 1, 'country_code' => 'CY'],
6 => ['country' => 'Czech Republic', 'taxes' => 21.00,'eu' => 1, 'country_code' => 'CZ'],
7 => ['country' => 'Denmark', 'taxes' => 25.00,'eu' => 1, 'country_code' => 'DK'],
8 => ['country' => 'Estonia', 'taxes' => 24.00,'eu' => 1, 'country_code' => 'EE'],
9 => ['country' => 'Finland', 'taxes' => 25.50,'eu' => 1, 'country_code' => 'FI'],
10 => ['country' => 'France', 'taxes' => 20.00,'eu' => 1, 'country_code' => 'FR'],
11 => ['country' => 'Germany', 'taxes' => 19.00,'eu' => 1, 'country_code' => 'DE'],
12 => ['country' => 'Greece', 'taxes' => 24.00,'eu' => 1, 'country_code' => 'GR'],
13 => ['country' => 'Hungary', 'taxes' => 27.00,'eu' => 1, 'country_code' => 'HU'],
14 => ['country' => 'Ireland', 'taxes' => 23.00,'eu' => 1, 'country_code' => 'IE'],
15 => ['country' => 'Italy', 'taxes' => 22.00,'eu' => 1, 'country_code' => 'IT'],
16 => ['country' => 'Latvia', 'taxes' => 21.00,'eu' => 1, 'country_code' => 'LV'],
17 => ['country' => 'Lithuania', 'taxes' => 21.00,'eu' => 1, 'country_code' => 'LT'],
18 => ['country' => 'Luxembourg', 'taxes' => 16.00,'eu' => 1, 'country_code' => 'LU'],
19 => ['country' => 'Malta', 'taxes' => 18.00,'eu' => 1, 'country_code' => 'MT'],
20 => ['country' => 'Netherlands', 'taxes' => 21.00,'eu' => 1, 'country_code' => 'NL'],
21 => ['country' => 'Poland', 'taxes' => 23.00,'eu' => 1, 'country_code' => 'PL'],
22 => ['country' => 'Portugal', 'taxes' => 23.00,'eu' => 1, 'country_code' => 'PT'],
23 => ['country' => 'Romania', 'taxes' => 19.00,'eu' => 1, 'country_code' => 'RO'],
24 => ['country' => 'Slovakia', 'taxes' => 23.00,'eu' => 1, 'country_code' => 'SK'],
25 => ['country' => 'Slovenia', 'taxes' => 22.00,'eu' => 1, 'country_code' => 'SI'],
26 => ['country' => 'Spain', 'taxes' => 21.00,'eu' => 1, 'country_code' => 'ES'],
27 => ['country' => 'Sweden', 'taxes' => 25.00,'eu' => 1, 'country_code' => 'SE'],
28 => ['country' => 'United Kingdom', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
29 => ['country' => 'Switzerland', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
30 => ['country' => 'Norway', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
31 => ['country' => 'Iceland', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
32 => ['country' => 'Albania', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
33 => ['country' => 'Serbia', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
34 => ['country' => 'North Macedonia', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
35 => ['country' => 'Bosnia and Herzegovina', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
36 => ['country' => 'Montenegro', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
37 => ['country' => 'Moldova', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
38 => ['country' => 'Ukraine', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
39 => ['country' => 'Belarus', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
40 => ['country' => 'Turkey', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
41 => ['country' => 'Andorra', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
42 => ['country' => 'Australia', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
43 => ['country' => 'New Zealand', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
44 => ['country' => 'Japan', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
45 => ['country' => 'China', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
46 => ['country' => 'India', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
47 => ['country' => 'South Korea', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
48 => ['country' => 'Singapore', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
49 => ['country' => 'Indonesia', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
50 => ['country' => 'Thailand', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
51 => ['country' => 'Vietnam', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
52 => ['country' => 'Philippines', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
53 => ['country' => 'Malaysia', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
54 => ['country' => 'Taiwan', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
55 => ['country' => 'Pakistan', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
56 => ['country' => 'Bangladesh', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
57 => ['country' => 'Sri Lanka', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
58 => ['country' => 'Nepal', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
59 => ['country' => 'Cambodia', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
60 => ['country' => 'Myanmar', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
61 => ['country' => 'Laos', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
62 => ['country' => 'Mongolia', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
63 => ['country' => 'Kazakhstan', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
64 => ['country' => 'Uzbekistan', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
65 => ['country' => 'Armenia', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
66 => ['country' => 'Georgia', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
67 => ['country' => 'Azerbaijan', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
68 => ['country' => 'Fiji', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
69 => ['country' => 'Papua New Guinea', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
70 => ['country' => 'Samoa', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
71 => ['country' => 'Tonga', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
72 => ['country' => 'Vanuatu', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
73 => ['country' => 'Bhutan', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
74 => ['country' => 'Saudi Arabia', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
75 => ['country' => 'United Arab Emirates', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
76 => ['country' => 'Bahrain', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
77 => ['country' => 'Kuwait', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
78 => ['country' => 'Oman', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
79 => ['country' => 'Qatar', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
80 => ['country' => 'Israel', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
81 => ['country' => 'Jordan', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
82 => ['country' => 'Lebanon', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
83 => ['country' => 'Egypt', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
85 => ['country' => 'South Africa', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
86 => ['country' => 'Nigeria', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
87 => ['country' => 'Kenya', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
88 => ['country' => 'Ghana', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
89 => ['country' => 'Morocco', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
90 => ['country' => 'Tunisia', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
91 => ['country' => 'Algeria', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
92 => ['country' => 'Egypt', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
93 => ['country' => 'Ethiopia', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
94 => ['country' => 'Tanzania', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
95 => ['country' => 'Uganda', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
96 => ['country' => 'Zimbabwe', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
97 => ['country' => 'Zambia', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
98 => ['country' => 'Botswana', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
99 => ['country' => 'Mauritius', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
100 => ['country' => 'Namibia', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
101 => ['country' => 'Rwanda', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
102 => ['country' => 'Senegal', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
103 => ['country' => 'Ivory Coast', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
104 => ['country' => 'Cameroon', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
105 => ['country' => 'Angola', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
106 => ['country' => 'Mozambique', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
107 => ['country' => 'Madagascar', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
108 => ['country' => 'Mali', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
109 => ['country' => 'Burkina Faso', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
110 => ['country' => 'Niger', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
111 => ['country' => 'Benin', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
112 => ['country' => 'Togo', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
113 => ['country' => 'Guinea', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
114 => ['country' => 'Malawi', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
115 => ['country' => 'Gabon', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
116 => ['country' => 'Mauritania', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
117 => ['country' => 'Lesotho', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
118 => ['country' => 'Eswatini', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
119 => ['country' => 'Liberia', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
120 => ['country' => 'Canada', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
121 => ['country' => 'United States', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
122 => ['country' => 'Mexico', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
123 => ['country' => 'Argentina', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
124 => ['country' => 'Brazil', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
125 => ['country' => 'Chile', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
126 => ['country' => 'Colombia', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
127 => ['country' => 'Peru', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
128 => ['country' => 'Ecuador', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
129 => ['country' => 'Uruguay', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
130 => ['country' => 'Paraguay', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
131 => ['country' => 'Bolivia', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
132 => ['country' => 'Venezuela', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
133 => ['country' => 'Costa Rica', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
134 => ['country' => 'Panama', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
135 => ['country' => 'Guatemala', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
136 => ['country' => 'Honduras', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
137 => ['country' => 'El Salvador', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
138 => ['country' => 'Nicaragua', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
139 => ['country' => 'Dominican Republic', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
140 => ['country' => 'Jamaica', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
141 => ['country' => 'Trinidad and Tobago', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
142 => ['country' => 'Barbados', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
143 => ['country' => 'Bahamas', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
];

View File

@@ -0,0 +1,83 @@
<?php
require 'settingsprofiles.php';
// This will change the title on the website
define('site_name','Customer Portal - TEST');
define('site_name_footer','Total Safety Solutions - TEST');
// This will change the title on browser TAB
define('site_title','Total Safety Solutions - TEST');
//Scriptversion
define('script_version','v3');
//Enable VeLiTi-issue mgt
define('veliti_cim',true);
//Enable VeLiTi-analytics
define('veliti_analytics',false);
//Rewrite rule
define('rewrite_url',true);
define('news','');
//maintenance_mode
define('maintenance_mode_communication',false);
define('maintenance_mode_notification','Notice: Portal not accessible due to maintenance on May 15th between 12.00 - 13.00 CET.');
define('maintenance_mode',false);
define('maintenance_mode_user','veliti_admin');
define('maintenance_mode_text','System in maintenance');
define('debug',true);
define('debug_id','114');
/*Business_Rules*/
//Business rules
define('WARRANTY_MONTHS','12');
define('WARRANTY_ELIGIBILITY_WINDOW','3');
define('WARRANTY_EXTENDED_MONTH','24');
define('SERVICE_MONTHS','12');
//Prevent downgrade from paid to free software versions
define('PREVENT_PAID_VERSION_DOWNGRADE',false);
/*Security*/
// Page security
define('page_security_key','secure_admin_342642');
define('cronjob_number','25');
define('header_security',false);
/* Email */
// The from email that will appear on the customer's order details email
define('mail_from','CustomerPortal');
// Your email
define('email','CustomerPortal@veliti.nl');
//Additional phpmailer-settings
define('email_host_name','veliti.nl');
define('email_reply_to','info@gewoonlekkerspaans.nl');
define('email_outgoing_pw','306yc%X5f');
define('email_outgoing_port','465');
define('email_outgoing_security','ssl');
// Enable automatice invoice forward to bookkeeping software
define('invoice_bookkeeping',false);
// Email of bookkeeping software
define('email_bookkeeping','');
/* Payment options */
// Mollie
define('mollie_enabled',true);
define('mollie_api_key','test_jFHqrt9KCSvaBwb4En9ttAM9MTrp9W'); //live_WhsBD8qv3ygR9WVKF3KnCvz9zzNaxh
// PayPal
define('paypal_enabled',true);
define('PAYPAL_URL','https://api-m.sandbox.paypal.com');
define('PAYPAL_WEBHOOK_ID','3UU05694H1382772B');
define('PAYPAL_WEBHOOK','https://acc.veliti.nl/webhook_paypal.php');
define('PAYPAL_CLIENT_ID','AYI8iqzBSD2rNrPStfC0xd3jNR3WzwrSIbPw7qgrEs_sOIvORJMZp3j2QjG7SOCOyI5OQ1s42IcZAJI-');
define('PAYPAL_CLIENT_SECRET','EEwnnw8adeHicjXSCv9abiQG6_0rCTqDWQAqn3TyMMyz7FURZChL3_ywlHF4BTwqUQtJZsQ4Q_WSwB9R');
define('pay_on_delivery_enabled',false);
/*Appearance*/
//Icon
define('icon_image','/assets/images/TSS-logo3.png');
define('color','#005655c2');
define('color_accent','#2FAC66');
define('emaillogo','/assets/images/TSSemail.png');
/*Default Users*/
define('software_update_user','EMP-updater');
define('software_update_pw','EMP-updater');
define('interface_user','interface@test.nl');
define('interface_pw','test1234');

View File

@@ -0,0 +1,112 @@
<?php
//------------------------------------------
//EXCEPTION LIST
//------------------------------------------
$serialnumber_exceptions = array("22050695","22110095");
//------------------------------------------
// Security
//------------------------------------------
$security_key = 'secure_34563$52';
//------------------------------------------
// Base color
//------------------------------------------
$color = '#005655';//'#0b1054';
$color_accent = '#2FAC66'; //'#ececec';
//------------------------------------------
// Database settings
//------------------------------------------
require '/var/www/vhosts/veliti.nl/settings/portalsettings-acc.php';
//------------------------------------------
// Menusetup & settings
//------------------------------------------
require 'settingsmenu.php';
//------------------------------------------
// API BaseUrl
//------------------------------------------
$baseurl = 'https://'.$_SERVER['SERVER_NAME'].'/api.php'; //URL of API
$portalURL = $_SERVER['SERVER_NAME'];
//------------------------------------------
// Equipmentdetails
//------------------------------------------
$servicedate = date("Y-m-d", strtotime("-365 days"));
$warrantydate = date("Y-m-d", strtotime("-365 days"));
$warranty_extended = date("Y-m-d", strtotime("+365 days"));
$date = date('Y-m-d H:i:s');
$curYear = date("Y", time());
$curMonth = date("m", time());
$curQuarter = (int)ceil($curMonth / 3);
$curdateObj = DateTime::createFromFormat('!m', $curMonth);
$curMonth_name = $curdateObj->format('F');
//------------------------------------------
//History Type
//------------------------------------------
$type1 = 'General';
$type2 = 'Customer';
$type3 = 'Service';
$type4 = 'Testing';
$type5 = 'Data';
$type6 = 'Other';
$type7 = 'Internal';
$type8 = 'Ignore';
$type9 = 'Warranty';
$type10 = 'Contract';
$type11 = 'Warranty-Expired';
$type12 = 'Contract-Expired';
$type13 = "Order";
$type14 = "ServiceReport";
$type15 = "SRIncluded";
$type16 = "Notes";
$type17 = "Visual";
$HistoryType_1 = 'Bootloader';
$HistoryType_2 = 'Firmware';
$HistoryType_3 = 'SerialNumber';
$HistoryType_4 = 'Visual_Test';
$HistoryType_5 = 'Maintenance_Test';
$HistoryType_6 = 'Assembly_Test';
$HistoryType_7 = 'ProductNumber';
$HistoryType_8 = 'Visual';
$HistoryType_9 = 'ServiceReport';
//------------------------------------------
//Permissions CRUD
//------------------------------------------
$permission_4 = 'CRUD'; //Admin+
$permission_3 = 'CRUD'; //Admin
$permission_2 = 'CRU'; //SuperUser
$permission_1 = 'CRU'; //CreateUpdate
$permission_0 = 'R'; //Readonly
$permissionlabel1 = 'Permission';
$permission1 = 'Superuser'; #1
$permission2 = 'Create & Update'; #2
$permission3 = 'read-only'; // #3
$permission4 = 'Admin'; //#4
$permission5 = 'Admin+'; // #5
$settingslabel1 = 'profile';
$setting1 = 'firmware'; //Fix
$setting2 = 'service';
$setting3 = 'build'; //Fix
$setting4 = 'distribution';
$setting5 = '';
$setting6 = '';
$setting7 = ''; //Fix
$setting8 = 'interface';
//------------------------------------------
//Partners
//------------------------------------------
$partnertype1 = 'SalesID';
$partnertype2 = 'SoldTo';
$partnertype3 = 'ShipTo';
$partnertype4 = 'Location';
$partnertype5 = 'Section';

View File

@@ -0,0 +1,56 @@
<?php
require 'settingsprofiles.php';
// This will change the title on the website
define('site_name','Customer Portal');
define('site_name_footer','Total Safety Solutions');
// This will change the title on browser TAB
define('site_title','Total Safety Solutions');
//Scriptversion
define('script_version','v12');
//Enable VeLiTi-issue mgt
define('veliti_cim',false);
//Enable VeLiTi-analytics
define('veliti_analytics',true);
//Rewrite rule
define('rewrite_url',false);
define('news','');
//maintenance_mode
define('maintenance_mode_communication',false);
define('maintenance_mode_notification','Notice: The Portal is offline due to infrastructure services issues');
define('maintenance_mode',false);
define('maintenance_mode_text','Portal not accessible due to infrastructure services issues.');
define('debug',false);
define('debug_id','114');
/*Security*/
// Page security
define('page_security_key','secure_admin_342642');
define('cronjob_number','43256');
define('header_security',false);
/* Email */
// The from email that will appear on the customer's order details email
define('mail_from','CustomerPortal');
// Your email
define('email','portal@totalsafetysolutions.nl');
//Additional phpmailer-settings
define('email_host_name','');
define('email_reply_to','service@totalsafetysolutions.nl');
define('email_outgoing_pw','test1234');
define('email_outgoing_port','587');
define('email_outgoing_security','tls');
/*Appearance*/
//Icon
define('icon_image','/assets/images/TSS-logo3.png');
define('color','#005655c2');
define('color_accent','#2FAC66');
define('emaillogo','/assets/images/tss-green.png');
/*Default Users*/
define('software_update_user','EMP-updater');
define('software_update_pw','EMP-updater');
define('interface_user','interface@test.nl');
define('interface_pw','test1234');

View File

@@ -0,0 +1,112 @@
<?php
//------------------------------------------
//EXCEPTION LIST
//------------------------------------------
$serialnumber_exceptions = array("22050253","22050821","22050799","22050813","22050203","22050810","22050803","22050834","22050811","22050817","22050849","22050820","22050819","22050897","22050924","22050905","22050906","22050670","22050762","22050947","22050948","22050120","22050863","22050571","22050213","22051233","22051226");
//------------------------------------------
// Security
//------------------------------------------
$security_key = 'secure_34563$52';
//------------------------------------------
// Base color
//------------------------------------------
$color = '#005655';//'#0b1054';
$color_accent = '#2FAC66'; //'#ececec';
//------------------------------------------
// Database settings
//------------------------------------------
require '/var/www/vhosts/veliti.nl/settings/portalsettings-prod.php';
//------------------------------------------
// Menusetup & settings
//------------------------------------------
require 'settingsmenu.php';
//------------------------------------------
// API BaseUrl
//------------------------------------------
$baseurl = 'https://'.$_SERVER['SERVER_NAME'].'/api.php'; //URL of API
$portalURL = $_SERVER['SERVER_NAME'];
//------------------------------------------
// Equipmentdetails
//------------------------------------------
$servicedate = date("Y-m-d", strtotime("-365 days"));
$warrantydate = date("Y-m-d", strtotime("-365 days"));
$warranty_extended = date("Y-m-d", strtotime("+365 days"));
$date = date('Y-m-d H:i:s');
$curYear = date("Y", time());
$curMonth = date("m", time());
$curQuarter = (int)ceil($curMonth / 3);
$curdateObj = DateTime::createFromFormat('!m', $curMonth);
$curMonth_name = $curdateObj->format('F');
//------------------------------------------
//History Type
//------------------------------------------
$type1 = 'General';
$type2 = 'Customer';
$type3 = 'Service';
$type4 = 'Testing';
$type5 = 'Data';
$type6 = 'Other';
$type7 = 'Internal';
$type8 = 'Ignore';
$type9 = 'Warranty';
$type10 = 'Contract';
$type11 = 'Warranty-Expired';
$type12 = 'Contract-Expired';
$type13 = "Order";
$type14 = "ServiceReport";
$type15 = "SRIncluded";
$type16 = "Notes";
$type17 = "Visual";
$HistoryType_1 = 'Bootloader';
$HistoryType_2 = 'Firmware';
$HistoryType_3 = 'SerialNumber';
$HistoryType_4 = 'Visual_Test';
$HistoryType_5 = 'Maintenance_Test';
$HistoryType_6 = 'Assembly_Test';
$HistoryType_7 = 'ProductNumber';
$HistoryType_8 = 'Visual';
$HistoryType_9 = 'ServiceReport';
//------------------------------------------
//Permissions CRUD
//------------------------------------------
$permission_4 = 'CRUD'; //Admin+
$permission_3 = 'CRU'; //Admin
$permission_2 = 'CRU'; //SuperUser
$permission_1 = 'CRU'; //CreateUpdate
$permission_0 = 'R'; //Readonly
$permissionlabel1 = 'Permission';
$permission1 = 'Superuser'; #1
$permission2 = 'Create & Update'; #2
$permission3 = 'read-only'; // #3
$permission4 = 'Admin'; //#4
$permission5 = 'Admin+'; // #5
$settingslabel1 = 'profile';
$setting1 = 'firmware'; //Fix
$setting2 = 'service';
$setting3 = 'build'; //Fix
$setting4 = 'distribution';
$setting5 = '';
$setting6 = '';
$setting7 = ''; //Fix
$setting8 = 'interface';
//------------------------------------------
//Partners
//------------------------------------------
$partnertype1 = 'SalesID';
$partnertype2 = 'SoldTo';
$partnertype3 = 'ShipTo';
$partnertype4 = 'Location';
$partnertype5 = 'Section';

View File

@@ -1,27 +1,12 @@
<?php
//=========================================
//REDIRECTOR TO CONFIG FILE BASED ON DOMAIN
//=========================================
$parts = explode('.', $_SERVER['SERVER_NAME']);
$count = count($parts);
//======================================================================
//REDIRECTOR TO settings FILE BASED ON .htacces - SetEnv APP_ENV development
//======================================================================
$env = getenv('APP_ENV') ?: 'development';
// For hostnames with enough parts to have a subdomain (at least 3 parts)
if ($count >= 3) {
// Return the second-to-last and third-to-last parts
$domain = $parts[$count - 2];
}
// For hostnames with just domain and TLD (2 parts)
else if ($count == 2) {
// Return just the domain part (without the TLD)
$domain = $parts[0];
}
// If it's a single part hostname
else {
$domain = $hostname;
}
$settings_location = ((file_exists(dirname(__FILE__,2).'/custom/'.$env.'/settings/'.$env.'_settings.php')) ? dirname(__FILE__,2).'/custom/'.$env.'/settings/'.$env.'_settings.php' : dirname(__FILE__).'/'.$env.'_settings.php');
$settings_location = ((file_exists(dirname(__FILE__,2).'/custom/'.$domain.'/settings/'.$domain.'_settings.php')) ? dirname(__FILE__,2).'/custom/'.$domain.'/settings/'.$domain.'_settings.php' : dirname(__FILE__).'/settings.php');
include $settings_location;
?>

View File

@@ -262,17 +262,18 @@ try {
$dompdf->render();
$subject = 'Software Upgrade - Invoice: '.$order_id;
$attachment = $dompdf->output();
$attachment_name = $subject.'.pdf';
//+++++++++++++++++++++++++++++++++++++++++++++++++++++
//Send email via PHPMailer
//+++++++++++++++++++++++++++++++++++++++++++++++++++++
// The send_mail function will exit on error and debuglog the error
$mail_result = send_mail($customer_email, $subject, $message, $attachment, $subject);
$mail_result = send_mail($customer_email, $subject, $message, $attachment, $attachment_name);
// Send to bookkeeping if configured
if(invoice_bookkeeping){
debuglog("WEBHOOK: Sending to bookkeeping: " . email_bookkeeping);
send_mail(email_bookkeeping, $subject, $message, $attachment, $subject);
send_mail(email_bookkeeping, $subject, $message, $attachment, $attachment_name);
}
} else {
debuglog("WEBHOOK: No invoice data found for invoice_id: $invoice_id");

View File

@@ -306,16 +306,17 @@ try {
$dompdf->render();
$subject = 'Software Upgrade - Invoice: '.$order_id;
$attachment = $dompdf->output();
$attachment_name = $subject.'.pdf';
//+++++++++++++++++++++++++++++++++++++++++++++++++++++
//Send email via PHPMailer
//+++++++++++++++++++++++++++++++++++++++++++++++++++++
$mail_result = send_mail($customer_email, $subject, $message, $attachment, $subject);
$mail_result = send_mail($customer_email, $subject, $message, $attachment, $attachment_name);
// Send to bookkeeping if configured
if(invoice_bookkeeping){
debuglog("PAYPAL WEBHOOK: Sending to bookkeeping: " . email_bookkeeping);
send_mail(email_bookkeeping, $subject, $message, $attachment, $subject);
send_mail(email_bookkeeping, $subject, $message, $attachment, $attachment_name);
}
} else {
debuglog("PAYPAL WEBHOOK: No invoice data found for invoice_id: $invoice_id");