Élimination de form->check() pour version 1.3

This commit is contained in:
Jean-Christophe Engel 2023-10-19 10:24:49 +02:00
parent 0ed03eb362
commit 2454883ffc
4 changed files with 150 additions and 209 deletions

View file

@ -17,22 +17,18 @@ if (!$client)
throw new UserException("Ce document n'existe pas.");
}
if (f('delete'))
{
$form->check('delete_doc_'.$f->id);
if (!$form->hasErrors())
{
try {
$facture->delete($f->id);
Utils::redirect(PLUGIN_ADMIN_URL . 'index.php');
}
catch (UserException $e)
{
$form->addError($e->getMessage());
}
}
}
$form->runIf(f('delete') && !$form->hasErrors(),
function () use ($facture, $f)
{
try {
$facture->delete($f->id);
Utils::redirect(PLUGIN_ADMIN_URL . 'index.php');
}
catch (UserException $e)
{
$form->addError($e->getMessage());
}
});
$tpl->assign('doc', $f);
$tpl->display(PLUGIN_ROOT . '/templates/facture_supprimer.tpl');
$tpl->display(PLUGIN_ROOT . '/templates/facture_supprimer.tpl');