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

@ -41,6 +41,37 @@ class PackageModel extends AdminModel
return $data;
}
protected function prepareTable($table)
{
$date = Factory::getDate();
$user = $this->getCurrentUser();
if (empty($table->id)) {
// Set the values
$table->created = $date->toSql();
$table->created_by = $user->id;
// Set ordering to the last item if not set
if (empty($table->ordering)) {
$db = $this->getDatabase();
$query = $db->createQuery()
->select('MAX(' . $db->quoteName('ordering') . ')')
->from($db->quoteName('#__depot_package'));
$db->setQuery($query);
$max = $db->loadResult();
$table->ordering = ++$max;
}
} else {
// Set the values
$table->modified = $date->toSql();
$table->modified_by = $user->id;
}
}
public function save($data)
{
/* Add code to modify data before saving */