Fixed issue#312 - In object manager, blank line in object deleted all values for selections.

This commit is contained in:
Martin Edenhofer 2016-11-04 08:42:46 +01:00
parent b9b8f1df46
commit 307b9dc744
4 changed files with 42 additions and 14 deletions

View file

@ -4,6 +4,7 @@
- 2016-10-28 Implemented issue#[317](https://github.com/zammad/zammad/issues/317) - Display origin url from tweet/facebook post in article view.
## Zammad 1.0.1
- 2016-11-04 Fixed issue#[312](https://github.com/zammad/zammad/issues/312) - In object manager, blank line in object deleted all values for selections.
- 2016-11-04 Fixed issue#[286](https://github.com/zammad/zammad/issues/286) - Answers from google mail shows complete quote.
- 2016-11-03 Fixed issue#[348](https://github.com/zammad/zammad/issues/348) - IMAP mail fetching stops because of broken spam email (invalid Content-Transfer-Encoding header)
- 2016-10-29 Fixed issue#[326](https://github.com/zammad/zammad/issues/326) - Create emails via fetchmail / procmail.

View file

@ -108,7 +108,7 @@ class App.ControllerForm extends App.Controller
if @fullForm
if !@formClass
@formClass = ''
fieldset = $('<form class="' + @formClass + '"><button class="btn">' + App.i18n.translateContent('Submit') + '</button></form>').prepend( fieldset )
fieldset = $('<form class="' + @formClass + '" autocomplete="off"><button class="btn">' + App.i18n.translateContent('Submit') + '</button></form>').prepend( fieldset )
# bind form events
if @events
@ -489,21 +489,21 @@ class App.ControllerForm extends App.Controller
inputSelectObject = {}
for key of param
parts = key.split '::'
if parts[0] && parts[1]
if parts[1] && !inputSelectObject[ parts[0] ]
if parts[0] && parts[1] isnt undefined
if parts[1] isnt undefined && !inputSelectObject[ parts[0] ]
inputSelectObject[ parts[0] ] = {}
if parts[2] && !inputSelectObject[ parts[0] ][ parts[1] ]
if parts[2] isnt undefined && !inputSelectObject[ parts[0] ][ parts[1] ]
inputSelectObject[ parts[0] ][ parts[1] ] = {}
if parts[3] && !inputSelectObject[ parts[0] ][ parts[1] ][ parts[2] ]
if parts[3] isnt undefined && !inputSelectObject[ parts[0] ][ parts[1] ][ parts[2] ]
inputSelectObject[ parts[0] ][ parts[1] ][ parts[2] ] = {}
if parts[3]
if parts[3] isnt undefined
inputSelectObject[ parts[0] ][ parts[1] ][ parts[2] ][ parts[3] ] = param[ key ]
delete param[ key ]
else if parts[2]
else if parts[2] isnt undefined
inputSelectObject[ parts[0] ][ parts[1] ][ parts[2] ] = param[ key ]
delete param[ key ]
else if parts[1]
else if parts[1] isnt undefined
inputSelectObject[ parts[0] ][ parts[1] ] = param[ key ]
delete param[ key ]

View file

@ -30,4 +30,4 @@ class App.UiElement.select extends App.UiElement.ApplicationUiElement
@filterOption(attribute, params)
# return item
$( App.view('generic/select')( attribute: attribute ) )
$( App.view('generic/select')(attribute: attribute) )

View file

@ -551,9 +551,9 @@ test("form handler check with and without fieldset", function() {
}
var formChanges = function(params, attribute, attributes, classname, form, ui) {
console.log('FROM', form)
//console.log('FROM', form)
if (params['select1'] === 'b') {
console.log('lala', params)
//console.log('select1 -> b', params)
var item = {
name: 'select2',
display: 'Select2',
@ -566,7 +566,7 @@ test("form handler check with and without fieldset", function() {
form.find('[name="select2"]').closest('.form-group').replaceWith(newElement)
}
if (params['select1'] === 'a') {
console.log('lala', params)
//console.log('select1 -> a', params)
var item = {
name: 'select2',
display: 'Select2',
@ -938,8 +938,35 @@ test("form params check", function() {
select3: '',
select4: '',
}
console.log('params', params)
console.log('test_params', test_params)
//console.log('params', params)
//console.log('test_params', test_params)
deepEqual(params, test_params, 'form param check')
});
test("form params check direct", function() {
$('#forms').append('<hr><h1>form params check direct</h1><form id="form10"><input name="a" value="b"><input name="l::l::l1" value="d"><input name="l::l::" value><input name="f::f::" value><input name="f::f::f1" value="e"></form>')
var el = $('#form10')
params = App.ControllerForm.params(el)
test_params = {
a: 'b',
l: {
l: {
l1: 'd',
'': '',
},
},
f: {
f: {
f1: 'e',
'': '',
},
},
}
//console.log('params', params)
//console.log('test_params', test_params)
deepEqual(params, test_params, 'form param check')
});