Version 0.9.13

This commit is contained in:
2023-11-18 21:05:43 +01:00
parent f656fb70fa
commit bedb36c136
24 changed files with 383 additions and 136 deletions

View File

@ -11,10 +11,12 @@
namespace KW4NZ\Component\Depot\Administrator\Model;
use Joomla\CMS\MVC\Model\ListModel;
// use Joomla\CMS\Table\Table;
use Joomla\CMS\Table\Table;
use Joomla\Database\ParameterType;
// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects
class StocksModel extends ListModel
{
@ -23,18 +25,25 @@ class StocksModel extends ListModel
$config['filter_fields'] = [
'id',
's.id',
's.name',
'name',
's.name',
'alias',
's.alias',
's.description',
'description',
'state',
's.state',
'published',
'd.published',
's.published',
'description',
's.description',
'ordering',
's.ordering',
'checked_out',
's.checked_out',
'owner',
];
parent::__construct($config);
}
/**
* Build an SQL query to load the list data.
*
@ -66,6 +75,10 @@ class StocksModel extends ListModel
$db->quoteName('s.name'),
$db->quoteName('s.alias'),
$db->quoteName('s.description'),
$db->quoteName('s.state'),
$db->quoteName('s.ordering'),
$db->quoteName('s.checked_out'),
$db->quoteName('s.checked_out_time'),
]
)
)
@ -99,9 +112,27 @@ class StocksModel extends ListModel
// Add the list ordering clause.
$query->order(
$db->quoteName($db->escape($this->getState('list.ordering', 'id'))) . ' ' . $db->escape($this->getState('list.direction', 'ASC'))
$db->quoteName($db->escape($this->getState('list.ordering', 's.ordering'))) . ' ' .
$db->escape($this->getState('list.direction', 'ASC'))
);
return $query;
}
/**
* Returns a reference to the Table object, always creating it.
*
* @param string $type The table type to instantiate
* @param string $prefix A prefix for the table class name. Optional.
* @param array $config Configuration array for model. Optional.
*
* @return Table A Table object
*
* @since 1.6
*/
public function getTable($type = 'Stock', $prefix = 'Administrator', $config = [])
{
return parent::getTable($type, $prefix, $config);
}
}