Fix: Accountancy - Problem to define account_parent for an accounting account & presentation

This commit is contained in:
aspangaro 2016-08-11 06:08:33 +02:00
parent 8c63d68083
commit 55a83f9d8d

View File

@ -69,10 +69,10 @@ if ($action == 'add') {
$account_number = clean_account(GETPOST('account_number')); $account_number = clean_account(GETPOST('account_number'));
} }
if (GETPOST('account_category') <= 0) { if (GETPOST('account_parent') <= 0) {
$account_parent = ''; $account_parent = '';
} else { } else {
$account_parent = GETPOST('account_category','int'); $account_parent = GETPOST('account_parent','int');
} }
$object->fk_pcg_version = $obj->pcg_version; $object->fk_pcg_version = $obj->pcg_version;
@ -98,7 +98,7 @@ if ($action == 'add') {
header("Location: account.php"); header("Location: account.php");
exit; exit;
} else if ($action == 'edit') { } else if ($action == 'edit') {
if (! GETPOST('cancel', 'alpha')) { if (! $cancel) {
$result = $object->fetch($id); $result = $object->fetch($id);
$sql = 'SELECT pcg_version FROM ' . MAIN_DB_PREFIX . 'accounting_system WHERE rowid=' . $conf->global->CHARTOFACCOUNTS; $sql = 'SELECT pcg_version FROM ' . MAIN_DB_PREFIX . 'accounting_system WHERE rowid=' . $conf->global->CHARTOFACCOUNTS;
@ -119,10 +119,10 @@ if ($action == 'add') {
$account_number = clean_account(GETPOST('account_number')); $account_number = clean_account(GETPOST('account_number'));
} }
if (GETPOST('account_category') <= 0) { if (GETPOST('account_parent') <= 0) {
$account_parent = ''; $account_parent = 0;
} else { } else {
$account_parent = GETPOST('account_category','int'); $account_parent = GETPOST('account_parent','int');
} }
$object->fk_pcg_version = $obj->pcg_version; $object->fk_pcg_version = $obj->pcg_version;
@ -165,7 +165,9 @@ if ($action == 'add') {
/* /*
* View * View
*/ */
llxheader('', $langs->trans('AccountAccounting')); $title = $langs->trans('AccountAccounting') ." - ". $langs->trans('Card');
$helpurl = '';
llxheader('', $title, $helpurl);
$form = new Form($db); $form = new Form($db);
$htmlacc = new FormVentilation($db); $htmlacc = new FormVentilation($db);
@ -184,7 +186,7 @@ if ($action == 'create') {
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
// Account number // Account number
print '<tr><td width="25%"><span class="fieldrequired">' . $langs->trans("AccountNumber") . '</span></td>'; print '<tr><td class="titlefieldcreate"><span class="fieldrequired">' . $langs->trans("AccountNumber") . '</span></td>';
print '<td><input name="account_number" size="30" value="' . $object->account_number . '"</td></tr>'; print '<td><input name="account_number" size="30" value="' . $object->account_number . '"</td></tr>';
// Label // Label
@ -247,7 +249,7 @@ if ($action == 'create') {
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
// Account number // Account number
print '<tr><td width="25%"><span class="fieldrequired">' . $langs->trans("AccountNumber") . '</span></td>'; print '<tr><td class="titlefieldcreate"><span class="fieldrequired">' . $langs->trans("AccountNumber") . '</span></td>';
print '<td><input name="account_number" size="30" value="' . $object->account_number . '"</td></tr>'; print '<td><input name="account_number" size="30" value="' . $object->account_number . '"</td></tr>';
// Label // Label
@ -299,7 +301,7 @@ if ($action == 'create') {
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
// Account number // Account number
print '<tr><td width="25%">' . $langs->trans("AccountNumber") . '</td>'; print '<tr><td class="titlefield">' . $langs->trans("AccountNumber") . '</td>';
print '<td>' . $object->account_number . '</td>'; print '<td>' . $object->account_number . '</td>';
print '<td align="right" width="25%">' . $linkback . '</td></tr>'; print '<td align="right" width="25%">' . $linkback . '</td></tr>';