File tree 2 files changed +14
-15
lines changed
2 files changed +14
-15
lines changed Original file line number Diff line number Diff line change @@ -356,13 +356,12 @@ function pre_deleteItem() {
356
356
}
357
357
358
358
//delete label translations
359
- $ translation = new PluginFieldsLabelTranslation ();
360
- $ translation ->delete (
361
- [
362
- 'itemtype ' => self ::getType (),
363
- 'items_id ' => $ this ->getID ()
364
- ]
365
- );
359
+ $ translation_obj = new PluginFieldsLabelTranslation ();
360
+ $ translations = $ translation_obj ->find ("plugin_fields_itemtype = ' " . self ::getType () .
361
+ "' AND plugin_fields_items_id = " . $ this ->fields ['id ' ]);
362
+ foreach ($ translations as $ translation_id => $ translation ) {
363
+ $ translation_obj ->delete (['id ' => $ translation_id ]);
364
+ }
366
365
367
366
//delete table
368
367
if (class_exists ($ classname )) {
Original file line number Diff line number Diff line change @@ -136,14 +136,6 @@ function pre_deleteItem() {
136
136
PluginFieldsDropdown::getClassname ($ this ->fields ['name ' ]));
137
137
}
138
138
139
- $ translation = new PluginFieldsLabelTranslation ();
140
- $ translation ->delete (
141
- [
142
- 'itemtype ' => self ::getType (),
143
- 'items_id ' => $ this ->getID ()
144
- ]
145
- );
146
-
147
139
$ container_obj = new PluginFieldsContainer ;
148
140
$ container_obj ->getFromDB ($ this ->fields ['plugin_fields_containers_id ' ]);
149
141
foreach (json_decode ($ container_obj ->fields ['itemtypes ' ]) as $ itemtype ) {
@@ -154,6 +146,14 @@ function pre_deleteItem() {
154
146
$ classname ::removeField ($ this ->fields ['name ' ]);
155
147
}
156
148
149
+ //delete label translations
150
+ $ translation_obj = new PluginFieldsLabelTranslation ();
151
+ $ translations = $ translation_obj ->find ("plugin_fields_itemtype = ' " . self ::getType () .
152
+ "' AND plugin_fields_items_id = " . $ this ->fields ['id ' ]);
153
+ foreach ($ translations as $ translation_id => $ translation ) {
154
+ $ translation_obj ->delete (['id ' => $ translation_id ]);
155
+ }
156
+
157
157
if (isset ($ oldname )) {
158
158
$ this ->fields ['name ' ] = $ oldname ;
159
159
}
You can’t perform that action at this time.
0 commit comments