Fix i18n language items for trophies
authorJoshua Rüsweg <josh@bastelstu.be>
Sun, 6 Aug 2017 09:47:41 +0000 (11:47 +0200)
committerJoshua Rüsweg <josh@bastelstu.be>
Sun, 6 Aug 2017 09:54:04 +0000 (11:54 +0200)
See #2315

wcfsetup/install/files/lib/acp/form/TrophyAddForm.class.php
wcfsetup/install/files/lib/acp/form/UserTrophyAddForm.class.php

index 8c41182f8c17955eb9552f4a7366c3ea7dde2dbf..490b7013693f8da430d7da532d1f1289d5b1deac 100644 (file)
@@ -5,6 +5,7 @@ use wcf\data\object\type\ObjectType;
 use wcf\data\trophy\category\TrophyCategoryCache;
 use wcf\data\trophy\Trophy;
 use wcf\data\trophy\TrophyAction;
+use wcf\data\trophy\TrophyEditor;
 use wcf\system\condition\ConditionHandler;
 use wcf\system\exception\UserInputException;
 use wcf\system\language\I18nValue;
@@ -139,11 +140,11 @@ class TrophyAddForm extends AbstractAcpForm {
                parent::readParameters();
                
                $titleI18n = new I18nValue('title');
-               $titleI18n->setLanguageItem('wcf.trophy.title', 'wcf.trophy', 'com.woltlab.wcf');
+               $titleI18n->setLanguageItem('wcf.user.trophy.title', 'wcf.user.trophy', 'com.woltlab.wcf');
                $this->registerI18nValue($titleI18n);
                
                $descriptionI18n = new I18nValue('description');
-               $descriptionI18n->setLanguageItem('wcf.trophy.description', 'wcf.trophy', 'com.woltlab.wcf');
+               $descriptionI18n->setLanguageItem('wcf.user.trophy.description', 'wcf.user.trophy', 'com.woltlab.wcf');
                $this->registerI18nValue($descriptionI18n);
                
                if (isset($_POST['tmpHash'])) {
@@ -283,6 +284,8 @@ class TrophyAddForm extends AbstractAcpForm {
                ]);
                $this->objectAction->executeAction();
                
+               $this->saveI18n($this->objectAction->getReturnValues()['returnValues'], TrophyEditor::class);
+               
                // transform conditions array into one-dimensional array
                $conditions = [];
                foreach ($this->conditions as $groupedObjectTypes) {
index 301431e7361b02570e4c5e87d62412683de97107..0b2b984349c9de9ab02c2a68274bf6432b473175 100644 (file)
@@ -3,6 +3,7 @@ namespace wcf\acp\form;
 use wcf\data\trophy\category\TrophyCategoryCache;
 use wcf\data\trophy\Trophy;
 use wcf\data\user\trophy\UserTrophyAction;
+use wcf\data\user\trophy\UserTrophyEditor;
 use wcf\data\user\UserProfile;
 use wcf\system\exception\UserInputException;
 use wcf\system\language\I18nHandler;
@@ -78,7 +79,7 @@ class UserTrophyAddForm extends AbstractAcpForm {
                parent::readParameters();
                
                $descriptionI18n = new I18nValue('description');
-               $descriptionI18n->setLanguageItem('wcf.user.trophy.description', 'wcf.trophy', 'com.woltlab.wcf');
+               $descriptionI18n->setLanguageItem('wcf.user.trophy.userTrophy.description', 'wcf.user.trophy', 'com.woltlab.wcf');
                $descriptionI18n->setFlags(I18nValue::ALLOW_EMPTY);
                $this->registerI18nValue($descriptionI18n);
        }
@@ -160,7 +161,7 @@ class UserTrophyAddForm extends AbstractAcpForm {
                parent::save();
                
                foreach ($this->userIDs as $user) {
-                       (new UserTrophyAction([], 'create', [
+                       $databaseObject = (new UserTrophyAction([], 'create', [
                                'data' => array_merge($this->additionalFields, [
                                        'trophyID' => $this->trophy->trophyID,
                                        'userID' => $user,
@@ -169,6 +170,8 @@ class UserTrophyAddForm extends AbstractAcpForm {
                                        'useCustomDescription' => $this->useCustomDescription
                                ])
                        ]))->executeAction();
+                       
+                       $this->saveI18n($databaseObject, UserTrophyEditor::class);
                }
                
                $this->reset();