csoc-de / Shifts

MIT License
30 stars 7 forks source link

When I click on the Shift Plans button, I get the "Could not fetch data" error. #59

Open fakman0 opened 11 months ago

fakman0 commented 11 months ago

phpVersion: 8.1.25 OS: Linux 4.15.0-213-generic x86_64 Ubuntu 18.04 LTS Browser: Firefox and chrome tested Nextcloud Version: Nextcloud Hub 6 (27.1.3) I deleted the app and reinstalled it, but nothing changed.

resim

strugee commented 11 months ago

I can reproduce on Shiftplan 1.9.3, freshly installed from the app store. Nextcloud 26.0.4.

Server logs (including a stack trace):

{"reqId":"DpHKeJ4hZAns5fEd7ebQ","level":3,"time":"2023-12-18T01:07:31+00:00","remoteAddr":"50.74.115.74","user":"aj","app":"index","method":"GET","url":"/index.php/apps/shifts/getAllAnalysts","message":"Call to a member function getUsers() on null in file '/var/www/cloud.seagl.org/nextcloud-26.0.4/apps/shifts/lib/Controller/ShiftController.php' line 189","userAgent":"Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/119.0","version":"26.0.4.2","exception":{"Exception":"Exception","Message":"Call to a member function getUsers() on null in file '/var/www/cloud.seagl.org/nextcloud-26.0.4/apps/shifts/lib/Controller/ShiftController.php' line 189","Code":0,"Trace":[{"file":"/var/www/cloud.seagl.org/nextcloud-26.0.4/lib/private/AppFramework/App.php","line":183,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[["OCA\\Shifts\\Controller\\ShiftController"],"getAllAnalysts"]},{"file":"/var/www/cloud.seagl.org/nextcloud-26.0.4/lib/private/Route/Router.php","line":315,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OCA\\Shifts\\Controller\\ShiftController","getAllAnalysts",["OC\\AppFramework\\DependencyInjection\\DIContainer"],["shifts.shift.getAllAnalysts"]]},{"file":"/var/www/cloud.seagl.org/nextcloud-26.0.4/lib/base.php","line":1065,"function":"match","class":"OC\\Route\\Router","type":"->","args":["/apps/shifts/getAllAnalysts"]},{"file":"/var/www/cloud.seagl.org/nextcloud-26.0.4/index.php","line":36,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"/var/www/cloud.seagl.org/nextcloud-26.0.4/lib/private/AppFramework/Http/Dispatcher.php","Line":169,"Previous":{"Exception":"Error","Message":"Call to a member function getUsers() on null","Code":0,"Trace":[{"file":"/var/www/cloud.seagl.org/nextcloud-26.0.4/lib/private/AppFramework/Http/Dispatcher.php","line":230,"function":"getAllAnalysts","class":"OCA\\Shifts\\Controller\\ShiftController","type":"->","args":[]},{"file":"/var/www/cloud.seagl.org/nextcloud-26.0.4/lib/private/AppFramework/Http/Dispatcher.php","line":137,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[["OCA\\Shifts\\Controller\\ShiftController"],"getAllAnalysts"]},{"file":"/var/www/cloud.seagl.org/nextcloud-26.0.4/lib/private/AppFramework/App.php","line":183,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[["OCA\\Shifts\\Controller\\ShiftController"],"getAllAnalysts"]},{"file":"/var/www/cloud.seagl.org/nextcloud-26.0.4/lib/private/Route/Router.php","line":315,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OCA\\Shifts\\Controller\\ShiftController","getAllAnalysts",["OC\\AppFramework\\DependencyInjection\\DIContainer"],["shifts.shift.getAllAnalysts"]]},{"file":"/var/www/cloud.seagl.org/nextcloud-26.0.4/lib/base.php","line":1065,"function":"match","class":"OC\\Route\\Router","type":"->","args":["/apps/shifts/getAllAnalysts"]},{"file":"/var/www/cloud.seagl.org/nextcloud-26.0.4/index.php","line":36,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"/var/www/cloud.seagl.org/nextcloud-26.0.4/apps/shifts/lib/Controller/ShiftController.php","Line":189},"CustomMessage":"--"}}
{"reqId":"5LUPie9PLbmfY6lLjjmU","level":3,"time":"2023-12-18T01:08:05+00:00","remoteAddr":"50.74.115.74","user":"aj","app":"index","method":"GET","url":"/index.php/apps/shifts/getAllAnalysts","message":"Call to a member function getUsers() on null in file '/var/www/cloud.seagl.org/nextcloud-26.0.4/apps/shifts/lib/Controller/ShiftController.php' line 189","userAgent":"Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/119.0","version":"26.0.4.2","exception":{"Exception":"Exception","Message":"Call to a member function getUsers() on null in file '/var/www/cloud.seagl.org/nextcloud-26.0.4/apps/shifts/lib/Controller/ShiftController.php' line 189","Code":0,"Trace":[{"file":"/var/www/cloud.seagl.org/nextcloud-26.0.4/lib/private/AppFramework/App.php","line":183,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[["OCA\\Shifts\\Controller\\ShiftController"],"getAllAnalysts"]},{"file":"/var/www/cloud.seagl.org/nextcloud-26.0.4/lib/private/Route/Router.php","line":315,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OCA\\Shifts\\Controller\\ShiftController","getAllAnalysts",["OC\\AppFramework\\DependencyInjection\\DIContainer"],["shifts.shift.getAllAnalysts"]]},{"file":"/var/www/cloud.seagl.org/nextcloud-26.0.4/lib/base.php","line":1065,"function":"match","class":"OC\\Route\\Router","type":"->","args":["/apps/shifts/getAllAnalysts"]},{"file":"/var/www/cloud.seagl.org/nextcloud-26.0.4/index.php","line":36,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"/var/www/cloud.seagl.org/nextcloud-26.0.4/lib/private/AppFramework/Http/Dispatcher.php","Line":169,"Previous":{"Exception":"Error","Message":"Call to a member function getUsers() on null","Code":0,"Trace":[{"file":"/var/www/cloud.seagl.org/nextcloud-26.0.4/lib/private/AppFramework/Http/Dispatcher.php","line":230,"function":"getAllAnalysts","class":"OCA\\Shifts\\Controller\\ShiftController","type":"->","args":[]},{"file":"/var/www/cloud.seagl.org/nextcloud-26.0.4/lib/private/AppFramework/Http/Dispatcher.php","line":137,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[["OCA\\Shifts\\Controller\\ShiftController"],"getAllAnalysts"]},{"file":"/var/www/cloud.seagl.org/nextcloud-26.0.4/lib/private/AppFramework/App.php","line":183,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[["OCA\\Shifts\\Controller\\ShiftController"],"getAllAnalysts"]},{"file":"/var/www/cloud.seagl.org/nextcloud-26.0.4/lib/private/Route/Router.php","line":315,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OCA\\Shifts\\Controller\\ShiftController","getAllAnalysts",["OC\\AppFramework\\DependencyInjection\\DIContainer"],["shifts.shift.getAllAnalysts"]]},{"file":"/var/www/cloud.seagl.org/nextcloud-26.0.4/lib/base.php","line":1065,"function":"match","class":"OC\\Route\\Router","type":"->","args":["/apps/shifts/getAllAnalysts"]},{"file":"/var/www/cloud.seagl.org/nextcloud-26.0.4/index.php","line":36,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"/var/www/cloud.seagl.org/nextcloud-26.0.4/apps/shifts/lib/Controller/ShiftController.php","Line":189},"CustomMessage":"--"}}
{"reqId":"Mfhg2cGChQ3wpPWJaxJP","level":3,"time":"2023-12-18T01:11:35+00:00","remoteAddr":"50.74.115.74","user":"aj","app":"index","method":"GET","url":"/index.php/apps/shifts/getAllAnalysts","message":"Call to a member function getUsers() on null in file '/var/www/cloud.seagl.org/nextcloud-26.0.4/apps/shifts/lib/Controller/ShiftController.php' line 189","userAgent":"Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/119.0","version":"26.0.4.2","exception":{"Exception":"Exception","Message":"Call to a member function getUsers() on null in file '/var/www/cloud.seagl.org/nextcloud-26.0.4/apps/shifts/lib/Controller/ShiftController.php' line 189","Code":0,"Trace":[{"file":"/var/www/cloud.seagl.org/nextcloud-26.0.4/lib/private/AppFramework/App.php","line":183,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[["OCA\\Shifts\\Controller\\ShiftController"],"getAllAnalysts"]},{"file":"/var/www/cloud.seagl.org/nextcloud-26.0.4/lib/private/Route/Router.php","line":315,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OCA\\Shifts\\Controller\\ShiftController","getAllAnalysts",["OC\\AppFramework\\DependencyInjection\\DIContainer"],["shifts.shift.getAllAnalysts"]]},{"file":"/var/www/cloud.seagl.org/nextcloud-26.0.4/lib/base.php","line":1065,"function":"match","class":"OC\\Route\\Router","type":"->","args":["/apps/shifts/getAllAnalysts"]},{"file":"/var/www/cloud.seagl.org/nextcloud-26.0.4/index.php","line":36,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"/var/www/cloud.seagl.org/nextcloud-26.0.4/lib/private/AppFramework/Http/Dispatcher.php","Line":169,"Previous":{"Exception":"Error","Message":"Call to a member function getUsers() on null","Code":0,"Trace":[{"file":"/var/www/cloud.seagl.org/nextcloud-26.0.4/lib/private/AppFramework/Http/Dispatcher.php","line":230,"function":"getAllAnalysts","class":"OCA\\Shifts\\Controller\\ShiftController","type":"->","args":[]},{"file":"/var/www/cloud.seagl.org/nextcloud-26.0.4/lib/private/AppFramework/Http/Dispatcher.php","line":137,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[["OCA\\Shifts\\Controller\\ShiftController"],"getAllAnalysts"]},{"file":"/var/www/cloud.seagl.org/nextcloud-26.0.4/lib/private/AppFramework/App.php","line":183,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[["OCA\\Shifts\\Controller\\ShiftController"],"getAllAnalysts"]},{"file":"/var/www/cloud.seagl.org/nextcloud-26.0.4/lib/private/Route/Router.php","line":315,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OCA\\Shifts\\Controller\\ShiftController","getAllAnalysts",["OC\\AppFramework\\DependencyInjection\\DIContainer"],["shifts.shift.getAllAnalysts"]]},{"file":"/var/www/cloud.seagl.org/nextcloud-26.0.4/lib/base.php","line":1065,"function":"match","class":"OC\\Route\\Router","type":"->","args":["/apps/shifts/getAllAnalysts"]},{"file":"/var/www/cloud.seagl.org/nextcloud-26.0.4/index.php","line":36,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"/var/www/cloud.seagl.org/nextcloud-26.0.4/apps/shifts/lib/Controller/ShiftController.php","Line":189},"CustomMessage":"--"}}
csoc-kevink commented 11 months ago

Hey,

the error comes from a missing admin setting. Are you sure you have configured the admin settings and groups described here: https://github.com/csoc-de/Shifts/blob/master/docs/README.md

Pedulla commented 11 months ago

I'm getting this error when I go to the admin setting for Shifts.

Freshly installed on 27.1.5

csoc-kevink commented 10 months ago

If it is the settings page there should be an error in the console of your browser. Can you show me the output of your browser console?

fakman0 commented 10 months ago

I tried to make the necessary authorizations, but I don't know if I did it right. The document is insufficient. The Shift authorization page opens, but there is nothing worth changing. Could you give more detailed information? I don't see any errors in the console.

csoc-kevink commented 10 months ago

When it's the error show above in the picture, then there might be missing groups or shift types that are not configured yet. privatemaker updated the documentation and pointed out which nextcloud groups need to be created: https://github.com/csoc-de/Shifts/tree/master/docs Created the nextcloud groups "Analyst", "Shiftsadmin" and "Level 1". Then create a shift type and you should see empty shifts in the app.

nilleholger commented 10 months ago

Same problem here. Created 3 groups with my acount but still no data

IMG_1655 IMG_1656

nilleholger commented 10 months ago

How do i create a shift type without fetching any data

csoc-kevink commented 10 months ago

That are the nextcloud groups in my test instance:

image

And this is the shifts configuration in the admin section:

image

Be aware that the group names are case sensitive! As I see, I might have made a mistake in my last post. The default value for the shift admin group is "ShiftsAdmin" not "Shiftsadmin". Sorry for that one...

csoc-kevink commented 9 months ago

Does the app now works?

gardinenstange commented 9 months ago

nope.....still the same problem here

csoc-kevink commented 9 months ago

Hi,

can you double check if all the group names you entered are the exact same? The App/Nextcloud are case sensitive and will not recognize 'analysts' as 'Analyst'...

WNYmathGuy commented 9 months ago

The groups to be created are done in https://sd.fqdn.tld/index.php/settings/users After creating the groups, and adding users to the newly created groups, go back to the settings page to overwrite the defaults https://sd.fqdn.tld/index.php/settings/admin/shifts While you're there also overwrite the Organizer defaults with real user info.

noci2012 commented 6 months ago

Anyway...... Tried newest version on Nextcoud 29.....

Created groups as in the example: with Analyst as it is hard coded..... (copy/pasted from the source!).

The app fails in getAllAnalysts on line 189. With an access though a null pointer.
Inserting the following code:

            $group = $this->groupManager->get($groupName);
            if ($group == null ) {
                    logger("shifts")->error("Missing group $groupName");
                    return 404;
            }
            $users = [];
            $result = $group->getUsers();

Shows the message: Missing group Analyst

It does show up in the Users entry... For some reason it is missed.... by the group manager:

image

BTW Sprinkling such logger messages in the text might give people clues on what happens. Also loaded on this system:

GroupFolders & Autogroups. Disabling or removing Autogroups makes no difference.

csoc-kevink commented 5 months ago

Hi @noci2012,

thank you for the detailed report. We try to fix this issue for nextcloud 29.

We've scheduled a version 2 of the app in the near future. We want to rewrite the whole backend since it is a little 'ugly' and cannot keep up with our planed features. The logging will also be much more detailed then. For the frontend we want to wait until the nextcloud-vue library is available for Vue3.

comradeferret commented 3 months ago

I'm still getting the same issue in the present version 1.9.9, on a Docker install (logs referring to a null pointer in line 189). Stayed with the default group/string values, as I just want to use it as a proof of concept for my bosses. Any chance this has been fixed? I've double checked the group names and string names in the admin panel.

Exception Call to a member function getUsers() on null in file '/var/www/html/custom_apps/shifts/lib/Controller/ShiftController.php' line 189

brownium commented 2 months ago

image

I created the groups Shiftworkers, Shiftadmin, and Skillgroups. I don't understand what the "Default" column represents, so I tried creating a user with those names and adding them to the groups. ("Level 1" seems like a weird name for a user, though).

And what is meant by "Additional Strings" and where am I supposed to put them?

csoc-kevink commented 2 months ago

Hi brownium,

in the settings section you need to enter the exact id of the groups. The name is not necessarily the same as the id. To get the correct id, click on the group and look into the URL of your browser. There should be the correct id of the group.

Skill groups should just represent different skill levels for the users. If you dont need that feature, just create one group and put all your users into it (and the main Shiftworkers group)

Here a small guide:

Where did you find "Additional Strings"?