Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ protected function prepareTable($table)

if ($table->state == Workflow::CONDITION_PUBLISHED && intval($table->publish_down) == 0)
{
$table->publish_down = $this->getDbo()->getNullDate();
$table->publish_down = null;
}

// Increment the content version number.
Expand Down
24 changes: 12 additions & 12 deletions libraries/src/Table/Content.php
Original file line number Diff line number Diff line change
Expand Up @@ -252,33 +252,27 @@ public function check()
$this->hits = 0;
}

// Set publish_up to null date if not set
// Set publish_up to null if not set
if (!$this->publish_up)
{
$this->publish_up = $this->_db->getNullDate();
$this->publish_up = null;
}

// Set publish_down to null date if not set
// Set publish_down to null if not set
if (!$this->publish_down)
{
$this->publish_down = $this->_db->getNullDate();
$this->publish_down = null;
}

// Check the publish down date is not earlier than publish up.
if ($this->publish_down < $this->publish_up && $this->publish_down > $this->_db->getNullDate())
if (!is_null($this->publish_up) && !is_null($this->publish_down) && $this->publish_down < $this->publish_up)
{
// Swap the dates.
$temp = $this->publish_up;
$this->publish_up = $this->publish_down;
$this->publish_down = $temp;
}

// Set modified to null date if not set
if (!$this->modified)
{
$this->modified = $this->_db->getNullDate();
}

// Clean up keywords -- eliminate extra spaces between phrases
// and cr (\r) and lf (\n) characters from string
if (!empty($this->metakey))
Expand Down Expand Up @@ -321,7 +315,7 @@ public function check()
*
* @since 1.6
*/
public function store($updateNulls = false)
public function store($updateNulls = true)
{
$date = Factory::getDate();
$user = Factory::getUser();
Expand All @@ -345,6 +339,12 @@ public function store($updateNulls = false)
{
$this->created_by = $user->get('id');
}

// Set modified to created date if not set
if (!$this->modified)
{
$this->modified = $this->created;
}
}

// Verify that the alias is unique
Expand Down