34require
'../../main.inc.php';
43require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
44require_once DOL_DOCUMENT_ROOT.
'/core/lib/accounting.lib.php';
45require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formaccounting.class.php';
48$langs->loadLangs(array(
"compta",
"bills",
"admin",
"accountancy",
"salaries",
"trips",
"loan"));
51if (!$user->hasRight(
'accounting',
'chartofaccount')) {
55$action =
GETPOST(
'action',
'aZ09');
58$list_account_main = array(
59 'ACCOUNTING_ACCOUNT_CUSTOMER',
60 'ACCOUNTING_ACCOUNT_SUPPLIER',
61 'SALARIES_ACCOUNTING_ACCOUNT_PAYMENT',
66 $list_account_main[] =
'ACCOUNTING_ACCOUNT_EXPENSEREPORT';
70$list_default_subledger = array(
71 'ACCOUNTING_ACCOUNT_CUSTOMER' =>
'ACCOUNTING_ACCOUNT_CUSTOMER_DEFAULT_SUBLEDGER',
72 'ACCOUNTING_ACCOUNT_SUPPLIER' =>
'ACCOUNTING_ACCOUNT_SUPPLIER_DEFAULT_SUBLEDGER',
75$list_account = array();
77$list_account[] =
'---Product---';
78$list_account[] =
'ACCOUNTING_PRODUCT_SOLD_ACCOUNT';
80 $list_account[] =
'ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT';
82$list_account[] =
'ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT';
83$list_account[] =
'ACCOUNTING_PRODUCT_BUY_ACCOUNT';
85 $list_account[] =
'ACCOUNTING_PRODUCT_BUY_INTRA_ACCOUNT';
87$list_account[] =
'ACCOUNTING_PRODUCT_BUY_EXPORT_ACCOUNT';
89$list_account[] =
'---Service---';
90$list_account[] =
'ACCOUNTING_SERVICE_SOLD_ACCOUNT';
92 $list_account[] =
'ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT';
94$list_account[] =
'ACCOUNTING_SERVICE_SOLD_EXPORT_ACCOUNT';
95$list_account[] =
'ACCOUNTING_SERVICE_BUY_ACCOUNT';
97 $list_account[] =
'ACCOUNTING_SERVICE_BUY_INTRA_ACCOUNT';
99$list_account[] =
'ACCOUNTING_SERVICE_BUY_EXPORT_ACCOUNT';
101$list_account[] =
'---Others---';
102$list_account[] =
'ACCOUNTING_VAT_SOLD_ACCOUNT';
103$list_account[] =
'ACCOUNTING_VAT_BUY_ACCOUNT';
104$list_account[] =
'ACCOUNTING_VAT_BUY_ASSET_ACCOUNT';
111$list_account[] =
'ACCOUNTING_VAT_PAY_ACCOUNT';
113$list_account[] =
'ACCOUNTING_LT1_SOLD_ACCOUNT';
114$list_account[] =
'ACCOUNTING_LT1_BUY_ACCOUNT';
115$list_account[] =
'ACCOUNTING_LT1_PAY_ACCOUNT';
116$list_account[] =
'ACCOUNTING_LT2_SOLD_ACCOUNT';
117$list_account[] =
'ACCOUNTING_LT2_BUY_ACCOUNT';
118$list_account[] =
'ACCOUNTING_LT2_PAY_ACCOUNT';
121 $list_account[] =
'ACCOUNTING_VAT_BUY_REVERSE_CHARGES_CREDIT';
122 $list_account[] =
'ACCOUNTING_VAT_BUY_REVERSE_CHARGES_DEBIT';
123 $list_account[] =
'ACCOUNTING_LT1_BUY_REVERSE_CHARGES_CREDIT';
124 $list_account[] =
'ACCOUNTING_LT1_BUY_REVERSE_CHARGES_DEBIT';
125 $list_account[] =
'ACCOUNTING_LT2_BUY_REVERSE_CHARGES_CREDIT';
126 $list_account[] =
'ACCOUNTING_LT2_BUY_REVERSE_CHARGES_DEBIT';
129 $list_account[] =
'ACCOUNTING_ACCOUNT_TRANSFER_CASH';
132 $list_account[] =
'ACCOUNTING_ACCOUNT_CUSTOMER_RETAINED_WARRANTY';
135 $list_account[] =
'DONATION_ACCOUNTINGACCOUNT';
138 $list_account[] =
'ADHERENT_SUBSCRIPTION_ACCOUNTINGACCOUNT';
141 $list_account[] =
'LOAN_ACCOUNTING_ACCOUNT_CAPITAL';
142 $list_account[] =
'LOAN_ACCOUNTING_ACCOUNT_INTEREST';
143 $list_account[] =
'LOAN_ACCOUNTING_ACCOUNT_INSURANCE';
145$list_account[] =
'ACCOUNTING_ACCOUNT_SUSPENSE';
147 $list_account[] =
'---Discounts---';
148 $list_account[] =
'ACCOUNTING_ACCOUNT_DISCOUNT_GRANTED';
149 $list_account[] =
'ACCOUNTING_ACCOUNT_DISCOUNT_RECEIVED';
152 $list_account[] =
'---Deposits---';
161if ($action ==
'update') {
163 foreach ($list_account_main as $constname) {
164 $constvalue =
GETPOST($constname,
'alpha');
171 foreach ($list_account as $constname) {
173 if (preg_match(
'/---(.*)---/', $constname, $reg)) {
177 $constvalue =
GETPOST($constname,
'alpha');
183 foreach (array(
'ACCOUNTING_ACCOUNT_CUSTOMER_DEFAULT_SUBLEDGER',
'ACCOUNTING_ACCOUNT_SUPPLIER_DEFAULT_SUBLEDGER') as $constname) {
184 $constvalue = trim(
GETPOST($constname,
'alphanohtml'));
190 $constname =
'ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT';
196 $constname =
'ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT_FOR_VAT';
202 $constname =
'ACCOUNTING_ACCOUNT_SUPPLIER_DEPOSIT';
210 setEventMessages($langs->trans(
"SetupSaved"),
null,
'mesgs');
212 setEventMessages($langs->trans(
"Error"),
null,
'errors');
216if ($action ==
'setACCOUNTING_ACCOUNT_CUSTOMER_USE_AUXILIARY_ON_DEPOSIT') {
217 $setDisableAuxiliaryAccountOnCustomerDeposit =
GETPOSTINT(
'value');
218 $res =
dolibarr_set_const($db,
"ACCOUNTING_ACCOUNT_CUSTOMER_USE_AUXILIARY_ON_DEPOSIT", $setDisableAuxiliaryAccountOnCustomerDeposit,
'yesno', 0,
'',
$conf->entity);
224 setEventMessages($langs->trans(
"SetupSaved"),
null,
'mesgs');
226 setEventMessages($langs->trans(
"Error"),
null,
'mesgs');
230if ($action ==
'setACCOUNTING_ACCOUNT_SUPPLIER_USE_AUXILIARY_ON_DEPOSIT') {
231 $setDisableAuxiliaryAccountOnSupplierDeposit =
GETPOSTINT(
'value');
232 $res =
dolibarr_set_const($db,
"ACCOUNTING_ACCOUNT_SUPPLIER_USE_AUXILIARY_ON_DEPOSIT", $setDisableAuxiliaryAccountOnSupplierDeposit,
'yesno', 0,
'',
$conf->entity);
238 setEventMessages($langs->trans(
"SetupSaved"),
null,
'mesgs');
240 setEventMessages($langs->trans(
"Error"),
null,
'mesgs');
249$form =
new Form($db);
252$help_url =
'EN:Module_Double_Entry_Accounting#Setup|FR:Module_Comptabilité_en_Partie_Double#Configuration';
254llxHeader(
'', $langs->trans(
'MenuDefaultAccounts'), $help_url,
'', 0, 0,
'',
'',
'',
'mod-accountancy page-admin_defaultaccounts');
257print
load_fiche_titre($langs->trans(
'MenuDefaultAccounts'), $linkback,
'title_accountancy');
259print
'<div class="info">'.$langs->trans(
"DefaultBindingDesc").
'</div>';
262print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
263print
'<input type="hidden" name="token" value="'.newToken().
'">';
264print
'<input type="hidden" name="action" value="update">';
267print
'<div class="div-table-responsive-no-min">';
268print
'<table class="noborder centpercent">';
269print
'<tr class="liste_titre"><td>'.$langs->trans(
"ThirdParties").
' | '.$langs->trans(
"Users").
'</td><td></td></tr>';
271foreach ($list_account_main as $key) {
272 print
'<tr class="oddeven value">';
274 $label = $langs->trans($key);
275 $keydesc = $key.
'_Desc';
277 $htmltext = $langs->trans($keydesc);
278 print
'<td class="fieldrequired">';
279 if ($key ==
'ACCOUNTING_ACCOUNT_CUSTOMER') {
280 print img_picto(
'',
'company',
'class="pictofixedwidth"');
281 } elseif ($key ==
'ACCOUNTING_ACCOUNT_SUPPLIER') {
282 print img_picto(
'',
'company',
'class="pictofixedwidth"');
284 print img_picto(
'',
'user',
'class="pictofixedwidth"');
286 print $form->textwithpicto($label, $htmltext);
289 print
'<td class="right">';
291 print $formaccounting->select_account($key_value, $key, 1, [], 1, 1,
'minwidth100 maxwidth300 maxwidthonsmartphone',
'accountsmain',
'1', 2);
296 if (isset($list_default_subledger[$key])) {
297 $subkey = $list_default_subledger[$key];
298 print
'<tr class="oddeven value">';
300 print img_picto(
'',
'company',
'class="pictofixedwidth"');
301 print $form->textwithpicto($langs->trans($subkey), $langs->trans($subkey.
'_Desc'));
303 print
'<td class="right">';
314print
'<div class="div-table-responsive-no-min">';
315print
'<table class="noborder centpercent">';
317foreach ($list_account as $key) {
319 if (preg_match(
'/---(.*)---/', $key, $reg)) {
320 print
'<tr class="liste_titre"><td>'.$langs->trans($reg[1]).
'</td><td></td></tr>';
322 print
'<tr class="oddeven value">';
324 $label = $langs->trans($key);
326 if (preg_match(
'/^ACCOUNTING_PRODUCT/', $key)) {
327 print img_picto(
'',
'product',
'class="pictofixedwidth"');
328 } elseif (preg_match(
'/^ACCOUNTING_SERVICE/', $key)) {
329 print img_picto(
'',
'service',
'class="pictofixedwidth"');
330 } elseif (preg_match(
'/^ACCOUNTING_VAT_PAY_ACCOUNT/', $key)) {
331 print img_picto(
'',
'payment_vat',
'class="pictofixedwidth"');
332 } elseif (preg_match(
'/^ACCOUNTING_LT1_PAY_ACCOUNT/', $key)) {
333 print img_picto(
'',
'payment_vat',
'class="pictofixedwidth"');
334 } elseif (preg_match(
'/^ACCOUNTING_LT2_PAY_ACCOUNT/', $key)) {
335 print img_picto(
'',
'payment_vat',
'class="pictofixedwidth"');
336 } elseif (preg_match(
'/^ACCOUNTING_VAT/', $key)) {
337 print img_picto(
'',
'vat',
'class="pictofixedwidth"');
338 } elseif (preg_match(
'/^ACCOUNTING_LT/', $key)) {
339 print img_picto(
'',
'vat',
'class="pictofixedwidth"');
340 } elseif (preg_match(
'/^ACCOUNTING_ACCOUNT_CUSTOMER/', $key)) {
341 print img_picto(
'',
'bill',
'class="pictofixedwidth"');
342 } elseif (preg_match(
'/^LOAN_ACCOUNTING_ACCOUNT/', $key)) {
343 print img_picto(
'',
'loan',
'class="pictofixedwidth"');
344 } elseif (preg_match(
'/^DONATION_ACCOUNTING/', $key)) {
345 print img_picto(
'',
'donation',
'class="pictofixedwidth"');
346 } elseif (preg_match(
'/^ADHERENT_SUBSCRIPTION/', $key)) {
347 print img_picto(
'',
'member',
'class="pictofixedwidth"');
348 } elseif (preg_match(
'/^ACCOUNTING_ACCOUNT_TRANSFER/', $key)) {
349 print img_picto(
'',
'bank_account',
'class="pictofixedwidth"');
350 } elseif (preg_match(
'/^ACCOUNTING_ACCOUNT_SUSPENSE/', $key)) {
351 print img_picto(
'',
'question',
'class="pictofixedwidth"');
357 print
'<td class="right">';
358 print $formaccounting->select_account(
getDolGlobalString($key), $key, 1, [], 1, 1,
'minwidth100 maxwidth300 maxwidthonsmartphone',
'accounts');
366print
'<tr class="oddeven value">';
369print img_picto(
'',
'bill',
'class="pictofixedwidth"') . $langs->trans(
'ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT');
372print
'<td class="right">';
373print $formaccounting->select_account(
getDolGlobalString(
'ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT'),
'ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT', 1, [], 1, 1,
'minwidth100 maxwidth300 maxwidthonsmartphone',
'accounts');
378print
'<tr class="oddeven value">';
381print img_picto(
'',
'bill',
'class="pictofixedwidth"') . $langs->trans(
'ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT_FOR_VAT');
384print
'<td class="right">';
385print $formaccounting->select_account(
getDolGlobalString(
'ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT_FOR_VAT'),
'ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT_FOR_VAT', 1, [], 1, 1,
'minwidth100 maxwidth300 maxwidthonsmartphone',
'accounts');
390 print
'<tr class="oddeven">';
391 print
'<td>' . img_picto(
'',
'bill',
'class="pictofixedwidth"') . $langs->trans(
"UseAuxiliaryAccountOnCustomerDeposit") .
'</td>';
392 if (
getDolGlobalInt(
'ACCOUNTING_ACCOUNT_CUSTOMER_USE_AUXILIARY_ON_DEPOSIT')) {
393 print
'<td class="right"><a class="reposition" href="' . $_SERVER[
'PHP_SELF'] .
'?token=' .
newToken() .
'&action=setACCOUNTING_ACCOUNT_CUSTOMER_USE_AUXILIARY_ON_DEPOSIT&value=0">';
394 print img_picto($langs->trans(
"Activated"),
'switch_on',
'', 0, 0, 0,
'',
'warning');
397 print
'<td class="right"><a class="reposition" href="' . $_SERVER[
'PHP_SELF'] .
'?token=' .
newToken() .
'&action=setACCOUNTING_ACCOUNT_CUSTOMER_USE_AUXILIARY_ON_DEPOSIT&value=1">';
398 print img_picto($langs->trans(
"Disabled"),
'switch_off');
405print
'<tr class="oddeven value">';
408print img_picto(
'',
'supplier_invoice',
'class="pictofixedwidth"') . $langs->trans(
'ACCOUNTING_ACCOUNT_SUPPLIER_DEPOSIT');
411print
'<td class="right">';
412print $formaccounting->select_account(
getDolGlobalString(
'ACCOUNTING_ACCOUNT_SUPPLIER_DEPOSIT'),
'ACCOUNTING_ACCOUNT_SUPPLIER_DEPOSIT', 1, [], 1, 1,
'minwidth100 maxwidth300 maxwidthonsmartphone',
'accounts');
417 print
'<tr class="oddeven">';
418 print
'<td>' . img_picto(
'',
'supplier_invoice',
'class="pictofixedwidth"') . $langs->trans(
"UseAuxiliaryAccountOnSupplierDeposit") .
'</td>';
419 if (
getDolGlobalInt(
'ACCOUNTING_ACCOUNT_SUPPLIER_USE_AUXILIARY_ON_DEPOSIT')) {
420 print
'<td class="right"><a class="reposition" href="' . $_SERVER[
'PHP_SELF'] .
'?token=' .
newToken() .
'&action=setACCOUNTING_ACCOUNT_SUPPLIER_USE_AUXILIARY_ON_DEPOSIT&value=0">';
421 print img_picto($langs->trans(
"Activated"),
'switch_on',
'', 0, 0, 0,
'',
'warning');
424 print
'<td class="right"><a class="reposition" href="' . $_SERVER[
'PHP_SELF'] .
'?token=' .
newToken() .
'&action=setACCOUNTING_ACCOUNT_SUPPLIER_USE_AUXILIARY_ON_DEPOSIT&value=1">';
425 print img_picto($langs->trans(
"Disabled"),
'switch_off');
434print
'<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).
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
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.
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0, $nodefault=0)
Return value of a param into GET or POST supervariable.
GETPOSTINT($paramname, $method=0, $nodefault=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.