Hi,
I have made some procs for Ticket Tracker Lite regarding deleting the Areas. As of now Ticket Tracker Lite does not delete areas that has tickets associated with it.
Here is what I did:
create function ttl__delete_file(integer)
returns integer as '
declare
p_item_id alias for $1;
begin
-- delete the content item
PERFORM content_item__delete(p_item_id);
return 0;
end;
' language 'plpgsql';
-- delete/nuke an area
create function ttl__delete_area(integer)
returns integer as '
declare
p_area_id alias for $1;
begin
-- lets delete all the tickets for this area
PERFORM ttl__delete_ticket(ticket_id) from ttl_tickets where area_id = p_area_id;
-- delete the area assignment for this area
delete from ttl_area_assignments where area_id = p_area_id;
-- delete the preference for this area
delete from ttl_prefs where area_id = p_area_id;
-- delete the area
PERFORM acs_object__delete(p_area_id);
return 0;
end;
' language 'plpgsql';
create function ttl__delete_ticket(integer)
returns integer as '
declare
p_ticket_id alias for $1;
begin
-- delete the assignment to this ticket
delete from ttl_assignments where ticket_id = p_ticket_id;
-- delete the comments to this ticket
delete from ttl_comments where ticket_id = p_ticket_id;
-- delete the attached files
PERFORM ttl__delete_file(item_id) from cr_items where parent_id = p_ticket_id;
-- delete the ticket and object
PERFORM acs_object__delete(p_ticket_id);
return 0;
end;
' language 'plpgsql';
If you guys think that this is useful the next steps are:
- Port to Oracle
- Create simple UI
There are real problems in ttl, in particular my attach file functionality inserts does not use API (sorry about that, way back then I have less knowledge about CR), create new content type for the attached files, or make use of attachment package and file-storage and remove the attach file functionality. Ttl make use of context_id as its package_id, I think this is not advisable.
I am willing to do the 2 items above. But the fundamental problems of ttl maybe not, I am too busy already. Anyway if people does not object, I will make a tar ball and send it to Vinod.
Ham,
The plsql can be used with Infiniteinfo extranet. If you think its useful maybe you can donate the UI part of it. It should be 5-10 lines of tcl calling the plsql proc.