facturation/admin/config.php

40 lines
1.4 KiB
PHP

<?php
namespace Paheko;
use Paheko\Users\DynamicFields;
require_once __DIR__ . '/_inc.php';
$session->requireAccess($session::SECTION_ACCOUNTING, $session::ACCESS_ADMIN);
$champsPaheko = DynamicFields::getInstance()->listAssocNames();
$champsPaheko = array('' => '- Choisir un champ -') + $champsPaheko;
$form->runIf('save', function () use ($plugin) {
$plugin->setConfigProperty('rna_asso', trim(f('rna_asso')));
$plugin->setConfigProperty('siret_asso', trim(f('siret_asso')));
$plugin->setConfigProperty('ttc', (bool) f('ttc'));
$plugin->setConfigProperty('numero_rue_asso', trim(f('numero_rue_asso')));
$plugin->setConfigProperty('rue_asso', trim(f('rue_asso')));
$plugin->setConfigProperty('cp_asso', trim(f('cp_asso')));
$plugin->setConfigProperty('ville_asso', trim(f('ville_asso')));
$plugin->setConfigProperty('logo', (bool)f('logo'));
$plugin->setConfigProperty('footer', f('footer'));
$plugin->setConfigProperty('validate_cp', (bool)f('validate_cp'));
$plugin->setConfigProperty('unique_client_name', (bool)f('unique_client_name'));
$plugin->setConfigProperty('pattern', f('pattern'));
$plugin->save();
}, 'facturation_config', PLUGIN_ADMIN_URL . 'config.php?ok');
$tpl->assign('ok', qg('ok') !== null);
$tpl->assign('conf', $plugin->getConfig());
$tpl->assign('patterns', \Paheko\Plugin\Facturation\PATTERNS_LIST);
$tpl->assign('champsPaheko', $champsPaheko);
$tpl->display(PLUGIN_ROOT . '/templates/config.tpl');