backoffice: fix javascript selection of multiple recipients (#15867)

This commit is contained in:
Frédéric Péters 2017-04-13 14:57:21 +02:00
parent 6c45cec968
commit b6b8c85aa5
1 changed files with 5 additions and 5 deletions

View File

@ -29,11 +29,11 @@ function prepare_widget_list_elements() {
var cur_name = $(this).attr('name');
var pos = cur_name.indexOf('element', prefix.length) + 7; // 7 == len(element)
var index = cur_name.substring(pos, cur_name.length);
var dash_pos = index.indexOf('-');
var after = '';
if (dash_pos != -1) {
after = index.substring(dash_pos, index.length);
}
var after_pos = Math.max(index.indexOf('-'), index.indexOf('$'));
var after = '';
if (after_pos != -1) {
after = index.substring(after_pos, index.length);
}
var new_name = cur_name.substring(0, cur_name.length-index.length) +
(parseInt(index)+1) + after;
$(this).attr('name', new_name);