Skip to content

Commit

Permalink
Issue #220502 Fix: We cannot access 'Notification Templates' in backe…
Browse files Browse the repository at this point in the history
…nd -> An error has occurred. 0 Class "JError" not found
  • Loading branch information
Sachintechjoomla committed Jun 4, 2024
1 parent 3c5cead commit e401f68
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 10 deletions.
3 changes: 2 additions & 1 deletion src/com_tjnotifications/admin/views/logs/view.html.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ public function display($tpl = null)
// Check for errors.
if (count($errors = $this->get('Errors')))
{
JError::raiseError(500, implode('<br />', $errors));
$app = Factory::getApplication();
$app->enqueueMessage(implode('<br />', $errors), 'error');

return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function display($tpl = null)
if (empty($this->user->authorise('core.create', 'com_tjnotifications')) || empty($this->user->authorise('core.edit', 'com_tjnotifications')))
{
$msg = Text::_('JERROR_ALERTNOAUTHOR');
JError::raiseError(403, $msg);
$this->app->enqueueMessage($msg, 'error');
$this->app->redirect(Route::_('index.php?Itemid=0', false));
}

Expand All @@ -74,7 +74,7 @@ public function display($tpl = null)
// Check for errors.
if (count($errors = $this->get('Errors')))
{
JError::raiseError(500, implode('<br />', $errors));
$this->app->enqueueMessage(implode('<br />', $errors), 'error');

return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public function display($tpl = null)
if (empty($this->user->authorise('core.viewlist', 'com_tjnotifications')))
{
$msg = Text::_('JERROR_ALERTNOAUTHOR');
JError::raiseError(403, $msg);
$this->app->enqueueMessage($msg, 'error');
$this->app->redirect(Route::_('index.php?Itemid=0', false));
}

Expand All @@ -78,7 +78,7 @@ public function display($tpl = null)
// Check for errors.
if (count($errors = $this->get('Errors')))
{
JError::raiseError(500, implode('<br />', $errors));
$this->app->enqueueMessage(implode('<br />', $errors), 'error');

return false;
}
Expand Down
12 changes: 7 additions & 5 deletions src/com_tjnotifications/install.tjnotifications.php
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,8 @@ public function installSqlFiles($parent)

if (!$db->execute())
{
JError::raiseWarning(1, Text::sprintf('JLIB_INSTALLER_ERROR_SQL_ERROR', $db->stderr(true)));
$app = Factory::getApplication();
$app->enqueueMessage(Text::sprintf('JLIB_INSTALLER_ERROR_SQL_ERROR', $db->stderr(true)), 'error');

return false;
}
Expand Down Expand Up @@ -294,6 +295,7 @@ public function installSqlFiles($parent)
*/
public function fixTemplateTable($db, $dbprefix, $config)
{
$app = Factory::getApplication();
$query = "SHOW COLUMNS FROM #__tj_notification_templates WHERE `Field` = 'title'";
$db->setQuery($query);
$check = $db->loadResult();
Expand All @@ -305,7 +307,7 @@ public function fixTemplateTable($db, $dbprefix, $config)

if (!$db->execute())
{
JError::raiseError(500, $db->stderr());
$app->enqueueMessage($db->stderr(), 'error');
}
}

Expand All @@ -320,7 +322,7 @@ public function fixTemplateTable($db, $dbprefix, $config)

if (!$db->execute())
{
JError::raiseError(500, $db->stderr());
$app->enqueueMessage($db->stderr(), 'error');
}
}

Expand All @@ -335,7 +337,7 @@ public function fixTemplateTable($db, $dbprefix, $config)

if (!$db->execute())
{
JError::raiseError(500, $db->stderr());
$app->enqueueMessage($db->stderr(), 'error');
}
}

Expand All @@ -350,7 +352,7 @@ public function fixTemplateTable($db, $dbprefix, $config)

if (!$db->execute())
{
JError::raiseError(500, $db->stderr());
$app->enqueueMessage($db->stderr(), 'error');
}
}
}
Expand Down

0 comments on commit e401f68

Please sign in to comment.