Jump to content

Reply above the line


aonap

Recommended Posts

8 hours ago, aonap said:

When clients reply via email, how do you get the system to remove our last response? Effectively, want to ensure that the tickets only show their new message.

This needs to be a feature as we were used to it with Zendesk.

Welcome to WHMCS ticket import system. It is not possible out of the box and no better way to solve it. Yes it is bored, because when you read a ticket you need to deal with a lot things (HTML codes, css, lot of garbage)...Also there is no module to get it better, and WHMCS perhaps do not care a lot about it, because usually I guess all WHMCS clients usually log in before answer their ticket, but we know in our real lives our clients do not do that, and get us on mess.

My clients usually find me at my local office or phone call, so We manual register them on admin side, so they are not familiar to login in their client area. This means they usually reply all tickets direct to their email, so 90% of my tickets has this mess garbage on there (importing all previous message). But yes We still a live, waiting that someday it could get better 🤞

Edited by zitu4life
correct word their to they
Link to comment
Share on other sites

Right, the hook still uses the mysql db connection, try to replace

$sql = "UPDATE tblticketreplies
			SET message = '" . mysql_real_escape_string(trim($message)) . "'
			WHERE id = '" . intval($vars['replyid']) . "'";
		mysql_query($sql);

with

Capsule::connection()->statement("UPDATE tblticketreplies
			SET message = '" . mysql_real_escape_string(trim($message)) . "'
			WHERE id = '" . intval($vars['replyid']) . "'");

and add

use Illuminate\Database\Capsule\Manager as Capsule;

after the <?php

Link to comment
Share on other sites

<?php

if (!defined("WHMCS"))
	die("This file cannot be accessed directly");

/*********************
 Reply Above This Line Settings
*********************/
function ReplyAboveThisLine_settings()
{
	return array(
		'breakrow' 	=> "*** Reply above this line ***", // this line will be added to the selected email. * all content below this line will be deleted from the client reply.
	);
}
/********************/

function ReplyAboveThisLine_cleanReply($vars) 
{
	$settings = ReplyAboveThisLine_settings();
	
	if(strpos($vars['message'], $settings['breakrow']) !== false) 
	{
		list($message) = explode($settings['breakrow'], $vars['message']);

Capsule::connection()->statement("UPDATE tblticketreplies
			SET message = '" . mysql_real_escape_string(trim($message)) . "'
			WHERE id = '" . intval($vars['replyid']) . "'");

	}
}	

function ReplyAboveThisLine_addBreakRow($vars) 
{
	return ReplyAboveThisLine_settings();
}
 
add_hook('EmailPreSend',	0, 'jetserverReplyAboveThisLine_addBreakRow');
add_hook('TicketUserReply', 	0, 'jetserverReplyAboveThisLine_cleanReply');


use Illuminate\Database\Capsule\Manager as Capsule;

?>

Is the above correct?

Link to comment
Share on other sites

9 hours ago, aonap said:

The code is not working

that "use" needs to be before you call a capsule query - as it's written, you're asking WHMCS to use capsule, but it has no idea what to use to do that.

so move it from the bottom of the hook to the top, after <?php and before the first function is called.

use WHMCS\Database\Capsule;

either bady's (the original way we were told to call Capsule) or the above (the more recent way) should work.

Edited by brian!
Link to comment
Share on other sites

40 minutes ago, brian! said:

that "use" needs to be before you call a capsule query - as it's written, you're asking WHMCS to use capsule, but it has no idea what to use to do that.

so move it from the bottom of the hook to the top, after <?php and before the first function is called.


use WHMCS\Database\Capsule;

either bady's (the original way we were told to call Capsule) or the above (the more recent way) should work.

It is working! Thank you. Only issue now is when we get the admin ticket replies, it is still showing the full email. We are trying to save space on the DB server, so how do you get rid of the content below?

In the support ticket at the backend it shows still parts of the email:

From: 
Sent: 
To: 
Subject: 

Link to comment
Share on other sites

  • 2 years later...
On 4/11/2020 at 10:12 PM, zitu4life said:

........ This means they usually reply all tickets direct to their email, so 90% of my tickets has this mess garbage on there (importing all previous message)......

Have you tried with the breaklines method?  Works for me.

https://help.whmcs.com/m/support_tools/l/1265973-stripping-quoted-emails-from-tickets

 

Link to comment
Share on other sites

  • 1 year later...

I just added:

<p>====== Please reply above this line ======</p>

To the mail header:

  • General Settings
  • Mail
  • Client Email Header Content

Below:

    </head>
    <body leftmargin="0" marginwidth="0" topmargin="0" marginheight="0" offset="0">
        <center>

So I end up with:

    </head>
    <body leftmargin="0" marginwidth="0" topmargin="0" marginheight="0" offset="0">
        <center>
            <p>====== Please reply above this line ======</p>
            <table align="center" border="0" cellpadding="0" cellspacing="0" height="100%" width="100%" id="bodyTable">

Not really sure why this, or something like it,  isn't already the default?

Cloudflare OWASP rules seems to otherwise block page loads/submits, when clients try to post a reply to a ticket that has various URLs in - imported from the email replies.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated