'', 'address' => '', 'postal_code' => '', 'city' => '', 'country' => '', 'region' => '', 'vat_id' => '', 'tax_number' => '', 'phone' => '', 'fax' => '', 'email' => '', 'support_email' => '', 'support_phone' => '', 'billing_email' => '', 'website' => '', 'privacy_url' => '', 'imprint_url' => '', 'primary_color' => '', 'primary_color_use_default' => 0, 'status' => 'active', ]; if (isset($_POST['description'])) { $currentUserId = (int) ($_SESSION['user']['id'] ?? 0); $result = TenantService::createFromAdmin($_POST, $currentUserId); $form = $result['form'] ?? $form; $errors = $result['errors'] ?? []; if ($result['ok'] ?? false) { $action = (string) ($_POST['action'] ?? 'create'); if ($action === 'create_close') { Flash::success('Tenant created', 'admin/tenants', 'tenant_created'); Router::redirect('admin/tenants'); } else { $uuid = (string) ($result['uuid'] ?? ''); if ($uuid !== '') { $target = "admin/tenants/edit/{$uuid}"; Flash::success('Tenant created', $target, 'tenant_created'); Router::redirect($target); } else { Flash::success('Tenant created', 'admin/tenants', 'tenant_created'); Router::redirect('admin/tenants'); } } } } Buffer::set('title', t('Create tenant'));