- Edited
It would be nice to merge tickets that belong to each other but somehow are created as to different tickets.
It would be nice to merge tickets that belong to each other but somehow are created as to different tickets.
In case you were interested...
It would be extremely difficult to merge the main ticket detail. (ie- ticket id, subject, help topic, dept, email, name, subject, etc...) You can only keep one ticket header.
But, if you were willing to lose one of these headers for the ticket, you could do this fairly easily with a few SQL queries.
First- you will need to determine the ticket_id of each of the tickets you wish to merge. In my case I have a ticket_id of 31 for the ticket I wish to keep and 32 is the ticket_id of the ticket I wish to merge and don't need.
If you are familiar with SQL, you can use your mySQL manager of choice to run the following queries and merge the two tickets into one (replace the ticket_ids with your own):
Merge ticket Responses:
UPDATE `ost_ticket_response` SET `ticket_id`=31 WHERE `ticket_id`=32;
Merge internal notes:
UPDATE `ost_ticket_note` SET `ticket_id`=31 WHERE `ticket_id`=32;
If there are attachments:
UPDATE `ost_ticket_attachment` SET `ticket_id`=31 WHERE `ticket_id`=32;
And finally, remove the ticket you don't need:
DELETE FROM`ost_ticket` WHERE `ticket_id`=32;
Please be careful. Backup before running any queries, and don't get mad if you screw anything up when you don't understand what you are doing.
Hi DackR,
Thanx for your reply.
I am well capable of SQL, but i just posted this in feature requests for it would be nice as a option in osticket and not to do is manualy by executing SQL code.
Raymond
Merge tickets
Once you merge the tickets...from multiple senders...who gets the response...everyone or the master (first) sender?
Here a function for class.ticket.php
// Fügt Tickts zusammen
function merge($tids) {
if( count($tids) == 2){
$superticket = $tids;
$subticket = $tids;
db_query('DELETE FROM '.TICKET_TABLE.' WHERE ticket_id='.db_input($subticket));
db_query('UPDATE '.TICKET_MESSAGE_TABLE.' SET ticket_id='.db_input($superticket).' WHERE ticket_id='.db_input($subticket));
db_query('UPDATE '.TICKET_RESPONSE_TABLE.' SET ticket_id='.db_input($superticket).' WHERE ticket_id='.db_input($subticket));
db_query('UPDATE '.TICKET_NOTE_TABLE.' SET ticket_id='.db_input($superticket).' WHERE ticket_id='.db_input($subticket));
db_query('UPDATE '.TICKET_ATTACHMENT_TABLE.' SET ticket_id='.db_input($superticket).' WHERE ticket_id='.db_input($subticket));
}
}
It merge 2 Tickets on frontpage, staff panel (because multiple checkbox)
In scp/tickets.php find
switch($_POST) {
case 'mass_process':
if(!$thisuser->canManageTickets())
$errors='You do not have permission to mass manage tickets. Contact admin for such access';
paste after
elseif(!$_POST || !is_array($_POST))
$errors='No tickets selected. You must select at least one ticket.';
than, find
if(!$errors) {
$count=count($_POST);
if(isset($_POST)){
$i=0;
$note='Ticket reopened by '.$thisuser->getName();
foreach($_POST as $k=>$v) {
$t = new Ticket($v);
if($t && @$t->reopen()) {
$i++;
$t->logActivity('Ticket Reopened',$note,false,'System');
}
}
$msg="$i of $count selected tickets reopened";
and paste after
}elseif(isset($_POST)){
$i=0;
$note='Ticket merge by '.$thisuser->getName();
foreach($_POST as $k=>$v) {
$t = new Ticket($v);
$i++;
$t->logActivity('Ticket ID '.$v.' merge',$note,false,'System');
}
$t->merge($_POST);
In include/staff/tickets.inc.php after
<input class="button" type="submit" name="overdue" value="Overdue" onClick=' return confirm("Are you sure you want to mark selected tickets overdue/stale?");'>
<input class="button" type="submit" name="close" value="Close" onClick=' return confirm("Are you sure you want to close selected tickets?");'>
insert
<input class="button" type="submit" name="merge" value="Merge" onClick=' return confirm("Are you sure you want to merge selected tickets?");'>
upload changed files an have fun,
sorry for bad english,
dear
tino :)
Great
I'm adding this to my implementation tonight.
I recently made a huge mod that overhauls mailing options and this was going to be last on my list. Now you've saved me the trouble. ;)
So does this work?
Do i ahve to add that function to class.ticket.php?
which email address gets preserved? I looks maybe this adds an option on the staff ticket screen where they check multiple and then merge them? is it restricted to admins?
Did anyone had a success of implementing this on the ST version?
Did anyone had a success of implementing this on the ST version?
Yes :) - It´s work perfectly.
Yes.. It works fine. I think i might have made a mistake somewhere before.
I skiped this line of code. I couldnt get what to do
switch($_POST) {
case 'mass_process':
if(!$thisuser->canManageTickets())
$errors='You do not have permission to mass manage tickets. Contact admin for such access';
Another suggestion
Paste this code
after
if($canDelete) {?>
onClick=' return confirm("Are you sure you want to DELETE selected tickets?");'>
This way the merge feature shows up even when you search & in the overdue section.
Thanks for the great help
HELP! Please
Implemented this mod and all looked fine until I actually select two tickets to merge and hit the merge button.
I get the Are you sure you want to merge the tickets dialogue and then I get an internal server error 500
Can anyone tell me why? help me rectify this?
Many thanks for any help.
Implemented this mod and all looked fine until I actually select two tickets to merge and hit the merge button.I get the Are you sure you want to merge the tickets dialogue and then I get an internal server error 500
Can anyone tell me why? help me rectify this?
Many thanks for any help.
You need to move the function for class.ticket.php into the correct spot.
Find:
function delete(){
if($this->getId())
{
if(db_query('DELETE FROM '.TICKET_TABLE.' WHERE ticket_id='.$this->getId()) && db_affected_rows()):
db_query('DELETE FROM '.TICKET_MESSAGE_TABLE.' WHERE ticket_id='.db_input($this->getId()));
db_query('DELETE FROM '.TICKET_RESPONSE_TABLE.' WHERE ticket_id='.db_input($this->getId()));
db_query('DELETE FROM '.TICKET_NOTE_TABLE.' WHERE ticket_id='.db_input($this->getId()));
$this->deleteAttachments();
return TRUE;
endif;
}
return FALSE;
}
And add the function below like so:
// Fügt Tickts zusammen
function merge($tids) {
if( count($tids) == 2){
$superticket = $tids;
$subticket = $tids;
db_query('DELETE FROM '.TICKET_TABLE.' WHERE ticket_id='.db_input($subticket));
db_query('UPDATE '.TICKET_MESSAGE_TABLE.' SET ticket_id='.db_input($superticket).' WHERE ticket_id='.db_input($subticket));
db_query('UPDATE '.TICKET_RESPONSE_TABLE.' SET ticket_id='.db_input($superticket).' WHERE ticket_id='.db_input($subticket));
db_query('UPDATE '.TICKET_NOTE_TABLE.' SET ticket_id='.db_input($superticket).' WHERE ticket_id='.db_input($subticket));
db_query('UPDATE '.TICKET_ATTACHMENT_TABLE.' SET ticket_id='.db_input($superticket).' WHERE ticket_id='.db_input($subticket));
}
}
Dsgsw
I have wanted to write something like this on my blog and you gave me an idea. Thank you.
how to implement.i did but not get success.plz help,its urgently
Hi
how to implement this given merge process.i did but not get success.plz help
send me the actuall steps for the same.
where we paste that class.ticket.php code as given below.
function merge($tids) {
if( count($tids) == 2){
$superticket = $tids;
$subticket = $tids;
db_query('DELETE FROM '.TICKET_TABLE.' WHERE ticket_id='.db_input($subticket));
db_query('UPDATE '.TICKET_MESSAGE_TABLE.' SET ticket_id='.db_input($superticket).' WHERE ticket_id='.db_input($subticket));
db_query('UPDATE '.TICKET_RESPONSE_TABLE.' SET ticket_id='.db_input($superticket).' WHERE ticket_id='.db_input($subticket));
db_query('UPDATE '.TICKET_NOTE_TABLE.' SET ticket_id='.db_input($superticket).' WHERE ticket_id='.db_input($subticket));
db_query('UPDATE '.TICKET_ATTACHMENT_TABLE.' SET ticket_id='.db_input($superticket).' WHERE ticket_id='.db_input($subticket));
}
}
and one more doubts is that--
this php code as given below is not present in scp/tickets.php....so mention where it is?
}elseif(isset($_POST)){
$i=0;
$note='Ticket merge by '.$thisuser->getName();
foreach($_POST as $k=>$v) {
$t = new Ticket($v);
$i++;
$t->logActivity('Ticket ID '.$v.' merge',$note,false,'System');
}
$t->merge($_POST);
Here a function for class.ticket.php
// Fügt Tickts zusammen
function merge($tids) {
if( count($tids) == 2){
$superticket = $tids;
$subticket = $tids;
db_query('DELETE FROM '.TICKET_TABLE.' WHERE ticket_id='.db_input($subticket));
db_query('UPDATE '.TICKET_MESSAGE_TABLE.' SET ticket_id='.db_input($superticket).' WHERE ticket_id='.db_input($subticket));
db_query('UPDATE '.TICKET_RESPONSE_TABLE.' SET ticket_id='.db_input($superticket).' WHERE ticket_id='.db_input($subticket));
db_query('UPDATE '.TICKET_NOTE_TABLE.' SET ticket_id='.db_input($superticket).' WHERE ticket_id='.db_input($subticket));
db_query('UPDATE '.TICKET_ATTACHMENT_TABLE.' SET ticket_id='.db_input($superticket).' WHERE ticket_id='.db_input($subticket));
}
}
It merge 2 Tickets on frontpage, staff panel (because multiple checkbox)
In scp/tickets.php find
switch($_POST) {
case 'mass_process':
if(!$thisuser->canManageTickets())
$errors='You do not have permission to mass manage tickets. Contact admin for such access';
paste after
elseif(!$_POST || !is_array($_POST))
$errors='No tickets selected. You must select at least one ticket.';
than, find
if(!$errors) {
$count=count($_POST);
if(isset($_POST)){
$i=0;
$note='Ticket reopened by '.$thisuser->getName();
foreach($_POST as $k=>$v) {
$t = new Ticket($v);
if($t && @$t->reopen()) {
$i++;
$t->logActivity('Ticket Reopened',$note,false,'System');
}
}
$msg="$i of $count selected tickets reopened";
and paste after
}elseif(isset($_POST)){
$i=0;
$note='Ticket merge by '.$thisuser->getName();
foreach($_POST as $k=>$v) {
$t = new Ticket($v);
$i++;
$t->logActivity('Ticket ID '.$v.' merge',$note,false,'System');
}
$t->merge($_POST);
In include/staff/tickets.inc.php after
<input class="button" type="submit" name="overdue" value="Overdue" onClick=' return confirm("Are you sure you want to mark selected tickets overdue/stale?");'>
<input class="button" type="submit" name="close" value="Close" onClick=' return confirm("Are you sure you want to close selected tickets?");'>
insert
<input class="button" type="submit" name="merge" value="Merge" onClick=' return confirm("Are you sure you want to merge selected tickets?");'>
upload changed files an have fun,
sorry for bad english,
dear
tino :)
hi arihant help me.plzz
hey where is this code?
this php code as given below is not present in scp/tickets.php....so mention where it is?
}elseif(isset($_POST)){
$i=0;
$note='Ticket merge by '.$thisuser->getName();
foreach($_POST as $k=>$v) {
$t = new Ticket($v);
$i++;
$t->logActivity('Ticket ID '.$v.' merge',$note,false,'System');
}$t->merge($_POST);
where we paste that class.ticket.php code as given below.
function merge($tids) {
if( count($tids) == 2){
$superticket = $tids;
$subticket = $tids;
db_query('DELETE FROM '.TICKET_TABLE.' WHERE ticket_id='.db_input($subticket));
db_query('UPDATE '.TICKET_MESSAGE_TABLE.' SET ticket_id='.db_input($superticket).' WHERE ticket_id='.db_input($subticket));
db_query('UPDATE '.TICKET_RESPONSE_TABLE.' SET ticket_id='.db_input($superticket).' WHERE ticket_id='.db_input($subticket));
db_query('UPDATE '.TICKET_NOTE_TABLE.' SET ticket_id='.db_input($superticket).' WHERE ticket_id='.db_input($subticket));
db_query('UPDATE '.TICKET_ATTACHMENT_TABLE.' SET ticket_id='.db_input($superticket).' WHERE ticket_id='.db_input($subticket));
}}Yes.. It works fine. I think i might have made a mistake somewhere before.I skiped this line of code. I couldnt get what to do
switch($_POST) {
case 'mass_process':
if(!$thisuser->canManageTickets())
$errors='You do not have permission to mass manage tickets. Contact admin for such access';
The code your asking where it is doesn't exist. You are supposed to put it into the /scp/tickets.php. Presuming a stock install I believe that it gets inserted at line 360.
You should at the function to class.ticket.php at the end.
Just another solutions ...
@[deleted] kumar raghubansi,
Hopefully (this mod) will help you to solve the problem.
Sincerely,
Masino Sinaga