Skip to content

Added AutoApprove button for automatic approval of submitted and breaktime-conforming approvals#86

Open
luisgalvezbommer wants to merge 9 commits intoKatjaGlassConsulting:mainfrom
luisgalvezbommer:main
Open

Added AutoApprove button for automatic approval of submitted and breaktime-conforming approvals#86
luisgalvezbommer wants to merge 9 commits intoKatjaGlassConsulting:mainfrom
luisgalvezbommer:main

Conversation

@luisgalvezbommer
Copy link
Copy Markdown

image

I added an autoApprove button, which can approve all approvals shown in the table, if their status is submitted.

If there is a breaktimeissue in one approval, the autoapprove for this particular approval will fail. If there are no breaktimeissues or the breaktimeissue isn't activated, it will suceed.

Additionally i created a little spinner while waiting for approving.

I also wrote some unit tests to the function i introduced.

@luisgalvezbommer
Copy link
Copy Markdown
Author

I updated, that if the last 2 statuses of an approval are denied and not submitted (which follows after denied), that then the card-body stays red (bg-danger):
image

@luisgalvezbommer
Copy link
Copy Markdown
Author

By the way, you can make tests with phpunit:
root@31b5023628c9:/opt/kimai# php vendor/bin/phpunit var/plugins/ApprovalBundle/Tests

@KatjaGlassConsulting
Copy link
Copy Markdown
Owner

Hi Luis, thanks a lot for your PR - I hope to be able to have a closer look at it next Thursday.

@luisgalvezbommer
Copy link
Copy Markdown
Author

I added also an overview for this german law: https://www.gesetze-im-internet.de/arbzg/__3.html.

image

Let me know, if something is not okay or buggy. Thank you

@luisgalvezbommer
Copy link
Copy Markdown
Author

!IMPORTANT! Wait. Maybe you can wait with the pull request. Somehow i get in prod an error when i try to create an activity after i made bin/console kimai:bundle:approval:install

I only did test it on dev container, but here on prod i get errors like this:
image

Do you get the same?

@KatjaGlassConsulting
Copy link
Copy Markdown
Owner

Hi Luis,

I didn't had time to test. Please feel free to do a new PR when you figured out the issue and are happy with the result. :) I think this functionality would be a nice addition.

Thanks

@luisgalvezbommer
Copy link
Copy Markdown
Author

luisgalvezbommer commented Mar 2, 2026

I checked the error, it didn't had to with the plugin.
I reopened the pull request, and i added an additional api endpoint: /api/approval/timesheets, which is exactly like `/api/timesheets, but with an extra attribute "approved" true/false, which is true, if a timesheet-begin is in the timerange of an approved approval.

Thank you. Let me know if something isn't fine.

@luisgalvezbommer
Copy link
Copy Markdown
Author

Hey,

i fixed a little bug: Before, all the timesheets of approval/week_by_user showed errors, if any error for this day existed. But it didn't match, if only partially timesheets have errors on this day (some yes, some no):

image

In the image you can see the bug. I fixed it, now it should appear correctly for each timesheet

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants