diff --git a/api/v0/post/application.php b/api/v0/post/application.php index 4f2cfa4..45207bc 100644 --- a/api/v0/post/application.php +++ b/api/v0/post/application.php @@ -344,7 +344,7 @@ if (!empty($post_content['sn']) && !empty($post_content['testdetails'])) { foreach ($results as $result){ $result = json_decode(json_encode($result)); - $servicereport = serviceReport($result, 'email'); + $servicereport = serviceReport($result, 'email', $language); generatedPDF($servicereport,$last_id,$useremail); } } diff --git a/api/v2/post/history.php b/api/v2/post/history.php index 3571f63..bccde2b 100644 --- a/api/v2/post/history.php +++ b/api/v2/post/history.php @@ -329,7 +329,7 @@ if (isset($post_content['sn']) && isset($post_content['payload'])){ foreach ($results as $result){ $result = json_decode(json_encode($result)); - $servicereport = serviceReport($result, 'email'); + $servicereport = serviceReport($result, 'email', $language); generatedPDF($servicereport,$last_id,$useremail); } } diff --git a/assets/functions.php b/assets/functions.php index 5171235..883b46b 100644 --- a/assets/functions.php +++ b/assets/functions.php @@ -1025,11 +1025,11 @@ function serviceEvents ($messages,$page){ // Service report //Input = servicereport //------------------------------------------ -function serviceReport($history, $request) +function serviceReport($history, $request, $country_code) { - if(isset($_SESSION['country_code'])){ - $api_file_language = dirname(__FILE__,2).'/settings/translations/translations_'.strtoupper($_SESSION['country_code']).'.php'; + if(isset($country_code) && $country_code != ''){ + $api_file_language = dirname(__FILE__,2).'/settings/translations/translations_'.strtoupper($country_code).'.php'; if (file_exists($api_file_language)){ include $api_file_language; //Include the code } diff --git a/render_service_report.php b/render_service_report.php index e1dbe5f..ecd6824 100644 --- a/render_service_report.php +++ b/render_service_report.php @@ -31,7 +31,7 @@ $historyID = $_GET['historyID'] ?? ''; // +++++++++++++++++++++++++++++++++++++++++++++++++++++++ // Create ServiceReport // +++++++++++++++++++++++++++++++++++++++++++++++++++++++ -$servicereport_data = serviceReport($history[0], ''); +$servicereport_data = serviceReport($history[0], '', $_SESSION['country_code']); $servicereport_name = 'Service report - '.$historyID; //+++++++++++++++++++++++++++++++++++++++++++ diff --git a/servicereport.php b/servicereport.php index ecf2436..6fcdf1f 100644 --- a/servicereport.php +++ b/servicereport.php @@ -53,7 +53,7 @@ if (empty($history)){ '.$servicereport_no_history.' '; } else { - $service_events = serviceReport($history[0], 'display'); + $service_events = serviceReport($history[0], 'display', $_SESSION['country_code']); } $view .= '