Ajout suppression doc + amélioration ui
This commit is contained in:
parent
d852c3c680
commit
2fda7a9db3
7 changed files with 81 additions and 5 deletions
|
|
@ -15,6 +15,7 @@ $client = new Client;
|
|||
$facture = new Facture;
|
||||
|
||||
$tpl->assign('f_obj', $facture);
|
||||
$tpl->assign('plugin_url', Utils::plugin_url());
|
||||
|
||||
$identite = (string) Config::getInstance()->get('champ_identite');
|
||||
|
||||
|
|
|
|||
|
|
@ -36,5 +36,5 @@ if (f('delete'))
|
|||
|
||||
|
||||
$tpl->assign('deletable', $client->isDeletable($id));
|
||||
$tpl->assign('client', $client->get($id));
|
||||
$tpl->assign('client', $c);
|
||||
$tpl->display(PLUGIN_ROOT . '/templates/client_supprimer.tpl');
|
||||
|
|
|
|||
38
www/admin/facture_supprimer.php
Normal file
38
www/admin/facture_supprimer.php
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
<?php
|
||||
|
||||
namespace Garradin;
|
||||
|
||||
require_once __DIR__ . '/_inc.php';
|
||||
|
||||
$session->requireAccess($session::SECTION_ACCOUNTING, $session::ACCESS_WRITE);
|
||||
|
||||
qv(['id' => 'required|numeric']);
|
||||
|
||||
$id = (int) qg('id');
|
||||
|
||||
$f = $facture->get($id);
|
||||
|
||||
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_URL . 'index.php');
|
||||
}
|
||||
catch (UserException $e)
|
||||
{
|
||||
$form->addError($e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$tpl->assign('doc', $f);
|
||||
$tpl->display(PLUGIN_ROOT . '/templates/facture_supprimer.tpl');
|
||||
Loading…
Add table
Add a link
Reference in a new issue