forked from Wavyzz/dolibarr
Merge pull request #4299 from aspangaro/develop-a12
Accountancy Add a list to select accounting account on dict
This commit is contained in:
@@ -36,6 +36,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
||||
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php';
|
||||
|
||||
$langs->load("errors");
|
||||
$langs->load("admin");
|
||||
@@ -586,6 +588,9 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
||||
// Clean some parameters
|
||||
if (isset($_POST["localtax1"]) && empty($_POST["localtax1"])) $_POST["localtax1"]='0'; // If empty, we force to 0
|
||||
if (isset($_POST["localtax2"]) && empty($_POST["localtax2"])) $_POST["localtax2"]='0'; // If empty, we force to 0
|
||||
if ($_POST["accountancy_code"] <= 0) $_POST["accountancy_code"]=''; // If empty, we force to null
|
||||
if ($_POST["accountancy_code_sell"] <= 0) $_POST["accountancy_code_sell"]=''; // If empty, we force to null
|
||||
if ($_POST["accountancy_code_buy"] <= 0) $_POST["accountancy_code_buy"]=''; // If empty, we force to null
|
||||
|
||||
// Si verif ok et action add, on ajoute la ligne
|
||||
if ($ok && GETPOST('actionadd'))
|
||||
@@ -1308,6 +1313,9 @@ if ($id)
|
||||
{
|
||||
$align="center";
|
||||
}
|
||||
else if ($fieldlist[$field]=='accountancy_code' || $fieldlist[$field]=='accountancy_code_sell' || $fieldlist[$field]=='accountancy_code_buy') {
|
||||
$valuetoshow = length_accountg($valuetoshow);
|
||||
}
|
||||
|
||||
// Show value for field
|
||||
if ($showfield) print '<td align="'.$align.'">'.$valuetoshow.'</td>';
|
||||
@@ -1461,6 +1469,7 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='')
|
||||
|
||||
$formadmin = new FormAdmin($db);
|
||||
$formcompany = new FormCompany($db);
|
||||
$formaccountancy = New FormVentilation($db);
|
||||
|
||||
foreach ($fieldlist as $field => $value)
|
||||
{
|
||||
@@ -1589,6 +1598,20 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='')
|
||||
print $form->selectarray($fieldlist[$field], $localtax_typeList, (! empty($obj->$fieldlist[$field])?$obj->$fieldlist[$field]:''));
|
||||
print '</td>';
|
||||
}
|
||||
elseif ($fieldlist[$field] == 'accountancy_code' || $fieldlist[$field] == 'accountancy_code_sell' || $fieldlist[$field] == 'accountancy_code_buy')
|
||||
{
|
||||
print '<td>';
|
||||
if (! empty($conf->accounting->enabled))
|
||||
{
|
||||
$accountancy_account = (! empty($obj->$fieldlist[$field]) ? $obj->$fieldlist[$field] : 0);
|
||||
print $formaccountancy->select_account($accountancy_account, $fieldlist[$field], 1, '', 1, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<input type="text" size="10" class="flat" value="'.(isset($obj->$fieldlist[$field])?$obj->$fieldlist[$field]:'').'" name="'.$fieldlist[$field].'">';
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td>';
|
||||
@@ -1597,9 +1620,6 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='')
|
||||
if ($fieldlist[$field]=='position') $size='size="4" ';
|
||||
if ($fieldlist[$field]=='libelle') $size='size="32" ';
|
||||
if ($fieldlist[$field]=='tracking') $size='size="92" ';
|
||||
if ($fieldlist[$field]=='accountancy_code') $size='size="10" ';
|
||||
if ($fieldlist[$field]=='accountancy_code_sell') $size='size="10" ';
|
||||
if ($fieldlist[$field]=='accountancy_code_buy') $size='size="10" ';
|
||||
if ($fieldlist[$field]=='sortorder') $size='size="2" ';
|
||||
print '<input type="text" '.$size.' class="flat" value="'.(isset($obj->$fieldlist[$field])?$obj->$fieldlist[$field]:'').'" name="'.$fieldlist[$field].'">';
|
||||
print '</td>';
|
||||
|
||||
Reference in New Issue
Block a user