+ [pref story #49397] Add model moveLib method.
This commit is contained in:
@@ -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');
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user