mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-04-29 15:22:15 +09:00
Fix error message when leaving current file unchanged in extra vars
This commit is contained in:
parent
65d68eec6d
commit
453f83db7d
3 changed files with 25 additions and 11 deletions
|
|
@ -232,9 +232,10 @@ class Value
|
|||
* Validate a value.
|
||||
*
|
||||
* @param mixed $value
|
||||
* @param mixed $old_value
|
||||
* @return ?BaseObject
|
||||
*/
|
||||
public function validate($value): ?BaseObject
|
||||
public function validate($value, $old_value = null): ?BaseObject
|
||||
{
|
||||
// Take legacy encoding into consideration.
|
||||
if (is_array($value))
|
||||
|
|
@ -256,6 +257,11 @@ class Value
|
|||
// Check if a required value is empty.
|
||||
if ($this->is_required === 'Y')
|
||||
{
|
||||
if ($this->type === 'file' && !$value && $old_value)
|
||||
{
|
||||
$value = $old_value;
|
||||
$values = (array)$old_value;
|
||||
}
|
||||
if ($is_array && trim(implode('', $values)) === '')
|
||||
{
|
||||
return new BaseObject(-1, sprintf(lang('common.filter.isnull'), Context::replaceUserLang($this->name)));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue