Skip to content
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

Add command to stop time exceeding timesheets #4768

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

binsky08
Copy link

Description

Currently there's no option to automatically stop timesheets, you forgot to stop manually.
If you have something like a company rule for a maximum work time per timesheets (or you're just forgetful :D), the implemented command helps enforcing that.


This pull request adds a command that stops timesheets with a duration longer than the specified amount of hours (as command argument), if they do not yet have an end value set.


Example usage would be a cron job that runs the command once a hour like:
bin/console kimai:timesheet:stop-time-exceeding 12 to disallow timesheets longer than 12 hours.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • I verified that my code applies to the guidelines (composer code-check)
  • I updated the documentation (see here)
  • I agree that this code is used in Kimai (see license)

@CLAassistant
Copy link

CLAassistant commented May 5, 2024

CLA assistant check
All committers have signed the CLA.

Copy link
Member

@kevinpapst kevinpapst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for taking the time to share your solution 👍

I have several issues with this.
A command can only be used from a cron-jobs, an API method would be better to make it more versatile.

Then there are already both an API method that allows to find active timesheets and one to stop a timesheet.
There is a system configuration for the max allowed duration of a timesheet.

Can you please move the logic to a service method, and use the existing system configuration as default option (instead of a required duration input) we can talk .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants