Skip to content

Commit

Permalink
Fix for email form plugin when attching as PDF. Need to reload the fo…
Browse files Browse the repository at this point in the history
…rm's data, so it's in getData() format for display.
  • Loading branch information
cheesegrits committed Mar 8, 2017
1 parent f8670ea commit 5522a5f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion plugins/fabrik_element/fileupload/fileupload.php
Expand Up @@ -269,7 +269,7 @@ public function elementJavascript($repeatCounter)

$singleCrop = false;

if (array_key_exists('params', $value))
if (is_array($value) && array_key_exists('params', $value))
{
$singleCrop = true;
$imgParams = (array) FArrayHelper::getValue($value, 'params');
Expand Down
10 changes: 8 additions & 2 deletions plugins/fabrik_form/email/email.php
Expand Up @@ -436,6 +436,7 @@ protected function pdfAttachment(&$thisAttachments)

/** @var FabrikFEModelForm $model */
$model = $this->getModel();
$model->setRowId($this->data['rowid']);
$document = JFactory::getDocument();
$docType = $document->getType();
$document->setType('pdf');
Expand Down Expand Up @@ -481,8 +482,13 @@ protected function pdfAttachment(&$thisAttachments)
* here instead of poking in to the _model, but I don't think there is a setModel for controllers?
*/
$controller->_model = $model;
$controller->_model->data = $this->getProcessData();
//$controller->_model->data = null;

/**
* Unfortunately, we need to reload the data, so it's in the right format. Can't use the
* submitted data. "One of these days" we need to have a serious look at normalizing the data formats,
* so submitted data is in the same format (once processed) as data read from the database.
*/
$controller->_model->data = $this->model->getData();

// Store in output buffer
ob_start();
Expand Down

0 comments on commit 5522a5f

Please sign in to comment.