Wrong message on duplicate TV with existing name #13221

Open
himurovich opened this Issue Dec 18, 2016 · 3 comments

Projects

None yet

3 participants

@himurovich

Summary

Wrong message lexicon is used for noticing non-unique TV name

Step to reproduce

Please open any existing TV, click on "Duplicate" button and enter new TV name, use some other existing TV name

Observed behavior

MODX reacts on non-unique name and returns message but with wrong lexicon key tv_err_ae
tv_err_ae

Expected behavior

right lexion here is tv_err_exists_name which contains "A Template Variable already exists with the name "[[+name]]".

Environment

MODX Revolution 2.5.1-pl

@Alroniks
Contributor

Spent some time for investigation. Not ready to prepare PR but leave here some info.
modTemplateVarDuplicateProcessor uses inherited method process and alreadyExists from common modObjectProcessor class. But in update and create processors used custom method that uses another lexicon, not that provided by modObjectProcessor.
modObjectProcessor build key such way:

if ($this->alreadyExists($name)) {
    $this->addFieldError($this->nameField, $this->modx->lexicon($this->objectType . '_err_ae', array('name' => $name)));
}

As result tv_err_ae that actually does not exist in lexicons. But exists tv_err_exists_name that uses in create/update. So easiest way just add new lexions, but I guess better to adopt duplicate processor for using already existing lang strings (and already translated).

@himurovich

Thanks @Alroniks for your deep investigation! Agree with you - it's better to adopt existing functional for that.

@himurovich himurovich closed this Jan 4, 2017
@himurovich himurovich reopened this Jan 4, 2017
@OptimusCrime
Contributor

Would you ( @himurovich and @Alroniks ) take a look at my PR in #13233 ?

I tried following your outline. Not sure if we agreed on the final solution or not.

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