facturation/www/admin/config.php

35 lines
1.0 KiB
PHP

<?php
namespace Garradin;
require_once __DIR__ . '/_inc.php';
$session->requireAccess('compta', Membres::DROIT_ADMIN);
if (f('save') && $form->check('facturation_config'))
{
try {
$plugin->setConfig('rna_asso', trim(f('rna_asso')));
$plugin->setConfig('siret_asso', trim(f('siret_asso')));
$plugin->setConfig('validate_cp', f('validate_cp'));
$plugin->setConfig('unique_client_name', f('unique_name'));
$plugin->setConfig('footer', f('footer'));
Utils::redirect(PLUGIN_URL . 'config.php?ok');
}
catch (UserException $e)
{
$form->addError($e->getMessage());
}
}
$tpl->assign('ok', qg('ok') !== null);
$tpl->assign('rna_asso', $plugin->getConfig('rna_asso') ?: '');
$tpl->assign('siret_asso', $plugin->getConfig('siret_asso') ?: '');
$tpl->assign('footer', $plugin->getConfig('footer') ?: '');
$tpl->assign('validate_cp', $plugin->getConfig('validate_cp') ? 'checked':'');
$tpl->assign('unique_name', $plugin->getConfig('unique_client_name') ? 'checked':'');
$tpl->display(PLUGIN_ROOT . '/templates/config.tpl');