* Copyright (C) 2013-2014 Florian Henry * Copyright (C) 2013-2015 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 Accounting Expert * \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"); // Security check if (!$user->admin) accessforbidden(); $action = GETPOST('action', 'alpha'); // Other parameters ACCOUNTING_* $list = array ( 'ACCOUNTING_LIMIT_LIST_VENTILATION', '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 'ACCOUNTING_LENGTH_GACCOUNT', 'ACCOUNTING_LENGTH_AACCOUNT', 'ACCOUNTING_ACCOUNT_CUSTOMER', 'ACCOUNTING_ACCOUNT_SUPPLIER', 'ACCOUNTING_PRODUCT_BUY_ACCOUNT', 'ACCOUNTING_PRODUCT_SOLD_ACCOUNT', 'ACCOUNTING_SERVICE_BUY_ACCOUNT', 'ACCOUNTING_SERVICE_SOLD_ACCOUNT', 'ACCOUNTING_VAT_BUY_ACCOUNT', 'ACCOUNTING_VAT_SOLD_ACCOUNT', 'ACCOUNTING_ACCOUNT_SUSPENSE', 'ACCOUNTING_ACCOUNT_TRANSFER_CASH' ); /* * 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++; } $chartofaccounts = GETPOST('chartofaccounts', 'int'); if (! empty($chartofaccounts)) { if (! dolibarr_set_const($db, 'CHARTOFACCOUNTS', $chartofaccounts, '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++; } } if (! $error) { setEventMessage($langs->trans("SetupSaved")); } else { setEventMessage($langs->trans("Error"),'errors'); } } 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) { setEventMessage($langs->trans("SetupSaved"), 'mesgs'); } else { setEventMessage($langs->trans("Error"), '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) { setEventMessage($langs->trans("SetupSaved"), 'mesgs'); } else { setEventMessage($langs->trans("Error"), 'mesgs'); } } /* * View */ llxHeader(); $form = new Form($db); $linkback=''.$langs->trans("BackToModuleList").''; print_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"), 0, 'cron'); print ''; // Cas du parametre 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')); // 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 "
\n"; /* * Define Chart of accounts */ print ''; $var = true; print ''; print ''; print "\n"; $var = ! $var; print ''; print ""; print ""; print "
'; print $langs->trans("Chartofaccounts") . '
" . $langs->trans("Selectchartofaccounts") . ""; print '"; print "
"; print "
\n"; /* * Others params */ print ''; print ''; print ''; print "\n"; foreach ($list as $key) { $var=!$var; print ''; // Param $label = $langs->trans($key); print ''; // Value print ''; } $var = ! $var; print ""; print ''; if (! empty($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_TODO)) { print ''; } else { print ''; } print ''; $var = ! $var; print ""; print ''; if (! empty($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_DONE)) { print ''; } else { print ''; } print ''; print "
' . $langs->trans('OtherOptions') . '
'; print ''; print '
' . $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 '
\n"; dol_fiche_end(); print '
'; print '
'; llxFooter(); $db->close();