From 3e68efc75740a5e3da4317e7d97549c95cd57fba Mon Sep 17 00:00:00 2001 From: wangyuting Date: Mon, 21 Jul 2025 10:01:12 +0800 Subject: [PATCH] * [task#146631,done,1h,0h] Finish delete deliverable category. --- module/tree/control.php | 8 +++++++- module/tree/model.php | 7 ++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/module/tree/control.php b/module/tree/control.php index 600c1c65b0..aa9833a825 100644 --- a/module/tree/control.php +++ b/module/tree/control.php @@ -392,9 +392,15 @@ class tree extends control */ public function delete(int $moduleID, string $confirm = 'no') { + $module = $this->tree->getByID($moduleID); + if($module->type == 'deliverable') + { + $this->app->loadLang('deliverable'); + foreach($this->lang->deliverable->moduleLang as $langCode => $langLabel) $this->lang->tree->{$langCode} = $langLabel; + } + if($confirm == 'no') { - $module = $this->tree->getByID($moduleID); $confirmLang = $this->lang->tree->confirmDelete; if($module->type == 'doc' or $module->type == 'api') $confirmLang = $this->lang->tree->confirmDeleteMenu; if($module->type == 'line') $confirmLang = $this->lang->tree->confirmDeleteLine; diff --git a/module/tree/model.php b/module/tree/model.php index 5fba8571f4..b5b25306e6 100644 --- a/module/tree/model.php +++ b/module/tree/model.php @@ -1992,7 +1992,7 @@ class treeModel extends model */ public function update(int $moduleID, string $type = ''): bool { - $module = fixer::input('post')->cleanInt('branch')->get(); + $module = fixer::input('post')->cleanInt('branch')->setDefault('parent', 0)->get(); $self = $this->getById($moduleID); $changes = common::createChanges($self, $module); if(!isset($_POST['branch'])) $module->branch = $self->branch; @@ -2183,9 +2183,10 @@ class treeModel extends model $objectType = (!empty($module->type) && strpos($this->config->tree->groupTypes, ",$module->type,") !== false) ? 'chartgroup' : 'module'; /* Mark deletion when delete a module. */ $this->dao->update(TABLE_MODULE)->set('deleted')->eq(1)->where('id')->in($childs)->exec(); - foreach($childs as $childID) + + if($module->type != 'deliverable') { - $this->loadModel('action')->create($objectType, $childID, 'deleted', '', actionModel::CAN_UNDELETED); + foreach($childs as $childID) $this->loadModel('action')->create($objectType, $childID, 'deleted', '', actionModel::CAN_UNDELETED); } $this->fixModulePath($module->root, $module->type);