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:
@@ -26,7 +26,7 @@ if(isset($get_content) && $get_content!=''){
|
||||
foreach ($requests as $y){
|
||||
$v = explode("=", $y);
|
||||
//INCLUDE VARIABLES IN ARRAY
|
||||
$criterias[$v[0]] = $v[1];
|
||||
$criterias[$v[0]] = $v[1] ?? '';
|
||||
|
||||
if ($v[0] == 'page' || $v[0] =='p' || $v[0] =='totals' || $v[0] =='list' || $v[0] =='history'|| $v[0] =='success_msg'){
|
||||
//do nothing
|
||||
|
||||
@@ -65,8 +65,8 @@ if ($stmt->rowCount() == 1) {
|
||||
//Refresh REFRESHKEY
|
||||
$user_data['refreshkey'] = bin2hex(random_bytes(25));
|
||||
$sql_refreshkey = 'UPDATE users SET refreshkey = ? WHERE id = ?';
|
||||
$stmt_service = $pdo->prepare($sql_refreshkey);
|
||||
$stmt_service->execute([$user_data['refreshkey'], $user_data['id']]);
|
||||
$stmt_refreshkey = $pdo->prepare($sql_refreshkey);
|
||||
$stmt_refreshkey->execute([$user_data['refreshkey'], $user_data['id']]);
|
||||
|
||||
$token = createCommunicationToken($user_data['userkey']);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user