Fixed the created_by auto save to current user if none is set at the creation of any new item. All other changes are only random variable name and date changes (due to automation)
This commit is contained in:
@ -11,7 +11,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.1.0
|
||||
@build 18th February, 2016
|
||||
@build 20th February, 2016
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage help_document.php
|
||||
@ -158,6 +158,12 @@ class ComponentbuilderModelHelp_document extends JModelAdmin
|
||||
$form->setFieldAttribute('ordering', 'filter', 'unset');
|
||||
$form->setFieldAttribute('published', 'filter', 'unset');
|
||||
}
|
||||
// If this is a new item insure the greated by is set.
|
||||
if (0 == $id)
|
||||
{
|
||||
// Set the created_by to this user
|
||||
$form->setValue('created_by', null, $user->id);
|
||||
}
|
||||
// Modify the form based on Edit Creaded By access controls.
|
||||
if (!$user->authorise('core.edit.created_by', 'com_componentbuilder'))
|
||||
{
|
||||
@ -176,6 +182,19 @@ class ComponentbuilderModelHelp_document extends JModelAdmin
|
||||
// Disable fields while saving.
|
||||
$form->setFieldAttribute('created', 'filter', 'unset');
|
||||
}
|
||||
// Only load these values if no id is found
|
||||
if (0 == $id)
|
||||
{
|
||||
// Set redirected field name
|
||||
$redirectedField = $jinput->get('ref', null, 'STRING');
|
||||
// Set redirected field value
|
||||
$redirectedValue = $jinput->get('refid', 0, 'INT');
|
||||
if (0 != $redirectedValue && $redirectedField)
|
||||
{
|
||||
// Now set the local-redirected field default value
|
||||
$form->setValue($redirectedField, null, $redirectedValue);
|
||||
}
|
||||
}
|
||||
|
||||
return $form;
|
||||
}
|
||||
@ -287,7 +306,7 @@ class ComponentbuilderModelHelp_document extends JModelAdmin
|
||||
{
|
||||
$table->created = $date->toSql();
|
||||
// set the user
|
||||
if ($table->created_by == 0)
|
||||
if ($table->created_by == 0 || empty($table->created_by))
|
||||
{
|
||||
$table->created_by = $user->id;
|
||||
}
|
||||
|
Reference in New Issue
Block a user