Artifact 974d7c46fdd09b289af4fc2fcf59cd9ba028c271:


<?php

namespace Garradin;

use Garradin\Compta\Categories;

require_once __DIR__ . '/../_inc.php';

$session->requireAccess('compta', Membres::DROIT_ADMIN);

$cats = new Compta\Categories;

$id = (int)qg('id');
$cat = $cats->get($id);

if (!$cat)
{
    throw new UserException('Cette cat├ęgorie n\'existe pas.');
}

$error = false;

if (f('delete') && $form->check('delete_compta_cat_' . $cat->id))
{
    try
    {
        $cats->delete($id);
        Utils::redirect('/admin/compta/categories/');
    }
    catch (UserException $e)
    {
        $form->addError($e->getMessage());
    }
}

$tpl->assign('cat', $cat);

$tpl->display('admin/compta/categories/supprimer.tpl');