?
avatar brianteeman
brianteeman
13 Mar 2017

Steps to reproduce the issue

Using Multilingual Associations select an article and a target language
Select Copy reference to target in the toolbar
Message on screen that the new article has been saved
Close and return to the article manager

Expected result

A duplicate article has been created but in the selected target language

Actual result

An unpublished article (see #14561) has been created but instead of it being in the target language you selected it is in the default language

System information (as much as possible)

Additional comments

avatar brianteeman brianteeman - open - 13 Mar 2017
avatar joomla-cms-bot joomla-cms-bot - change - 13 Mar 2017
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 13 Mar 2017
avatar brianteeman
brianteeman - comment - 13 Mar 2017

Note it says default language which is odd as this isnt actually something you can select anywhere else as the language for anything????

avatar wilsonge
wilsonge - comment - 13 Mar 2017

@infograf768 this seems like a pretty big bug. Adding a release blocker here

avatar wilsonge wilsonge - change - 13 Mar 2017
Labels Added: ?
avatar wilsonge wilsonge - labeled - 13 Mar 2017
avatar infograf768
infograf768 - comment - 20 Mar 2017

Testing now

avatar infograf768
infograf768 - comment - 20 Mar 2017

I can't reproduce.

Default Language is English en-GB.
Displaying a French article. Target is Italian.
The new target article is saved correctly with Italian language.

assoctarget

@wilsonge
Please take off the release blocker until we get a better explanation of the possible bug.

avatar infograf768
infograf768 - comment - 20 Mar 2017

I see why Brian got that: he did not save the new target, just closed it.

avatar brianteeman
brianteeman - comment - 20 Mar 2017

Yes that is what I said in the report. Note that my report also stated that you get the message that the reference article has been saved.

you can see in your own movie above that after clicking on copy reference to target you get a message that the article has been saved.

and it has been saved but with the non-existant language "default" - you can see this if you go to the article manager and view a list of all the articles.

avatar infograf768
infograf768 - comment - 20 Mar 2017

Yes, I did confirm that. The Target has to be Saved with "Save Target" before.

As for the Reference article, when we use "Copy Reference to Target", it pre-save it with the new association. That is normal and will work fine if the Target is saved before Closing.

Closing as you did does not create an association and the new article is saved with no tagged language, therefore its language is displayed as Default by this code in /layouts/joomla/content/language.php

if ($item->language == '')
{
	echo JText::_('JDEFAULT');
}

Now what can we do about it?
Not fully sure.
Correct behaviour would be to not save the new item at all if Save Target is not used.

avatar infograf768
infograf768 - comment - 20 Mar 2017

I guess we should look at the controller

avatar brianteeman
brianteeman - comment - 20 Mar 2017

Correct behaviour would be to not save the new item at all if Save Target is not used

Why wouldn't the correct behaviour be to save it with the selected language in the first place. The item language was selected already on the process - you can't copy reference to target until you have selected a language.

avatar infograf768
infograf768 - comment - 20 Mar 2017

Why do you think we have a Save Target for?
Anyhow, patch is welcome

avatar infograf768
infograf768 - comment - 20 Mar 2017

hmm, it may be in the js file...

@dgt41 @Fedik
we need help here.

avatar brianteeman
brianteeman - comment - 20 Mar 2017

We have a save target for subsequent changes after the creation and saving of the initial item.

avatar infograf768
infograf768 - comment - 20 Mar 2017

one has to understand that when using copy reference, it copies everything except the language.
it is very likely that many modifications have to be done to the target:

title, alias, category are the usual main ones.
therefore target in that case has always to be saved before the association is created.
that works fine.

we therefore have tp prevent closing when the language is empty or display an alert.

avatar brianteeman
brianteeman - comment - 20 Mar 2017

While i disagree with this approach you still should not be setting the language to the non existent string 'default'

avatar infograf768
infograf768 - comment - 20 Mar 2017

i am not setting anything voluntarily. it comes from the way the feature is used. i am sure we will find a way for people who close instead of saving. patience.

avatar alikon
alikon - comment - 20 Mar 2017

the copy reference is something like as "set to work in progress "
before this issue i've never experienced this situation , cause i've always pushed the "save target" button after pushing a copy reference button, yuo can blame me as a bad tester ?
but , the target language should be the actual language not "DEFAULT" even if you don't complete the entire workflow
i think this is a valid point

avatar Fedik
Fedik - comment - 20 Mar 2017

It seems something with component logic in general. It create a new article when push "copy reference", but do not add "association" between "reference article" and "target".

In result it can produce 1000 "un-associated" articles, with strange new language "default" ?
Where is this country Default? I want to visit there ?

avatar alikon
alikon - comment - 20 Mar 2017

if you push the copy reference button then the target language is already setted
maybe is only a bug ?

avatar infograf768
infograf768 - comment - 21 Mar 2017

The issue is that save2copy is a generic method. It can't therefore pick up the Target language when creating the new Target when using Copy Reference to Target.

I have a patch implementing an alert reminding user to use the "Save Target" before confirming Closing.
It would display anytime the Close button is used.

It would give this:

screen shot 2017-03-21 at 12 12 53

What do you think?

avatar Fedik
Fedik - comment - 21 Mar 2017

@infograf768 but even with the alert, the "draft" article will remain after user push "ok" in the alert

avatar infograf768
infograf768 - comment - 21 Mar 2017

Not if one uses Save Target...

avatar infograf768
infograf768 - comment - 21 Mar 2017

I.e. one should cancel the alert, then Save Target, then can click OK.
Same behaviour with the Alert behaviour for items delete. If one clicks OK and did not want to delete, it will be too late...

avatar infograf768
infograf768 - comment - 21 Mar 2017

@Fedik
If you have a better idea, look at
https://github.com/joomla/joomla-cms/blob/staging/media/com_associations/js/sidebyside-uncompressed.js

to Copy reference, we use

else if(task == 'copy')
		{
			window.frames['reference-association'].Joomla.submitbutton(document.getElementById('adminForm').getAttribute('data-associatedview') + '.save2copy');
}
avatar Fedik
Fedik - comment - 21 Mar 2017

hm, I have no better idea currently

avatar infograf768
infograf768 - comment - 21 Mar 2017

will make pr

avatar infograf768 infograf768 - change - 21 Mar 2017
Status New Closed
Closed_Date 0000-00-00 00:00:00 2017-03-21 15:39:34
Closed_By infograf768
avatar joomla-cms-bot joomla-cms-bot - change - 21 Mar 2017
Closed_By infograf768 joomla-cms-bot
avatar joomla-cms-bot joomla-cms-bot - close - 21 Mar 2017
avatar joomla-cms-bot
joomla-cms-bot - comment - 21 Mar 2017
avatar infograf768
infograf768 - comment - 21 Mar 2017

Closed as we have a PR

#14834


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

avatar zero-24 zero-24 - change - 16 Oct 2017
Labels Removed: ?
avatar zero-24 zero-24 - unlabeled - 16 Oct 2017

Add a Comment

Login with GitHub to post a comment