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_SUPPLIER_DEPOSIT';
197if ($action ==
'setACCOUNTING_ACCOUNT_CUSTOMER_USE_AUXILIARY_ON_DEPOSIT') {
198 $setDisableAuxiliaryAccountOnCustomerDeposit =
GETPOSTINT(
'value');
199 $res =
dolibarr_set_const(
$db,
"ACCOUNTING_ACCOUNT_CUSTOMER_USE_AUXILIARY_ON_DEPOSIT", $setDisableAuxiliaryAccountOnCustomerDeposit,
'yesno', 0,
'',
$conf->entity);
211if ($action ==
'setACCOUNTING_ACCOUNT_SUPPLIER_USE_AUXILIARY_ON_DEPOSIT') {
212 $setDisableAuxiliaryAccountOnSupplierDeposit =
GETPOSTINT(
'value');
213 $res =
dolibarr_set_const(
$db,
"ACCOUNTING_ACCOUNT_SUPPLIER_USE_AUXILIARY_ON_DEPOSIT", $setDisableAuxiliaryAccountOnSupplierDeposit,
'yesno', 0,
'',
$conf->entity);
233$help_url =
'EN:Module_Double_Entry_Accounting#Setup|FR:Module_Comptabilité_en_Partie_Double#Configuration';
235llxHeader(
'', $langs->trans(
'MenuDefaultAccounts'), $help_url,
'', 0, 0,
'',
'',
'',
'mod-accountancy page-admin_defaultaccounts');
238print
load_fiche_titre($langs->trans(
'MenuDefaultAccounts'), $linkback,
'title_accountancy');
240print
'<span class="opacitymedium">'.$langs->trans(
"DefaultBindingDesc").
'</span><br>';
243print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
244print
'<input type="hidden" name="token" value="'.newToken().
'">';
245print
'<input type="hidden" name="action" value="update">';
250print
'<div class="div-table-responsive-no-min">';
251print
'<table class="noborder centpercent">';
252print
'<tr class="liste_titre"><td>'.$langs->trans(
"ThirdParties").
' | '.$langs->trans(
"Users").
'</td><td></td></tr>';
254foreach ($list_account_main as $key) {
255 print
'<tr class="oddeven value">';
257 $label = $langs->trans($key);
258 $keydesc = $key.
'_Desc';
260 $htmltext = $langs->trans($keydesc);
261 print
'<td class="fieldrequired">';
262 if ($key ==
'ACCOUNTING_ACCOUNT_CUSTOMER') {
263 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
264 } elseif ($key ==
'ACCOUNTING_ACCOUNT_SUPPLIER') {
265 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
267 print
img_picto(
'',
'user',
'class="pictofixedwidth"');
269 print $form->textwithpicto($label, $htmltext);
272 print
'<td class="right">';
274 print $formaccounting->select_account($key_value, $key, 1, [], 1, 1,
'minwidth100 maxwidth300 maxwidthonsmartphone',
'accountsmain',
'1', 2);
282print
'<div class="div-table-responsive-no-min">';
283print
'<table class="noborder centpercent">';
285foreach ($list_account as $key) {
287 if (preg_match(
'/---(.*)---/', $key, $reg)) {
288 print
'<tr class="liste_titre"><td>'.$langs->trans($reg[1]).
'</td><td></td></tr>';
290 print
'<tr class="oddeven value">';
292 $label = $langs->trans($key);
294 if (preg_match(
'/^ACCOUNTING_PRODUCT/', $key)) {
295 print
img_picto(
'',
'product',
'class="pictofixedwidth"');
296 } elseif (preg_match(
'/^ACCOUNTING_SERVICE/', $key)) {
297 print
img_picto(
'',
'service',
'class="pictofixedwidth"');
298 } elseif (preg_match(
'/^ACCOUNTING_VAT_PAY_ACCOUNT/', $key)) {
299 print
img_picto(
'',
'payment_vat',
'class="pictofixedwidth"');
300 } elseif (preg_match(
'/^ACCOUNTING_LT1_PAY_ACCOUNT/', $key)) {
301 print
img_picto(
'',
'payment_vat',
'class="pictofixedwidth"');
302 } elseif (preg_match(
'/^ACCOUNTING_LT2_PAY_ACCOUNT/', $key)) {
303 print
img_picto(
'',
'payment_vat',
'class="pictofixedwidth"');
304 } elseif (preg_match(
'/^ACCOUNTING_VAT/', $key)) {
305 print
img_picto(
'',
'vat',
'class="pictofixedwidth"');
306 } elseif (preg_match(
'/^ACCOUNTING_LT/', $key)) {
307 print
img_picto(
'',
'vat',
'class="pictofixedwidth"');
308 } elseif (preg_match(
'/^ACCOUNTING_ACCOUNT_CUSTOMER/', $key)) {
309 print
img_picto(
'',
'bill',
'class="pictofixedwidth"');
310 } elseif (preg_match(
'/^LOAN_ACCOUNTING_ACCOUNT/', $key)) {
311 print
img_picto(
'',
'loan',
'class="pictofixedwidth"');
312 } elseif (preg_match(
'/^DONATION_ACCOUNTING/', $key)) {
313 print
img_picto(
'',
'donation',
'class="pictofixedwidth"');
314 } elseif (preg_match(
'/^ADHERENT_SUBSCRIPTION/', $key)) {
315 print
img_picto(
'',
'member',
'class="pictofixedwidth"');
316 } elseif (preg_match(
'/^ACCOUNTING_ACCOUNT_TRANSFER/', $key)) {
317 print
img_picto(
'',
'bank_account',
'class="pictofixedwidth"');
318 } elseif (preg_match(
'/^ACCOUNTING_ACCOUNT_SUSPENSE/', $key)) {
319 print
img_picto(
'',
'question',
'class="pictofixedwidth"');
325 print
'<td class="right">';
326 print $formaccounting->select_account(
getDolGlobalString($key), $key, 1, [], 1, 1,
'minwidth100 maxwidth300 maxwidthonsmartphone',
'accounts');
334print
'<tr class="oddeven value">';
337print
img_picto(
'',
'bill',
'class="pictofixedwidth"') . $langs->trans(
'ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT');
340print
'<td class="right">';
341print $formaccounting->select_account(
getDolGlobalString(
'ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT'),
'ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT', 1, [], 1, 1,
'minwidth100 maxwidth300 maxwidthonsmartphone',
'accounts');
346 print
'<tr class="oddeven">';
347 print
'<td>' .
img_picto(
'',
'bill',
'class="pictofixedwidth"') . $langs->trans(
"UseAuxiliaryAccountOnCustomerDeposit") .
'</td>';
348 if (
getDolGlobalInt(
'ACCOUNTING_ACCOUNT_CUSTOMER_USE_AUXILIARY_ON_DEPOSIT')) {
349 print
'<td class="right"><a class="reposition" href="' . $_SERVER[
'PHP_SELF'] .
'?token=' . newToken() .
'&action=setACCOUNTING_ACCOUNT_CUSTOMER_USE_AUXILIARY_ON_DEPOSIT&value=0">';
350 print
img_picto($langs->trans(
"Activated"),
'switch_on',
'', 0, 0, 0,
'',
'warning');
353 print
'<td class="right"><a class="reposition" href="' . $_SERVER[
'PHP_SELF'] .
'?token=' . newToken() .
'&action=setACCOUNTING_ACCOUNT_CUSTOMER_USE_AUXILIARY_ON_DEPOSIT&value=1">';
354 print
img_picto($langs->trans(
"Disabled"),
'switch_off');
361print
'<tr class="oddeven value">';
364print
img_picto(
'',
'supplier_invoice',
'class="pictofixedwidth"') . $langs->trans(
'ACCOUNTING_ACCOUNT_SUPPLIER_DEPOSIT');
367print
'<td class="right">';
368print $formaccounting->select_account(
getDolGlobalString(
'ACCOUNTING_ACCOUNT_SUPPLIER_DEPOSIT'),
'ACCOUNTING_ACCOUNT_SUPPLIER_DEPOSIT', 1, [], 1, 1,
'minwidth100 maxwidth300 maxwidthonsmartphone',
'accounts');
373 print
'<tr class="oddeven">';
374 print
'<td>' .
img_picto(
'',
'supplier_invoice',
'class="pictofixedwidth"') . $langs->trans(
"UseAuxiliaryAccountOnSupplierDeposit") .
'</td>';
375 if (
getDolGlobalInt(
'ACCOUNTING_ACCOUNT_SUPPLIER_USE_AUXILIARY_ON_DEPOSIT')) {
376 print
'<td class="right"><a class="reposition" href="' . $_SERVER[
'PHP_SELF'] .
'?token=' . newToken() .
'&action=setACCOUNTING_ACCOUNT_SUPPLIER_USE_AUXILIARY_ON_DEPOSIT&value=0">';
377 print
img_picto($langs->trans(
"Activated"),
'switch_on',
'', 0, 0, 0,
'',
'warning');
380 print
'<td class="right"><a class="reposition" href="' . $_SERVER[
'PHP_SELF'] .
'?token=' . newToken() .
'&action=setACCOUNTING_ACCOUNT_SUPPLIER_USE_AUXILIARY_ON_DEPOSIT&value=1">';
381 print
img_picto($langs->trans(
"Disabled"),
'switch_off');
390print
'<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)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
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.