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';
 
   48$langs->loadLangs(array(
"compta", 
"bills", 
"admin", 
"accountancy", 
"salaries", 
"trips", 
"loan"));
 
   51if (!$user->hasRight(
'accounting', 
'chartofaccount')) {
 
   55$action = 
GETPOST(
'action', 
'aZ09');
 
   58$list_account_main = array(
 
   59  'ACCOUNTING_ACCOUNT_CUSTOMER',
 
   60  'ACCOUNTING_ACCOUNT_SUPPLIER',
 
   61  'SALARIES_ACCOUNTING_ACCOUNT_PAYMENT',
 
   64if (isModEnabled(
'expensereport')) {
 
   65  $list_account_main[] = 
'ACCOUNTING_ACCOUNT_EXPENSEREPORT';
 
   68$list_account = array();
 
   70$list_account[] = 
'---Product---';
 
   71$list_account[] = 
'ACCOUNTING_PRODUCT_SOLD_ACCOUNT';
 
   72if ($mysoc->isInEEC()) {
 
   73  $list_account[] = 
'ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT';
 
   75$list_account[] = 
'ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT';
 
   76$list_account[] = 
'ACCOUNTING_PRODUCT_BUY_ACCOUNT';
 
   77if ($mysoc->isInEEC()) {
 
   78  $list_account[] = 
'ACCOUNTING_PRODUCT_BUY_INTRA_ACCOUNT';
 
   80$list_account[] = 
'ACCOUNTING_PRODUCT_BUY_EXPORT_ACCOUNT';
 
   82$list_account[] = 
'---Service---';
 
   83$list_account[] = 
'ACCOUNTING_SERVICE_SOLD_ACCOUNT';
 
   84if ($mysoc->isInEEC()) {
 
   85  $list_account[] = 
'ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT';
 
   87$list_account[] = 
'ACCOUNTING_SERVICE_SOLD_EXPORT_ACCOUNT';
 
   88$list_account[] = 
'ACCOUNTING_SERVICE_BUY_ACCOUNT';
 
   89if ($mysoc->isInEEC()) {
 
   90  $list_account[] = 
'ACCOUNTING_SERVICE_BUY_INTRA_ACCOUNT';
 
   92$list_account[] = 
'ACCOUNTING_SERVICE_BUY_EXPORT_ACCOUNT';
 
   94$list_account[] = 
'---Others---';
 
   95$list_account[] = 
'ACCOUNTING_VAT_SOLD_ACCOUNT';
 
   96$list_account[] = 
'ACCOUNTING_VAT_BUY_ACCOUNT';
 
  103$list_account[] = 
'ACCOUNTING_VAT_PAY_ACCOUNT';
 
  106  $list_account[] = 
'ACCOUNTING_VAT_BUY_REVERSE_CHARGES_CREDIT';
 
  107  $list_account[] = 
'ACCOUNTING_VAT_BUY_REVERSE_CHARGES_DEBIT';
 
  109if (isModEnabled(
'bank')) {
 
  110  $list_account[] = 
'ACCOUNTING_ACCOUNT_TRANSFER_CASH';
 
  113  $list_account[] = 
'ACCOUNTING_ACCOUNT_CUSTOMER_RETAINED_WARRANTY';
 
  115if (isModEnabled(
'don')) {
 
  116  $list_account[] = 
'DONATION_ACCOUNTINGACCOUNT';
 
  118if (isModEnabled(
'member')) {
 
  119  $list_account[] = 
'ADHERENT_SUBSCRIPTION_ACCOUNTINGACCOUNT';
 
  121if (isModEnabled(
'loan')) {
 
  122  $list_account[] = 
'LOAN_ACCOUNTING_ACCOUNT_CAPITAL';
 
  123  $list_account[] = 
'LOAN_ACCOUNTING_ACCOUNT_INTEREST';
 
  124  $list_account[] = 
'LOAN_ACCOUNTING_ACCOUNT_INSURANCE';
 
  126$list_account[] = 
'ACCOUNTING_ACCOUNT_SUSPENSE';
 
  127if (isModEnabled(
'societe')) {
 
  128  $list_account[] = 
'---Deposits---';
 
  137if ($action == 
'update') {
 
  139  foreach ($list_account_main as $constname) {
 
  140    $constvalue = 
GETPOST($constname, 
'alpha');
 
  147  foreach ($list_account as $constname) {
 
  149    if (preg_match(
'/---(.*)---/', $constname, $reg)) { 
 
  153    $constvalue = 
GETPOST($constname, 
'alpha');
 
  160  $constname = 
'ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT';
 
  166  $constname = 
'ACCOUNTING_ACCOUNT_SUPPLIER_DEPOSIT';
 
  180if ($action == 
'setACCOUNTING_ACCOUNT_CUSTOMER_USE_AUXILIARY_ON_DEPOSIT') {
 
  181  $setDisableAuxiliaryAccountOnCustomerDeposit = 
GETPOSTINT(
'value');
 
  182  $res = 
dolibarr_set_const($db, 
"ACCOUNTING_ACCOUNT_CUSTOMER_USE_AUXILIARY_ON_DEPOSIT", $setDisableAuxiliaryAccountOnCustomerDeposit, 
'yesno', 0, 
'', 
$conf->entity);
 
  194if ($action == 
'setACCOUNTING_ACCOUNT_SUPPLIER_USE_AUXILIARY_ON_DEPOSIT') {
 
  195  $setDisableAuxiliaryAccountOnSupplierDeposit = 
GETPOSTINT(
'value');
 
  196  $res = 
dolibarr_set_const($db, 
"ACCOUNTING_ACCOUNT_SUPPLIER_USE_AUXILIARY_ON_DEPOSIT", $setDisableAuxiliaryAccountOnSupplierDeposit, 
'yesno', 0, 
'', 
$conf->entity);
 
  213$form = 
new Form($db);
 
  216$help_url = 
'EN:Module_Double_Entry_Accounting#Setup|FR:Module_Comptabilité_en_Partie_Double#Configuration';
 
  218llxHeader(
'', $langs->trans(
'MenuDefaultAccounts'), $help_url, 
'', 0, 0, 
'', 
'', 
'', 
'mod-accountancy page-admin_defaultaccounts');
 
  221print 
load_fiche_titre($langs->trans(
'MenuDefaultAccounts'), $linkback, 
'title_accountancy');
 
  223print 
'<span class="opacitymedium">'.$langs->trans(
"DefaultBindingDesc").
'</span><br>';
 
  226print 
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
 
  227print 
'<input type="hidden" name="token" value="'.newToken().
'">';
 
  228print 
'<input type="hidden" name="action" value="update">';
 
  233print 
'<div class="div-table-responsive-no-min">';
 
  234print 
'<table class="noborder centpercent">';
 
  235print 
'<tr class="liste_titre"><td>'.$langs->trans(
"ThirdParties").
' | '.$langs->trans(
"Users").
'</td><td></td></tr>';
 
  237foreach ($list_account_main as $key) {
 
  238  print 
'<tr class="oddeven value">';
 
  240  $label = $langs->trans($key);
 
  241  $keydesc = $key.
'_Desc';
 
  243  $htmltext = $langs->trans($keydesc);
 
  244  print 
'<td class="fieldrequired">';
 
  245  if ($key == 
'ACCOUNTING_ACCOUNT_CUSTOMER') {
 
  246    print 
img_picto(
'', 
'company', 
'class="pictofixedwidth"');
 
  247  } elseif ($key == 
'ACCOUNTING_ACCOUNT_SUPPLIER') {
 
  248    print 
img_picto(
'', 
'company', 
'class="pictofixedwidth"');
 
  250    print 
img_picto(
'', 
'user', 
'class="pictofixedwidth"');
 
  252  print $form->textwithpicto($label, $htmltext);
 
  255  print 
'<td class="right">'; 
 
  257  print $formaccounting->select_account($key_value, $key, 1, [], 1, 1, 
'minwidth100 maxwidth300 maxwidthonsmartphone', 
'accountsmain');
 
  265print 
'<div class="div-table-responsive-no-min">';
 
  266print 
'<table class="noborder centpercent">';
 
  268foreach ($list_account as $key) {
 
  270  if (preg_match(
'/---(.*)---/', $key, $reg)) {
 
  271    print 
'<tr class="liste_titre"><td>'.$langs->trans($reg[1]).
'</td><td></td></tr>';
 
  273    print 
'<tr class="oddeven value">';
 
  275    $label = $langs->trans($key);
 
  277    if (preg_match(
'/^ACCOUNTING_PRODUCT/', $key)) {
 
  278      print 
img_picto(
'', 
'product', 
'class="pictofixedwidth"');
 
  279    } elseif (preg_match(
'/^ACCOUNTING_SERVICE/', $key)) {
 
  280      print 
img_picto(
'', 
'service', 
'class="pictofixedwidth"');
 
  281    } elseif (preg_match(
'/^ACCOUNTING_VAT_PAY_ACCOUNT/', $key)) {
 
  282      print 
img_picto(
'', 
'payment_vat', 
'class="pictofixedwidth"');
 
  283    } elseif (preg_match(
'/^ACCOUNTING_VAT/', $key)) {
 
  284      print 
img_picto(
'', 
'vat', 
'class="pictofixedwidth"');
 
  285    } elseif (preg_match(
'/^ACCOUNTING_ACCOUNT_CUSTOMER/', $key)) {
 
  286      print 
img_picto(
'', 
'bill', 
'class="pictofixedwidth"');
 
  287    } elseif (preg_match(
'/^LOAN_ACCOUNTING_ACCOUNT/', $key)) {
 
  288      print 
img_picto(
'', 
'loan', 
'class="pictofixedwidth"');
 
  289    } elseif (preg_match(
'/^DONATION_ACCOUNTING/', $key)) {
 
  290      print 
img_picto(
'', 
'donation', 
'class="pictofixedwidth"');
 
  291    } elseif (preg_match(
'/^ADHERENT_SUBSCRIPTION/', $key)) {
 
  292      print 
img_picto(
'', 
'member', 
'class="pictofixedwidth"');
 
  293    } elseif (preg_match(
'/^ACCOUNTING_ACCOUNT_TRANSFER/', $key)) {
 
  294      print 
img_picto(
'', 
'bank_account', 
'class="pictofixedwidth"');
 
  295    } elseif (preg_match(
'/^ACCOUNTING_ACCOUNT_SUSPENSE/', $key)) {
 
  296      print 
img_picto(
'', 
'question', 
'class="pictofixedwidth"');
 
  302    print 
'<td class="right">'; 
 
  303    print $formaccounting->select_account(
getDolGlobalString($key), $key, 1, [], 1, 1, 
'minwidth100 maxwidth300 maxwidthonsmartphone', 
'accounts');
 
  311print 
'<tr class="oddeven value">';
 
  314print 
img_picto(
'', 
'bill', 
'class="pictofixedwidth"') . $langs->trans(
'ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT');
 
  317print 
'<td class="right">'; 
 
  318print $formaccounting->select_account(
getDolGlobalString(
'ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT'), 
'ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT', 1, [], 1, 1, 
'minwidth100 maxwidth300 maxwidthonsmartphone', 
'accounts');
 
  323  print 
'<tr class="oddeven">';
 
  324  print 
'<td>' . 
img_picto(
'', 
'bill', 
'class="pictofixedwidth"') . $langs->trans(
"UseAuxiliaryAccountOnCustomerDeposit") . 
'</td>';
 
  325  if (
getDolGlobalInt(
'ACCOUNTING_ACCOUNT_CUSTOMER_USE_AUXILIARY_ON_DEPOSIT')) {
 
  326    print 
'<td class="right"><a class="reposition" href="' . $_SERVER[
'PHP_SELF'] . 
'?token=' . 
newToken() . 
'&action=setACCOUNTING_ACCOUNT_CUSTOMER_USE_AUXILIARY_ON_DEPOSIT&value=0">';
 
  327    print 
img_picto($langs->trans(
"Activated"), 
'switch_on', 
'', 0, 0, 0, 
'', 
'warning');
 
  330    print 
'<td class="right"><a class="reposition" href="' . $_SERVER[
'PHP_SELF'] . 
'?token=' . 
newToken() . 
'&action=setACCOUNTING_ACCOUNT_CUSTOMER_USE_AUXILIARY_ON_DEPOSIT&value=1">';
 
  331    print 
img_picto($langs->trans(
"Disabled"), 
'switch_off');
 
  338print 
'<tr class="oddeven value">';
 
  341print 
img_picto(
'', 
'supplier_invoice', 
'class="pictofixedwidth"') . $langs->trans(
'ACCOUNTING_ACCOUNT_SUPPLIER_DEPOSIT');
 
  344print 
'<td class="right">'; 
 
  345print $formaccounting->select_account(
getDolGlobalString(
'ACCOUNTING_ACCOUNT_SUPPLIER_DEPOSIT'), 
'ACCOUNTING_ACCOUNT_SUPPLIER_DEPOSIT', 1, [], 1, 1, 
'minwidth100 maxwidth300 maxwidthonsmartphone', 
'accounts');
 
  350  print 
'<tr class="oddeven">';
 
  351  print 
'<td>' . 
img_picto(
'', 
'supplier_invoice', 
'class="pictofixedwidth"') . $langs->trans(
"UseAuxiliaryAccountOnSupplierDeposit") . 
'</td>';
 
  352  if (
getDolGlobalInt(
'ACCOUNTING_ACCOUNT_SUPPLIER_USE_AUXILIARY_ON_DEPOSIT')) {
 
  353    print 
'<td class="right"><a class="reposition" href="' . $_SERVER[
'PHP_SELF'] . 
'?token=' . 
newToken() . 
'&action=setACCOUNTING_ACCOUNT_SUPPLIER_USE_AUXILIARY_ON_DEPOSIT&value=0">';
 
  354    print 
img_picto($langs->trans(
"Activated"), 
'switch_on', 
'', 0, 0, 0, 
'', 
'warning');
 
  357    print 
'<td class="right"><a class="reposition" href="' . $_SERVER[
'PHP_SELF'] . 
'?token=' . 
newToken() . 
'&action=setACCOUNTING_ACCOUNT_SUPPLIER_USE_AUXILIARY_ON_DEPOSIT&value=1">';
 
  358    print 
img_picto($langs->trans(
"Disabled"), 
'switch_off');
 
  367print 
'<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.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
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)
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.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.