? Success

User tests: Successful: Unsuccessful:

avatar infograf768
infograf768
17 Oct 2014

See #4702
When trying to Save and Copy a module, the new module does not get (copy) appended to the title (regression vs 2.5)
The issue comes from the change from var to input.
Here is a tentative patch, restoring the former behaviour.

Votes

# of Users Experiencing Issue
0/1
Average Importance Score
3.00

avatar infograf768 infograf768 - open - 17 Oct 2014
avatar jissues-bot jissues-bot - change - 17 Oct 2014
Labels Added: ?
avatar 1apweb 1apweb - test_item - 17 Oct 2014 - Tested successfully
avatar ChrisHoefliger
ChrisHoefliger - comment - 17 Oct 2014

Test done with different types of modules. All will get appended 'copy' when saved as copy.

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

avatar joomdonation
joomdonation - comment - 17 Oct 2014

Sorry @infograf768. The code doesn't look right to me. The original code is supposed to work as below:

  1. If you don't change the title before press "Save & Copy" button, the new module will be unpublished and title as " Copy" text appended.

  2. If you change the title before press, the system will save the title of the module as how it is and leave it as published

To me, that's logical. However, with your propose code, actually $data['title'] == $orig_data['title'] is always return true, so title of the module is always changed and the module is always unpublished. To me, that's an unexpected behavior.

avatar infograf768
infograf768 - comment - 17 Oct 2014

@joomdonation
Agree, this is wrong

avatar infograf768
infograf768 - comment - 17 Oct 2014

The original error is in getting the id
PHP Notice: Undefined index: id in ROOT
/administrator/components/com_modules/models/module.php on line 935

avatar joomdonation
joomdonation - comment - 17 Oct 2014

Could you update that block of code with the following code:

if ($input->get('task') == 'save2copy')
{
    $orig_table = clone $this->getTable();
    $orig_table->load((int) $input->getInt('id'));
    if ($data['title'] == $orig_table->title)
    {
        $data['title'] .= ' ' . JText::_('JGLOBAL_COPY');
        $data['published'] = 0;
    }
}
avatar infograf768
infograf768 - comment - 17 Oct 2014

Testing

avatar jespersoelundhansen jespersoelundhansen - test_item - 17 Oct 2014 - Tested successfully
avatar micker micker - test_item - 17 Oct 2014 - Tested successfully
avatar infograf768
infograf768 - comment - 17 Oct 2014

Although this now behaves as it does in 2.5, I don't think it is right.
What I expect when using save and copy is to save the original module with any modifications done and then copy it to a new instance with a (copy) in the title and unpublished if the new instance is not modified before save.

What we get —with both patches— is saving the original module as it was before modifications.

avatar joomdonation
joomdonation - comment - 17 Oct 2014

@infograf768 : The label of the button is "Save as Copy", not "Save & Copy" so I think it is working as it should. Maybe others have different ideas ?

avatar infograf768
infograf768 - comment - 17 Oct 2014

LOL. you are right

avatar infograf768
infograf768 - comment - 17 Oct 2014

I still think we should unpublish the copied module by default, what you think?

avatar joomdonation
joomdonation - comment - 17 Oct 2014

LOL. Then maybe you can update your PR with new code, then lets other tests it and get it merged :).

avatar lunalars
lunalars - comment - 17 Oct 2014

agree with @infograf768 - copied module should always be unpublished.

avatar infograf768
infograf768 - comment - 17 Oct 2014

New tests needed

avatar seakson
seakson - comment - 17 Oct 2014

I am test save and copy module. module is copy config but save multiple times title not change. format "title module (copy)"

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

avatar joomdonation
joomdonation - comment - 17 Oct 2014

I think if users change title before pressing Save & Copy, maybe they are ready to have the module published. If he doesn't want to publish, he can change published from Yes to No.

So I think just leave the state of the copied module as how users setup it. Otherwise, it might causes users an extra step.

Not sure how other users think about it.

avatar infograf768
infograf768 - comment - 17 Oct 2014

Save as Copy unpublishes the item in all core

avatar joomdonation
joomdonation - comment - 17 Oct 2014

@infograf768 Yes, checked and confirmed. However, checking Save as Copy in Joomla core Articles component also showing that the title doesn't have ' Copy' appended. They also use title (2), title (3)...

avatar lunalars
lunalars - comment - 17 Oct 2014

if i need to save&copy a module, i first change the title and save it (save&copy) and then go on and make more changes.
i think the extra step is ok as you have another chance to check if all is correct.
also, if this is default core behaviour, it should be consistent.

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

avatar garstud garstud - test_item - 17 Oct 2014 - Tested successfully
avatar joomdonation
joomdonation - comment - 17 Oct 2014

OK. So do we need to change the title of the copied module from Title (Copy) to Title (2), Title (3) ....to make the behavior consistent all in core ? Of use Title (Copy) is enough ?

Of just use Title (Copy), then you have a good test from me.

avatar garstud
garstud - comment - 17 Oct 2014

test works. if click 'save as copy' without renaming the title, the '(copy)' label is added to the end of the title of the dupplicated module.
if i change the title just before click on 'save as copy', the module title becomes the new title without the '(copy)' label.
great.

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

avatar infograf768 infograf768 - close - 17 Oct 2014
avatar infograf768 infograf768 - change - 17 Oct 2014
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2014-10-17 08:53:38
avatar infograf768
infograf768 - comment - 17 Oct 2014

Thanks folks. Let's keep it as it was in 2.5.

avatar joomdonation
joomdonation - comment - 17 Oct 2014

OK. Then we are good. Thanks All :).

Add a Comment

Login with GitHub to post a comment