From bc0a4bb1070dd78e116cc3726a01b14256ce8cc9 Mon Sep 17 00:00:00 2001 From: Linty Date: Tue, 5 Nov 2024 18:20:42 +0100 Subject: [PATCH] fixes #2237 added a temporary parameter to pwg.images.setInfo it's also adapted in the batch manager unit js file --- admin/themes/default/js/batchManagerUnit.js | 5 +++-- include/ws_functions/pwg.images.php | 14 ++++++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/admin/themes/default/js/batchManagerUnit.js b/admin/themes/default/js/batchManagerUnit.js index fa88aa1de..f2783e9df 100644 --- a/admin/themes/default/js/batchManagerUnit.js +++ b/admin/themes/default/js/batchManagerUnit.js @@ -357,7 +357,7 @@ function saveChanges(pictureId) { // Get Tags let tags = []; $("#picture-" + pictureId + " #tags option").each(function () { - let tagId = $(this).val().replace(/~~/g, ''); + let tagId = $(this).val(); tags.push(tagId); }); let tagsStr = tags.join(','); @@ -369,7 +369,8 @@ function saveChanges(pictureId) { date_creation: date_creation, comment: comment, categories: categoriesStr, - tag_ids: tagsStr, + // tag_ids: tagsStr, + tag_list: tags, level: level, single_value_mode: "replace", multiple_value_mode: "replace", diff --git a/include/ws_functions/pwg.images.php b/include/ws_functions/pwg.images.php index 7d62f0957..bb99351ec 100644 --- a/include/ws_functions/pwg.images.php +++ b/include/ws_functions/pwg.images.php @@ -2630,6 +2630,20 @@ SELECT * ); } } + + // Temporary use of the batch manager's unit mode, + // not to be used by an external application, + // as this code bellow will be deleted when a tag selector is added. + if (isset($_REQUEST['tag_list'])) + { + if (isset($params['tag_ids'])) + { + return new PwgError(WS_ERR_INVALID_PARAM, 'Do not use tag_list and tag_ids at the same time.'); + } + + $tag_list = get_tag_ids($_REQUEST['tag_list']); + set_tags($tag_list, $params['image_id']); + } invalidate_user_cache(); }