Merge remote-tracking branch 'upstream/master' into master

This commit is contained in:
Lastorder-DC 2025-10-27 23:09:27 +09:00
commit 1c8ae0d766
52 changed files with 447 additions and 1007 deletions

View file

@ -239,6 +239,7 @@ class DocumentModel extends Document
$sort_check = self::_setSortIndex($obj, $load_extra_vars);
$obj->sort_index = $sort_check->sort_index;
$obj->isExtraVars = $sort_check->isExtraVars;
$obj->isExtraVarsSortAsNumber = $sort_check->isExtraVarsSortAsNumber;
$obj->except_notice = $except_notice;
$obj->columnList = $columnList;
@ -672,6 +673,7 @@ class DocumentModel extends Document
$sort_check = self::_setSortIndex($opt);
$opt->sort_index = $sort_check->sort_index;
$opt->isExtraVars = $sort_check->isExtraVars;
$opt->isExtraVarsSortAsNumber = $sort_check->isExtraVarsSortAsNumber;
self::_setSearchOption($opt, $args, $query_id, $use_division);
@ -1348,6 +1350,7 @@ class DocumentModel extends Document
$args = new stdClass;
$args->sort_index = $obj->sort_index ?? null;
$args->isExtraVars = false;
$args->isExtraVarsSortAsNumber = false;
// check it's default sort
$default_sort = array('list_order', 'regdate', 'last_update', 'update_order', 'readed_count', 'voted_count', 'blamed_count', 'comment_count', 'trackback_count', 'uploaded_count', 'title', 'category_srl');
@ -1363,20 +1366,20 @@ class DocumentModel extends Document
return $args;
}
$eids = array();
foreach($extra_keys as $idx => $key)
foreach($extra_keys as $extra_key)
{
$eids[] = $key->eid;
if ($args->sort_index === $extra_key->eid)
{
$args->isExtraVars = true;
if ($extra_key->type === 'number')
{
$args->isExtraVarsSortAsNumber = true;
}
return $args;
}
}
// check it exists in extra keys of the module
if(!in_array($args->sort_index, $eids))
{
$args->sort_index = 'list_order';
return $args;
}
$args->isExtraVars = true;
$args->sort_index = 'list_order';
return $args;
}
@ -1560,7 +1563,14 @@ class DocumentModel extends Document
{
$args->sort_eid = $args->sort_index;
$args->sort_lang = Context::getLangType();
$args->sort_index = 'extra_sort.value';
if ($searchOpt->isExtraVarsSortAsNumber ?? false)
{
$args->sort_index = 'extra_sort.sort_value';
}
else
{
$args->sort_index = 'extra_sort.value';
}
}
$query_id = 'document.getDocumentListWithExtraVars';
}