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

Forgetting duration on timesheet entry gives error 500 and save remains greyed out #1147

Closed
nightwatch75 opened this issue Sep 26, 2019 · 7 comments · Fixed by #1150
Closed
Labels
Milestone

Comments

@nightwatch75
Copy link

After entering an entry in the timesheet without indicating the duration an error 500 is generated, at the closing of the error popup the save button remains disabled and it is not possible to correct the error

To Reproduce
Steps to reproduce the behavior:

  1. Go to My time
  2. Click on plus "create" button
  3. select customer, projectm activity
  4. try to save without entering duration
  5. Close the "error 500" popup
  6. the save button remains disabled
  • Kimai version: 1.3 Stable
  • PHP version: 7.3.9
@kevinpapst
Copy link
Member

Not adding an end date will start the entry, that's expected and happening at https://demo.kimai.org

What do you mean by saying "without entering duration".
Are you using a different timesheet mode than default?

Is anything in your log file var/log/prod.log?

@nightwatch75
Copy link
Author

nightwatch75 commented Sep 26, 2019

02_save_disabled

Not adding an end date will start the entry, that's expected and happening at https://demo.kimai.org

What do you mean by saying "without entering duration".
Are you using a different timesheet mode than default?

Yes sorry I didn't specified, we are using"[Duration] replaces the end time with a duration input field"
mode

Is anything in your log file var/log/prod.log?

2019/09/26 14:13:05 [error] 29155#0: *8428 FastCGI sent in stderr: "PHP message: PHP Fatal error: Uncaught Symfony\Component\Debug\Exception\FatalThrowableError: Return value of App\Entity\Timesheet::getDuration() must be of the type int, null returned in /usr/share/nginx/html/kimai2/src/Entity/Timesheet.php:266 Stack trace: #0 /usr/share/nginx/html/kimai2/src/Twig/Extensions.php(136): App\Entity\Timesheet->getDuration() #1 /usr/share/nginx/html/kimai2/src/Twig/Extensions.php(107): App\Twig\Extensions->getSecondsForDuration(Object(App\Entity\Timesheet)) #2 /usr/share/nginx/html/kimai2/var/cache/prod/twig/b9/b92a4e77cff6c491d6af6fbd0111a5bb1cfe3f246a31480e7e545506c4a462da.php(116): App\Twig\Extensions->duration(Object(App\Entity\Timesheet)) #3 /usr/share/nginx/html/kimai2/vendor/twig/twig/src/Template.php(407): __TwigTemplate_689b6438d81f2c05e432b9b6f9ae736b8692b9f85cd41774b9777c7e3b35b1da->doDisplay(Array, Array) #4 /usr/share/nginx/html/kimai2/vendor/twig/twig/src/Template.php(380): Twig\Template->displayWithErrorHandling(Array, Array) #5 /usr/share/nginx/html/k" while reading response header from upstream, client: x.x.x.x., server: kimai.HOST.it, request: "POST /en/timesheet/168/edit HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.3-fpm.sock:", host: "kimai.HOST.it", referrer: "http://kimai.HOST.it/en/timesheet/"

@kevinpapst
Copy link
Member

Alright, I need to test that.
As a quick fix, you could try and change this line:
https://github.com/kevinpapst/kimai2/blob/master/src/Entity/Timesheet.php#L264
from

public function getDuration(): int

to

public function getDuration(): ?int

So basically only adding the ?.

Not sure if that will be the final fix, but I believe that could fix it.

@kevinpapst kevinpapst added the bug label Sep 26, 2019
@nightwatch75
Copy link
Author

Changing that line brakes the app... blank page everywhere

log:

`2019/09/26 15:52:44 [error] 10039#0: *1 FastCGI sent in stderr: "PHP message: PHP Fatal error: Declaration of App\Entity\Timesheet::getDuration(): ?int must be compatible with App\Invoice\InvoiceItemInterface::getDuration(): int in /usr/share/nginx/html/kimai2/src/Entity/Timesheet.php on line 42PHP message: PHP Fatal error: Uncaught Symfony\Component\Debug\Exception\FatalErrorException: Compile Error: Declaration of App\Entity\Timesheet::getDuration(): ?int must be compatible with App\Invoice\InvoiceItemInterface::getDuration(): int in /usr/share/nginx/html/kimai2/src/Entity/Timesheet.php:42
Stack trace:
#0 {main}

Next Twig\Error\SyntaxError: Unknown "encore_entry_link_tags" function. in /usr/share/nginx/html/kimai2/templates/base.html.twig:185
Stack trace:
#0 /usr/share/nginx/html/kimai2/vendor/twig/twig/src/ExpressionParser.php(451): Twig\ExpressionParser->getFunctionNodeClass('encore_entry_li...', 185)
#1 /usr/share/nginx/html/kimai2/vendor/twig/twig/src/ExpressionParser.php(235): Twig\ExpressionParser->getFunctionNode('encore_entry_li...', 185)
#2 /usr/share/nginx/html/kimai2/vendor/twig/twig/src/ExpressionParser.php(175): Twig\ExpressionParser->parsePrimaryExpression()
#3 /usr/share/nginx/html/kimai2/vendor/twig/twig/src/ExpressionParser.php(70): Twig\ExpressionParser->getPrimary(" while reading response header from upstream, client`

@kevinpapst
Copy link
Member

Ah, okay, forgot about that. Change that line accordingly:
https://github.com/kevinpapst/kimai2/blob/master/src/Invoice/InvoiceItemInterface.php#L35

@nightwatch75
Copy link
Author

Seems working! No more error and entry added with duration counting mode from 00:00h

thanks!

@lock
Copy link

lock bot commented Dec 2, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. If you use Kimai on a daily basis, please consider donating to support further development of Kimai.

@lock lock bot locked and limited conversation to collaborators Dec 2, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants