* Copyright (C) 2013-2014 Florian Henry * Copyright (C) 2013-2017 Alexandre Spangaro * Copyright (C) 2014-2015 Ari Elbaz (elarifr) * Copyright (C) 2014 Marcos García * Copyright (C) 2014 Juanjo Menent * Copyright (C) 2015 Jean-François Ferry * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * */ /** * \file htdocs/accountancy/admin/index.php * \ingroup Advanced accountancy * \brief Setup page to configure accounting expert module */ require '../../main.inc.php'; // Class require_once DOL_DOCUMENT_ROOT . '/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php'; $langs->load("compta"); $langs->load("bills"); $langs->load("admin"); $langs->load("accountancy"); $langs->load("salaries"); // Security check if (empty($user->admin)) { accessforbidden(); } $action = GETPOST('action', 'alpha'); // Parameters ACCOUNTING_* and others $list = array ( 'ACCOUNTING_LENGTH_GACCOUNT', 'ACCOUNTING_LENGTH_AACCOUNT' , // 'ACCOUNTING_LENGTH_DESCRIPTION', // adjust size displayed for lines description for dol_trunc // 'ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT', // adjust size displayed for select account description for dol_trunc ); /* * Actions */ $accounting_mode = defined('ACCOUNTING_MODE') ? ACCOUNTING_MODE : 'RECETTES-DEPENSES'; if ($action == 'update') { $error = 0; $accounting_modes = array ( 'RECETTES-DEPENSES', 'CREANCES-DETTES' ); $accounting_mode = GETPOST('accounting_mode', 'alpha'); if (in_array($accounting_mode, $accounting_modes)) { if (! dolibarr_set_const($db, 'ACCOUNTING_MODE', $accounting_mode, 'chaine', 0, '', $conf->entity)) { $error ++; } } else { $error ++; } if ($error) { setEventMessages($langs->trans("Error"), null, 'errors'); } foreach ($list as $constname) { $constvalue = GETPOST($constname, 'alpha'); if (! dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) { $error ++; } } if (! $error) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { setEventMessages($langs->trans("Error"), null, 'errors'); } } // TO DO Mutualize code for yes/no constants if ($action == 'setlistsorttodo') { $setlistsorttodo = GETPOST('value', 'int'); $res = dolibarr_set_const($db, "ACCOUNTING_LIST_SORT_VENTILATION_TODO", $setlistsorttodo, 'yesno', 0, '', $conf->entity); if (! $res > 0) $error ++; if (! $error) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { setEventMessages($langs->trans("Error"), null, 'mesgs'); } } if ($action == 'setlistsortdone') { $setlistsortdone = GETPOST('value', 'int'); $res = dolibarr_set_const($db, "ACCOUNTING_LIST_SORT_VENTILATION_DONE", $setlistsortdone, 'yesno', 0, '', $conf->entity); if (! $res > 0) $error ++; if (! $error) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { setEventMessages($langs->trans("Error"), null, 'mesgs'); } } if ($action == 'setmanagezero') { $setmanagezero = GETPOST('value', 'int'); $res = dolibarr_set_const($db, "ACCOUNTING_MANAGE_ZERO", $setmanagezero, 'yesno', 0, '', $conf->entity); if (! $res > 0) $error ++; if (! $error) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { setEventMessages($langs->trans("Error"), null, 'mesgs'); } } if ($action == 'setdisabledirectinput') { $setdisabledirectinput = GETPOST('value', 'int'); $res = dolibarr_set_const($db, "BANK_DISABLE_DIRECT_INPUT", $setdisabledirectinput, 'yesno', 0, '', $conf->entity); if (! $res > 0) $error ++; if (! $error) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { setEventMessages($langs->trans("Error"), null, 'mesgs'); } } /* * View */ llxHeader(); $form = new Form($db); $linkback = '' . $langs->trans("BackToModuleList") . ''; print load_fiche_titre($langs->trans('ConfigAccountingExpert'), $linkback, 'title_setup'); $head = admin_accounting_prepare_head($accounting); print '
'; print ''; print ''; dol_fiche_head($head, 'general', $langs->trans("Configuration"), -1, 'cron'); // Default mode for calculating turnover (parameter ACCOUNTING_MODE) print ''; print ''; print ''; print "\n"; print ''; print '\n"; print ''; print '\n"; print "
' . $langs->trans('OptionMode') . '' . $langs->trans('Description') . '
' . $langs->trans('OptionModeTrue') . '' . nl2br($langs->trans('OptionModeTrueDesc')); // Write info on way to count VAT // if (! empty($conf->global->MAIN_MODULE_COMPTABILITE)) // { // // print "
\n"; // // print nl2br($langs->trans('OptionModeTrueInfoModuleComptabilite')); // } // else // { // // print "
\n"; // // print nl2br($langs->trans('OptionModeTrueInfoExpert')); // } print "
' . $langs->trans('OptionModeVirtual') . '' . nl2br($langs->trans('OptionModeVirtualDesc')) . "
\n"; print '
'; // Others params print ''; print ''; print ''; print "\n"; if (! empty($user->admin)) { // TO DO Mutualize code for yes/no constants print ''; print ''; if (! empty($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_TODO)) { print ''; } else { print ''; } print ''; print ''; print ''; if (! empty($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_DONE)) { print ''; } else { print ''; } print ''; print ''; print ''; if (! empty($conf->global->BANK_DISABLE_DIRECT_INPUT)) { print ''; } else { print ''; } print ''; print ''; print ''; if (! empty($conf->global->ACCOUNTING_MANAGE_ZERO)) { print ''; } else { print ''; } print ''; } // Param a user $user->rights->accounting->chartofaccount can access foreach ($list as $key) { print ''; if (! empty($conf->global->ACCOUNTING_MANAGE_ZERO) && ($key == 'ACCOUNTING_LENGTH_GACCOUNT' || $key == 'ACCOUNTING_LENGTH_AACCOUNT')) continue; // Param $label = $langs->trans($key); print ''; // Value print ''; print ''; } print '
' . $langs->trans('OtherOptions') . '
' . $langs->trans("ACCOUNTING_LIST_SORT_VENTILATION_TODO") . ''; print img_picto($langs->trans("Activated"), 'switch_on'); print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); print '
' . $langs->trans("ACCOUNTING_LIST_SORT_VENTILATION_DONE") . ''; print img_picto($langs->trans("Activated"), 'switch_on'); print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); print '
' . $langs->trans("BANK_DISABLE_DIRECT_INPUT") . ''; print img_picto($langs->trans("Activated"), 'switch_on'); print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); print '
' . $langs->trans("ACCOUNTING_MANAGE_ZERO") . ''; print img_picto($langs->trans("Activated"), 'switch_on'); print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); print '
'.$label.''; print ''; print '
'; dol_fiche_end(); print '
'; print '
'; print '
'; print '
'.$langs->trans("AccountancySetupDoneFromAccountancyMenu", $langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy")).'
'; print '
'; print '
'; llxFooter(); $db->close();