KatjaGlassConsulting / ApprovalBundle

A Kimai Plugin to manage weekly approval workflow
MIT License
11 stars 14 forks source link

Uncaught PHP Exception #36

Closed sj-patel closed 4 months ago

sj-patel commented 4 months ago

Hello,

New to Kimai and the Approval plugin. It is entirely likely that I have misconfigured something. However, I ran through the setup process multiple times and got a successful message during installation.

Here is what I am running into after the plugin has been successfully installed. I am getting the following exception and Error 500 on the application. Could you please let me know if this is a setup error on my part or something else:

Setup:

Host OS: MacOS Sonoma Docker setup using Kimai documentation Kimai version: 2.11.0 Plugins:

Error:

2024-02-19 21:15:41 localhost:8001 127.0.0.1 - - [20/Feb/2024:03:15:41 +0000] "GET / HTTP/1.1" 302 581 "-" "curl/7.88.1"
2024-02-19 21:16:01 localhost:8001 127.0.0.1 - - [20/Feb/2024:03:16:01 +0000] "GET / HTTP/1.1" 302 581 "-" "curl/7.88.1"
2024-02-19 21:16:16 [2024-02-20T03:16:16.161439+00:00] request.INFO: Matched route "approval_bundle_report". {"route":"approval_bundle_report","route_parameters":{"_route":"approval_bundle_report","_controller":"KimaiPlugin\\ApprovalBundle\\Controller\\WeekReportController::weekByUser","_locale":"en"},"request_uri":"http://localhost:8001/en/approval/week_by_user","method":"GET"} {"channel":"request"}
2024-02-19 21:16:16 [2024-02-20T03:16:16.187868+00:00] request.CRITICAL: Uncaught PHP Exception Doctrine\DBAL\Exception\DriverException: "An exception occurred while executing a query: SQLSTATE[HY000]: General error: 1525 Incorrect DATE value: 'now'" at ExceptionConverter.php line 117 {"exception":"[object] (Doctrine\\DBAL\\Exception\\DriverException(code: 1525): An exception occurred while executing a query: SQLSTATE[HY000]: General error: 1525 Incorrect DATE value: 'now' at /opt/kimai/vendor/doctrine/dbal/src/Driver/API/MySQL/ExceptionConverter.php:117)\n[previous exception] [object] (Doctrine\\DBAL\\Driver\\PDO\\Exception(code: 1525): SQLSTATE[HY000]: General error: 1525 Incorrect DATE value: 'now' at /opt/kimai/vendor/doctrine/dbal/src/Driver/PDO/Exception.php:28)\n[previous exception] [object] (PDOException(code: HY000): SQLSTATE[HY000]: General error: 1525 Incorrect DATE value: 'now' at /opt/kimai/vendor/doctrine/dbal/src/Driver/PDO/Statement.php:130)"} {"channel":"request"}
2024-02-19 21:16:16 localhost:8001 xxx.xxx.xx.x - - [20/Feb/2024:03:16:16 +0000] "GET /en/approval/week_by_user HTTP/1.1" 500 1939 "http://localhost:8001/en/admin/plugins/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36"
2024-02-19 21:16:21 localhost:8001 127.0.0.1 - - [20/Feb/2024:03:16:21 +0000] "GET / HTTP/1.1" 302 581 "-" "curl/7.88.1"
KatjaGlassConsulting commented 4 months ago

Hi, I guess you are not using MySQL or PostgreSQL as database? Might it be that you are using SQLite?

I updated the source in the main branch, so please try the update. I am not 100% sure whether this issue was caused by the snippet I updated, so please provide feedback.

sj-patel commented 4 months ago

Hi!

I confirm that I am no longer experiencing the uncaught exception. The plugin is loading fine, and all tabs are rendering correctly. Thank you for your quick attention to this issue; we are eager to try Kimai for our needs.

BTW, I am using mySQL; I forgot to mention that critical information in the original post.

Jay

ahmedazeemh commented 4 months ago

I have updated line 117 in WeekReportController.php from this line
$startWeek = $request->query->get('date', 'now'); to $startWeek = $request->query->get('date', date('Y-m-d H:i:s'));

and everything working fine now