2022-01-29 15:00:04 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Garradin;
|
2022-02-24 11:28:08 +01:00
|
|
|
use Garradin\Files\Files;
|
|
|
|
use Garradin\Entities\Files\File;
|
|
|
|
|
2022-01-29 15:00:04 +01:00
|
|
|
$session->requireAccess($session::SECTION_CONFIG, $session::ACCESS_ADMIN);
|
2022-02-07 15:13:22 +01:00
|
|
|
$art_sel=f('articlesCGI') ? : [];
|
2022-02-18 12:51:13 +01:00
|
|
|
|
2022-02-24 11:28:08 +01:00
|
|
|
$path = qg('path') ?: File::CONTEXT_CONFIG;
|
|
|
|
$context = Files::getContext($path);
|
|
|
|
$context_ref = Files::getContextRef($path);
|
|
|
|
|
2022-01-29 15:00:04 +01:00
|
|
|
if (f('save') && $form->check('recusfiscaux_config'))
|
|
|
|
{
|
|
|
|
try {
|
2022-02-24 11:28:08 +01:00
|
|
|
// objet de l'association
|
2022-02-07 14:32:17 +01:00
|
|
|
$plugin->setConfig('objet_asso', trim(f('objet_asso')));
|
2022-02-24 11:28:08 +01:00
|
|
|
|
|
|
|
// articles du CGI
|
2022-02-07 14:32:17 +01:00
|
|
|
$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);
|
2022-02-24 11:28:08 +01:00
|
|
|
|
2022-02-25 15:51:48 +01:00
|
|
|
// nom, fonction et signature du responsable
|
|
|
|
$plugin->setConfig('nom_responsable', trim(f('nom_responsable')));
|
|
|
|
$plugin->setConfig('fonction_responsable', trim(f('fonction_responsable')));
|
2022-02-24 11:28:08 +01:00
|
|
|
if (isset($_SESSION['sig_file'])) {
|
|
|
|
$plugin->setConfig('signature', $_SESSION['sig_file'][0]->path);
|
|
|
|
}
|
|
|
|
|
2022-01-29 15:00:04 +01:00
|
|
|
\Garradin\Utils::redirect(PLUGIN_URL . 'config.php?ok');
|
|
|
|
}
|
|
|
|
catch (UserException $e)
|
|
|
|
{
|
|
|
|
$form->addError($e->getMessage());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$tpl->assign('ok', qg('ok') !== null);
|
2022-02-24 11:28:08 +01:00
|
|
|
$tpl->assign('path', $path);
|
2022-02-25 13:23:30 +01:00
|
|
|
$tpl->assign('default_signature', \Garradin\WWW_URL . "plugin/recusFiscaux/default_signature.png");
|
2022-01-29 15:00:04 +01:00
|
|
|
$tpl->assign('plugin_config', $plugin->getConfig());
|
|
|
|
$tpl->assign('plugin_css', ['style.css']);
|
|
|
|
$tpl->display(PLUGIN_ROOT . '/templates/config.tpl');
|