recusfiscaux/www/admin/config.php
engel a787c1dacb ajout vérification sélection année reçu
FossilOrigin-Name: 2ce14b6d56ad130d5ee4521f616d694a5855aaf638aac97d80aed46302c2fa38
2022-02-07 14:13:22 +00:00

37 lines
1.2 KiB
PHP

<?php
namespace Garradin;
$session->requireAccess($session::SECTION_CONFIG, $session::ACCESS_ADMIN);
$art_sel=f('articlesCGI') ? : [];
error_log("art sel=" . print_r($art_sel, true) . "\n");
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;
}
error_log("confArticles=" . print_r($confArticles, true) . "\n");
$plugin->setConfig("articlesCGI", $confArticles);
error_log("plugin->config=" . print_r($plugin->getConfig("articlesCGI"), true) . "\n");
\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');