* Copyright (C) 2004-2008 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2011-2013 Juanjo Menent * Copyright (C) 2013-2017 Philippe Grand * Copyright (C) 2014 Marcos GarcĂ­a * Copyright (C) 2020 Maxime DEMAREST * * 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/admin/compta.php * \ingroup compta * \brief Page to setup accountancy module */ // Load Dolibarr environment require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; // Load translation files required by the page $langs->loadLangs(array('admin', 'compta', 'accountancy')); if (!$user->admin) { accessforbidden(); } $action = GETPOST('action', 'aZ09'); // Other parameters ACCOUNTING_* $list = array( 'ACCOUNTING_PRODUCT_BUY_ACCOUNT', 'ACCOUNTING_PRODUCT_SOLD_ACCOUNT', 'ACCOUNTING_SERVICE_BUY_ACCOUNT', 'ACCOUNTING_SERVICE_SOLD_ACCOUNT', 'ACCOUNTING_VAT_SOLD_ACCOUNT', 'ACCOUNTING_VAT_BUY_ACCOUNT', 'ACCOUNTING_ACCOUNT_CUSTOMER', 'ACCOUNTING_ACCOUNT_SUPPLIER' ); /* * Actions */ $accounting_mode = getDolGlobalString('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++; } foreach ($list as $constname) { $constvalue = GETPOST($constname, 'alpha'); if (!dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) { $error++; } } $report_include_varpay = GETPOST('ACCOUNTING_REPORTS_INCLUDE_VARPAY', 'alpha'); if (!empty($report_include_varpay)) { if ($report_include_varpay == 'yes') { if (!dolibarr_set_const($db, 'ACCOUNTING_REPORTS_INCLUDE_VARPAY', 1, 'chaine', 0, '', $conf->entity)) { $error++; } } } if ($report_include_varpay == 'no') { if (!dolibarr_del_const($db, 'ACCOUNTING_REPORTS_INCLUDE_VARPAY', $conf->entity)) { $error++; } } $report_include_loan = GETPOST('ACCOUNTING_REPORTS_INCLUDE_LOAN', 'alpha'); if (!empty($report_include_loan)) { if ($report_include_loan == 'yes') { if (!dolibarr_set_const($db, 'ACCOUNTING_REPORTS_INCLUDE_LOAN', 1, 'chaine', 0, '', $conf->entity)) { $error++; } } } if ($report_include_loan == 'no') { if (!dolibarr_del_const($db, 'ACCOUNTING_REPORTS_INCLUDE_LOAN', $conf->entity)) { $error++; } } if (!$error) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { setEventMessages($langs->trans("Error"), null, 'errors'); } } /* * View */ llxHeader('', '', '', '', 0, 0, '', '', '', 'mod-admin page-compta'); $form = new Form($db); $linkback = ''.$langs->trans("BackToModuleList").''; print load_fiche_titre($langs->trans('ComptaSetup'), $linkback, 'title_setup'); print '
'; print '
'; print ''; print ''; print ''; // case of the parameter ACCOUNTING_MODE print ''; print ''; print "\n"; print ''; print '\n"; print ''; print '\n"; print "
'.$langs->trans('OptionMode').''.$langs->trans('Description').'
'.$langs->trans('OptionModeTrue').''.nl2br($langs->trans('OptionModeTrueDesc')); print "
'.$langs->trans('OptionModeVirtual').''.nl2br($langs->trans('OptionModeVirtualDesc'))."
\n"; print "
\n"; print ''; print ''; print ''; print "\n"; foreach ($list as $key) { print ''; // Param $libelle = $langs->trans($key); print ''; // Value print ''; } // Option to include various payment in results print ''."\n"; print ''."\n"; print ''; // Option to include loan in results print ''."\n"; print ''."\n"; print ''; print "
'.$langs->trans('OtherOptions').'
'; print ''; print '
'."\n"; print $form->selectyesno('ACCOUNTING_REPORTS_INCLUDE_VARPAY', (getDolGlobalString('ACCOUNTING_REPORTS_INCLUDE_VARPAY'))); print '
'."\n"; print $form->selectyesno('ACCOUNTING_REPORTS_INCLUDE_LOAN', (getDolGlobalString('ACCOUNTING_REPORTS_INCLUDE_LOAN'))); print '
\n"; print '

'; print '
'; // End of page llxFooter(); $db->close();