facturation/admin/client_supprimer.php

30 lines
648 B
PHP
Raw Permalink Normal View History

2019-11-02 17:53:27 +01:00
<?php
2023-08-01 22:56:38 +02:00
namespace Paheko;
2019-11-02 17:53:27 +01:00
require_once __DIR__ . '/_inc.php';
2021-04-11 14:25:59 +02:00
$session->requireAccess($session::SECTION_ACCOUNTING, $session::ACCESS_WRITE);
2019-11-02 17:53:27 +01:00
2023-08-01 22:56:38 +02:00
f(['id' => 'required|numeric']);
2019-11-02 17:53:27 +01:00
$id = (int) qg('id');
$c = $client->get($id);
if (!$client)
{
2019-11-03 17:51:31 +01:00
throw new UserException("Ce client n'existe pas.");
2019-11-02 17:53:27 +01:00
}
$csrf_key = 'delete_client_'.$c->id;
2019-11-02 17:53:27 +01:00
$form->runIf('delete', function () use ($client, $c) {
$client->delete($c->id);
2023-08-01 22:56:38 +02:00
}, $csrf_key, PLUGIN_ADMIN_URL . 'clients.php');
2019-11-02 17:53:27 +01:00
$tpl->assign('deletable', $client->isDeletable($id));
$tpl->assign('client', $c);
$tpl->assign(compact('csrf_key'));
2019-11-03 17:51:31 +01:00
$tpl->display(PLUGIN_ROOT . '/templates/client_supprimer.tpl');