* [refac] fix doc->update not work in extensions.

This commit is contained in:
sunhao
2025-02-24 16:25:46 +08:00
committed by 曹延义
parent 9b7286a165
commit 1f1f32a77e
2 changed files with 3 additions and 4 deletions
+1 -1
View File
@@ -640,7 +640,7 @@ class doc extends control
->removeIF($this->post->product === false, 'product')
->removeIF($this->post->execution === false, 'execution')
->get();
$result = $this->doc->update($docID, $docData, $doc);
$result = $this->doc->update($docID, $docData);
if(dao::isError())
{
if(!empty(dao::$errors['lib']) || !empty(dao::$errors['keywords'])) return $this->send(array('result' => 'fail', 'message' => dao::getError(), 'callback' => "zui.Modal.open({id: 'modalBasicInfo'});"));
+2 -3
View File
@@ -1589,11 +1589,10 @@ class docModel extends model
*
* @param int $docID
* @param object $doc
* @param object $oldDoc
* @access public
* @return array|string|bool
*/
public function update(int $docID, object $doc, ?object $oldDoc = null): array|string|bool
public function update(int $docID, object $doc): array|string|bool
{
/* 检查必填项。 Check required fields. */
$requiredFields = $doc->status == 'draft' ? 'title' : $this->config->doc->edit->requiredFields;
@@ -1606,7 +1605,7 @@ class docModel extends model
$files = $this->loadModel('file')->saveUpload('doc', $docID);
if(dao::isError()) return false;
$oldDoc = $oldDoc ? $oldDoc : $this->getByID($docID);
$oldDoc = $this->getByID($docID);
$changes = common::createChanges($oldDoc, $doc);
$oldRawContent = isset($oldDoc->rawContent) ? $oldDoc->rawContent : '';
$newRawContent = isset($doc->rawContent) ? $doc->rawContent : '';