Skip to content

Commit

Permalink
[BUGFIX] Using Generators in Finisher\Mail or Finisher\SubmittedOK re…
Browse files Browse the repository at this point in the history
…sults in Exception
  • Loading branch information
reinhardfuehricht committed Feb 24, 2016
1 parent c6b702c commit 0c1ec98
Show file tree
Hide file tree
Showing 11 changed files with 20 additions and 15 deletions.
11 changes: 8 additions & 3 deletions Classes/Controller/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,21 +176,24 @@ public function process()
*/
protected function processAction($action)
{

$content = '';
$gp = $_GET;
if ($this->globals->getFormValuesPrefix()) {
$gp = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP($this->globals->getFormValuesPrefix());
}
if (is_array($this->settings['finishers.'])) {
$finisherConf = [];

foreach ($this->settings['finishers.'] as $key => $config) {
if (strpos($key, '.') !== FALSE) {
$className = $this->utilityFuncs->getPreparedClassName($config);
if ($className === '\Typoheads\Formhandler\Finisher\SubmittedOK' && is_array($config['config.'])) {
if ($className === $this->utilityFuncs->prepareClassName('\Typoheads\Formhandler\Finisher\SubmittedOK') && is_array($config['config.'])) {
$finisherConf = $config['config.'];
}
}
}

$params = [];
$tstamp = intval($gp['tstamp']);
$hash = $GLOBALS['TYPO3_DB']->fullQuoteStr($gp['hash'], 'tx_formhandler_log');
Expand All @@ -202,18 +205,20 @@ protected function processAction($action)
$params = unserialize($row['params']);
}
}

if ($finisherConf['actions.'][$action . '.'] && !empty($params) && intval($this->utilityFuncs->getSingle($finisherConf['actions.'][$action . '.']['config.'], 'returns')) !== 1) {

$class = $this->utilityFuncs->getPreparedClassName($finisherConf['actions.'][$action . '.']);
if ($class) {

$object = $this->componentManager->getComponent($class);
$object->init($params, $finisherConf['actions.'][$action . '.']['config.']);
$object->process();
}
} elseif ($action === 'show') {

//"show" makes it possible that Finisher_SubmittedOK show its output again
$class = '\Typoheads\Formhandler\Finisher\SubmittedOK';
$class = $this->utilityFuncs->prepareClassName('\Typoheads\Formhandler\Finisher\SubmittedOK');
$object = $this->componentManager->getComponent($class);
unset($finisherConf['actions.']);
$object->init($params, $finisherConf);
Expand All @@ -229,7 +234,7 @@ protected function processAction($action)
} else {

//Makes it possible that Finisher_SubmittedOK show its output again
$class = '\Typoheads\Formhandler\Finisher\SubmittedOK';
$class = $this->utilityFuncs->prepareClassName('\Typoheads\Formhandler\Finisher\SubmittedOK');
$object = $this->componentManager->getComponent($class);
unset($finisherConf['actions.']);
$object->init($params, $finisherConf);
Expand Down
4 changes: 2 additions & 2 deletions Classes/Controller/ModuleController.php
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ public function exportAction($logDataUids = NULL, array $fields, $filetype = '')
if ($filetype === 'pdf') {
$className = $this->utilityFuncs->getPreparedClassName(
$this->settings['pdf'],
'\Typoheads\Formhandler\Generator\TCPDF'
'\Typoheads\Formhandler\Generator\BE\TCPDF'
);

$generator = $this->componentManager->getComponent($className);
Expand All @@ -216,7 +216,7 @@ public function exportAction($logDataUids = NULL, array $fields, $filetype = '')
} elseif ($filetype === 'csv') {
$className = $this->utilityFuncs->getPreparedClassName(
$this->settings['generators.']['csv.'],
'\Typoheads\Formhandler\Generator\CSV'
'\Typoheads\Formhandler\Generator\BE\CSV'
);

$generator = $this->componentManager->getComponent($className);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
namespace Typoheads\Formhandler\Generator\FE;
namespace Typoheads\Formhandler\Generator;
/* *
* This script is part of the TYPO3 project - inspiring people to share! *
* *
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
*/
require_once(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('formhandler') . 'Resources/PHP/parsecsv.lib.php');

class CSV extends \Typoheads\Formhandler\Component\AbstractComponent
class BackendCsv extends \Typoheads\Formhandler\Component\AbstractComponent
{

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
* @subpackage Generator
* @uses Tx_Formhandler_Template_TCPDF
*/
class TCPDF extends \Typoheads\Formhandler\Component\AbstractComponent
class BackendTcPdf extends \Typoheads\Formhandler\Component\AbstractComponent
{

/**
Expand Down
2 changes: 1 addition & 1 deletion Classes/Generator/FE/Csv.php → Classes/Generator/Csv.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
namespace Typoheads\Formhandler\Generator\FE;
namespace Typoheads\Formhandler\Generator;
/* *
* This script is part of the TYPO3 project - inspiring people to share! *
* *
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
namespace Typoheads\Formhandler\Generator\FE;
namespace Typoheads\Formhandler\Generator;
/* *
* This script is part of the TYPO3 project - inspiring people to share! *
* *
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
namespace Typoheads\Formhandler\Generator\FE;
namespace Typoheads\Formhandler\Generator;
/* *
* This script is part of the TYPO3 project - inspiring people to share! *
* *
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
namespace Typoheads\Formhandler\Generator\FE;
namespace Typoheads\Formhandler\Generator;
/* *
* This script is part of the TYPO3 project - inspiring people to share! *
* *
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
namespace Typoheads\Formhandler\Generator\FE;
namespace Typoheads\Formhandler\Generator;
/* *
* This script is part of the TYPO3 project - inspiring people to share! *
* *
Expand Down
4 changes: 2 additions & 2 deletions ext_typoscript_setup.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ module.tx_formhandler {
view.widget.TYPO3\CMS\Fluid\ViewHelpers\Be\Widget\PaginateViewHelper.templateRootPath = EXT:formhandler/Resources/Private/Templates/
settings {
pdf {
class = Generator\TCPDF
class = Typoheads\Formhandler\Generator\BackendTcPdf
config {
font = FreeSans
fontSize = 12
Expand All @@ -37,7 +37,7 @@ module.tx_formhandler {
}
}
csv {
class = Generator\CSV
class = Typoheads\Formhandler\Generator\BackendCsv
config {
encoding = utf-8
delimiter = ,
Expand Down

0 comments on commit 0c1ec98

Please sign in to comment.