facturation/admin/config.php

49 lines
1.5 KiB
PHP
Raw Normal View History

2019-11-02 17:53:27 +01:00
<?php
namespace Garradin;
require_once __DIR__ . '/_inc.php';
2021-04-11 14:25:59 +02:00
$session->requireAccess($session::SECTION_ACCOUNTING, $session::ACCESS_ADMIN);
2019-11-02 17:53:27 +01:00
if (f('save') && $form->check('facturation_config'))
{
2019-11-03 17:51:31 +01:00
try {
2020-10-24 01:57:41 +02:00
$plugin->setConfig('rna_asso', trim(f('rna_asso')));
$plugin->setConfig('siret_asso', trim(f('siret_asso')));
2022-01-10 06:40:40 +01:00
$plugin->setConfig('ttc', (bool)trim(f('ttc')));
2020-12-29 18:07:26 +01:00
$plugin->setConfig('numero_rue_asso', trim(f('numero_rue_asso')));
$plugin->setConfig('rue_asso', trim(f('rue_asso')));
$plugin->setConfig('cp_asso', trim(f('cp_asso')));
$plugin->setConfig('ville_asso', trim(f('ville_asso')));
$plugin->setConfig('droit_art200', (bool)f('droit_art200'));
$plugin->setConfig('droit_art238bis', (bool)f('droit_art238bis'));
$plugin->setConfig('droit_art885-0VbisA', (bool)f('droit_art885-0VbisA'));
$plugin->setConfig('objet_0', trim(f('objet_0')));
$plugin->setConfig('objet_1', trim(f('objet_1')));
$plugin->setConfig('objet_2', trim(f('objet_2')));;
$plugin->setConfig('footer', f('footer'));
$plugin->setConfig('validate_cp', (bool)f('validate_cp'));
2020-12-29 18:07:26 +01:00
$plugin->setConfig('unique_client_name', (bool)f('unique_client_name'));
2019-11-02 17:53:27 +01:00
$plugin->setConfig('pattern', f('pattern'));
2019-11-03 17:51:31 +01:00
Utils::redirect(PLUGIN_URL . 'config.php?ok');
2019-11-02 17:53:27 +01:00
}
catch (UserException $e)
{
2019-11-03 17:51:31 +01:00
$form->addError($e->getMessage());
2019-11-02 17:53:27 +01:00
}
}
2019-11-02 17:53:27 +01:00
$tpl->assign('ok', qg('ok') !== null);
$tpl->assign('patterns', \Garradin\Plugin\Facturation\PATTERNS_LIST);
2019-11-02 17:53:27 +01:00
$tpl->display(PLUGIN_ROOT . '/templates/config.tpl');