Merge pull request #478 from ivandiazwm/master

Bug fixing
This commit is contained in:
Ivan Diaz 2019-02-28 23:41:22 -03:00 committed by GitHub
commit 3b84142004
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 19 additions and 10 deletions

View File

@ -15,7 +15,7 @@ before_install:
- mysql -e 'CREATE DATABASE development;'
- nvm install 6.14.4
- npm install -g npm@6.1.0
- npm install -g mocha
- npm install -g mocha@5.2.0
- cd client
- npm install
- cd ../tests

View File

@ -185,21 +185,24 @@ class AdminPanelEmailSettings extends React.Component {
</div>
</div>
<FormField label={i18n('TEXT') + '1'} name="text1" validation="TEXT_AREA" required
<FormField key="text1" label={i18n('TEXT') + '1'} name="text1" validation="TEXT_AREA" required
decorator={'textarea'}
fieldProps={{className: 'admin-panel-email-settings__text-area'}}/>
{(this.state.form.text2) ?
<FormField label={i18n('TEXT') + '2'} name="text2" validation="TEXT_AREA" required
<FormField key="text2" label={i18n('TEXT') + '2'} name="text2" validation="TEXT_AREA" required
decorator={'textarea'}
fieldProps={{className: 'admin-panel-email-settings__text-area'}}/> : null}
{(this.state.form.text3) ?
<FormField label={i18n('TEXT') + '3'} name="text3" validation="TEXT_AREA" required
<FormField key="text3" label={i18n('TEXT') + '3'} name="text3" validation="TEXT_AREA" required
decorator={'textarea'}
fieldProps={{className: 'admin-panel-email-settings__text-area'}}/> : null}
<div className="admin-panel-email-settings__actions">
<div className="admin-panel-email-settings__save-button">
<SubmitButton type="secondary" size="small">{i18n('SAVE')}</SubmitButton>
<SubmitButton key="submit-email-template" type="secondary" size="small" onClick={e => {
e.preventDefault();
this.onFormSubmit(this.state.form);
}}>{i18n('SAVE')}</SubmitButton>
</div>
<div className="admin-panel-email-settings__optional-buttons">
{(this.state.edited) ? this.renderDiscardButton() : null}
@ -245,7 +248,6 @@ class AdminPanelEmailSettings extends React.Component {
onValidateErrors: (errors) => {
this.setState({errors})
},
onSubmit: this.onFormSubmit.bind(this)
}
}

View File

@ -530,5 +530,10 @@ module.exports = [
]
};
}
},
{
path: '/system/get-custom-fields',
time: 100,
data: []
}
];

View File

@ -159,6 +159,7 @@ module.exports = [
email: 'kurt@currycurrylady.hs',
verified: false,
sendEmailOnNewTicket: true,
customfields: [],
tickets: _.times(13).map(() => {
return {
ticketNumber: '118551',
@ -379,6 +380,7 @@ module.exports = [
name: 'Haskell Curry',
email: 'haskell@lambda.com',
sendEmailOnNewTicket: true,
customfields: [],
tickets: [
{
ticketNumber: '445441',

View File

@ -36,7 +36,7 @@ class EditMailTemplateController extends Controller {
const PATH = '/edit-mail-template';
const METHOD = 'POST';
private $langauge;
private $language;
private $templateType;
private $subject;
private $texts;
@ -92,21 +92,21 @@ class EditMailTemplateController extends Controller {
public function validateReplacements() {
$originalText = MailTexts::getTexts()[$this->language][$this->templateType];
if(!$this->includes(
if(array_key_exists(1, $originalText) && !$this->includes(
$this->getReplacementStrings($originalText[1]),
$this->getReplacementStrings($this->texts[0])
)) {
throw new RequestException(ERRORS::INVALID_TEXT_1);
}
if(!$this->includes(
if(array_key_exists(2, $originalText) && !$this->includes(
$this->getReplacementStrings($originalText[2]),
$this->getReplacementStrings($this->texts[1])
)) {
throw new RequestException(ERRORS::INVALID_TEXT_2);
}
if(!$this->includes(
if(array_key_exists(3, $originalText) && !$this->includes(
$this->getReplacementStrings($originalText[3]),
$this->getReplacementStrings($this->texts[2])
)) {