Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multilingual associations doesnt save language #14562

Closed
brianteeman opened this issue Mar 13, 2017 · 27 comments
Closed

Multilingual associations doesnt save language #14562

brianteeman opened this issue Mar 13, 2017 · 27 comments

Comments

@brianteeman
Copy link
Contributor

brianteeman commented Mar 13, 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

@brianteeman
Copy link
Contributor Author

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

@wilsonge
Copy link
Contributor

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

@infograf768
Copy link
Member

Testing now

@infograf768
Copy link
Member

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.

@infograf768
Copy link
Member

infograf768 commented Mar 20, 2017

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

@brianteeman
Copy link
Contributor Author

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.

@infograf768
Copy link
Member

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.

@infograf768
Copy link
Member

I guess we should look at the controller

@brianteeman
Copy link
Contributor Author

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.

@infograf768
Copy link
Member

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

@infograf768
Copy link
Member

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

@dgt41 @Fedik
we need help here.

@brianteeman
Copy link
Contributor Author

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

@infograf768
Copy link
Member

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.

@brianteeman
Copy link
Contributor Author

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

@infograf768
Copy link
Member

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.

@alikon
Copy link
Contributor

alikon commented Mar 20, 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

@Fedik
Copy link
Member

Fedik commented Mar 20, 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 😄

@alikon
Copy link
Contributor

alikon commented Mar 20, 2017

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

@infograf768
Copy link
Member

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?

@Fedik
Copy link
Member

Fedik commented Mar 21, 2017

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

@infograf768
Copy link
Member

Not if one uses Save Target...

@infograf768
Copy link
Member

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...

@infograf768
Copy link
Member

@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');
}

@Fedik
Copy link
Member

Fedik commented Mar 21, 2017

hm tricky, I have no better idea currently

@infograf768
Copy link
Member

will make pr

@joomla-cms-bot
Copy link

Set to "closed" on behalf of @infograf768 by The JTracker Application at issues.joomla.org/joomla-cms/14562

@infograf768
Copy link
Member

Closed as we have a PR

#14834


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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants