fungus75 / ReadOnlyAccessBundle

Read Only Access Plugin for Kimai
MIT License
4 stars 6 forks source link

bug error #4

Open clayme2019 opened 4 years ago

clayme2019 commented 4 years ago

Screenshot_4 I installed it correctly, but when I click the button

Screenshot_5

Screenshot_6

what could i have done wrong?

clayme2019 commented 4 years ago

Current PHP version 7.2

clayme2019 commented 4 years ago

Screenshot_7

clayme2019 commented 4 years ago

please

clayme2019 commented 4 years ago

help me please

BKapelari commented 4 years ago

Have the same problem

rafaelgou commented 4 years ago

Having the same problem.

Cause: there's a reference to a non-existent template:

[2020-02-02 00:30:18] request.CRITICAL: Uncaught PHP Exception Twig\Error\LoaderError: "Unable to find template "macros/actions.html.twig" (looked into: /opt/kimai/templates, /opt/kimai/vendor/symfony/twig-bridge/Resources/views/Form) in "@ReadOnlyAccess/index.html.twig" at line 5." at /opt/kimai/vendor/twig/twig/src/Loader/FilesystemLoader.php line 250 {"exception":"[object] (Twig\\Error\\LoaderError(code: 0): Unable to find template \"macros/actions.html.twig\" (looked into: /opt/kimai/templates, /opt/kimai/vendor/symfony/twig-bridge/Resources/views/Form) in \"@ReadOnlyAccess/index.html.twig\" at line 5. at /opt/kimai/vendor/twig/twig/src/Loader/FilesystemLoader.php:250)"} []
[2020-02-02 00:30:18] security.DEBUG: Stored the security token in the session. {"key":"_security_secured_area"} []

So a solution:

cd kimai/
bin/console cache:clear
bin/console cache:warmup

Then you get the page back.

I created a pull request: https://github.com/fungus75/ReadOnlyAccessBundle/pull/5

If somebody is in hurry can clone from my fork with this fix: https://github.com/rafaelgou/ReadOnlyAccessBundle

ftrojahn commented 4 years ago

There's another one: if the readonly-user clicks on the "Show Recorded Times" page:

Spoiler: critical exception ``` request.CRITICAL: Uncaught PHP Exception Twig\Error\LoaderError: "Unable to find template "macros/actions.html.twig" (looked into: /home/time/kimai2/templates, /home/time/kimai2/vendor/symfon y/twig-bridge/Resources/views/Form) in "@ReadOnlyAccess/showCustomerTimes.html.twig" at line 5." at /home/time/kimai2/vendor/twig/twig/src/Loader/FilesystemLoader.php line 250 {"exception":"[object] (Twig\\Error\\ LoaderError(code: 0): Unable to find template \"macros/actions.html.twig\" (looked into: /home/time/kimai2/templates, /home/time/kimai2/vendor/symfony/twig-bridge/Resources/views/Form) in \"@ReadOnlyAccess/showCus tomerTimes.html.twig\" at line 5. at /home/time/kimai2/vendor/twig/twig/src/Loader/FilesystemLoader.php:250)"} [] ```

So, you have to delete the same line in the file Resources/views/showCustomerTimes.html.twig

Spoiler: patch ``` diff --git a/Resources/views/showCustomerTimes.html.twig b/Resources/views/showCustomerTimes.html.twig index 0a00c5e..9921c9a 100644 --- a/Resources/views/showCustomerTimes.html.twig +++ b/Resources/views/showCustomerTimes.html.twig @@ -2,7 +2,6 @@ {% import "macros/widgets.html.twig" as widgets %} {% import "macros/datatables.html.twig" as tables %} {% import "macros/toolbar.html.twig" as toolbar %} -{% import "macros/actions.html.twig" as actions %} {% set columns = { 'date': 'alwaysVisible', ```