ChurchCRM / CRM

ChurchCRM is an OpenSource Church CRM & Management Software.
https://ChurchCRM.io
MIT License
626 stars 444 forks source link

Deposit List does not display in secondary admin user account after upgrade to 5.11.0 #7186

Open brimarq opened 6 days ago

brimarq commented 6 days ago

Describe the issue

We recently upgraded from ChurchCRM v5.8.0 to v5.11.0 via the built-in upgrade process under the original admin account. That account seems to work fine; but, we seem to be having trouble with a secondary account with full admin privileges which is the primary user that interacts with CRM on a day-to-day basis. What brought this to notice was that, today, she was unable to view the list of deposits from within her account on the Deposit >> View All Deposits page.

I've not gone through the entire site; but, here are some things that I immediately took note of that are happening under her secondary admin account:

On the main dashboard at /v2/dashboard

On the View All Deposits page at /FindDepositSlip.php, in the "Deposits" section:

Note that these problems don't seem to be happening under the built-in admin account, only the secondary account with full admin privileges is experiencing this. Before the upgrade everything had been working fine. No CRM app or slim logs were created today, only the usual auth logs. I did notice that there were errors in the browser console for the aforementioned pages under the secondary admin account that did not appear when logged into the built-in admin account. I can include those if you think that they would help. Of note in the Firefox console logs that did not appear in the Brave ones, there was an error that window.CRM is undefined.

Collected Value Title Data
Page Name /FindDepositSlip.php
Screen Size 1440x2560
Window Size 714x1536
Page Size 2671x1536
Platform Information Linux iad1-shared-e1-25 5.15.128-grsec-focal+ #1 SMP Mon Aug 28 23:02:20 UTC 2023 x86_64
PHP Version 8.2.18
SQL Version 8.0.28-0ubuntu0.20.04.3
ChurchCRM Version 5.11.0
Reporting Browser Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:131.0) Gecko/20100101 Firefox/131.0
Prerequisite Status All Prerequisites met
brimarq commented 6 days ago

Browser console logs under secondary admin user account

for /v2/dashboard page:

Brave

dashboard:77 Uncaught SyntaxError: Unexpected token ',' (at dashboard:77:35)
CRMJSOM.js:5 Uncaught TypeError: Cannot set properties of undefined (setting 'APIRequest')
    at CRMJSOM.js:5:23
(anonymous) @ CRMJSOM.js:5
Footer.js:2 Uncaught TypeError: Cannot read properties of undefined (reading 'shortLocale')
    at Footer.js:2:21
(anonymous) @ Footer.js:2
jquery.min.js:2 jQuery.Deferred exception: Cannot read properties of undefined (reading 'root') TypeError: Cannot read properties of undefined (reading 'root')
    at HTMLDocument.<anonymous> (https://CHURCHCRM_DOMAIN/skin/js/MainDashboard.js:49:29)
    at e (https://CHURCHCRM_DOMAIN/skin/external/jquery/jquery.min.js:2:27028)
    at t (https://CHURCHCRM_DOMAIN/skin/external/jquery/jquery.min.js:2:27330) undefined
ce.Deferred.exceptionHook @ jquery.min.js:2
t @ jquery.min.js:2
setTimeout
(anonymous) @ jquery.min.js:2
c @ jquery.min.js:2
fireWith @ jquery.min.js:2
fire @ jquery.min.js:2
c @ jquery.min.js:2
fireWith @ jquery.min.js:2
ready @ jquery.min.js:2
P @ jquery.min.js:2
jquery.min.js:2 Uncaught TypeError: Cannot read properties of undefined (reading 'root')
    at HTMLDocument.<anonymous> (MainDashboard.js:49:29)
    at e (jquery.min.js:2:27028)
    at t (jquery.min.js:2:27330)
(anonymous) @ MainDashboard.js:49
e @ jquery.min.js:2
t @ jquery.min.js:2
setTimeout
ce.readyException @ jquery.min.js:2
(anonymous) @ jquery.min.js:2
e @ jquery.min.js:2
t @ jquery.min.js:2
setTimeout
(anonymous) @ jquery.min.js:2
c @ jquery.min.js:2
fireWith @ jquery.min.js:2
fire @ jquery.min.js:2
c @ jquery.min.js:2
fireWith @ jquery.min.js:2
t @ jquery.min.js:2
setTimeout
(anonymous) @ jquery.min.js:2
c @ jquery.min.js:2
fireWith @ jquery.min.js:2
fire @ jquery.min.js:2
c @ jquery.min.js:2
fireWith @ jquery.min.js:2
ready @ jquery.min.js:2
P @ jquery.min.js:2

Firefox DE

Layout was forced before the page was fully loaded. If stylesheets are not yet loaded this may cause a flash of unstyled content. markup.js:250:53
Uncaught SyntaxError: expected expression, got ',' dashboard:77:35
Uncaught TypeError: can't access property "APIRequest", window.CRM is undefined
    <anonymous> https://CHURCHCRM_DOMAIN/skin/js/CRMJSOM.js:5
CRMJSOM.js:5:1
Uncaught TypeError: can't access property "shortLocale", window.CRM is undefined
    <anonymous> https://CHURCHCRM_DOMAIN/skin/js/Footer.js:2
Footer.js:2:5
jQuery.Deferred exception: can't access property "root", window.CRM is undefined @https://CHURCHCRM_DOMAIN/skin/js/MainDashboard.js:49:13
e@https://CHURCHCRM_DOMAIN/skin/external/jquery/jquery.min.js:2:27028
Deferred/then/l/</t<@https://CHURCHCRM_DOMAIN/skin/external/jquery/jquery.min.js:2:27330
setTimeout handler*Deferred/then/l/<@https://CHURCHCRM_DOMAIN/skin/external/jquery/jquery.min.js:2:27594
c@https://CHURCHCRM_DOMAIN/skin/external/jquery/jquery.min.js:2:25304
fireWith@https://CHURCHCRM_DOMAIN/skin/external/jquery/jquery.min.js:2:26053
fire@https://CHURCHCRM_DOMAIN/skin/external/jquery/jquery.min.js:2:26089
c@https://CHURCHCRM_DOMAIN/skin/external/jquery/jquery.min.js:2:25304
fireWith@https://CHURCHCRM_DOMAIN/skin/external/jquery/jquery.min.js:2:26053
ready@https://CHURCHCRM_DOMAIN/skin/external/jquery/jquery.min.js:2:29112
P@https://CHURCHCRM_DOMAIN/skin/external/jquery/jquery.min.js:2:28884
EventListener.handleEvent*@https://CHURCHCRM_DOMAIN/skin/external/jquery/jquery.min.js:2:29264
@https://CHURCHCRM_DOMAIN/skin/external/jquery/jquery.min.js:2:220
@https://CHURCHCRM_DOMAIN/skin/external/jquery/jquery.min.js:2:225
 undefined jquery.min.js:2:28648
Uncaught TypeError: can't access property "root", window.CRM is undefined
    <anonymous> https://CHURCHCRM_DOMAIN/skin/js/MainDashboard.js:49
    jQuery 13
MainDashboard.js:49:13

for /FindDepositSlip.php page:

Brave

FindDepositSlip.php:77 Uncaught SyntaxError: Unexpected token ',' (at FindDepositSlip.php:77:35)
CRMJSOM.js:5 Uncaught TypeError: Cannot set properties of undefined (setting 'APIRequest')
    at CRMJSOM.js:5:23
(anonymous) @ CRMJSOM.js:5
Footer.js:2 Uncaught TypeError: Cannot read properties of undefined (reading 'shortLocale')
    at Footer.js:2:21
(anonymous) @ Footer.js:2
FindDepositSlip.js:80 Uncaught TypeError: Cannot read properties of undefined (reading 'lang')
    at HTMLDocument.<anonymous> (FindDepositSlip.js:80:66)
(anonymous) @ FindDepositSlip.js:80
jquery.min.js:2 jQuery.Deferred exception: Cannot read properties of undefined (reading 'aDataSort') TypeError: Cannot read properties of undefined (reading 'aDataSort')
    at X (https://CHURCHCRM_DOMAIN/skin/external/datatables/datatables.min.js:93:157)
    at wa (https://CHURCHCRM_DOMAIN/skin/external/datatables/datatables.min.js:97:284)
    at e (https://CHURCHCRM_DOMAIN/skin/external/datatables/datatables.min.js:118:115)
    at HTMLTableElement.<anonymous> (https://CHURCHCRM_DOMAIN/skin/external/datatables/datatables.min.js:120:118)
    at Function.each (https://CHURCHCRM_DOMAIN/skin/external/jquery/jquery.min.js:2:3129)
    at ce.each (https://CHURCHCRM_DOMAIN/skin/external/jquery/jquery.min.js:2:1594)
    at ce.n [as dataTable] (https://CHURCHCRM_DOMAIN/skin/external/datatables/datatables.min.js:110:199)
    at HTMLDocument.<anonymous> (https://CHURCHCRM_DOMAIN/skin/js/DataTables.js:3:43)
    at e (https://CHURCHCRM_DOMAIN/skin/external/jquery/jquery.min.js:2:27028)
    at https://CHURCHCRM_DOMAIN/skin/external/jquery/jquery.min.js:2:27330 undefined
(anonymous) @ jquery.min.js:2
(anonymous) @ jquery.min.js:2
setTimeout
(anonymous) @ jquery.min.js:2
c @ jquery.min.js:2
fireWith @ jquery.min.js:2
fire @ jquery.min.js:2
c @ jquery.min.js:2
fireWith @ jquery.min.js:2
ready @ jquery.min.js:2
P @ jquery.min.js:2
jquery.min.js:2 Uncaught TypeError: Cannot read properties of undefined (reading 'aDataSort')
    at X (datatables.min.js:93:157)
    at wa (datatables.min.js:97:284)
    at e (datatables.min.js:118:115)
    at HTMLTableElement.<anonymous> (datatables.min.js:120:118)
    at Function.each (jquery.min.js:2:3129)
    at ce.each (jquery.min.js:2:1594)
    at ce.n [as dataTable] (datatables.min.js:110:199)
    at HTMLDocument.<anonymous> (DataTables.js:3:43)
    at e (jquery.min.js:2:27028)
    at jquery.min.js:2:27330
X @ datatables.min.js:93
wa @ datatables.min.js:97
e @ datatables.min.js:118
(anonymous) @ datatables.min.js:120
each @ jquery.min.js:2
each @ jquery.min.js:2
n @ datatables.min.js:110
(anonymous) @ DataTables.js:3
e @ jquery.min.js:2
(anonymous) @ jquery.min.js:2
setTimeout
(anonymous) @ jquery.min.js:2
(anonymous) @ jquery.min.js:2
e @ jquery.min.js:2
(anonymous) @ jquery.min.js:2
setTimeout
(anonymous) @ jquery.min.js:2
c @ jquery.min.js:2
fireWith @ jquery.min.js:2
fire @ jquery.min.js:2
c @ jquery.min.js:2
fireWith @ jquery.min.js:2
(anonymous) @ jquery.min.js:2
setTimeout
(anonymous) @ jquery.min.js:2
c @ jquery.min.js:2
fireWith @ jquery.min.js:2
fire @ jquery.min.js:2
c @ jquery.min.js:2
fireWith @ jquery.min.js:2
ready @ jquery.min.js:2
P @ jquery.min.js:2

Firefox DE

Layout was forced before the page was fully loaded. If stylesheets are not yet loaded this may cause a flash of unstyled content. markup.js:250:53
Uncaught SyntaxError: expected expression, got ',' FindDepositSlip.php:77:35
Uncaught TypeError: can't access property "APIRequest", window.CRM is undefined
    <anonymous> https://CHURCHCRM_DOMAIN/skin/js/CRMJSOM.js:5
CRMJSOM.js:5:1
Uncaught TypeError: can't access property "shortLocale", window.CRM is undefined
    <anonymous> https://CHURCHCRM_DOMAIN/skin/js/Footer.js:2
Footer.js:2:5
Uncaught TypeError: can't access property "lang", window.CRM is undefined
    <anonymous> https://CHURCHCRM_DOMAIN/skin/js/FindDepositSlip.js:80
    EventListener.handleEvent* https://CHURCHCRM_DOMAIN/skin/js/FindDepositSlip.js:3
FindDepositSlip.js:80:45
jQuery.Deferred exception: can't access property "aDataSort", e[i] is undefined X@https://CHURCHCRM_DOMAIN/skin/external/datatables/datatables.min.js:93:150
wa@https://CHURCHCRM_DOMAIN/skin/external/datatables/datatables.min.js:97:285
e@https://CHURCHCRM_DOMAIN/skin/external/datatables/datatables.min.js:118:117
n/<@https://CHURCHCRM_DOMAIN/skin/external/datatables/datatables.min.js:120:118
each@https://CHURCHCRM_DOMAIN/skin/external/jquery/jquery.min.js:2:3129
each@https://CHURCHCRM_DOMAIN/skin/external/jquery/jquery.min.js:2:1594
n@https://CHURCHCRM_DOMAIN/skin/external/datatables/datatables.min.js:110:199
@https://CHURCHCRM_DOMAIN/skin/js/DataTables.js:3:43
e@https://CHURCHCRM_DOMAIN/skin/external/jquery/jquery.min.js:2:27028
Deferred/then/l/</t<@https://CHURCHCRM_DOMAIN/skin/external/jquery/jquery.min.js:2:27330
setTimeout handler*Deferred/then/l/<@https://CHURCHCRM_DOMAIN/skin/external/jquery/jquery.min.js:2:27594
c@https://CHURCHCRM_DOMAIN/skin/external/jquery/jquery.min.js:2:25304
fireWith@https://CHURCHCRM_DOMAIN/skin/external/jquery/jquery.min.js:2:26053
fire@https://CHURCHCRM_DOMAIN/skin/external/jquery/jquery.min.js:2:26089
c@https://CHURCHCRM_DOMAIN/skin/external/jquery/jquery.min.js:2:25304
fireWith@https://CHURCHCRM_DOMAIN/skin/external/jquery/jquery.min.js:2:26053
ready@https://CHURCHCRM_DOMAIN/skin/external/jquery/jquery.min.js:2:29112
P@https://CHURCHCRM_DOMAIN/skin/external/jquery/jquery.min.js:2:28884
EventListener.handleEvent*@https://CHURCHCRM_DOMAIN/skin/external/jquery/jquery.min.js:2:29264
@https://CHURCHCRM_DOMAIN/skin/external/jquery/jquery.min.js:2:220
@https://CHURCHCRM_DOMAIN/skin/external/jquery/jquery.min.js:2:225
 undefined jquery.min.js:2:28648
Uncaught TypeError: can't access property "aDataSort", e[i] is undefined
    X https://CHURCHCRM_DOMAIN/skin/external/datatables/datatables.min.js:93
    wa https://CHURCHCRM_DOMAIN/skin/external/datatables/datatables.min.js:97
    e https://CHURCHCRM_DOMAIN/skin/external/datatables/datatables.min.js:118
    n https://CHURCHCRM_DOMAIN/skin/external/datatables/datatables.min.js:120
    jQuery 2
    n https://CHURCHCRM_DOMAIN/skin/external/datatables/datatables.min.js:110
    <anonymous> https://CHURCHCRM_DOMAIN/skin/js/DataTables.js:3
    jQuery 13
datatables.min.js:93:150
brimarq commented 6 days ago

Just tried restoring the database from before the upgrade, once again using the built-in admin account. All seemed to go well. I then logged out and logged back in with the secondary admin account. No change. It still has the same problems.

brimarq commented 6 days ago

I just tried this in my local test environment starting with v5.8.0 and loaded the last db backup from the live site before upgrading it to 5.11.0. I did a manual update to 5.11.0 in the test environment and I'm able to duplicate the problems listed above. The built-in admin user is fine, but the secondary user with full admin privileges has the same issues as the live site above.

I wonder... has something gone wrong with the db updating process going from 5.8.0 to 5.11.0?

Everything about this secondary user worked as expected before the update. This makes no sense. I'll have to think on this some more... sleep on it... it's getting too late for my brain to function properly tonight.

brimarq commented 5 days ago

Ok... back in the local test env with v5.11.0, I created a new person, then used it to create a new system user with full admin privileges, just like the one that had problems after the upgrade. This new user works as it should with none of the problems listed above.

So, it seems that something about our secondary admin system user was corrupted in some way during the upgrade from 5.8.0 to 5.11.0. I just can't imagine what... it doesn't look like the database upgrade sql would have done anything to that user that it wouldn't have also done to the original admin. I might have chalked this up to a freak glitch; but, it happened in both the live and test environments in exactly the same way.

We do have two other full admin system user accounts, the passwords of which I changed in the test environment to see if either of them were affected in the same way. Nope... they both work as expected. It's only the one account that is the main one in use on a day-to-day basis!

brimarq commented 5 days ago

Ok, back in the 5.11.0 test environment, from the built-in admin account, I decided to delete the affected secondary admin system user account and re-create it using the same "person" from before. I would have thought that would clear any issue with a somehow corrupted system user account, but no! Upon logging in with the newly created account I experienced the exact same issues.

Now, here's something interesting: the actual person that has been using the now borked system user admin account actually has two entries for herself in the person_per table. For some reason a second entry was created for her using the same first/last name, some similar other details, and different per_ID; and, that latter one was connected to the system user account in question. Apparently, this has been the case since 2015, and there have been no problems operating that way until this last upgrade.

Having discovered this, I decided to, once again, delete the affected system user account and re-create it, this time using the original "person" entry for her with the earlier per_ID. This time, logging into that user account seems to work as expected.

I'm thinking this may be the best way to move forward; although, it bothers me that I have no explanation as to what went wrong during the upgrade. It seems like there's something about that particular per_ID that is connected to the problems we're having that didn't exist before.

Another thought: if we should delete that seemingly problematic person, how will everything that was edited by that person be affected? I know that there are many, many entries in the person_per table whose per_EnteredBy and perEditedBy columns contain that per_ID. Will all those fields be set to NULL if that person is removed? Will it negatively affect those entries in any way? @DawoudIO ?

brimarq commented 4 days ago

In my test environment, I just tried deleting the person entry that had previously been linked with the problematic system user account. After having done this, the person entries that had been added/edited by that particular per_ID don't seem to be adversely affected. When subsequently viewing their Person Profile Timelines, one can still see the timestamped listings for the creation and edits of each person, but it will now show "Original Entry by Unknown", "Last Edit by Unknown", etc., instead of displaying the deleted system user's name as it had previously done.

I also see, directly in the database, that the per_ID for the former system user's deleted person is still kept in the per_EnteredBy and perEditedBy columns of the person_per table for all of those person entries that it had previously added/edited. On the surface, there don't seem to be any ill effects from leaving a reference to a deleted person in those fields.

So, I just ran this fix on the live site. The re-created system user linked to the original person entry seems to be working fine there now, just as it did in the test environment.

While we have returned to an operational status with this workaround, there are still some nagging questions after our upgrade from v5.8.0 to v5.11.0 that remain unanswered:

  1. Why did that particular system user suffer corruption when none of the others were affected?
  2. Why was the window.CRM DOM property missing only when logged in with the affected system user?