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 (empty($user->rights->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',
55 $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';
67 $list_account[] =
'---Service---';
68 $list_account[] =
'ACCOUNTING_SERVICE_SOLD_ACCOUNT';
69 if ($mysoc->isInEEC()) {
70 $list_account[] =
'ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT';
72 $list_account[] =
'ACCOUNTING_SERVICE_SOLD_EXPORT_ACCOUNT';
73 $list_account[] =
'ACCOUNTING_SERVICE_BUY_ACCOUNT';
74 if ($mysoc->isInEEC()) {
75 $list_account[] =
'ACCOUNTING_SERVICE_BUY_INTRA_ACCOUNT';
77 $list_account[] =
'ACCOUNTING_SERVICE_BUY_EXPORT_ACCOUNT';
78 $list_account[] =
'---Others---';
79 $list_account[] =
'ACCOUNTING_VAT_BUY_ACCOUNT';
80 $list_account[] =
'ACCOUNTING_VAT_SOLD_ACCOUNT';
81 $list_account[] =
'ACCOUNTING_VAT_PAY_ACCOUNT';
82 $list_account[] =
'ACCOUNTING_ACCOUNT_SUSPENSE';
83 if ($conf->banque->enabled) {
84 $list_account[] =
'ACCOUNTING_ACCOUNT_TRANSFER_CASH';
86 if ($conf->don->enabled) {
87 $list_account[] =
'DONATION_ACCOUNTINGACCOUNT';
89 if ($conf->adherent->enabled) {
90 $list_account[] =
'ADHERENT_SUBSCRIPTION_ACCOUNTINGACCOUNT';
92 if ($conf->loan->enabled) {
93 $list_account[] =
'LOAN_ACCOUNTING_ACCOUNT_CAPITAL';
94 $list_account[] =
'LOAN_ACCOUNTING_ACCOUNT_INTEREST';
95 $list_account[] =
'LOAN_ACCOUNTING_ACCOUNT_INSURANCE';
97 if ($conf->societe->enabled) {
98 $list_account[] =
'ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT';
104 if ($action ==
'update') {
107 foreach ($list_account_main as $constname) {
108 $constvalue =
GETPOST($constname,
'alpha');
110 if (!
dolibarr_set_const($db, $constname, $constvalue,
'chaine', 0,
'', $conf->entity)) {
115 foreach ($list_account as $constname) {
117 if (preg_match(
'/---(.*)---/', $constname, $reg)) {
121 $constvalue =
GETPOST($constname,
'alpha');
123 if (!
dolibarr_set_const($db, $constname, $constvalue,
'chaine', 0,
'', $conf->entity)) {
140 $form =
new Form($db);
148 print '<span class="opacitymedium">'.$langs->trans(
"DefaultBindingDesc").
'</span><br>';
151 print '<form action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
152 print '<input type="hidden" name="token" value="'.newToken().
'">';
153 print '<input type="hidden" name="action" value="update">';
158 print '<table class="noborder centpercent">';
159 print '<tr class="liste_titre"><td>'.$langs->trans(
"ThirdParties").
' | '.$langs->trans(
"Users").
'</td><td></td></tr>';
161 foreach ($list_account_main as $key) {
162 print '<tr class="oddeven value">';
164 $label = $langs->trans($key);
165 $keydesc = $key.
'_Desc';
167 $htmltext = $langs->trans($keydesc);
168 print '<td class="fieldrequired" width="50%">';
169 print $form->textwithpicto($label, $htmltext);
173 print $formaccounting->select_account($conf->global->$key, $key, 1,
'', 1, 1);
179 foreach ($list_account as $key) {
181 if (preg_match(
'/---(.*)---/', $key, $reg)) {
182 print '<tr class="liste_titre"><td>'.$langs->trans($reg[1]).
'</td><td></td></tr>';
184 print '<tr class="oddeven value">';
186 $label = $langs->trans($key);
187 print '<td width="50%">'.$label.
'</td>';
190 print $formaccounting->select_account($conf->global->$key, $key, 1,
'', 1, 1);
200 print '<div class="center"><input type="submit" class="button" value="'.$langs->trans(
'Modify').
'" name="button"></div>';
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
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).
setEventMessages($mesg, $mesgs, $style= 'mesgs', $messagekey= '')
Set event messages in dol_events session object.
load_fiche_titre($titre, $morehtmlright= '', $picto= 'generic', $pictoisfullpath=0, $id= '', $morecssontable= '', $morehtmlcenter= '')
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 Calling this function terminate execution ...
print
Draft customers invoices.