Skip to content

Commit

Permalink
Accountancy Add a list to select accounting account on accoutancy admin
Browse files Browse the repository at this point in the history
  • Loading branch information
aspangaro committed Dec 26, 2015
1 parent cdd1641 commit 6114606
Showing 1 changed file with 32 additions and 3 deletions.
35 changes: 32 additions & 3 deletions htdocs/accountancy/admin/index.php
Expand Up @@ -31,8 +31,9 @@
require '../../main.inc.php';

// Class
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php';

$langs->load("compta");
$langs->load("bills");
Expand All @@ -51,7 +52,10 @@
'ACCOUNTING_LENGTH_DESCRIPTION', // adjust size displayed for lines description for dol_trunc
'ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT', // adjust size displayed for select account description for dol_trunc
'ACCOUNTING_LENGTH_GACCOUNT',
'ACCOUNTING_LENGTH_AACCOUNT',
'ACCOUNTING_LENGTH_AACCOUNT'
);

$list_account = array (
'ACCOUNTING_ACCOUNT_CUSTOMER',
'ACCOUNTING_ACCOUNT_SUPPLIER',
'ACCOUNTING_PRODUCT_BUY_ACCOUNT',
Expand Down Expand Up @@ -109,6 +113,14 @@
}
}

foreach ($list_account as $constname) {
$constvalue = GETPOST($constname, 'alpha');

if (!dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
$error++;
}
}

if (! $error)
{
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
Expand Down Expand Up @@ -151,6 +163,7 @@
llxHeader();

$form = new Form($db);
$formaccountancy = New FormVentilation($db);

$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($langs->trans('ConfigAccountingExpert'),$linkback,'title_setup');
Expand Down Expand Up @@ -262,6 +275,22 @@
print '</td></tr>';
}

foreach ($list_account as $key)
{
$var=!$var;

print '<tr '.$bc[$var].' class="value">';

// Param
$label = $langs->trans($key);
print '<td><label for="'.$key.'">'.$label.'</label></td>';

// Value
print '<td>';
print $formaccountancy->select_account($conf->global->$key, $key, 1, '', 1, 1);
print '</td></tr>';
}

$var = ! $var;
print "<tr " . $bc[$var] . ">";
print '<td width="80%">' . $langs->trans("ACCOUNTING_LIST_SORT_VENTILATION_TODO") . '</td>';
Expand Down

0 comments on commit 6114606

Please sign in to comment.