facturation/admin/clients.php

38 lines
1.1 KiB
PHP
Raw 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_READ);
2019-11-02 17:53:27 +01:00
$form->runIf(f('add') && !$form->hasErrors(),
2024-01-12 11:50:04 +01:00
function () use ($client, $form)
{
try
{
$id = $client->add([
'nom' => f('nom'),
'adresse' => f('adresse'),
'code_postal' => f('code_postal'),
'ville' => f('ville'),
'siret' => f('siret'),
'telephone' => f('telephone'),
'email' => f('email')
]);
$id ? Utils::redirect(PLUGIN_ADMIN_URL . 'client.php?id='.(int)$id):'';
}
catch (UserException $e)
{
$form->addError($e->getMessage());
}
}, 'add_client');
2019-11-02 17:53:27 +01:00
$list = $client->list();
$list->loadFromQueryString();
$tpl->assign(compact('list'));
2019-11-02 17:53:27 +01:00
$tpl->display(PLUGIN_ROOT . '/templates/clients.tpl');