?
avatar eltonpang
eltonpang
15 Aug 2017

Steps to reproduce the issue

open any existing articles, modify its titles and content and save as copy to a new article

Expected result

any new articles that are create using save as copy method should have its own time stamp and consider as new article

Actual result

new article created using save as copy has time stamp matching article that it copied. The new article will not be listed under recently added article in the dashboard
example of an article in the attachment "Yunmai Smart Scale ..." created using save as copy from article ID 5 "How embedded ..." doesn't appear on recently added articles and its time stamp dated 2017-07-01 instead of 2017-08.10 as per the version history

System information (as much as possible)

joomla 3.7.4 and earlier
php 7.1.8
MySQLi 5.5.56-cll-lve
using free domain from cloudaccess.net

Additional comments

screen shot 2017-08-15 at 09 13 20!
screen shot 2017-08-15 at 09 13 25screen shot 2017-08-15 at 09 13 27

Votes

# of Users Experiencing Issue
1/1
Average Importance Score
4.00

avatar eltonpang eltonpang - open - 15 Aug 2017
avatar joomla-cms-bot joomla-cms-bot - labeled - 15 Aug 2017
avatar franz-wohlkoenig franz-wohlkoenig - change - 15 Aug 2017
Category UI/UX com_content UI/UX
avatar eltonpang
eltonpang - comment - 15 Aug 2017

take note that Published and Created Date of the copied articles will also follow its original article that it copied. e.g. if you pick an existing article that was created and publish on 2010-10-01 and use save as copy, modified its title and contents, the new article created and publish date will follow its original article date i.e. 2010-10-01


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/17542.

avatar franz-wohlkoenig
franz-wohlkoenig - comment - 15 Aug 2017
avatar franz-wohlkoenig franz-wohlkoenig - change - 15 Aug 2017
Status New Discussion
avatar eltonpang
eltonpang - comment - 15 Aug 2017

Other than the created date, the published date also copied over. Don't tell me this is expected behavior as well. The primary issue raise here is the new article that uses save as copy won't appear in the recently added articles list, is that an expected behavior?

If both of the answer is yes. I have nothing more to say but the to comment such design are not a normal user behavior should expect.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/17542.

avatar infograf768
infograf768 - comment - 15 Aug 2017

This can be modified in the model line 569 by adding values for $data.
/administrator/components/com_content/models/article.php

		if ($input->get('task') == 'save2copy')
		{
			$origTable = clone $this->getTable();
			$origTable->load($input->getInt('id'));

			if ($data['title'] == $origTable->title)
			{
				list($title, $alias) = $this->generateNewTitle($data['catid'], $data['alias'], $data['title']);
				$data['title']        = $title;
				$data['alias']        = $alias;
				$data['created']      = JFactory::getDate('now', $offset)->format('%Y-%m-%d'); 
				$data['modified']     = JFactory::getDate('now', $offset)->format('%Y-%m-%d');
				$data['publish_up']   = '';
				$data['publish_down'] = '';
			}
			else
etc.

And I do agree that if no one wants to modify the model, we should at least provide an Option (I know, I know, another option...)

avatar mbabker
mbabker - comment - 15 Aug 2017

The dates are only set to now if there isn't anything else existing, it's a default behavior (if you fill in the dates on a new item then those values are used). We don't arbitrarily change them after the fact because they are user editable data.

avatar brianteeman
brianteeman - comment - 15 Aug 2017

Its a difficult one. On the one hand you are saving a copy so you should expect to get a copy of all userdata and that includes the dates as they are user editable. On the other hand in your use case it makes sense for the date to always be new. I guess its a balance between what is the most common use case

avatar eltonpang
eltonpang - comment - 15 Aug 2017

thanks infograf768 ? ? , I had modified the file to include your code that meet my needs. Probably a good idea to share your code to other users that rely on current create & publish date for their Save as Copy articles

avatar eltonpang eltonpang - change - 15 Aug 2017
Status Discussion Closed
Closed_Date 0000-00-00 00:00:00 2017-08-15 14:24:42
Closed_By eltonpang
avatar eltonpang eltonpang - close - 15 Aug 2017
avatar infograf768
infograf768 - comment - 16 Aug 2017

@eltonpang
Warning though! This would be overwritten when you update Joomla.

Also, you may have to add after $origTable->load($input->getInt('id'));

$offset = JFactory::getApplication()->get('offset');

avatar eltonpang
eltonpang - comment - 17 Aug 2017

thanks again infograf768, fully understand what I need to do on each Joomla update. I did test it to work on my site without the string $offset = JFactory::getApplication()->get('offset');
so it should be as followings:?

if ($input->get('task') == 'save2copy')
{
$origTable = clone $this->getTable();
$origTable->load($input->getInt('id'));
$offset = JFactory::getApplication()->get('offset');
if ($data['title'] == $origTable->title)
{
list($title, $alias) = $this->generateNewTitle($data['catid'], $data['alias'], $data['title']);
$data['title'] = $title;
$data['alias'] = $alias;
$data['created'] = JFactory::getDate('now', $offset)->format('%Y-%m-%d');
$data['modified'] = JFactory::getDate('now', $offset)->format('%Y-%m-%d');
$data['publish_up'] = '';
$data['publish_down'] = '';
}
else

avatar infograf768
infograf768 - comment - 17 Aug 2017

I guess so. You should test by modifying the default server time zone.

Add a Comment

Login with GitHub to post a comment