32require
'../../main.inc.php';
35require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
36require_once DOL_DOCUMENT_ROOT.
'/core/lib/accounting.lib.php';
37require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formaccounting.class.php';
49$langs->loadLangs(array(
"compta",
"bills",
"admin",
"accountancy",
"salaries",
"trips",
"loan"));
52if (!$user->hasRight(
'accounting',
'chartofaccount')) {
56$action =
GETPOST(
'action',
'aZ09');
59$list_account_main = array(
60 'ACCOUNTING_ACCOUNT_CUSTOMER',
61 'ACCOUNTING_ACCOUNT_SUPPLIER',
62 'SALARIES_ACCOUNTING_ACCOUNT_PAYMENT',
66 $list_account_main[] =
'ACCOUNTING_ACCOUNT_EXPENSEREPORT';
69$list_account = array();
71$list_account[] =
'---Product---';
72$list_account[] =
'ACCOUNTING_PRODUCT_SOLD_ACCOUNT';
74 $list_account[] =
'ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT';
76$list_account[] =
'ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT';
77$list_account[] =
'ACCOUNTING_PRODUCT_BUY_ACCOUNT';
79 $list_account[] =
'ACCOUNTING_PRODUCT_BUY_INTRA_ACCOUNT';
81$list_account[] =
'ACCOUNTING_PRODUCT_BUY_EXPORT_ACCOUNT';
83$list_account[] =
'---Service---';
84$list_account[] =
'ACCOUNTING_SERVICE_SOLD_ACCOUNT';
86 $list_account[] =
'ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT';
88$list_account[] =
'ACCOUNTING_SERVICE_SOLD_EXPORT_ACCOUNT';
89$list_account[] =
'ACCOUNTING_SERVICE_BUY_ACCOUNT';
91 $list_account[] =
'ACCOUNTING_SERVICE_BUY_INTRA_ACCOUNT';
93$list_account[] =
'ACCOUNTING_SERVICE_BUY_EXPORT_ACCOUNT';
95$list_account[] =
'---Others---';
96$list_account[] =
'ACCOUNTING_VAT_SOLD_ACCOUNT';
97$list_account[] =
'ACCOUNTING_VAT_BUY_ACCOUNT';
104$list_account[] =
'ACCOUNTING_VAT_PAY_ACCOUNT';
106$list_account[] =
'ACCOUNTING_LT1_SOLD_ACCOUNT';
107$list_account[] =
'ACCOUNTING_LT1_BUY_ACCOUNT';
108$list_account[] =
'ACCOUNTING_LT1_PAY_ACCOUNT';
109$list_account[] =
'ACCOUNTING_LT2_SOLD_ACCOUNT';
110$list_account[] =
'ACCOUNTING_LT2_BUY_ACCOUNT';
111$list_account[] =
'ACCOUNTING_LT2_PAY_ACCOUNT';
114 $list_account[] =
'ACCOUNTING_VAT_BUY_REVERSE_CHARGES_CREDIT';
115 $list_account[] =
'ACCOUNTING_VAT_BUY_REVERSE_CHARGES_DEBIT';
116 $list_account[] =
'ACCOUNTING_LT1_BUY_REVERSE_CHARGES_CREDIT';
117 $list_account[] =
'ACCOUNTING_LT1_BUY_REVERSE_CHARGES_DEBIT';
118 $list_account[] =
'ACCOUNTING_LT2_BUY_REVERSE_CHARGES_CREDIT';
119 $list_account[] =
'ACCOUNTING_LT2_BUY_REVERSE_CHARGES_DEBIT';
122 $list_account[] =
'ACCOUNTING_ACCOUNT_TRANSFER_CASH';
125 $list_account[] =
'ACCOUNTING_ACCOUNT_CUSTOMER_RETAINED_WARRANTY';
128 $list_account[] =
'DONATION_ACCOUNTINGACCOUNT';
131 $list_account[] =
'ADHERENT_SUBSCRIPTION_ACCOUNTINGACCOUNT';
134 $list_account[] =
'LOAN_ACCOUNTING_ACCOUNT_CAPITAL';
135 $list_account[] =
'LOAN_ACCOUNTING_ACCOUNT_INTEREST';
136 $list_account[] =
'LOAN_ACCOUNTING_ACCOUNT_INSURANCE';
138$list_account[] =
'ACCOUNTING_ACCOUNT_SUSPENSE';
140 $list_account[] =
'---Discounts---';
141 $list_account[] =
'ACCOUNTING_ACCOUNT_DISCOUNT_GRANTED';
142 $list_account[] =
'ACCOUNTING_ACCOUNT_DISCOUNT_RECEIVED';
145 $list_account[] =
'---Deposits---';
154if ($action ==
'update') {
156 foreach ($list_account_main as $constname) {
157 $constvalue =
GETPOST($constname,
'alpha');
164 foreach ($list_account as $constname) {
166 if (preg_match(
'/---(.*)---/', $constname, $reg)) {
170 $constvalue =
GETPOST($constname,
'alpha');
177 $constname =
'ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT';
183 $constname =
'ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT_FOR_VAT';
189 $constname =
'ACCOUNTING_ACCOUNT_SUPPLIER_DEPOSIT';
203if ($action ==
'setACCOUNTING_ACCOUNT_CUSTOMER_USE_AUXILIARY_ON_DEPOSIT') {
204 $setDisableAuxiliaryAccountOnCustomerDeposit =
GETPOSTINT(
'value');
205 $res =
dolibarr_set_const(
$db,
"ACCOUNTING_ACCOUNT_CUSTOMER_USE_AUXILIARY_ON_DEPOSIT", $setDisableAuxiliaryAccountOnCustomerDeposit,
'yesno', 0,
'',
$conf->entity);
217if ($action ==
'setACCOUNTING_ACCOUNT_SUPPLIER_USE_AUXILIARY_ON_DEPOSIT') {
218 $setDisableAuxiliaryAccountOnSupplierDeposit =
GETPOSTINT(
'value');
219 $res =
dolibarr_set_const(
$db,
"ACCOUNTING_ACCOUNT_SUPPLIER_USE_AUXILIARY_ON_DEPOSIT", $setDisableAuxiliaryAccountOnSupplierDeposit,
'yesno', 0,
'',
$conf->entity);
239$help_url =
'EN:Module_Double_Entry_Accounting#Setup|FR:Module_Comptabilité_en_Partie_Double#Configuration';
241llxHeader(
'', $langs->trans(
'MenuDefaultAccounts'), $help_url,
'', 0, 0,
'',
'',
'',
'mod-accountancy page-admin_defaultaccounts');
244print
load_fiche_titre($langs->trans(
'MenuDefaultAccounts'), $linkback,
'title_accountancy');
246print
'<span class="opacitymedium">'.$langs->trans(
"DefaultBindingDesc").
'</span><br>';
249print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
250print
'<input type="hidden" name="token" value="'.newToken().
'">';
251print
'<input type="hidden" name="action" value="update">';
256print
'<div class="div-table-responsive-no-min">';
257print
'<table class="noborder centpercent">';
258print
'<tr class="liste_titre"><td>'.$langs->trans(
"ThirdParties").
' | '.$langs->trans(
"Users").
'</td><td></td></tr>';
260foreach ($list_account_main as $key) {
261 print
'<tr class="oddeven value">';
263 $label = $langs->trans($key);
264 $keydesc = $key.
'_Desc';
266 $htmltext = $langs->trans($keydesc);
267 print
'<td class="fieldrequired">';
268 if ($key ==
'ACCOUNTING_ACCOUNT_CUSTOMER') {
269 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
270 } elseif ($key ==
'ACCOUNTING_ACCOUNT_SUPPLIER') {
271 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
273 print
img_picto(
'',
'user',
'class="pictofixedwidth"');
275 print $form->textwithpicto($label, $htmltext);
278 print
'<td class="right">';
280 print $formaccounting->select_account($key_value, $key, 1, [], 1, 1,
'minwidth100 maxwidth300 maxwidthonsmartphone',
'accountsmain',
'1', 2);
288print
'<div class="div-table-responsive-no-min">';
289print
'<table class="noborder centpercent">';
291foreach ($list_account as $key) {
293 if (preg_match(
'/---(.*)---/', $key, $reg)) {
294 print
'<tr class="liste_titre"><td>'.$langs->trans($reg[1]).
'</td><td></td></tr>';
296 print
'<tr class="oddeven value">';
298 $label = $langs->trans($key);
300 if (preg_match(
'/^ACCOUNTING_PRODUCT/', $key)) {
301 print
img_picto(
'',
'product',
'class="pictofixedwidth"');
302 } elseif (preg_match(
'/^ACCOUNTING_SERVICE/', $key)) {
303 print
img_picto(
'',
'service',
'class="pictofixedwidth"');
304 } elseif (preg_match(
'/^ACCOUNTING_VAT_PAY_ACCOUNT/', $key)) {
305 print
img_picto(
'',
'payment_vat',
'class="pictofixedwidth"');
306 } elseif (preg_match(
'/^ACCOUNTING_LT1_PAY_ACCOUNT/', $key)) {
307 print
img_picto(
'',
'payment_vat',
'class="pictofixedwidth"');
308 } elseif (preg_match(
'/^ACCOUNTING_LT2_PAY_ACCOUNT/', $key)) {
309 print
img_picto(
'',
'payment_vat',
'class="pictofixedwidth"');
310 } elseif (preg_match(
'/^ACCOUNTING_VAT/', $key)) {
311 print
img_picto(
'',
'vat',
'class="pictofixedwidth"');
312 } elseif (preg_match(
'/^ACCOUNTING_LT/', $key)) {
313 print
img_picto(
'',
'vat',
'class="pictofixedwidth"');
314 } elseif (preg_match(
'/^ACCOUNTING_ACCOUNT_CUSTOMER/', $key)) {
315 print
img_picto(
'',
'bill',
'class="pictofixedwidth"');
316 } elseif (preg_match(
'/^LOAN_ACCOUNTING_ACCOUNT/', $key)) {
317 print
img_picto(
'',
'loan',
'class="pictofixedwidth"');
318 } elseif (preg_match(
'/^DONATION_ACCOUNTING/', $key)) {
319 print
img_picto(
'',
'donation',
'class="pictofixedwidth"');
320 } elseif (preg_match(
'/^ADHERENT_SUBSCRIPTION/', $key)) {
321 print
img_picto(
'',
'member',
'class="pictofixedwidth"');
322 } elseif (preg_match(
'/^ACCOUNTING_ACCOUNT_TRANSFER/', $key)) {
323 print
img_picto(
'',
'bank_account',
'class="pictofixedwidth"');
324 } elseif (preg_match(
'/^ACCOUNTING_ACCOUNT_SUSPENSE/', $key)) {
325 print
img_picto(
'',
'question',
'class="pictofixedwidth"');
331 print
'<td class="right">';
332 print $formaccounting->select_account(
getDolGlobalString($key), $key, 1, [], 1, 1,
'minwidth100 maxwidth300 maxwidthonsmartphone',
'accounts');
340print
'<tr class="oddeven value">';
343print
img_picto(
'',
'bill',
'class="pictofixedwidth"') . $langs->trans(
'ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT');
346print
'<td class="right">';
347print $formaccounting->select_account(
getDolGlobalString(
'ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT'),
'ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT', 1, [], 1, 1,
'minwidth100 maxwidth300 maxwidthonsmartphone',
'accounts');
352print
'<tr class="oddeven value">';
355print
img_picto(
'',
'bill',
'class="pictofixedwidth"') . $langs->trans(
'ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT_FOR_VAT');
358print
'<td class="right">';
359print $formaccounting->select_account(
getDolGlobalString(
'ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT_FOR_VAT'),
'ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT_FOR_VAT', 1, [], 1, 1,
'minwidth100 maxwidth300 maxwidthonsmartphone',
'accounts');
364 print
'<tr class="oddeven">';
365 print
'<td>' .
img_picto(
'',
'bill',
'class="pictofixedwidth"') . $langs->trans(
"UseAuxiliaryAccountOnCustomerDeposit") .
'</td>';
366 if (
getDolGlobalInt(
'ACCOUNTING_ACCOUNT_CUSTOMER_USE_AUXILIARY_ON_DEPOSIT')) {
367 print
'<td class="right"><a class="reposition" href="' . $_SERVER[
'PHP_SELF'] .
'?token=' .
newToken() .
'&action=setACCOUNTING_ACCOUNT_CUSTOMER_USE_AUXILIARY_ON_DEPOSIT&value=0">';
368 print
img_picto($langs->trans(
"Activated"),
'switch_on',
'', 0, 0, 0,
'',
'warning');
371 print
'<td class="right"><a class="reposition" href="' . $_SERVER[
'PHP_SELF'] .
'?token=' .
newToken() .
'&action=setACCOUNTING_ACCOUNT_CUSTOMER_USE_AUXILIARY_ON_DEPOSIT&value=1">';
372 print
img_picto($langs->trans(
"Disabled"),
'switch_off');
379print
'<tr class="oddeven value">';
382print
img_picto(
'',
'supplier_invoice',
'class="pictofixedwidth"') . $langs->trans(
'ACCOUNTING_ACCOUNT_SUPPLIER_DEPOSIT');
385print
'<td class="right">';
386print $formaccounting->select_account(
getDolGlobalString(
'ACCOUNTING_ACCOUNT_SUPPLIER_DEPOSIT'),
'ACCOUNTING_ACCOUNT_SUPPLIER_DEPOSIT', 1, [], 1, 1,
'minwidth100 maxwidth300 maxwidthonsmartphone',
'accounts');
391 print
'<tr class="oddeven">';
392 print
'<td>' .
img_picto(
'',
'supplier_invoice',
'class="pictofixedwidth"') . $langs->trans(
"UseAuxiliaryAccountOnSupplierDeposit") .
'</td>';
393 if (
getDolGlobalInt(
'ACCOUNTING_ACCOUNT_SUPPLIER_USE_AUXILIARY_ON_DEPOSIT')) {
394 print
'<td class="right"><a class="reposition" href="' . $_SERVER[
'PHP_SELF'] .
'?token=' .
newToken() .
'&action=setACCOUNTING_ACCOUNT_SUPPLIER_USE_AUXILIARY_ON_DEPOSIT&value=0">';
395 print
img_picto($langs->trans(
"Activated"),
'switch_on',
'', 0, 0, 0,
'',
'warning');
398 print
'<td class="right"><a class="reposition" href="' . $_SERVER[
'PHP_SELF'] .
'?token=' .
newToken() .
'&action=setACCOUNTING_ACCOUNT_SUPPLIER_USE_AUXILIARY_ON_DEPOSIT&value=1">';
399 print
img_picto($langs->trans(
"Disabled"),
'switch_off');
408print
'<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.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
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.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.