Skip to content

Commit 153913d

Browse files
committed
Version 4.8.6
2 parents d002d7c + 4823754 commit 153913d

5 files changed

Lines changed: 42 additions & 14 deletions

File tree

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
# (MODX)EvolutionCMS.plugins.ManagerManager.mm_ddMultipleFields changelog
22

33

4+
## Version 4.8.6 (2021-10-04)
5+
* \* Improved working with deprecated `id` columns.
6+
* \* Improved working with invalid JSON field values.
7+
8+
49
## Version 4.8.5 (2021-10-03)
510
* \* (MODX)EvolutionsCMS.libraries.ddTools is including from `assets/libs/ddTools/`, because ManagerManager does not contain the library files anymore.
611

CHANGELOG_ru.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
# (MODX)EvolutionCMS.plugins.ManagerManager.mm_ddMultipleFields changelog
22

33

4+
## Версия 4.8.6 (2021-10-04)
5+
* \* Улучшена работа с устаревшими колонками типа `id`.
6+
* \* Улучшена работа с невалидным JSON в значении полей.
7+
8+
49
## Версия 4.8.5 (2021-10-03)
510
* \* (MODX)EvolutionsCMS.libraries.ddTools подключается из `assets/libs/ddTools/`, потому что ManagerManager больше не содержит файлов библиотеки.
611

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "dd/evolutioncms-plugins-managermanager-mm_ddmultiplefields",
3-
"version": "4.8.5",
3+
"version": "4.8.6",
44
"description": "Widget for plugin ManagerManager that allows you to add any number of fields values (TV) in one document (values are written in field as a JSON object). For example: a few images.",
55
"keywords": [
66
"modx",

ddmultiplefields.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
33
* (MODX)EvolutionCMS.plugins.ManagerManager.mm_ddMultipleFields
4-
* @version 4.8.5 (2021-10-03)
4+
* @version 4.8.6 (2021-10-04)
55
*
66
* @link https://code.divandesign.biz/modx/mm_ddmultiplefields
77
*
@@ -103,7 +103,7 @@ function mm_ddMultipleFields($params){
103103
),
104104
'html',
105105
'jQuery.ddMM.mm_ddMultipleFields',
106-
'2.5.7'
106+
'2.5.9'
107107
);
108108

109109
$e->output($output);

jQuery.ddMM.mm_ddMultipleFields.js

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
/**
22
* jQuery.ddMM.mm_ddMultipleFields
3-
* @version 2.5.7 (2021-01-15)
3+
* @version 2.5.9 (2021-10-04)
44
*
55
* @uses jQuery 1.9.1
66
* @uses jQuery.ddTools 1.8.1
77
* @uses jQuery.ddMM 1.1.2
88
*
9-
* @copyright 2013–2020 [DD Group]{@link https://DivanDesign.biz }
9+
* @copyright 2013–2021 [DD Group]{@link https://DivanDesign.biz }
1010
*/
1111

1212
(function($){
@@ -189,7 +189,7 @@ $.ddMM.mm_ddMultipleFields = {
189189

190190
/**
191191
* @method init
192-
* @version 4.3.4 (2021-01-15)
192+
* @version 4.3.5 (2021-10-04)
193193
*
194194
* @desc Инициализация.
195195
*
@@ -236,9 +236,6 @@ $.ddMM.mm_ddMultipleFields = {
236236
if (columnObject.type == 'id'){
237237
columnIdIndex = columnIndex;
238238

239-
//Remove deprecated column
240-
delete instance.columns[columnIndex];
241-
242239
//Continue
243240
return true;
244241
}
@@ -257,7 +254,11 @@ $.ddMM.mm_ddMultipleFields = {
257254

258255
//Prepare width
259256
if (!columnObject.width){
260-
if (columnIndex > 0){
257+
if (
258+
//Preverious column exist
259+
$.isPlainObject(instance.columns[columnIndex - 1]) &&
260+
instance.columns[columnIndex - 1].width
261+
){
261262
//Take from preverious column
262263
instance.columns[columnIndex].width = instance.columns[columnIndex - 1].width;
263264
}else{
@@ -273,6 +274,15 @@ $.ddMM.mm_ddMultipleFields = {
273274
}
274275
);
275276

277+
//If deprecated ID column exists
278+
if (columnIdIndex != -1){
279+
//Remove it
280+
instance.columns.splice(
281+
columnIdIndex,
282+
1
283+
);
284+
}
285+
276286
var
277287
//Объект значения поля
278288
fieldValueObject = _this.init_prepareFieldValueObject({
@@ -359,7 +369,7 @@ $.ddMM.mm_ddMultipleFields = {
359369

360370
/**
361371
* @method init_prepareFieldValueObject
362-
* @version 1.0.2 (2020-05-25)
372+
* @version 1.1 (2021-10-04)
363373
*
364374
* @desc Инициализация → Подготовка объекта значений поля.
365375
*
@@ -390,7 +400,11 @@ $.ddMM.mm_ddMultipleFields = {
390400
) ==
391401
'{'
392402
){
393-
fieldValueObject = $.parseJSON(params.value);
403+
try {
404+
fieldValueObject = $.parseJSON(params.value);
405+
}catch{
406+
fieldValueObject = {};
407+
}
394408
//Bacward compatibility
395409
}else{
396410
var
@@ -411,8 +425,12 @@ $.ddMM.mm_ddMultipleFields = {
411425
rowId = _this.generateRowId()
412426
;
413427

414-
//If deprecated ID column exists
415-
if (params.columnIdIndex != -1){
428+
if (
429+
//If deprecated ID column exists
430+
params.columnIdIndex != -1 &&
431+
//And not empty
432+
columnValuesArray[params.columnIdIndex] != ''
433+
){
416434
rowId = columnValuesArray[params.columnIdIndex];
417435
}
418436

0 commit comments

Comments
 (0)