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

Bug: Unable to Generate Deposit Slip reports #6777

Closed
infina opened this issue Dec 26, 2023 · 5 comments · Fixed by #6787
Closed

Bug: Unable to Generate Deposit Slip reports #6777

infina opened this issue Dec 26, 2023 · 5 comments · Fixed by #6787

Comments

@infina
Copy link

infina commented Dec 26, 2023

Description

  • ChurchCRM version: 5.3.1
  • PHP version is the server running: 8.2
  • DB Server and Version are you running: MariaDB 10.6.12

Steps To Reproduce

  1. Go to Deposit->View All Deposits
  2. Load a deposit slip.
  3. Click on Deposit Slip Report
  4. Get error Error making API Call to: /api/deposits/<#>/pdf
    Error text: There was a problem retrieving the requested object

Expected behavior

A PDF of the deposit slip should generate and be download.

Screenshots and/or logs

Slim Application Error:
Type: Error
Message: Attempt to modify property "title" on null
File: /var/www/churchcrm/ChurchCRM/model/ChurchCRM/Deposit.php
Line: 229
Trace: #0 /var/www/churchcrm/ChurchCRM/model/ChurchCRM/Deposit.php(408): ChurchCRM\model\ChurchCRM\Deposit->generateDepositSummary()
#1 /var/www/churchcrm/api/routes/finance/finance-deposits.php(58): ChurchCRM\model\ChurchCRM\Deposit->getPDF()
#2 [internal function]: Closure->{closure}()
#3 /var/www/churchcrm/vendor/slim/slim/Slim/Handlers/Strategies/RequestResponse.php(40): call_user_func()
#4 /var/www/churchcrm/vendor/slim/slim/Slim/Route.php(281): Slim\Handlers\Strategies\RequestResponse->__invoke()
#5 /var/www/churchcrm/ChurchCRM/Slim/Middleware/Request/Auth/BaseAuthRoleMiddleware.php(28): Slim\Route->__invoke()
#6 [internal function]: ChurchCRM\Slim\Middleware\Request\Auth\BaseAuthRoleMiddleware->__invoke()
#7 /var/www/churchcrm/vendor/slim/slim/Slim/DeferredCallable.php(57): call_user_func_array()
#8 [internal function]: Slim\DeferredCallable->__invoke()
#9 /var/www/churchcrm/vendor/slim/slim/Slim/MiddlewareAwareTrait.php(70): call_user_func()
#10 /var/www/churchcrm/vendor/slim/slim/Slim/MiddlewareAwareTrait.php(117): Slim\Route->Slim{closure}()
#11 /var/www/churchcrm/vendor/slim/slim/Slim/Route.php(268): Slim\Route->callMiddlewareStack()
#12 /var/www/churchcrm/vendor/slim/slim/Slim/App.php(503): Slim\Route->run()
#13 /var/www/churchcrm/ChurchCRM/Slim/Middleware/VersionMiddleware.php(13): Slim\App->__invoke()
#14 [internal function]: ChurchCRM\Slim\Middleware\VersionMiddleware->__invoke()
#15 /var/www/churchcrm/vendor/slim/slim/Slim/DeferredCallable.php(57): call_user_func_array()
#16 [internal function]: Slim\DeferredCallable->__invoke()
#17 /var/www/churchcrm/vendor/slim/slim/Slim/MiddlewareAwareTrait.php(70): call_user_func()
#18 /var/www/churchcrm/ChurchCRM/Slim/Middleware/AuthMiddleware.php(33): Slim\App->Slim{closure}()
#19 [internal function]: ChurchCRM\Slim\Middleware\AuthMiddleware->__invoke()
#20 /var/www/churchcrm/vendor/slim/slim/Slim/DeferredCallable.php(57): call_user_func_array()
#21 [internal function]: Slim\DeferredCallable->__invoke()
#22 /var/www/churchcrm/vendor/slim/slim/Slim/MiddlewareAwareTrait.php(70): call_user_func()
#23 /var/www/churchcrm/vendor/slim/slim/Slim/MiddlewareAwareTrait.php(117): Slim\App->Slim{closure}()
#24 /var/www/churchcrm/vendor/slim/slim/Slim/App.php(392): Slim\App->callMiddlewareStack()
#25 /var/www/churchcrm/vendor/slim/slim/Slim/App.php(297): Slim\App->process()
#26 /var/www/churchcrm/api/index.php(83): Slim\App->run()
#27 {main}
View in rendered output by enabling the "displayErrorDetails" setting.

Debugging Steps

  • Tested over older deposit slips that have generated reports in previous versions and they cause the same error.
  • Installed on a fresh system, and I am getting the same error.

Additional context

It appears that it is not liking the line of '$thisReport->depositSummaryParameters->title->x = 85;' in the function generateDepositSummary.

@infina infina added the bug label Dec 26, 2023
@DAcodedBEAT
Copy link
Contributor

DAcodedBEAT commented Dec 26, 2023

Yeah, that looks like the line that is causing the error. Specifically, I don't see where depositSummaryParameters or title are being initialized, which is probably causing the error.

@infina Do you know if this functionality ever worked? if so, do you know what version it worked on?

@brimarq
Copy link

brimarq commented Dec 27, 2023

I just got the same error attempting to create an individual deposit report using pdf output method. Outputting the same report to csv works.

@infina
Copy link
Author

infina commented Dec 27, 2023

It did work, and I was looking through my system to see which version I had it working on, and it appears to have been working on version 4.5.4 on php7.

@DAcodedBEAT
Copy link
Contributor

It did work, and I was looking through my system to see which version I had it working on, and it appears to have been working on version 4.5.4 on php7.

Thanks! It looks like this is a breaking change from PHP itself after the codebase was upgraded to >=8.0 compatibility.

Attempting to write to a property of a non-object. Previously this implicitly created an stdClass object for null, false and empty strings.

(from https://www.php.net/manual/en/migration80.incompatible.php)

Ideally, the application wouldn't use the unstructured stdClass object but a quick fix would be to instantiate each of these nested objects in this class.

@infina or @brimarq Do either of you want to try to submit the fix to this issue?

@DAcodedBEAT DAcodedBEAT added this to the v5.4.1 milestone Dec 28, 2023
@DAcodedBEAT
Copy link
Contributor

@infina or @brimarq Do either of you want to try to submit the fix to this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants