Merge branch 'rhymix:master' into master

This commit is contained in:
Lastorder 2026-02-27 18:04:35 +09:00 committed by GitHub
commit 25f6d02677
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
27 changed files with 945 additions and 1153 deletions

View file

@ -907,7 +907,7 @@ class DocumentController extends Document
}
// Handle extra vars that support file upload.
if ($extra_item->type === 'file' && is_array($value))
if ($extra_item->type === 'file' && $value)
{
$ev_output = $extra_item->uploadFile($value, $obj->document_srl, 'doc');
if (!$ev_output->toBool())
@ -1305,16 +1305,20 @@ class DocumentController extends Document
if ($extra_item->type === 'file')
{
// New upload
if (is_array($value) && isset($value['name']))
if (is_array($value) && isset($value['tmp_name']))
{
// Delete old file
if (isset($old_extra_vars[$idx]->value))
{
$fc_output = FileController::getInstance()->deleteFile($old_extra_vars[$idx]->value);
if (!$fc_output->toBool())
$old_file = FileModel::getFile($old_extra_vars[$idx]->value);
if ($old_file && $old_file->upload_target_srl == $obj->document_srl)
{
$oDB->rollback();
return $fc_output;
$fc_output = FileController::getInstance()->deleteFile($old_file->file_srl);
if (!$fc_output->toBool())
{
$oDB->rollback();
return $fc_output;
}
}
}
// Insert new file
@ -1339,21 +1343,22 @@ class DocumentController extends Document
return $ev_output;
}
// Delete old file
$fc_output = FileController::getInstance()->deleteFile($old_extra_vars[$idx]->value);
if (!$fc_output->toBool())
$old_file = FileModel::getFile($old_extra_vars[$idx]->value);
if ($old_file && $old_file->upload_target_srl == $obj->document_srl)
{
$oDB->rollback();
return $fc_output;
$fc_output = FileController::getInstance()->deleteFile($old_file->file_srl);
if (!$fc_output->toBool())
{
$oDB->rollback();
return $fc_output;
}
}
}
}
// Leave current file unchanged
elseif (!$value)
elseif (isset($old_extra_vars[$idx]->value))
{
if (isset($old_extra_vars[$idx]->value))
{
$value = $old_extra_vars[$idx]->value;
}
$value = $old_extra_vars[$idx]->value;
}
}
}

View file

@ -1650,6 +1650,10 @@ class DocumentItem extends BaseObject
return ModuleModel::getModuleInfoByModuleSrl($this->get('module_srl'))->browser_title;
}
/**
* Get the title of the module to which the document belongs.
* @return string
*/
function getBrowserTitle()
{
return $this->getModuleName();

View file

@ -111,6 +111,7 @@ class DocumentModel extends Document
foreach($GLOBALS['XE_EXTRA_KEYS'][$module_srl] as $idx => $key)
{
$document_extra_vars[$idx] = clone($key);
$document_extra_vars[$idx]->parent_srl = $document_srl;
// set variable value in user language
if(isset($document_extra_values[$idx][$user_lang_code]))