prise en compte de différents champs nom et prénom
FossilOrigin-Name: 2895a7a5054d102c3262500e9e67557129592b607830a406d30fd3596cdfe6a9
This commit is contained in:
parent
5995f33efd
commit
a3aa6fa200
8 changed files with 271 additions and 108 deletions
|
|
@ -5,8 +5,27 @@ use Garradin\Files\Files;
|
|||
use Garradin\Entities\Files\File;
|
||||
|
||||
$session->requireAccess($session::SECTION_CONFIG, $session::ACCESS_ADMIN);
|
||||
$art_sel=f('articlesCGI') ? : [];
|
||||
$art_sel = f('articlesCGI') ? : [];
|
||||
$taux_sel = f('tauxReduction') ? : [];
|
||||
$noms_sel = f('champsNom') ? : [];
|
||||
|
||||
$confNoms = $plugin->getConfig('nomChamps');
|
||||
if (! isset($confNoms))
|
||||
{
|
||||
// récupérer les champs des membres utilisés pour le nom et le prénom
|
||||
$nomChamps = array();
|
||||
foreach ($config->get('champs_membres')->listAssocNames() as $name => $title)
|
||||
{
|
||||
if (stristr($title, 'nom'))
|
||||
{
|
||||
$champ = new \stdClass();
|
||||
$champ->titre = $title;
|
||||
$champ->position = 0;
|
||||
$nomChamps[$name] = $champ;
|
||||
}
|
||||
}
|
||||
$plugin->setConfig('nomChamps', $nomChamps);
|
||||
}
|
||||
|
||||
$path = qg('path') ?: File::CONTEXT_CONFIG;
|
||||
$context = Files::getContext($path);
|
||||
|
|
@ -63,6 +82,19 @@ if (f('save') && $form->check('recusfiscaux_config'))
|
|||
// ville
|
||||
$plugin->setConfig('ville_asso', trim(f('ville_asso')));
|
||||
|
||||
// champs pour le nom et prénom
|
||||
$confNoms = (array)$plugin->getConfig('nomChamps');
|
||||
foreach ($confNoms as $nom => $champ)
|
||||
{
|
||||
$champ->position = 0;
|
||||
}
|
||||
$i = -count($noms_sel);
|
||||
foreach ($noms_sel as $nom)
|
||||
{
|
||||
$confNoms[$nom]->position = $i++;
|
||||
}
|
||||
$plugin->setConfig('nomChamps', $confNoms);
|
||||
|
||||
\Garradin\Utils::redirect(PLUGIN_URL . 'config.php?ok');
|
||||
}
|
||||
catch (UserException $e)
|
||||
|
|
@ -71,9 +103,17 @@ if (f('save') && $form->check('recusfiscaux_config'))
|
|||
}
|
||||
}
|
||||
|
||||
// trier les champs de nom pour l'affichage
|
||||
$nomChamps = (array) $plugin->getConfig('nomChamps');
|
||||
uasort($nomChamps, function ($a, $b)
|
||||
{
|
||||
return $a->position - $b->position;
|
||||
});
|
||||
|
||||
$tpl->assign('ok', qg('ok') !== null);
|
||||
$tpl->assign('path', $path);
|
||||
$tpl->assign('default_signature', \Garradin\WWW_URL . "plugin/recusfiscaux/default_signature.png");
|
||||
$tpl->assign('plugin_config', $plugin->getConfig());
|
||||
$tpl->assign('nomChamps', $nomChamps);
|
||||
$tpl->assign('plugin_css', ['style.css']);
|
||||
$tpl->display(PLUGIN_ROOT . '/templates/config.tpl');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue