From a5eadd5890f3922fe8f39665437932cafd166890 Mon Sep 17 00:00:00 2001 From: Stanislas Kita Date: Wed, 10 Sep 2025 16:12:41 +0200 Subject: [PATCH 1/2] Fix(container): fix classname resolution when multiple 's' at end --- CHANGELOG.md | 1 + inc/container.class.php | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2c9a62c6..34ece948 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - Fix for the `COALESCE` part of the `SQL query` for `multiple` dropdowns - Fix `search option` for `multiple` dropdown - Fix display from Planning view +- Fix `classname` resolution when multiple `s` at end of container name ## [1.21.23] - 2025-08-26 diff --git a/inc/container.class.php b/inc/container.class.php index d6750d44..8b9dab33 100644 --- a/inc/container.class.php +++ b/inc/container.class.php @@ -767,7 +767,9 @@ public static function preItemPurge($item) foreach ($founded_containers as $container) { $itemtypes = json_decode($container['itemtypes']); if (in_array($itemtype, $itemtypes)) { - $classname = 'PluginFields' . $itemtype . getSingular($container['name']); + $toolbox = new PluginFieldsToolbox(); + $container_name = $toolbox->getSystemNameFromLabel($container['label']); + $classname = self::getClassname($itemtype, $container_name); $fields = new $classname(); $fields->deleteByCriteria(['items_id' => $item->fields['id']], true); } From 2f0e8969c44b548ca0202bb77dc363e10d797b8d Mon Sep 17 00:00:00 2001 From: Stanislas Kita Date: Thu, 11 Sep 2025 09:03:56 +0200 Subject: [PATCH 2/2] fix --- inc/container.class.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/inc/container.class.php b/inc/container.class.php index 8b9dab33..3968e27e 100644 --- a/inc/container.class.php +++ b/inc/container.class.php @@ -767,9 +767,8 @@ public static function preItemPurge($item) foreach ($founded_containers as $container) { $itemtypes = json_decode($container['itemtypes']); if (in_array($itemtype, $itemtypes)) { - $toolbox = new PluginFieldsToolbox(); - $container_name = $toolbox->getSystemNameFromLabel($container['label']); - $classname = self::getClassname($itemtype, $container_name); + $classname = 'PluginFields' . $itemtype . getSingular($container['name']); + $classname = preg_replace('/s{2}$/i', 's', $classname); // in case name ends with 'ss' remove last 's' $fields = new $classname(); $fields->deleteByCriteria(['items_id' => $item->fields['id']], true); }