nhovratov / jobfair

5 stars 4 forks source link

Feature Request: More than one attachment possible? #11

Open ineswillenbrock opened 1 year ago

ineswillenbrock commented 1 year ago

Hi there,

I'm on TYPO3 11.5 with PHP 7.4 and Jobfair 4.0.4, legacy install. (was TYPO3 10.4, behaves the same)

I'm able to configure jobfair to accept more than one Upload, but I can't figure out, how to attach more than one file to the mails.

I configured it to have 4 attachments called attachement, attachement2, attachement3 and attachment4 and can access those in the Backend, but when I try to send an application via the frontend, it failes when trying to attache the files to the mail(s).

I get this error:

(1/1) Error

Call to a member function getOriginalResource() on null
in /var/www/localhost/htdocs/t3-11/typo3conf/ext/jobfair/Classes/Controller/JobController.php line 656

            $recipientsBcc,
            $sender,
            LocalizationUtility::translate('tx_jobfair_domain_model_application.email_subject', 'jobfair', ['jobTitle' => $job->getJobTitle()]),
            ['newApplication' => $newApplication, 'job' => $job],
            $newApplication->getAttachment()->getOriginalResource()->getName()
        )) {
            $this->flashMessageService('applicationSendMessage', 'applicationSendStatus', 'OK');
        } else {
            $this->flashMessageService('applicationSendMessageGeneralError', 'applicationSendStatusGeneralErrorStatus', 'ERROR');

at Dan\Jobfair\Controller\JobController->createApplicationAction()
in /var/www/localhost/htdocs/typo3_src-11.5.21/typo3/sysext/extbase/Classes/Mvc/Controller/ActionController.php line 575

        }
        $validationResult = $this->arguments->validate();
        if (!$validationResult->hasErrors()) {
            $this->eventDispatcher->dispatch(new BeforeActionCallEvent(static::class, $this->actionMethodName, $preparedArguments));
            $actionResult = $this->{$this->actionMethodName}(...$preparedArguments);
        } else {
            $actionResult = $this->{$this->errorMethodName}();
        }

Any idea, how to fix it? Or should I save my time and use just the one attachment thats there?

edit: TYPO3 Version

ineswillenbrock commented 1 year ago

Seems, that it's a general problem with applications without attachments, not just my idea of adding more than one. If I wrap the "create mail"- part of createApplicationAction() with a check, if there is an attachment, it works for me. Do you want a pull request?

nhovratov commented 1 year ago

Hey, thanks for investigating and coming back with a fix. Sure, make a PR so I can release a new version for this. Thanks!

ineswillenbrock commented 1 year ago

Will do, when I find a solution, that's a bit less brutal