Élimination de form->check() pour version 1.3
This commit is contained in:
parent
0ed03eb362
commit
2454883ffc
4 changed files with 150 additions and 209 deletions
|
|
@ -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');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue