A while back I found a php email template in the forums that only sent updated fields from a form which is very helpful in my case because I have clients updating their forms all the time. Now that I have upgraded my site to Joomla 2.5 and Fabrik 3 the template does not work and gives me the below error. Is there a way to fix this error?
Fatal error: Call to protected method FabrikFEModelForm::setOrigData() from context 'plgFabrik_FormEmail' in /home/public_html/plugins/fabrik_form/email/tmpl/old_new_showupdated.php on line 21
Line 21: $tableid = JRequest::getInt('tableid');
Fatal error: Call to protected method FabrikFEModelForm::setOrigData() from context 'plgFabrik_FormEmail' in /home/public_html/plugins/fabrik_form/email/tmpl/old_new_showupdated.php on line 21
Line 21: $tableid = JRequest::getInt('tableid');
PHP:
<!-- This is a sample email template.
It will tell the user if the record is a new one or an updated one
It contains a link to the record in question
It shows in the table a list of the updated fields.
-->
<?php
//the original data
$orig = JArrayHelper::fromObject($this->formModel->_origData[0]);
if (empty($orig)) {
$action = 'toegevoegd';//new
} else {
$action = 'aangepast';//existing
}
$formid = JRequest::getInt('fabrik');
$tableid = JRequest::getInt('tableid');
$rowid = JRequest::getInt('rowid');
//get the updated record from the database
$this->formModel->set('_origData', null);
$this->formModel->setOrigData();
$data = JArrayHelper::fromObject($this->formModel->_origData[0]);
$config =& JFactory::getConfig();
$live_site = $config->getValue('config.live_site');
$uri =& JURI::getInstance($live_site);
$url = 'http://www.mysite.com'.$uri->getHost().JRoute::_("index.php?option=com_fabrik&view=form&fabrik=$formid&tableid=$tableid&rowid=$rowid");
?>
<p>Dear Administrator,</p>
<p>
There is an updated record <?php echo $action ?> on the website <a href="http://www.afpcomputers.com">http://www.afpcomputers.com</a>.
For the record view online click on the link below:
</p>
<a href="<?php echo $url?>"><?php echo $url?></a>
<p>(If you want to modify information from the record first make sure that you are logged onto the website.)</p>
<table>
<?php
foreach ($data as $key => $val) {
if (substr($key, -4) == '_raw') {
continue;
}
if(!array_key_exists($key, $orig) || $orig[$key] !== $val) {
echo "<tr><td>$key</td><td>";
if (is_array($val)) {
foreach ($val as $v) {
if (is_array($v)) {
echo implode("<br>", $v);
} else {
echo implode("<br>", $val);
}
}
} else {
echo $val;
}
echo "</td></tr>";
}
}
?>
</table>