facturation/www/admin/config.php

35 lines
915 B
PHP

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