31require
'../../main.inc.php';
34require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
35require_once DOL_DOCUMENT_ROOT.
'/core/lib/accounting.lib.php';
36require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formaccounting.class.php';
39$langs->loadLangs(array(
"compta",
"bills",
"admin",
"accountancy",
"salaries",
"trips",
"loan"));
42if (!$user->hasRight(
'accounting',
'chartofaccount')) {
46$action =
GETPOST(
'action',
'aZ09');
49$list_account_main = array(
50 'ACCOUNTING_ACCOUNT_CUSTOMER',
51 'ACCOUNTING_ACCOUNT_SUPPLIER',
52 'SALARIES_ACCOUNTING_ACCOUNT_PAYMENT',
55if (isModEnabled(
'expensereport')) {
56 $list_account_main[] =
'ACCOUNTING_ACCOUNT_EXPENSEREPORT';
59$list_account = array();
61$list_account[] =
'---Product---';
62$list_account[] =
'ACCOUNTING_PRODUCT_SOLD_ACCOUNT';
63if ($mysoc->isInEEC()) {
64 $list_account[] =
'ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT';
66$list_account[] =
'ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT';
67$list_account[] =
'ACCOUNTING_PRODUCT_BUY_ACCOUNT';
68if ($mysoc->isInEEC()) {
69 $list_account[] =
'ACCOUNTING_PRODUCT_BUY_INTRA_ACCOUNT';
71$list_account[] =
'ACCOUNTING_PRODUCT_BUY_EXPORT_ACCOUNT';
73$list_account[] =
'---Service---';
74$list_account[] =
'ACCOUNTING_SERVICE_SOLD_ACCOUNT';
75if ($mysoc->isInEEC()) {
76 $list_account[] =
'ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT';
78$list_account[] =
'ACCOUNTING_SERVICE_SOLD_EXPORT_ACCOUNT';
79$list_account[] =
'ACCOUNTING_SERVICE_BUY_ACCOUNT';
80if ($mysoc->isInEEC()) {
81 $list_account[] =
'ACCOUNTING_SERVICE_BUY_INTRA_ACCOUNT';
83$list_account[] =
'ACCOUNTING_SERVICE_BUY_EXPORT_ACCOUNT';
85$list_account[] =
'---Others---';
86$list_account[] =
'ACCOUNTING_VAT_SOLD_ACCOUNT';
87$list_account[] =
'ACCOUNTING_VAT_BUY_ACCOUNT';
94$list_account[] =
'ACCOUNTING_VAT_PAY_ACCOUNT';
97 $list_account[] =
'ACCOUNTING_VAT_BUY_REVERSE_CHARGES_CREDIT';
98 $list_account[] =
'ACCOUNTING_VAT_BUY_REVERSE_CHARGES_DEBIT';
100if (isModEnabled(
'bank')) {
101 $list_account[] =
'ACCOUNTING_ACCOUNT_TRANSFER_CASH';
104 $list_account[] =
'ACCOUNTING_ACCOUNT_CUSTOMER_RETAINED_WARRANTY';
106if (isModEnabled(
'don')) {
107 $list_account[] =
'DONATION_ACCOUNTINGACCOUNT';
109if (isModEnabled(
'member')) {
110 $list_account[] =
'ADHERENT_SUBSCRIPTION_ACCOUNTINGACCOUNT';
112if (isModEnabled(
'loan')) {
113 $list_account[] =
'LOAN_ACCOUNTING_ACCOUNT_CAPITAL';
114 $list_account[] =
'LOAN_ACCOUNTING_ACCOUNT_INTEREST';
115 $list_account[] =
'LOAN_ACCOUNTING_ACCOUNT_INSURANCE';
117$list_account[] =
'ACCOUNTING_ACCOUNT_SUSPENSE';
118if (isModEnabled(
'societe')) {
119 $list_account[] =
'---Deposits---';
126if ($action ==
'update') {
129 foreach ($list_account_main as $constname) {
130 $constvalue =
GETPOST($constname,
'alpha');
132 if (!
dolibarr_set_const($db, $constname, $constvalue,
'chaine', 0,
'', $conf->entity)) {
137 foreach ($list_account as $constname) {
139 if (preg_match(
'/---(.*)---/', $constname, $reg)) {
143 $constvalue =
GETPOST($constname,
'alpha');
145 if (!
dolibarr_set_const($db, $constname, $constvalue,
'chaine', 0,
'', $conf->entity)) {
150 $constname =
'ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT';
152 if (!
dolibarr_set_const($db, $constname, $constvalue,
'chaine', 0,
'', $conf->entity)) {
156 $constname =
'ACCOUNTING_ACCOUNT_SUPPLIER_DEPOSIT';
158 if (!
dolibarr_set_const($db, $constname, $constvalue,
'chaine', 0,
'', $conf->entity)) {
170if ($action ==
'setACCOUNTING_ACCOUNT_CUSTOMER_USE_AUXILIARY_ON_DEPOSIT') {
171 $setDisableAuxiliaryAccountOnCustomerDeposit =
GETPOSTINT(
'value');
172 $res =
dolibarr_set_const($db,
"ACCOUNTING_ACCOUNT_CUSTOMER_USE_AUXILIARY_ON_DEPOSIT", $setDisableAuxiliaryAccountOnCustomerDeposit,
'yesno', 0,
'', $conf->entity);
184if ($action ==
'setACCOUNTING_ACCOUNT_SUPPLIER_USE_AUXILIARY_ON_DEPOSIT') {
185 $setDisableAuxiliaryAccountOnSupplierDeposit =
GETPOSTINT(
'value');
186 $res =
dolibarr_set_const($db,
"ACCOUNTING_ACCOUNT_SUPPLIER_USE_AUXILIARY_ON_DEPOSIT", $setDisableAuxiliaryAccountOnSupplierDeposit,
'yesno', 0,
'', $conf->entity);
203$form =
new Form($db);
206$help_url =
'EN:Module_Double_Entry_Accounting#Setup|FR:Module_Comptabilité_en_Partie_Double#Configuration';
208llxHeader(
'', $langs->trans(
'MenuDefaultAccounts'), $help_url);
211print
load_fiche_titre($langs->trans(
'MenuDefaultAccounts'), $linkback,
'title_accountancy');
213print
'<span class="opacitymedium">'.$langs->trans(
"DefaultBindingDesc").
'</span><br>';
216print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
217print
'<input type="hidden" name="token" value="'.newToken().
'">';
218print
'<input type="hidden" name="action" value="update">';
223print
'<div class="div-table-responsive-no-min">';
224print
'<table class="noborder centpercent">';
225print
'<tr class="liste_titre"><td>'.$langs->trans(
"ThirdParties").
' | '.$langs->trans(
"Users").
'</td><td></td></tr>';
227foreach ($list_account_main as $key) {
228 print
'<tr class="oddeven value">';
230 $label = $langs->trans($key);
231 $keydesc = $key.
'_Desc';
233 $htmltext = $langs->trans($keydesc);
234 print
'<td class="fieldrequired">';
235 if ($key ==
'ACCOUNTING_ACCOUNT_CUSTOMER') {
236 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
237 } elseif ($key ==
'ACCOUNTING_ACCOUNT_SUPPLIER') {
238 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
240 print
img_picto(
'',
'user',
'class="pictofixedwidth"');
242 print $form->textwithpicto($label, $htmltext);
245 print
'<td class="right">';
247 print $formaccounting->select_account($key_value, $key, 1, [], 1, 1,
'minwidth100 maxwidth300 maxwidthonsmartphone',
'accountsmain');
255print
'<div class="div-table-responsive-no-min">';
256print
'<table class="noborder centpercent">';
258foreach ($list_account as $key) {
260 if (preg_match(
'/---(.*)---/', $key, $reg)) {
261 print
'<tr class="liste_titre"><td>'.$langs->trans($reg[1]).
'</td><td></td></tr>';
263 print
'<tr class="oddeven value">';
265 $label = $langs->trans($key);
267 if (preg_match(
'/^ACCOUNTING_PRODUCT/', $key)) {
268 print
img_picto(
'',
'product',
'class="pictofixedwidth"');
269 } elseif (preg_match(
'/^ACCOUNTING_SERVICE/', $key)) {
270 print
img_picto(
'',
'service',
'class="pictofixedwidth"');
271 } elseif (preg_match(
'/^ACCOUNTING_VAT_PAY_ACCOUNT/', $key)) {
272 print
img_picto(
'',
'payment_vat',
'class="pictofixedwidth"');
273 } elseif (preg_match(
'/^ACCOUNTING_VAT/', $key)) {
274 print
img_picto(
'',
'vat',
'class="pictofixedwidth"');
275 } elseif (preg_match(
'/^ACCOUNTING_ACCOUNT_CUSTOMER/', $key)) {
276 print
img_picto(
'',
'bill',
'class="pictofixedwidth"');
277 } elseif (preg_match(
'/^LOAN_ACCOUNTING_ACCOUNT/', $key)) {
278 print
img_picto(
'',
'loan',
'class="pictofixedwidth"');
279 } elseif (preg_match(
'/^DONATION_ACCOUNTING/', $key)) {
280 print
img_picto(
'',
'donation',
'class="pictofixedwidth"');
281 } elseif (preg_match(
'/^ADHERENT_SUBSCRIPTION/', $key)) {
282 print
img_picto(
'',
'member',
'class="pictofixedwidth"');
283 } elseif (preg_match(
'/^ACCOUNTING_ACCOUNT_TRANSFER/', $key)) {
284 print
img_picto(
'',
'bank_account',
'class="pictofixedwidth"');
285 } elseif (preg_match(
'/^ACCOUNTING_ACCOUNT_SUSPENSE/', $key)) {
286 print
img_picto(
'',
'question',
'class="pictofixedwidth"');
292 print
'<td class="right">';
293 print $formaccounting->select_account(
getDolGlobalString($key), $key, 1, [], 1, 1,
'minwidth100 maxwidth300 maxwidthonsmartphone',
'accounts');
301print
'<tr class="oddeven value">';
304print
img_picto(
'',
'bill',
'class="pictofixedwidth"') . $langs->trans(
'ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT');
307print
'<td class="right">';
308print $formaccounting->select_account(
getDolGlobalString(
'ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT'),
'ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT', 1, [], 1, 1,
'minwidth100 maxwidth300 maxwidthonsmartphone',
'accounts');
313 print
'<tr class="oddeven">';
314 print
'<td>' .
img_picto(
'',
'bill',
'class="pictofixedwidth"') . $langs->trans(
"UseAuxiliaryAccountOnCustomerDeposit") .
'</td>';
315 if (
getDolGlobalInt(
'ACCOUNTING_ACCOUNT_CUSTOMER_USE_AUXILIARY_ON_DEPOSIT')) {
316 print
'<td class="right"><a class="reposition" href="' . $_SERVER[
'PHP_SELF'] .
'?token=' .
newToken() .
'&action=setACCOUNTING_ACCOUNT_CUSTOMER_USE_AUXILIARY_ON_DEPOSIT&value=0">';
317 print
img_picto($langs->trans(
"Activated"),
'switch_on',
'',
false, 0, 0,
'',
'warning');
320 print
'<td class="right"><a class="reposition" href="' . $_SERVER[
'PHP_SELF'] .
'?token=' .
newToken() .
'&action=setACCOUNTING_ACCOUNT_CUSTOMER_USE_AUXILIARY_ON_DEPOSIT&value=1">';
321 print
img_picto($langs->trans(
"Disabled"),
'switch_off');
328print
'<tr class="oddeven value">';
331print
img_picto(
'',
'supplier_invoice',
'class="pictofixedwidth"') . $langs->trans(
'ACCOUNTING_ACCOUNT_SUPPLIER_DEPOSIT');
334print
'<td class="right">';
335print $formaccounting->select_account(
getDolGlobalString(
'ACCOUNTING_ACCOUNT_SUPPLIER_DEPOSIT'),
'ACCOUNTING_ACCOUNT_SUPPLIER_DEPOSIT', 1, [], 1, 1,
'minwidth100 maxwidth300 maxwidthonsmartphone',
'accounts');
340 print
'<tr class="oddeven">';
341 print
'<td>' .
img_picto(
'',
'supplier_invoice',
'class="pictofixedwidth"') . $langs->trans(
"UseAuxiliaryAccountOnSupplierDeposit") .
'</td>';
342 if (
getDolGlobalInt(
'ACCOUNTING_ACCOUNT_SUPPLIER_USE_AUXILIARY_ON_DEPOSIT')) {
343 print
'<td class="right"><a class="reposition" href="' . $_SERVER[
'PHP_SELF'] .
'?token=' .
newToken() .
'&action=setACCOUNTING_ACCOUNT_SUPPLIER_USE_AUXILIARY_ON_DEPOSIT&value=0">';
344 print
img_picto($langs->trans(
"Activated"),
'switch_on',
'',
false, 0, 0,
'',
'warning');
347 print
'<td class="right"><a class="reposition" href="' . $_SERVER[
'PHP_SELF'] .
'?token=' .
newToken() .
'&action=setACCOUNTING_ACCOUNT_SUPPLIER_USE_AUXILIARY_ON_DEPOSIT&value=1">';
348 print
img_picto($langs->trans(
"Disabled"),
'switch_off');
357print
'<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()
Empty header.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
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.
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)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.