amélioration gestion configuration
FossilOrigin-Name: dd08bb3079c4797c7944082ca9377c645a73f466048bd3928eb1e83973f4fba3
This commit is contained in:
parent
a988c131aa
commit
3e02319484
7 changed files with 62 additions and 31 deletions
|
|
@ -3,16 +3,24 @@
|
|||
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_0', trim(f('objet_0')));
|
||||
$plugin->setConfig('objet_1', trim(f('objet_1')));
|
||||
$plugin->setConfig('objet_2', trim(f('objet_2')));;
|
||||
$plugin->setConfig('cgi_art1', (bool)f('cgi_art_1'));
|
||||
$plugin->setConfig('cgi_art2', (bool)f('cgi_art_2'));
|
||||
$plugin->setConfig('cgi_art3', (bool)f('cgi_art_3'));
|
||||
$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)
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ $activitesTarifsComptes = Utils::getActivitesTarifsEtComptes();
|
|||
$tpl->assign('anneesFiscales', $anneesFiscales);
|
||||
$tpl->assign('anneeCourante', $anneeCourante);
|
||||
$tpl->assign('activitesTarifsComptes', $activitesTarifsComptes);
|
||||
$tpl->assign('plugin_config', $plugin->getConfig());
|
||||
$tpl->assign('plugin_css', ['style.css']);
|
||||
|
||||
// envoyer au template
|
||||
|
|
|
|||
|
|
@ -4,9 +4,20 @@ namespace Garradin;
|
|||
|
||||
use Garradin\Plugin\RecusFiscaux\Utils;
|
||||
|
||||
// récupérer les tarifs sélectionnés
|
||||
// récupérer les infos du formulaire
|
||||
$lesTarifs = f('tarifs');
|
||||
$_SESSION['annee_recu'] = strip_tags($_POST['annee_recu']);
|
||||
$_SESSION['annee_recu'] = f('annee_recu');
|
||||
|
||||
// taux de réduction associés
|
||||
$lesTaux = array();
|
||||
foreach ($lesTarifs as $idTarif) {
|
||||
$nomRadio = "taux_reduction_" . $idTarif;
|
||||
$valRadio = f("$nomRadio");
|
||||
$lesTaux[] = $valRadio ? $valRadio: $plugin->getConfig()->reduction[0]->taux;
|
||||
}
|
||||
// error_log("Tarifs = " . print_r($lesTarifs, true) . "\n");
|
||||
// error_log("Réducs = " . print_r($lesTaux, true) . "\n");
|
||||
|
||||
// liste des versements correspondants
|
||||
$_SESSION['lesVersements'] = Utils::getVersementsActivite($_SESSION['annee_recu'], $lesTarifs);
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ namespace Garradin;
|
|||
use Garradin\Plugin\RecusFiscaux\Utils;
|
||||
|
||||
// liste des versements totaux par personne
|
||||
$_SESSION['annee_recu'] = strip_tags($_POST['annee_recu']);
|
||||
$_SESSION['annee_recu'] = f('annee_recu');
|
||||
$_SESSION['lesVersementsTotaux'] = Utils::getVersementsTotaux($_SESSION['annee_recu']);
|
||||
|
||||
// préparation de l'affichage
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue