- | ' . nl2br($quote_note) . ' |
+ ' . nl2br($quote_note) . ' |
| Subtotal: | ' . numfmt_format_currency($currency_format, $sub_total, $quote_currency_code) . ' | ';
@@ -526,7 +526,7 @@ if (isset($_GET['export_invoice_pdf'])) {
// Start TCPDF
$pdf = new TCPDF('P', 'mm', 'A4', true, 'UTF-8', false);
- $pdf->SetMargins(15, 15, 15);
+ $pdf->SetMargins(10, 10, 10);
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);
$pdf->AddPage();
@@ -620,7 +620,7 @@ if (isset($_GET['export_invoice_pdf'])) {
// Totals
$html .= '
- | ' . nl2br($invoice_note) . ' |
+ ' . nl2br($invoice_note) . ' |
| Subtotal: | ' . numfmt_format_currency($currency_format, $sub_total, $invoice_currency_code) . ' | ';
diff --git a/includes/app_version.php b/includes/app_version.php
index 6f5c5b6f..3382a24d 100644
--- a/includes/app_version.php
+++ b/includes/app_version.php
@@ -5,4 +5,4 @@
* Update this file each time we merge develop into master. Format is YY.MM (add a .v if there is more than one release a month.
*/
-DEFINE("APP_VERSION", "25.09");
+DEFINE("APP_VERSION", "25.09.1");
diff --git a/js/ai_reword.js b/js/ai_reword.js
deleted file mode 100644
index ef6eb8a9..00000000
--- a/js/ai_reword.js
+++ /dev/null
@@ -1,41 +0,0 @@
-document.getElementById('rewordButton').addEventListener('click', function() {
- var textInput = this.closest('form').querySelector('textarea');
- var ticketDescription = document.getElementById('ticketDescription');
- var rewordButton = document.getElementById('rewordButton');
- var undoButton = document.getElementById('undoButton');
- var previousText = textInput.value; // Store the current text
-
- // Disable the Reword button and show loading state
- rewordButton.disabled = true;
- rewordButton.innerText = 'Processing...';
-
- fetch('post.php?ai_reword', {
- method: 'POST',
- headers: {
- 'Content-Type': 'application/json',
- },
- // Body with the text to reword and the ticket description
- body: JSON.stringify({
- text: textInput.value,
- ticketDescription: ticketDescription.innerText.valueOf(),
- }),
- })
- .then(response => response.json())
- .then(data => {
- textInput.value = data.rewordedText || 'Error: Could not reword the text.';
- rewordButton.disabled = false;
- rewordButton.innerText = 'Reword'; // Reset button text
- undoButton.style.display = 'inline'; // Show the Undo button
-
- // Set up the Undo button to revert to the previous text
- undoButton.onclick = function() {
- textInput.value = previousText;
- this.style.display = 'none'; // Hide the Undo button again
- };
- })
- .catch(error => {
- console.error('Error:', error);
- rewordButton.disabled = false;
- rewordButton.innerText = 'Reword'; // Reset button text
- });
-});
\ No newline at end of file
diff --git a/post/ai.php b/post/ai.php
index a2db416e..7ca2f22c 100644
--- a/post/ai.php
+++ b/post/ai.php
@@ -31,7 +31,7 @@ if (isset($_GET['ai_reword'])) {
["role" => "system", "content" => $promptText],
["role" => "user", "content" => $userText],
],
- "temperature" => 0.7
+ "temperature" => 0.5
];
// Initialize cURL session to the OpenAI Chat API.
@@ -78,6 +78,8 @@ if (isset($_GET['ai_reword'])) {
if (isset($_GET['ai_ticket_summary'])) {
+ header('Content-Type: text/html; charset=UTF-8');
+
$sql = mysqli_query($mysqli, "SELECT * FROM ai_models LEFT JOIN ai_providers ON ai_model_ai_provider_id = ai_provider_id WHERE ai_model_use_case = 'General' LIMIT 1");
$row = mysqli_fetch_array($sql);
@@ -89,21 +91,27 @@ if (isset($_GET['ai_ticket_summary'])) {
$ticket_id = intval($_POST['ticket_id']);
// Query the database for ticket details
- // (You can reuse code from ticket.php or write a simplified query here)
$sql = mysqli_query($mysqli, "
- SELECT ticket_subject, ticket_details
+ SELECT ticket_subject, ticket_details, ticket_source, ticket_priority, ticket_status_name, category_name
FROM tickets
+ LEFT JOIN ticket_statuses ON ticket_status = ticket_status_id
+ LEFT JOIN categories ON ticket_category = category_id
WHERE ticket_id = $ticket_id
LIMIT 1
");
$row = mysqli_fetch_assoc($sql);
$ticket_subject = $row['ticket_subject'];
$ticket_details = strip_tags($row['ticket_details']); // strip HTML for cleaner prompt
+ $ticket_status = $row['ticket_status_name'];
+ $ticket_category = $row['category_name'];
+ $ticket_source = $row['ticket_source'];
+ $ticket_priority = $row['ticket_priority'];
// Get ticket replies
$sql_replies = mysqli_query($mysqli, "
- SELECT ticket_reply, ticket_reply_type
+ SELECT ticket_reply, ticket_reply_type, user_name
FROM ticket_replies
+ LEFT JOIN users ON ticket_reply_by = user_id
WHERE ticket_reply_ticket_id = $ticket_id
AND ticket_reply_archived_at IS NULL
ORDER BY ticket_reply_id ASC
@@ -113,20 +121,52 @@ if (isset($_GET['ai_ticket_summary'])) {
while ($reply = mysqli_fetch_assoc($sql_replies)) {
$reply_type = $reply['ticket_reply_type'];
$reply_text = strip_tags($reply['ticket_reply']);
- $all_replies_text .= "\n[$reply_type]: $reply_text";
+ $reply_by = $reply['user_name'];
+ $all_replies_text .= "\nReply Type: $reply_type Reply By: $reply_by: Reply Text: $reply_text";
}
- // Craft a prompt for ChatGPT
- $prompt = "Based on the language detection (case not detected use default English), dont show \"Language Detected\", and Summarize using this language, the following ticket and its responses in a concise and clear way. The summary should be short, highlight the main issue, the actions taken, and any resolution steps:\n\nTicket Subject: $ticket_subject\nTicket Details: $ticket_details\nReplies:$all_replies_text\n\nShort Summary:";
+ $prompt = "
+ Summarize the following IT support ticket and its responses in a concise, clear, and professional manner.
+ The summary should include:
+
+ 1. Main Issue: What was the problem reported by the user?
+ 2. Actions Taken: What steps were taken to address the issue?
+ 3. Resolution or Next Steps: Was the issue resolved or is it ongoing?
+
+ Please ensure:
+ - If there are multiple issues, summarize each separately.
+ - Urgency: If the ticket or replies express urgency or escalation, highlight it.
+ - Attachments: If mentioned in the ticket, note any relevant attachments or files.
+ - Avoid extra explanations or unnecessary information.
+
+ Ticket Data:
+ - Ticket Source: $ticket_source
+ - Current Ticket Status: $ticket_status
+ - Ticket Priority: $ticket_priority
+ - Ticket Category: $ticket_category
+ - Ticket Subject: $ticket_subject
+ - Ticket Details: $ticket_details
+ - Replies:
+ $all_replies_text
+
+ Formatting instructions:
+ - Use valid HTML tags only.
+ - Use for section headers (Main Issue, Actions Taken, Resolution).
+ - Use - for bullet points under each section.
+ - Do NOT wrap the output in ```html or any other code fences.
+ - Do NOT include , , or .
+ - Output only the summary content in pure HTML.
+ If any part of the ticket or replies is unclear or ambiguous, mention it in the summary and suggest if further clarification is needed.
+ ";
// Prepare the POST data
$post_data = [
"model" => "$model_name",
"messages" => [
- ["role" => "system", "content" => "You are a helpful assistant."],
+ ["role" => "system", "content" => "Your task is to summarize IT support tickets with clear, concise details."],
["role" => "user", "content" => $prompt]
],
- "temperature" => 0.7
+ "temperature" => 0.3
];
$ch = curl_init();
@@ -149,8 +189,8 @@ if (isset($_GET['ai_ticket_summary'])) {
$response_data = json_decode($response, true);
$summary = $response_data['choices'][0]['message']['content'] ?? "No summary available.";
- // Print the summary
- echo nl2br(htmlentities($summary));
+
+ echo $summary; // nl2br to convert newlines to
, htmlspecialchars to prevent XSS
}
if (isset($_GET['ai_create_document_template'])) {
@@ -183,7 +223,7 @@ if (isset($_GET['ai_create_document_template'])) {
["role" => "system", "content" => $system_message],
["role" => "user", "content" => $user_message]
],
- "temperature" => 0.7
+ "temperature" => 0.5
];
$ch = curl_init();
diff --git a/setup/index.php b/setup/index.php
index 1ba35516..8eb15fc8 100644
--- a/setup/index.php
+++ b/setup/index.php
@@ -89,7 +89,7 @@ if (isset($_POST['add_database'])) {
// Name of the file
- $filename = 'install.sql';
+ $filename = '../db.sql';
// Temporary variable, used to store current query
$templine = '';
// Read in entire file
diff --git a/user/clients.php b/user/clients.php
index 20b10b7a..2dbd32af 100644
--- a/user/clients.php
+++ b/user/clients.php
@@ -504,7 +504,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
-
+
@@ -566,10 +566,12 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
Paid
+ 0) { ?>
Credit
+
Monthly
diff --git a/user/includes/inc_client_top_head.php b/user/includes/inc_client_top_head.php
index ba602466..48ecb584 100644
--- a/user/includes/inc_client_top_head.php
+++ b/user/includes/inc_client_top_head.php
@@ -1,3 +1,5 @@
+
+
| |