28require
'../../main.inc.php';
29require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
30require_once DOL_DOCUMENT_ROOT.
'/core/lib/accounting.lib.php';
31require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formaccounting.class.php';
42$langs->loadLangs(array(
"compta",
"admin",
"accountancy"));
45if (!$user->hasRight(
'accounting',
'chartofaccount')) {
49$action =
GETPOST(
'action',
'aZ09');
52$list_account_main = array(
53 'ACCOUNTING_RESULT_PROFIT',
54 'ACCOUNTING_RESULT_LOSS'
61if ($action ==
'update') {
64 $defaultjournal =
GETPOST(
'ACCOUNTING_CLOSURE_DEFAULT_JOURNAL',
'alpha');
66 if (!empty($defaultjournal)) {
67 if (!
dolibarr_set_const($db,
'ACCOUNTING_CLOSURE_DEFAULT_JOURNAL', $defaultjournal,
'chaine', 0,
'',
$conf->entity)) {
74 $accountinggroupsusedforbalancesheetaccount =
GETPOST(
'ACCOUNTING_CLOSURE_ACCOUNTING_GROUPS_USED_FOR_BALANCE_SHEET_ACCOUNT',
'alphanohtml');
75 if (!empty($accountinggroupsusedforbalancesheetaccount)) {
76 if (!
dolibarr_set_const($db,
'ACCOUNTING_CLOSURE_ACCOUNTING_GROUPS_USED_FOR_BALANCE_SHEET_ACCOUNT', $accountinggroupsusedforbalancesheetaccount,
'chaine', 0,
'',
$conf->entity)) {
83 $accountinggroupsusedforincomestatement =
GETPOST(
'ACCOUNTING_CLOSURE_ACCOUNTING_GROUPS_USED_FOR_INCOME_STATEMENT',
'alpha');
84 if (!empty($accountinggroupsusedforincomestatement)) {
85 if (!
dolibarr_set_const($db,
'ACCOUNTING_CLOSURE_ACCOUNTING_GROUPS_USED_FOR_INCOME_STATEMENT', $accountinggroupsusedforincomestatement,
'chaine', 0,
'',
$conf->entity)) {
92 foreach ($list_account_main as $constname) {
93 $constvalue =
GETPOST($constname,
'alpha');
111$form =
new Form($db);
114$title = $langs->trans(
'Closure');
116$help_url =
'EN:Module_Double_Entry_Accounting#Setup|FR:Module_Comptabilité_en_Partie_Double#Configuration';
118llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-accountancy page-admin_closure');
121print
load_fiche_titre($langs->trans(
'MenuClosureAccounts'), $linkback,
'title_accountancy');
123print
'<span class="opacitymedium">'.$langs->trans(
"DefaultClosureDesc").
'</span><br>';
126print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
127print
'<input type="hidden" name="token" value="'.newToken().
'">';
128print
'<input type="hidden" name="action" value="update">';
131print
'<table class="noborder centpercent">';
133print
'<tr class="liste_titre">';
134print
'<th>'.$langs->trans(
"Parameter").
'</th>';
138foreach ($list_account_main as $key) {
139 print
'<tr class="oddeven value">';
141 $label = $langs->trans($key);
142 $keydesc = $key.
'_Desc';
144 $htmltext = $langs->trans($keydesc);
145 print
'<td class="fieldrequired" width="50%">';
146 print $form->textwithpicto($label, $htmltext);
150 print $formaccounting->select_account(
getDolGlobalString($key), $key, 1, array(), 1, 1);
156print
'<tr class="oddeven">';
157print
'<td class="fieldrequired">'.$langs->trans(
"ACCOUNTING_CLOSURE_DEFAULT_JOURNAL").
'</td>';
160print $formaccounting->select_journal($defaultjournal,
"ACCOUNTING_CLOSURE_DEFAULT_JOURNAL", 9, 1, 0, 0);
164print
'<tr class="oddeven">';
165print
'<td class="fieldrequired">';
166print $form->textwithpicto($langs->trans(
"ACCOUNTING_CLOSURE_ACCOUNTING_GROUPS_USED_FOR_BALANCE_SHEET_ACCOUNT"), $langs->trans(
"ACCOUNTING_CLOSURE_ACCOUNTING_GROUPS_USED_FOR_BALANCE_SHEET_ACCOUNTHelp"));
169print
'<input type="text" class="quatrevingtpercent" id="ACCOUNTING_CLOSURE_ACCOUNTING_GROUPS_USED_FOR_BALANCE_SHEET_ACCOUNT" name="ACCOUNTING_CLOSURE_ACCOUNTING_GROUPS_USED_FOR_BALANCE_SHEET_ACCOUNT" value="' .
dol_escape_htmltag(
getDolGlobalString(
'ACCOUNTING_CLOSURE_ACCOUNTING_GROUPS_USED_FOR_BALANCE_SHEET_ACCOUNT')).
'">';
173print
'<tr class="oddeven">';
174print
'<td class="fieldrequired">';
175print $form->textwithpicto($langs->trans(
"ACCOUNTING_CLOSURE_ACCOUNTING_GROUPS_USED_FOR_INCOME_STATEMENT"), $langs->trans(
"ACCOUNTING_CLOSURE_ACCOUNTING_GROUPS_USED_FOR_INCOME_STATEMENTHelp"));
178print
'<input type="text" class="quatrevingtpercent" id="ACCOUNTING_CLOSURE_ACCOUNTING_GROUPS_USED_FOR_INCOME_STATEMENT" name="ACCOUNTING_CLOSURE_ACCOUNTING_GROUPS_USED_FOR_INCOME_STATEMENT" value="' .
dol_escape_htmltag(
getDolGlobalString(
'ACCOUNTING_CLOSURE_ACCOUNTING_GROUPS_USED_FOR_INCOME_STATEMENT')).
'">';
183print
'<div class="center"><input type="submit" class="button button-edit" name="button" value="'.$langs->trans(
'Save').
'"></div>';
dolibarr_set_const($db, $name, $value, $type='chaine', $visible=0, $note='', $entity=1)
Insert a parameter (key,value) into database (delete old key then insert it again).
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.