feat: Implement invoice generation and emailing functionality
- Added invoice generation logic using DomPDF. - Integrated invoice data retrieval from the API. - Implemented language determination for invoices based on customer data. - Added options to email invoices to customers and admin. - Included HTML output option for direct viewing in the browser. - Ensured proper redirection and error handling throughout the process.
This commit is contained in:
@@ -161,6 +161,7 @@ if (isset($criterias['sn']) && $criterias['sn'] != ''){
|
||||
$debug['decision'] = 'No active software assignments found';
|
||||
}
|
||||
} else {
|
||||
$available_upgrades = 0;
|
||||
$has_priced_options = false;
|
||||
$has_latest_version_different = false;
|
||||
|
||||
@@ -242,6 +243,8 @@ if (isset($criterias['sn']) && $criterias['sn'] != ''){
|
||||
}
|
||||
|
||||
if ($show_version) {
|
||||
$available_upgrades++;
|
||||
|
||||
//Check if there's a valid license for this upgrade
|
||||
if ($final_price > 0 && $sw_version_license) {
|
||||
//Check if the license is valid
|
||||
@@ -286,23 +289,18 @@ if (isset($criterias['sn']) && $criterias['sn'] != ''){
|
||||
}
|
||||
}
|
||||
|
||||
// Apply the logic:
|
||||
// 1. If there are priced options -> "yes"
|
||||
// 2. If no priced options but current version != latest flagged version -> "yes"
|
||||
// 3. Default -> "no"
|
||||
if ($has_priced_options) {
|
||||
// Simple logic: if any upgrades are available to show, return "yes"
|
||||
if ($available_upgrades > 0) {
|
||||
$software_available = "yes";
|
||||
$availability_reason = "Has priced upgrade options available";
|
||||
} elseif ($has_latest_version_different) {
|
||||
$software_available = "yes";
|
||||
$availability_reason = "Has free latest version available";
|
||||
$availability_reason = "Software upgrades available";
|
||||
} else {
|
||||
$software_available = "no";
|
||||
$availability_reason = "No upgrades available or already on latest";
|
||||
$availability_reason = "No upgrades available";
|
||||
}
|
||||
|
||||
if (debug) {
|
||||
$debug['final_decision'] = [
|
||||
'available_upgrades' => $available_upgrades,
|
||||
'has_priced_options' => $has_priced_options,
|
||||
'has_latest_version_different' => $has_latest_version_different,
|
||||
'software_available' => $software_available,
|
||||
|
||||
Reference in New Issue
Block a user