Fix when adding a new objectclass with required attributes, validation errors are correctly display on the returned form

This commit is contained in:
Deon George 2025-03-10 13:03:24 +11:00
parent ef2ea5e266
commit b34dad8836
2 changed files with 8 additions and 2 deletions

View File

@ -383,6 +383,11 @@ class HomeController extends Controller
: view('frames.'.$key['cmd'])) : view('frames.'.$key['cmd']))
->with('bases',$this->bases()); ->with('bases',$this->bases());
// If we are rendering a DN, rebuild our object
$o = config('server')->fetch($key['dn']);
foreach (collect(old())->except(['dn','_token']) as $attr => $value)
$o->{$attr} = $value;
return match ($key['cmd']) { return match ($key['cmd']) {
'create' => $view 'create' => $view
->with('container',old('container',$key['dn'])) ->with('container',old('container',$key['dn']))
@ -390,7 +395,8 @@ class HomeController extends Controller
'dn' => $view 'dn' => $view
->with('dn',$key['dn']) ->with('dn',$key['dn'])
->with('page_actions',collect(['edit'=>TRUE,'copy'=>TRUE])), ->with('o',$o)
->with('page_actions',collect(['edit'=>TRUE])),
'import' => $view, 'import' => $view,

View File

@ -1,7 +1,7 @@
@extends('layouts.dn') @extends('layouts.dn')
@section('page_title') @section('page_title')
@include('fragment.dn.header',['o'=>($o=config('server')->fetch($dn))]) @include('fragment.dn.header',['o'=>($o ?? $o=config('server')->fetch($dn))])
@endsection @endsection
@section('main-content') @section('main-content')