requireAccess($session::SECTION_ACCOUNTING, $session::ACCESS_WRITE); f(['id' => 'required|numeric']); $id = (int) qg('id'); $c = $client->get($id); if (!$c) { throw new UserException("Ce client n'existe pas."); } $form->runIf(f('save') && !$form->hasErrors(), function () use ($client, $id, $form) { try { $r = $client->edit($id,[ 'nom' => f('nom'), 'adresse' => f('adresse'), 'code_postal' => f('code_postal'), 'ville' => f('ville'), 'siret' => f('siret'), 'telephone' => f('telephone'), 'email' => f('email') ]); $r ? Utils::redirect(PLUGIN_ADMIN_URL . 'client.php?id='.(int)$id):''; } catch (UserException $e) { $form->addError($e->getMessage()); } }, 'edit_client'); $tpl->assign('client', $c); $tpl->display(PLUGIN_ROOT . '/templates/client_modifier.tpl');