30 require
'../../main.inc.php';
33 require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
34 require_once DOL_DOCUMENT_ROOT.
'/core/lib/accounting.lib.php';
35 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formaccounting.class.php';
38 $langs->loadLangs(array(
"compta",
"bills",
"admin",
"accountancy",
"salaries",
"loan"));
41 if (!$user->hasRight(
'accounting',
'chartofaccount')) {
45 $action =
GETPOST(
'action',
'aZ09');
48 $list_account_main = array(
49 'ACCOUNTING_ACCOUNT_CUSTOMER',
50 'ACCOUNTING_ACCOUNT_SUPPLIER',
51 'SALARIES_ACCOUNTING_ACCOUNT_PAYMENT',
54 $list_account = array();
56 $list_account[] =
'---Product---';
57 $list_account[] =
'ACCOUNTING_PRODUCT_SOLD_ACCOUNT';
58 if ($mysoc->isInEEC()) {
59 $list_account[] =
'ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT';
61 $list_account[] =
'ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT';
62 $list_account[] =
'ACCOUNTING_PRODUCT_BUY_ACCOUNT';
63 if ($mysoc->isInEEC()) {
64 $list_account[] =
'ACCOUNTING_PRODUCT_BUY_INTRA_ACCOUNT';
66 $list_account[] =
'ACCOUNTING_PRODUCT_BUY_EXPORT_ACCOUNT';
68 $list_account[] =
'---Service---';
69 $list_account[] =
'ACCOUNTING_SERVICE_SOLD_ACCOUNT';
70 if ($mysoc->isInEEC()) {
71 $list_account[] =
'ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT';
73 $list_account[] =
'ACCOUNTING_SERVICE_SOLD_EXPORT_ACCOUNT';
74 $list_account[] =
'ACCOUNTING_SERVICE_BUY_ACCOUNT';
75 if ($mysoc->isInEEC()) {
76 $list_account[] =
'ACCOUNTING_SERVICE_BUY_INTRA_ACCOUNT';
78 $list_account[] =
'ACCOUNTING_SERVICE_BUY_EXPORT_ACCOUNT';
80 $list_account[] =
'---Others---';
81 $list_account[] =
'ACCOUNTING_VAT_BUY_ACCOUNT';
82 $list_account[] =
'ACCOUNTING_VAT_SOLD_ACCOUNT';
83 $list_account[] =
'ACCOUNTING_VAT_PAY_ACCOUNT';
85 $list_account[] =
'ACCOUNTING_ACCOUNT_TRANSFER_CASH';
88 $list_account[] =
'DONATION_ACCOUNTINGACCOUNT';
91 $list_account[] =
'ADHERENT_SUBSCRIPTION_ACCOUNTINGACCOUNT';
94 $list_account[] =
'LOAN_ACCOUNTING_ACCOUNT_CAPITAL';
95 $list_account[] =
'LOAN_ACCOUNTING_ACCOUNT_INTEREST';
96 $list_account[] =
'LOAN_ACCOUNTING_ACCOUNT_INSURANCE';
98 $list_account[] =
'ACCOUNTING_ACCOUNT_SUSPENSE';
100 $list_account[] =
'---Deposits---';
106 if ($action ==
'update') {
109 foreach ($list_account_main as $constname) {
110 $constvalue =
GETPOST($constname,
'alpha');
112 if (!
dolibarr_set_const($db, $constname, $constvalue,
'chaine', 0,
'', $conf->entity)) {
117 foreach ($list_account as $constname) {
119 if (preg_match(
'/---(.*)---/', $constname, $reg)) {
123 $constvalue =
GETPOST($constname,
'alpha');
125 if (!
dolibarr_set_const($db, $constname, $constvalue,
'chaine', 0,
'', $conf->entity)) {
130 $constname =
'ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT';
131 $constvalue =
GETPOST($constname,
'int');
132 if (!
dolibarr_set_const($db, $constname, $constvalue,
'chaine', 0,
'', $conf->entity)) {
136 $constname =
'ACCOUNTING_ACCOUNT_SUPPLIER_DEPOSIT';
137 $constvalue =
GETPOST($constname,
'int');
138 if (!
dolibarr_set_const($db, $constname, $constvalue,
'chaine', 0,
'', $conf->entity)) {
150 if ($action ==
'setACCOUNTING_ACCOUNT_CUSTOMER_USE_AUXILIARY_ON_DEPOSIT') {
151 $setDisableAuxiliaryAccountOnCustomerDeposit =
GETPOST(
'value',
'int');
152 $res =
dolibarr_set_const($db,
"ACCOUNTING_ACCOUNT_CUSTOMER_USE_AUXILIARY_ON_DEPOSIT", $setDisableAuxiliaryAccountOnCustomerDeposit,
'yesno', 0,
'', $conf->entity);
164 if ($action ==
'setACCOUNTING_ACCOUNT_SUPPLIER_USE_AUXILIARY_ON_DEPOSIT') {
165 $setDisableAuxiliaryAccountOnSupplierDeposit =
GETPOST(
'value',
'int');
166 $res =
dolibarr_set_const($db,
"ACCOUNTING_ACCOUNT_SUPPLIER_USE_AUXILIARY_ON_DEPOSIT", $setDisableAuxiliaryAccountOnSupplierDeposit,
'yesno', 0,
'', $conf->entity);
189 print
load_fiche_titre($langs->trans(
'MenuDefaultAccounts'), $linkback,
'title_accountancy');
191 print
'<span class="opacitymedium">'.$langs->trans(
"DefaultBindingDesc").
'</span><br>';
194 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
195 print
'<input type="hidden" name="token" value="'.newToken().
'">';
196 print
'<input type="hidden" name="action" value="update">';
201 print
'<div class="div-table-responsive-no-min">';
202 print
'<table class="noborder centpercent">';
203 print
'<tr class="liste_titre"><td>'.$langs->trans(
"ThirdParties").
' | '.$langs->trans(
"Users").
'</td><td></td></tr>';
205 foreach ($list_account_main as $key) {
206 print
'<tr class="oddeven value">';
208 $label = $langs->trans($key);
209 $keydesc = $key.
'_Desc';
211 $htmltext = $langs->trans($keydesc);
212 print
'<td class="fieldrequired">';
213 if ($key ==
'ACCOUNTING_ACCOUNT_CUSTOMER') {
214 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
215 } elseif ($key ==
'ACCOUNTING_ACCOUNT_SUPPLIER') {
216 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
218 print
img_picto(
'',
'user',
'class="pictofixedwidth"');
220 print
$form->textwithpicto($label, $htmltext);
223 print
'<td class="right">';
225 print $formaccounting->select_account($key_value, $key, 1,
'', 1, 1,
'minwidth100 maxwidth300 maxwidthonsmartphone',
'accountsmain');
233 print
'<div class="div-table-responsive-no-min">';
234 print
'<table class="noborder centpercent">';
236 foreach ($list_account as $key) {
238 if (preg_match(
'/---(.*)---/', $key, $reg)) {
239 print
'<tr class="liste_titre"><td>'.$langs->trans($reg[1]).
'</td><td></td></tr>';
241 print
'<tr class="oddeven value">';
243 $label = $langs->trans($key);
245 if (preg_match(
'/^ACCOUNTING_PRODUCT/', $key)) {
246 print
img_picto(
'',
'product',
'class="pictofixedwidth"');
247 } elseif (preg_match(
'/^ACCOUNTING_SERVICE/', $key)) {
248 print
img_picto(
'',
'service',
'class="pictofixedwidth"');
249 } elseif (preg_match(
'/^ACCOUNTING_VAT_PAY_ACCOUNT/', $key)) {
250 print
img_picto(
'',
'payment_vat',
'class="pictofixedwidth"');
251 } elseif (preg_match(
'/^ACCOUNTING_VAT/', $key)) {
252 print
img_picto(
'',
'vat',
'class="pictofixedwidth"');
253 } elseif (preg_match(
'/^ACCOUNTING_ACCOUNT_CUSTOMER/', $key)) {
254 print
img_picto(
'',
'bill',
'class="pictofixedwidth"');
255 } elseif (preg_match(
'/^LOAN_ACCOUNTING_ACCOUNT/', $key)) {
256 print
img_picto(
'',
'loan',
'class="pictofixedwidth"');
257 } elseif (preg_match(
'/^DONATION_ACCOUNTING/', $key)) {
258 print
img_picto(
'',
'donation',
'class="pictofixedwidth"');
259 } elseif (preg_match(
'/^ADHERENT_SUBSCRIPTION/', $key)) {
260 print
img_picto(
'',
'member',
'class="pictofixedwidth"');
261 } elseif (preg_match(
'/^ACCOUNTING_ACCOUNT_TRANSFER/', $key)) {
262 print
img_picto(
'',
'bank_account',
'class="pictofixedwidth"');
263 } elseif (preg_match(
'/^ACCOUNTING_ACCOUNT_SUSPENSE/', $key)) {
264 print
img_picto(
'',
'question',
'class="pictofixedwidth"');
269 print
'<td class="right">';
270 print $formaccounting->select_account(
getDolGlobalString($key), $key, 1,
'', 1, 1,
'minwidth100 maxwidth300 maxwidthonsmartphone',
'accounts');
278 print
'<tr class="oddeven value">';
281 print
img_picto(
'',
'bill',
'class="pictofixedwidth"') . $langs->trans(
'ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT');
284 print
'<td class="right">';
285 print $formaccounting->select_account(
getDolGlobalString(
'ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT'),
'ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT', 1,
'', 1, 1,
'minwidth100 maxwidth300 maxwidthonsmartphone',
'accounts');
290 print
'<tr class="oddeven">';
291 print
'<td>' .
img_picto(
'',
'bill',
'class="pictofixedwidth"') . $langs->trans(
"UseAuxiliaryAccountOnCustomerDeposit") .
'</td>';
292 if (
getDolGlobalInt(
'ACCOUNTING_ACCOUNT_CUSTOMER_USE_AUXILIARY_ON_DEPOSIT')) {
293 print
'<td class="right"><a class="reposition" href="' . $_SERVER[
'PHP_SELF'] .
'?token=' .
newToken() .
'&action=setACCOUNTING_ACCOUNT_CUSTOMER_USE_AUXILIARY_ON_DEPOSIT&value=0">';
294 print
img_picto($langs->trans(
"Activated"),
'switch_on',
'',
false, 0, 0,
'',
'warning');
297 print
'<td class="right"><a class="reposition" href="' . $_SERVER[
'PHP_SELF'] .
'?token=' .
newToken() .
'&action=setACCOUNTING_ACCOUNT_CUSTOMER_USE_AUXILIARY_ON_DEPOSIT&value=1">';
298 print
img_picto($langs->trans(
"Disabled"),
'switch_off');
305 print
'<tr class="oddeven value">';
308 print
img_picto(
'',
'supplier_invoice',
'class="pictofixedwidth"') . $langs->trans(
'ACCOUNTING_ACCOUNT_SUPPLIER_DEPOSIT');
311 print
'<td class="right">';
312 print $formaccounting->select_account(
getDolGlobalString(
'ACCOUNTING_ACCOUNT_SUPPLIER_DEPOSIT'),
'ACCOUNTING_ACCOUNT_SUPPLIER_DEPOSIT', 1,
'', 1, 1,
'minwidth100 maxwidth300 maxwidthonsmartphone',
'accounts');
317 print
'<tr class="oddeven">';
318 print
'<td>' .
img_picto(
'',
'supplier_invoice',
'class="pictofixedwidth"') . $langs->trans(
"UseAuxiliaryAccountOnSupplierDeposit") .
'</td>';
319 if (
getDolGlobalInt(
'ACCOUNTING_ACCOUNT_SUPPLIER_USE_AUXILIARY_ON_DEPOSIT')) {
320 print
'<td class="right"><a class="reposition" href="' . $_SERVER[
'PHP_SELF'] .
'?token=' .
newToken() .
'&action=setACCOUNTING_ACCOUNT_SUPPLIER_USE_AUXILIARY_ON_DEPOSIT&value=0">';
321 print
img_picto($langs->trans(
"Activated"),
'switch_on',
'',
false, 0, 0,
'',
'warning');
324 print
'<td class="right"><a class="reposition" href="' . $_SERVER[
'PHP_SELF'] .
'?token=' .
newToken() .
'&action=setACCOUNTING_ACCOUNT_SUPPLIER_USE_AUXILIARY_ON_DEPOSIT&value=1">';
325 print
img_picto($langs->trans(
"Disabled"),
'switch_off');
334 print
'<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.
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
getDolGlobalInt($key, $default=0)
Return dolibarr global constant int value.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
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.
if(!function_exists('utf8_encode')) if(!function_exists('utf8_decode')) getDolGlobalString($key, $default='')
Return 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.