32require
'../../main.inc.php';
41require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
42require_once DOL_DOCUMENT_ROOT.
'/core/lib/accounting.lib.php';
43require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formaccounting.class.php';
46$langs->loadLangs(array(
"compta",
"bills",
"admin",
"accountancy",
"salaries",
"trips",
"loan"));
49if (!$user->hasRight(
'accounting',
'chartofaccount')) {
53$action =
GETPOST(
'action',
'aZ09');
56$list_account_main = array(
57 'ACCOUNTING_ACCOUNT_CUSTOMER',
58 'ACCOUNTING_ACCOUNT_SUPPLIER',
59 'SALARIES_ACCOUNTING_ACCOUNT_PAYMENT',
63 $list_account_main[] =
'ACCOUNTING_ACCOUNT_EXPENSEREPORT';
66$list_account = array();
68$list_account[] =
'---Product---';
69$list_account[] =
'ACCOUNTING_PRODUCT_SOLD_ACCOUNT';
71 $list_account[] =
'ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT';
73$list_account[] =
'ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT';
74$list_account[] =
'ACCOUNTING_PRODUCT_BUY_ACCOUNT';
76 $list_account[] =
'ACCOUNTING_PRODUCT_BUY_INTRA_ACCOUNT';
78$list_account[] =
'ACCOUNTING_PRODUCT_BUY_EXPORT_ACCOUNT';
80$list_account[] =
'---Service---';
81$list_account[] =
'ACCOUNTING_SERVICE_SOLD_ACCOUNT';
83 $list_account[] =
'ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT';
85$list_account[] =
'ACCOUNTING_SERVICE_SOLD_EXPORT_ACCOUNT';
86$list_account[] =
'ACCOUNTING_SERVICE_BUY_ACCOUNT';
88 $list_account[] =
'ACCOUNTING_SERVICE_BUY_INTRA_ACCOUNT';
90$list_account[] =
'ACCOUNTING_SERVICE_BUY_EXPORT_ACCOUNT';
92$list_account[] =
'---Others---';
93$list_account[] =
'ACCOUNTING_VAT_SOLD_ACCOUNT';
94$list_account[] =
'ACCOUNTING_VAT_BUY_ACCOUNT';
101$list_account[] =
'ACCOUNTING_VAT_PAY_ACCOUNT';
103$list_account[] =
'ACCOUNTING_LT1_SOLD_ACCOUNT';
104$list_account[] =
'ACCOUNTING_LT1_BUY_ACCOUNT';
105$list_account[] =
'ACCOUNTING_LT1_PAY_ACCOUNT';
106$list_account[] =
'ACCOUNTING_LT2_SOLD_ACCOUNT';
107$list_account[] =
'ACCOUNTING_LT2_BUY_ACCOUNT';
108$list_account[] =
'ACCOUNTING_LT2_PAY_ACCOUNT';
111 $list_account[] =
'ACCOUNTING_VAT_BUY_REVERSE_CHARGES_CREDIT';
112 $list_account[] =
'ACCOUNTING_VAT_BUY_REVERSE_CHARGES_DEBIT';
113 $list_account[] =
'ACCOUNTING_LT1_BUY_REVERSE_CHARGES_CREDIT';
114 $list_account[] =
'ACCOUNTING_LT1_BUY_REVERSE_CHARGES_DEBIT';
115 $list_account[] =
'ACCOUNTING_LT2_BUY_REVERSE_CHARGES_CREDIT';
116 $list_account[] =
'ACCOUNTING_LT2_BUY_REVERSE_CHARGES_DEBIT';
119 $list_account[] =
'ACCOUNTING_ACCOUNT_TRANSFER_CASH';
122 $list_account[] =
'ACCOUNTING_ACCOUNT_CUSTOMER_RETAINED_WARRANTY';
125 $list_account[] =
'DONATION_ACCOUNTINGACCOUNT';
128 $list_account[] =
'ADHERENT_SUBSCRIPTION_ACCOUNTINGACCOUNT';
131 $list_account[] =
'LOAN_ACCOUNTING_ACCOUNT_CAPITAL';
132 $list_account[] =
'LOAN_ACCOUNTING_ACCOUNT_INTEREST';
133 $list_account[] =
'LOAN_ACCOUNTING_ACCOUNT_INSURANCE';
135$list_account[] =
'ACCOUNTING_ACCOUNT_SUSPENSE';
137 $list_account[] =
'---Discounts---';
138 $list_account[] =
'ACCOUNTING_ACCOUNT_DISCOUNT_GRANTED';
139 $list_account[] =
'ACCOUNTING_ACCOUNT_DISCOUNT_RECEIVED';
142 $list_account[] =
'---Deposits---';
151if ($action ==
'update') {
153 foreach ($list_account_main as $constname) {
154 $constvalue =
GETPOST($constname,
'alpha');
161 foreach ($list_account as $constname) {
163 if (preg_match(
'/---(.*)---/', $constname, $reg)) {
167 $constvalue =
GETPOST($constname,
'alpha');
174 $constname =
'ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT';
180 $constname =
'ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT_FOR_VAT';
186 $constname =
'ACCOUNTING_ACCOUNT_SUPPLIER_DEPOSIT';
194 setEventMessages($langs->trans(
"SetupSaved"),
null,
'mesgs');
196 setEventMessages($langs->trans(
"Error"),
null,
'errors');
200if ($action ==
'setACCOUNTING_ACCOUNT_CUSTOMER_USE_AUXILIARY_ON_DEPOSIT') {
201 $setDisableAuxiliaryAccountOnCustomerDeposit =
GETPOSTINT(
'value');
202 $res =
dolibarr_set_const($db,
"ACCOUNTING_ACCOUNT_CUSTOMER_USE_AUXILIARY_ON_DEPOSIT", $setDisableAuxiliaryAccountOnCustomerDeposit,
'yesno', 0,
'',
$conf->entity);
208 setEventMessages($langs->trans(
"SetupSaved"),
null,
'mesgs');
210 setEventMessages($langs->trans(
"Error"),
null,
'mesgs');
214if ($action ==
'setACCOUNTING_ACCOUNT_SUPPLIER_USE_AUXILIARY_ON_DEPOSIT') {
215 $setDisableAuxiliaryAccountOnSupplierDeposit =
GETPOSTINT(
'value');
216 $res =
dolibarr_set_const($db,
"ACCOUNTING_ACCOUNT_SUPPLIER_USE_AUXILIARY_ON_DEPOSIT", $setDisableAuxiliaryAccountOnSupplierDeposit,
'yesno', 0,
'',
$conf->entity);
222 setEventMessages($langs->trans(
"SetupSaved"),
null,
'mesgs');
224 setEventMessages($langs->trans(
"Error"),
null,
'mesgs');
233$form =
new Form($db);
236$help_url =
'EN:Module_Double_Entry_Accounting#Setup|FR:Module_Comptabilité_en_Partie_Double#Configuration';
238llxHeader(
'', $langs->trans(
'MenuDefaultAccounts'), $help_url,
'', 0, 0,
'',
'',
'',
'mod-accountancy page-admin_defaultaccounts');
241print
load_fiche_titre($langs->trans(
'MenuDefaultAccounts'), $linkback,
'title_accountancy');
243print
'<div class="info">'.$langs->trans(
"DefaultBindingDesc").
'</div>';
246print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
247print
'<input type="hidden" name="token" value="'.newToken().
'">';
248print
'<input type="hidden" name="action" value="update">';
253print
'<div class="div-table-responsive-no-min">';
254print
'<table class="noborder centpercent">';
255print
'<tr class="liste_titre"><td>'.$langs->trans(
"ThirdParties").
' | '.$langs->trans(
"Users").
'</td><td></td></tr>';
257foreach ($list_account_main as $key) {
258 print
'<tr class="oddeven value">';
260 $label = $langs->trans($key);
261 $keydesc = $key.
'_Desc';
263 $htmltext = $langs->trans($keydesc);
264 print
'<td class="fieldrequired">';
265 if ($key ==
'ACCOUNTING_ACCOUNT_CUSTOMER') {
266 print img_picto(
'',
'company',
'class="pictofixedwidth"');
267 } elseif ($key ==
'ACCOUNTING_ACCOUNT_SUPPLIER') {
268 print img_picto(
'',
'company',
'class="pictofixedwidth"');
270 print img_picto(
'',
'user',
'class="pictofixedwidth"');
272 print $form->textwithpicto($label, $htmltext);
275 print
'<td class="right">';
277 print $formaccounting->select_account($key_value, $key, 1, [], 1, 1,
'minwidth100 maxwidth300 maxwidthonsmartphone',
'accountsmain',
'1', 2);
286print
'<div class="div-table-responsive-no-min">';
287print
'<table class="noborder centpercent">';
289foreach ($list_account as $key) {
291 if (preg_match(
'/---(.*)---/', $key, $reg)) {
292 print
'<tr class="liste_titre"><td>'.$langs->trans($reg[1]).
'</td><td></td></tr>';
294 print
'<tr class="oddeven value">';
296 $label = $langs->trans($key);
298 if (preg_match(
'/^ACCOUNTING_PRODUCT/', $key)) {
299 print img_picto(
'',
'product',
'class="pictofixedwidth"');
300 } elseif (preg_match(
'/^ACCOUNTING_SERVICE/', $key)) {
301 print img_picto(
'',
'service',
'class="pictofixedwidth"');
302 } elseif (preg_match(
'/^ACCOUNTING_VAT_PAY_ACCOUNT/', $key)) {
303 print img_picto(
'',
'payment_vat',
'class="pictofixedwidth"');
304 } elseif (preg_match(
'/^ACCOUNTING_LT1_PAY_ACCOUNT/', $key)) {
305 print img_picto(
'',
'payment_vat',
'class="pictofixedwidth"');
306 } elseif (preg_match(
'/^ACCOUNTING_LT2_PAY_ACCOUNT/', $key)) {
307 print img_picto(
'',
'payment_vat',
'class="pictofixedwidth"');
308 } elseif (preg_match(
'/^ACCOUNTING_VAT/', $key)) {
309 print img_picto(
'',
'vat',
'class="pictofixedwidth"');
310 } elseif (preg_match(
'/^ACCOUNTING_LT/', $key)) {
311 print img_picto(
'',
'vat',
'class="pictofixedwidth"');
312 } elseif (preg_match(
'/^ACCOUNTING_ACCOUNT_CUSTOMER/', $key)) {
313 print img_picto(
'',
'bill',
'class="pictofixedwidth"');
314 } elseif (preg_match(
'/^LOAN_ACCOUNTING_ACCOUNT/', $key)) {
315 print img_picto(
'',
'loan',
'class="pictofixedwidth"');
316 } elseif (preg_match(
'/^DONATION_ACCOUNTING/', $key)) {
317 print img_picto(
'',
'donation',
'class="pictofixedwidth"');
318 } elseif (preg_match(
'/^ADHERENT_SUBSCRIPTION/', $key)) {
319 print img_picto(
'',
'member',
'class="pictofixedwidth"');
320 } elseif (preg_match(
'/^ACCOUNTING_ACCOUNT_TRANSFER/', $key)) {
321 print img_picto(
'',
'bank_account',
'class="pictofixedwidth"');
322 } elseif (preg_match(
'/^ACCOUNTING_ACCOUNT_SUSPENSE/', $key)) {
323 print img_picto(
'',
'question',
'class="pictofixedwidth"');
329 print
'<td class="right">';
330 print $formaccounting->select_account(
getDolGlobalString($key), $key, 1, [], 1, 1,
'minwidth100 maxwidth300 maxwidthonsmartphone',
'accounts');
338print
'<tr class="oddeven value">';
341print img_picto(
'',
'bill',
'class="pictofixedwidth"') . $langs->trans(
'ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT');
344print
'<td class="right">';
345print $formaccounting->select_account(
getDolGlobalString(
'ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT'),
'ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT', 1, [], 1, 1,
'minwidth100 maxwidth300 maxwidthonsmartphone',
'accounts');
350print
'<tr class="oddeven value">';
353print img_picto(
'',
'bill',
'class="pictofixedwidth"') . $langs->trans(
'ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT_FOR_VAT');
356print
'<td class="right">';
357print $formaccounting->select_account(
getDolGlobalString(
'ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT_FOR_VAT'),
'ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT_FOR_VAT', 1, [], 1, 1,
'minwidth100 maxwidth300 maxwidthonsmartphone',
'accounts');
362 print
'<tr class="oddeven">';
363 print
'<td>' . img_picto(
'',
'bill',
'class="pictofixedwidth"') . $langs->trans(
"UseAuxiliaryAccountOnCustomerDeposit") .
'</td>';
364 if (
getDolGlobalInt(
'ACCOUNTING_ACCOUNT_CUSTOMER_USE_AUXILIARY_ON_DEPOSIT')) {
365 print
'<td class="right"><a class="reposition" href="' . $_SERVER[
'PHP_SELF'] .
'?token=' .
newToken() .
'&action=setACCOUNTING_ACCOUNT_CUSTOMER_USE_AUXILIARY_ON_DEPOSIT&value=0">';
366 print img_picto($langs->trans(
"Activated"),
'switch_on',
'', 0, 0, 0,
'',
'warning');
369 print
'<td class="right"><a class="reposition" href="' . $_SERVER[
'PHP_SELF'] .
'?token=' .
newToken() .
'&action=setACCOUNTING_ACCOUNT_CUSTOMER_USE_AUXILIARY_ON_DEPOSIT&value=1">';
370 print img_picto($langs->trans(
"Disabled"),
'switch_off');
377print
'<tr class="oddeven value">';
380print img_picto(
'',
'supplier_invoice',
'class="pictofixedwidth"') . $langs->trans(
'ACCOUNTING_ACCOUNT_SUPPLIER_DEPOSIT');
383print
'<td class="right">';
384print $formaccounting->select_account(
getDolGlobalString(
'ACCOUNTING_ACCOUNT_SUPPLIER_DEPOSIT'),
'ACCOUNTING_ACCOUNT_SUPPLIER_DEPOSIT', 1, [], 1, 1,
'minwidth100 maxwidth300 maxwidthonsmartphone',
'accounts');
389 print
'<tr class="oddeven">';
390 print
'<td>' . img_picto(
'',
'supplier_invoice',
'class="pictofixedwidth"') . $langs->trans(
"UseAuxiliaryAccountOnSupplierDeposit") .
'</td>';
391 if (
getDolGlobalInt(
'ACCOUNTING_ACCOUNT_SUPPLIER_USE_AUXILIARY_ON_DEPOSIT')) {
392 print
'<td class="right"><a class="reposition" href="' . $_SERVER[
'PHP_SELF'] .
'?token=' .
newToken() .
'&action=setACCOUNTING_ACCOUNT_SUPPLIER_USE_AUXILIARY_ON_DEPOSIT&value=0">';
393 print img_picto($langs->trans(
"Activated"),
'switch_on',
'', 0, 0, 0,
'',
'warning');
396 print
'<td class="right"><a class="reposition" href="' . $_SERVER[
'PHP_SELF'] .
'?token=' .
newToken() .
'&action=setACCOUNTING_ACCOUNT_SUPPLIER_USE_AUXILIARY_ON_DEPOSIT&value=1">';
397 print img_picto($langs->trans(
"Disabled"),
'switch_off');
406print
'<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.
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.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.