Skip to content

Inline update on index deletes values from Currency field when not read only #11

@roadsend

Description

@roadsend
  • Laravel Version: #.#.#
  •     "laravel/framework": "^8.0",
    
  • Nova Version: #.#.#
    "laravel/nova": "^3.10",
  • PHP Version: #.#.#
    "php": "^7.4",

Description:

When a Currency field is used and another field is used with inline-text->updateOnIndex()
the value of the currency field is not set on the record when saved but is updated to null.

Detailed steps to reproduce the issue on a fresh Nova installation:

Create a test nova resource with the following fields

public function fields(Request $request)
{
    return [
        ID::make(__('ID'), 'id'),
        Currency::make('CPL', 'cost_per_lead')
        InlineText::make('Leads', 'qualified_leads_count')
            ->inlineOnIndex(),
];

}

I've added updateRules('sometimes') on CPL with no changes - it isn't a required field.

If the CPL data field is not nullable it generates a MySQL error on update - if it is nullable it is set to null

In the same example if you replace Currency with Number it works normally.

If you make Currency read only it works normally.

If you try and hack it by using two fields and onlyOnForms/ExceptOnForms to make it still is updated to null.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions