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:
@@ -136,10 +136,22 @@ else {
|
||||
$messages = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
}
|
||||
|
||||
// Clean up nested JSON in description fields before final encoding
|
||||
if (!isset($criterias['totals']) || $criterias['totals'] != '') {
|
||||
foreach ($messages as &$message) {
|
||||
if (isset($message['description']) && is_string($message['description'])) {
|
||||
$decoded = json_decode($message['description'], true);
|
||||
if (json_last_error() === JSON_ERROR_NONE) {
|
||||
$message['description'] = json_encode($decoded, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------
|
||||
//JSON_ENCODE
|
||||
//------------------------------------------
|
||||
$messages = json_encode($messages, JSON_UNESCAPED_UNICODE);
|
||||
$messages = json_encode($messages, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
|
||||
|
||||
//Send results
|
||||
echo $messages;
|
||||
|
||||
Reference in New Issue
Block a user