Skip to content

Commit eea3a30

Browse files
committed
Task #197935 chore: Tjucm upgrade and compatible as per joomla4
1 parent 93917be commit eea3a30

File tree

6 files changed

+16
-14
lines changed

6 files changed

+16
-14
lines changed

src/components/com_tjucm/media/js/ui/items.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/components/com_tjucm/site/controllers/itemform.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,9 +171,8 @@ public function cancel($key = null)
171171
if ($model->checkin($recordId) === false)
172172
{
173173
// Check-in failed, go back to the record and display a notice.
174-
$this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_CHECKIN_FAILED', $model->getError()));
175-
$this->setMessage($this->getError(), 'error');
176-
174+
175+
Factory::getApplication()->enqueueMessage(Text::sprintf('JLIB_APPLICATION_ERROR_CHECKIN_FAILED', $model->getError()), 'error');
177176
$link = 'index.php?option=com_tjucm&view=itemform&client=' . $this->client;
178177
$itemId = $tjUcmFrontendHelper->getItemId($link);
179178
$this->setRedirect(Route::_($link . '&Itemid=' . $itemId . $this->getRedirectToItemAppend($recordId, $key), false));

src/components/com_tjucm/site/includes/tjucm.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,8 @@ public static function init($location = 'site')
189189
$options = array("version" => $version);
190190

191191
if ($view == 'itemform' || $view == 'items')
192-
{
192+
{
193+
HTMLHelper::script('/media/system/js/messages.min.js');
193194
HTMLHelper::script('media/com_tjucm/js/com_tjucm.min.js', $options);
194195
HTMLHelper::script('media/com_tjucm/js/core/class.min.js', $options);
195196
HTMLHelper::script('media/com_tjucm/js/core/base.min.js', $options);

src/components/com_tjucm/site/models/itemform.php

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,13 @@
1919
use Joomla\CMS\Form\Form;
2020
use Joomla\CMS\Filesystem\File;
2121
use Joomla\CMS\Plugin\PluginHelper;
22-
use Joomla\Event\Dispatcher as EventDispatcher;
23-
24-
require_once JPATH_SITE . "/components/com_tjfields/filterFields.php";
25-
2622
use Joomla\Utilities\ArrayHelper;
2723
use Joomla\CMS\Component\ComponentHelper;
2824
use Joomla\Registry\Registry;
2925
use TJQueue\Admin\TJQueueProduce;
3026

27+
require_once JPATH_SITE . "/components/com_tjfields/filterFields.php";
28+
3129
if (ComponentHelper::getComponent('com_tjqueue', true)->enabled)
3230
{
3331
jimport('tjqueueproduce', JPATH_SITE . '/administrator/components/com_tjqueue/libraries');
@@ -174,7 +172,8 @@ public function &getData($id = null)
174172
// Check for published state if filter set.
175173
if (((is_numeric($published)) || (is_numeric($archived))) && (($table->state != $published) && ($table->state != $archived)))
176174
{
177-
return JError::raiseError(404, Text::_('COM_TJUCM_ITEM_DOESNT_EXIST'));
175+
return throw new Exception(Text::_('COM_TJUCM_ITEM_DOESNT_EXIST'), 404);
176+
178177
}
179178
}
180179

@@ -214,7 +213,7 @@ public function &getData($id = null)
214213
}
215214
else
216215
{
217-
return JError::raiseError(404, Text::_('COM_TJUCM_ITEM_DOESNT_EXIST'));
216+
return throw new Exception(Text::_('COM_TJUCM_ITEM_DOESNT_EXIST'), 404);
218217
}
219218

220219
return $this->item;
@@ -565,7 +564,7 @@ public function save($data)
565564
$tableParentData = $this->getTable();
566565
$tableParentData->load(array('id' => $data['parent_id']));
567566

568-
if (!property_exists($tableParentData->id) && (!$tableParentData->id))
567+
if (!property_exists($tableParentData, 'id') && (!$tableParentData->id))
569568
{
570569
$this->setError(Text::_('COM_TJUCM_INVALID_PARENT_ID'));
571570

src/components/com_tjucm/site/models/items.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
use Joomla\CMS\MVC\Model\BaseDatabaseModel;
1515
use Joomla\CMS\Table\Table;
1616
use Joomla\Data\DataObject;
17+
use Joomla\Utilities\ArrayHelper;
18+
use Joomla\CMS\Plugin\PluginHelper;
1719
use Joomla\CMS\Component\ComponentHelper;
1820

1921
/**
@@ -102,7 +104,7 @@ protected function populateState($ordering = "a.id", $direction = "DESC")
102104
$menuitem = $app->getMenu()->getActive();
103105

104106
// Get the params
105-
$this->menuparams = $menuitem->getparams();
107+
$this->menuparams = $menuitem->getParams();
106108

107109
if (!empty($this->menuparams))
108110
{
@@ -204,6 +206,7 @@ protected function getListQuery()
204206
{
205207
// Call function to initialise fields lists
206208
$this->getFields();
209+
$user = Factory::getUser();
207210

208211
// Create a new query object.
209212
$db = $this->getDbo();

src/components/com_tjucm/site/views/itemform/tmpl/default.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
jQuery("#item-form").areYouSure();
6464
});
6565
66-
jQuery(window).load(function ()
66+
jQuery(document).ready(function ()
6767
{
6868
jQuery("#item-form .nav-tabs li a").first().click();
6969
});

0 commit comments

Comments
 (0)