38 lines
1.1 KiB
PHP
38 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace Paheko;
|
|
|
|
require_once __DIR__ . '/_inc.php';
|
|
|
|
$session->requireAccess($session::SECTION_ACCOUNTING, $session::ACCESS_READ);
|
|
|
|
$form->runIf(f('add') && !$form->hasErrors(),
|
|
function () use ($client)
|
|
{
|
|
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');
|
|
|
|
$list = $client->list();
|
|
$list->loadFromQueryString();
|
|
|
|
$tpl->assign(compact('list'));
|
|
|
|
$tpl->display(PLUGIN_ROOT . '/templates/clients.tpl');
|