recusfiscaux/www/admin/config.php
engel 3acbd2038e gestion complète taux réduction
FossilOrigin-Name: 65f4c90bd70dda1733695d52ff242e58fe10220efee4077c813f49961d2686bc
2022-02-18 11:51:13 +00:00

35 lines
1021 B
PHP

<?php
namespace Garradin;
$session->requireAccess($session::SECTION_CONFIG, $session::ACCESS_ADMIN);
$art_sel=f('articlesCGI') ? : [];
if (f('save') && $form->check('recusfiscaux_config'))
{
try {
$plugin->setConfig('objet_asso', trim(f('objet_asso')));
$confArticles = $plugin->getConfig('articlesCGI');
// effacer l'ancienne configuration
for ($i = 0; $i < count($confArticles); ++$i) {
$confArticles[$i]->valeur = 0;
}
// et copier la nouvelle
foreach ($art_sel as $article) {
$confArticles[$article]->valeur = 1;
}
$plugin->setConfig("articlesCGI", $confArticles);
\Garradin\Utils::redirect(PLUGIN_URL . 'config.php?ok');
}
catch (UserException $e)
{
$form->addError($e->getMessage());
}
}
$tpl->assign('ok', qg('ok') !== null);
$tpl->assign('plugin_config', $plugin->getConfig());
$tpl->assign('plugin_css', ['style.css']);
$tpl->display(PLUGIN_ROOT . '/templates/config.tpl');