Integrating Accounted Time and the Time Accounting plug-in

Moderator: crythias

Post Reply
seberget2
Znuny newbie
Posts: 74
Joined: 17 May 2013, 09:30
Znuny Version: 6.0.30
Real Name: Stein Erik Berget

Integrating Accounted Time and the Time Accounting plug-in

Post by seberget2 »

Hi!
I've had 'Accounted Time' activated for some time, and have been happy about it. That way my Support Engineers can add time spent on tickets quite easily. Another department here have been using the Time Accounting plug-in for registering their time. And both parties have been quite happy.

I've been quite unhappy with the fact that these two modules have not been integrated. So I have now solved this issue by adding a trigger to the MySQL database we use.

Below is the trigger we use:

Code: Select all

delimiter $$
CREATE TRIGGER accounted_time_to_accounting_table AFTER INSERT ON time_accounting FOR EACH ROW
BEGIN
  INSERT INTO time_accounting_table (user_id, project_id, action_id, remark, time_start,time_end, period, created, article_id)
  SELECT 
    time_accounting.create_by AS user_id,
    24 AS project_id,
    CASE
      WHEN ticket.queue_id = 5 THEN 9
      WHEN ticket.queue_id = 9 THEN 10
      WHEN ticket.queue_id = 8 THEN 3
      ELSE 7
    END as action_id,
    ticket.title AS remark,
    DATE(time_accounting.create_time) AS time_start,
    DATE(time_accounting.create_time) AS time_end,
    time_accounting.time_unit / 60 AS period,
    time_accounting.create_time AS created,
    article_id
  FROM 
    ticket,
    time_accounting,
    article
  WHERE 
      time_accounting.article_id = article.id
    AND
      article.ticket_id = ticket.id
    AND
      time_accounting.article_id = NEW.article_id
END $$

delimiter;
  • 24 is the id of the project
  • 5, 9 and 8 are the id of the queues I want to use to add actions
  • 9, 10, 3 and 7 are the id of the actions i want to use
I've also added a new column to the time_accounting_table to hold the article_id. This to cater for more reporting in the future.

Hope that me fixing my 'itch' helps you out!

Have a happy day!
OTRS 6.0.12 on Ubuntu with MySQL DB, and various plug-ins and a hack or two :-D
Wolfgangf
Znuny ninja
Posts: 1029
Joined: 13 Apr 2009, 12:26
Znuny Version: 6.0.13
Real Name: Wolfgang Fürtbauer
Company: PBS Logitek GmbH
Location: Pinsdorf

Re: Integrating Accounted Time and the Time Accounting plug-

Post by Wolfgangf »

I'm using the same features and having the same troubles / wishes

In my ideal world, I'd like to add some input fields / combo boxes to AgentTicketNote, ...
- Projekt
- Task
- Remarks (? or use the notes subject or text as the remark)

and save the data then to "time_accounting_table";

If there is a developer available to code this: I would spend some bucks. I anyone's interested in coding this: let me know

Wolfgang
Produktiv:
OTRS 6.0.13/ ITSM 6.0.13
OS: SUSE Linux (SLES 12, Leap), MySql 5.5.x, 5.6.x
Windows 2012 AD Integration (agents and customers), Nagios integration (incidents, CMDB), Survey, TimeAccounting
Post Reply