hasRight("declarationtva", "declarationtva", "admin")) { accessforbidden(); } // Load language files $langs->load("declarationtva@declarationtva"); // Initialize objects $config = new DeclarationTVA_Config($db, $conf->entity); $form = new Form($db); // Handle form submission $action = GETPOST('action', 'alpha'); if ($action == 'update_mappings') { // CSRF protection if (!checkToken()) { setEventMessages($langs->trans("ErrorCSRFToken"), null, 'errors'); } else { $ca3_definitions = $config->getCA3LineDefinitions(); foreach ($ca3_definitions as $line => $definition) { $account_codes = GETPOST('account_codes_' . $line, 'array'); if (!empty($account_codes)) { $config->updateAccountMapping($line, $account_codes); } } setEventMessages($langs->trans("ConfigurationUpdated"), null, 'mesgs'); } } // Get current mappings $mappings_by_line = $config->getAccountMappingsByLine(); $accounts = $config->getAccountingAccounts(); $ca3_definitions = $config->getCA3LineDefinitions(); $section_headers = $config->getCA3SectionHeaders(); // Page title $title = $langs->trans("DeclarationTVASetup"); llxHeader('', $title); // Print page header print load_fiche_titre($title, '', 'title_accountancy'); // Print notice information print '
| ' . $langs->trans("CA3Line") . ' | '; print '' . $langs->trans("SelectedAccounts") . ' | '; print '' . $langs->trans("AccountCount") . ' | '; print '
|---|---|---|
| ' . $line . ' | '; print '' . implode(', ', $account_codes) . ' | '; print '' . count($account_codes) . ' | '; print '