-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
request : use the plugin when creating a task #4
Comments
Hi, If a task is not saved, and you start a timer nothing is saved in the DB. So if you close the browser window, everything is lost. Regards |
i understand, but as e don't use glpi to sched tasks, it's not so usefull for us :( i was thinking the plugin was acting as a chronometer as lawyers use :( |
It does. You need to :
Repeat as many times as you need. I hope it fits you, If you need any other behavior we could talk about it. |
We just need to be able to have it before creating the task :) |
We could discuss a solution. |
what ?! |
Maybe the start button could be shown on task create form and perform an 'Add' action followed immediately with the 'Start' action. I'll look into the code if that is possible. |
Ok. I've got a working test for this specific feature: when a new task is created, it is automatically opened. So all you have to do is click on "Task (create)", click on "Add" and automatically the task list is loaded and the newly created task is opened. Just click "Start" and the timer is on (no need to click on "Edit Task" before). This will not disrupt anything on ticket or ActualTime procedures. The only detail is: I use glpi_plugin_actualtime_task database table and create a record with the tasks_id and "zero" as the users_id. Using the database was the easiest way I found for from Item Add Hook tell Post Show Item Hook to open the task edit box. I know this field was not supposed to do that, but we would have to come up with some different solution. |
Another thought: If OscarBeiro is Ok, I can work on modifications that includes (a), (b) and also:
I would like boscorelly's input, if possible. |
Hi Multiconecta, The thing here is you're talking about a few changes, so we would like to split each new feature into a different Issue and its PR. Is that OK? Obrigado |
i think if i can test, i'll be able to tell if it's good for us :) |
Perfect. That seems the way to go. |
@boscorelly , you can try to see if that's what you were thinking at this branch. I was thinking the possibility of a checkbox when including the task (not sure if there is a hook for that) where I could start the timer when the task is created (when it is created, the form will open with the timer on). But I am not sure if this is really useful, as if you create the task, the form will open and you can immediately, manually, click the 'Begin' button. EDIT: corrected some coding standard and also you can set to have the task window automatically opened if there is a timer running for that task (and logged in user). |
Hi, with your update, i don't have the timer starting without creating the task. |
I created a task, started a timer, tried to pause it : "Seul l'utilisateur qui a démarré la tâche peut l'arrêter" (only the user who started the task can stop it) |
Ok. So you did the update, correct? (plugin version should report 1.1.3, so the database is updated). If you did that, now you have the pause button (issue #17 ). To have auto open window (when a new task is created or when the timer is on), you must change the settings to do so (if you don't change the settings, the behaviour does not change). Go to 'Configuration' - Générale - Actual time and turn on the needed settings. |
Well, it will not start without create the task (I think I mentioned that above). Before you click 'Add' (Ajouter) in task creation windows, the task does not exist in the database, and does not have an ID. So it is impossible to start a timer for that task. What we created was a way to, just after you click 'Add', the task window reopens automatically and, then, you can click on Begin/Início/Début and start the timer. That was the best thing I could imagine to fulfill our needs (my company also needed to start the timer right in the moment the task is created. The best option was click the 'Tâche' button to create a task, then, immediately, 'Ajouter'. The task is created in the database and the edit window is automatically opened. There you can start the timer and fill any field needed. |
Well, Camille, that's really odd. It is the same issue #5 you created before. I'll try to look into it. I think Oscar found that the task timer was created with an user ID that does not exist. It really does not make too much sense, as the ID is picked from the user currently logged in, using Glpi's core session function, to create the timer. To stop it, the same session function is used to verify if the stopper is the same as the starter. When you create the task, the same user logged in is the user in 'Utilisateur' field, the same user that starts the timer and the same user that tries to stop it? |
yes it is :(
|
Well, that's odd. But there's something else odd: the timer id 2 is closed for tickettask id 23815. It was started the day before yesterday, at 12:12 and was successfully stopped the same day, at 17:16. The task user is really id 127, and the calculated active time was 18,265 s, or 5h 4min 25s. So, even with the error message was you able to stop the timer? The same does not apply to the timer id 1, that seems to be still running since January. Maybe there is no more the tickettask. And there goes another oddity: user id 127 should no be able to start a new timer on March 4th, as there's already a timer running for that user started on January 24th. I'm trying to replicate that here, with no success. I'll look into Glpi ticket tasks' core code better to try to understand how user id 153 starts a timer as inexistant user id 127. If there's no sensible information, could you please send the output of the task and ticket info? SELECT glpi_tickets., glpi_tickettasks. FROM glpi_tickettasks LEFT JOIN glpi_tickets ON glpi_tickettasks.tickets_id = glpi_tickets.id WHERE glpi_tickettasks.id = 23815 OR glpi_tickettasks.id = 23543; |
Hi, it may have been closed because i closed the ticket ? |
Well, it seems you have found the problem of #5 . Can you test the automatically opening of task edit windows when you create a new task, @boscorelly ? Would it solve your issue that way? |
Yes. The pre-update hook do stop the timer when you close a ticket. |
Camille, I made some adjusts on the code, including all current commits already in 'development'. Please, now that you fixed the user id problem, could you try the "Auto open new tasks" feature to see if this way solve your need. Clone my branch dev_autoopennewtask or download/extract the alpha release in directory Install: the version is changed to 1.1.4, to force a database update (four new settings are available in this test version):
Once again, you cannot start a timer before the task is saved (the first time), because it must exist (the timer is linked to the task id). So that's the steps your user must do:
|
New features in this test version:
|
Hi, i'll try this. For point 7, can you do this with a user or group ? We want that only technicians can see it but not customer or phone answers. |
Could you please push 7 and 8 to development? |
On the other had, I used a new user as phone answer, with Hotliner profile modified so the user can create a task, but cannot update it. This way, you really found a bug both in plugin and also in Glpi:
This is related to item 5, and it is being discussed in issue #35 . I think the best way to address it would be using profile rights. To circumvent the Glpi bug, it would be good to check if user has right to update task (we could do when verifying if the user is the task user, so nothing more is changed). |
Done. Bug above corrected also (buttons will only appear if user actually has rights to update the task). @boscorelly , in the future we may try to develop an arrangement where we could specifically set rights for task creator, task technician, task group, and ticket watchers, ticket requesters and ticket assignees. One could set those rights in different profiles and assign those profiles to different users and entities. That way one could have granular definition of who can use the timer and also who can see the timers. But that's a new issue. Today we will be able to set who can operate granting or revoking profile's right to update tasks. So, if you have update task, you can be assigned to a task. Also you can start and stop the timer in the tasks you are assigned to. |
Done in PR #36 |
Well that mess in on me. We should be working in one at each time, as they changed the same functions. We've got some collisions in code merging. Doing a PR right now to solve all these (error on creating database table, method exiting too soon because of double break command, error formatting settings page.
About those, they address different user suggestions:
Both options default to DISABLED, and are just a plus for custom behavior some user may prefer. |
PR #39 will do it. Tested (I think) all possible configurations and situations. |
Thanks again. |
Is it possible to enable the usage of the plugin when creating a task ?
it will be helpful for us.
The text was updated successfully, but these errors were encountered: