SimpleDesk

SimpleDesk! => SimpleDesk Discussion => Topic started by: Achilles on April 09, 2010, 12:52:03 AM

Title: I think I found a bug...
Post by: Achilles on April 09, 2010, 12:52:03 AM
Well, when I delete a reply from my ticket, I see this read thing up saying: "This ticket has had replies deleted from it previously. Please click here to view them." I clicked view then I want to permanent delete it, when I clicked permanent delete; it says an error message like a database error thing. Then the red thing is still there even the reply was permanently deleted.
Title: Re: I think I found a bug...
Post by: ~DS~ on April 09, 2010, 12:54:51 AM
Can you post what's in the error log when that happen?
Title: Re: I think I found a bug...
Post by: Achilles on April 09, 2010, 01:10:27 AM
Quote from: Dismal Shadow on April 09, 2010, 12:54:51 AM
Can you post what's in the error log when that happen?

weird. It does work now. I believe I've seen that error appear for 2-3 times already after deleting a reply (permanently). I'll post again if ever I see it. I try looking that the error logs but i didn't see any.

I'll attach a screenshot... as u can see there's no (was) deleted ticket but the red thing up still shows?


Thanks
Title: Re: I think I found a bug...
Post by: tfs on April 09, 2010, 01:30:30 AM
I just reproduced this running today's SVN build. r540

I added a reply to a ticket.  Deleted the reply.  Told it I want to see the deleted replies in red.  Tried to permanently delete the reply and got the following.

An Error Has Occurred!
The database value you're trying to insert does not exist: first_msg

Error logs contained the following:

  Reverse chronological order of list Today at 12:22:29 AM
http://sd1.x.com/index.php?action=helpdesk;sa=permadelete;reply=37;ticket=8;b47deee5a=d0f479a9c2cde6804045e6264a5a1f39
The database value you're trying to insert does not exist: first_msg
Function: shd_recalc_ids
File: /x/Sources/SimpleDesk-Delete.php
Line: 589

  Reverse chronological order of list Today at 12:22:29 AM
http://sd1.x.com/index.php?action=helpdesk;sa=permadelete;reply=37;ticket=8;b47deee5a=d0f479a9c2cde6804045e6264a5a1f39
8: Undefined variable: first_msg
File: /x/Sources/SimpleDesk-Delete.php
Line: 585

  Reverse chronological order of list Today at 12:22:29 AM
http://sd1.x.com/index.php?action=helpdesk;sa=permadelete;reply=37;ticket=8;b47deee5a=d0f479a9c2cde6804045e6264a5a1f39
8: Undefined variable: first_msg
File: /x/Sources/SimpleDesk-Delete.php
Line: 575


I'll go put this in the Bug Tracker.  Thanks!
Title: Re: I think I found a bug...
Post by: Achilles on April 09, 2010, 01:32:52 AM
np. I believe i've encountered also some small glitches/bugs, i'll try to send it here when I see it again. :)

EDIT: Nice, 1.1 is already 17%, great!
Title: Re: I think I found a bug...
Post by: ~DS~ on April 09, 2010, 01:33:08 AM
Thanks for the report Achilles
@ tfs, Thanks
Title: Re: I think I found a bug...
Post by: Gruffen on April 09, 2010, 04:49:28 AM
Confirmed, this is a bug, caused by the routine designed to clean up ids after a delete operation has occurred; it doesn't know how to deal with the case of physical deletion leaving nothing but the opening post only - an oversight on my part.

I've pushed this fix into SVN, not sure whether we're going to roll out with a 1.0.1 as a bug fix release or not, or whether just to fold everything into 1.1 at this point.

In SimpleDesk-Delete.php, find:
function shd_recalc_ids($ticket)
{
global $smcFunc;


Leave a line for nicety, then add:
$query = shd_db_query('', '
SELECT hdt.id_first_msg
FROM {db_prefix}helpdesk_tickets AS hdt
WHERE hdt.id_ticket = {int:ticket}',
array(
'ticket' => $ticket,
)
);
list($first_msg) = $smcFunc['db_fetch_row']($query);
$smcFunc['db_free_result']($query);


This will run before any other query in that function, and ensure first_msg is known.
Title: Re: I think I found a bug...
Post by: Achilles on April 09, 2010, 05:58:54 AM
well, not really good with adding codes, ill jsut wait for the fix for it on 1.0.1 or to 1.1 :) thanks anyway.
Title: Re: I think I found a bug...
Post by: Gruffen on April 09, 2010, 06:00:33 AM
Here's the patched file for you.