From f0537de0294cc5943369ea225662faea3bf1b1f3 Mon Sep 17 00:00:00 2001 From: wangyidong Date: Thu, 8 Aug 2024 15:22:13 +0800 Subject: [PATCH] + [pref story #49397] Add model moveLib method. --- module/doc/config/form.php | 5 +++++ module/doc/model.php | 14 ++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/module/doc/config/form.php b/module/doc/config/form.php index 4c32424297..04cfd253e9 100644 --- a/module/doc/config/form.php +++ b/module/doc/config/form.php @@ -66,3 +66,8 @@ $config->doc->form->edit['users'] = array('type' => 'array', 'required' $config->doc->form->edit['mailto'] = array('type' => 'array', 'required' => false, 'default' => '', 'filter' => 'join'); $config->doc->form->edit['editedBy'] = array('type' => 'string', 'required' => false, 'default' => ''); $config->doc->form->edit['editedDate'] = array('type' => 'datetime', 'required' => false, 'default' => $now); + +$config->doc->form->movelib['space'] = array('type' => 'string', 'required' => true, 'default' => ''); +$config->doc->form->movelib['acl'] = array('type' => 'string', 'required' => true, 'default' => ''); +$config->doc->form->movelib['groups'] = array('type' => 'array', 'required' => false, 'default' => '', 'filter' => 'join'); +$config->doc->form->movelib['users'] = array('type' => 'array', 'required' => false, 'default' => '', 'filter' => 'join'); diff --git a/module/doc/model.php b/module/doc/model.php index b5d1f1ff23..b5ab2d04a6 100644 --- a/module/doc/model.php +++ b/module/doc/model.php @@ -2978,4 +2978,18 @@ class docModel extends model return !dao::isError(); } + + public function moveLib(int $libID, object $data): bool + { + $lib = $this->getLibByID($libID); + $changes = common::createChanges($lib, $data); + if(empty($changes)) return false; + + unset($data->space); + $this->dao->update(TABLE_DOCLIB)->data($data)->where('id')->eq($libID)->exec(); + + $actionID = $this->loadModel('action')->create('docLib', $libID, 'Moved', '', json_encode(array('from' => $lib->type == 'mine' ? 'mine' : $lib->parent, 'to' => $data->type == 'mine' ? 'mine' : $data->parent))); + $this->action->logHistory($actionID, $changes); + return true; + } }