Fix it was not possible to create/edit a new chart of account
This commit is contained in:
parent
29953b46cd
commit
6c91cb4f90
@ -145,8 +145,6 @@ if ($action == 'delete') {
|
|||||||
|
|
||||||
$pcgver = $conf->global->CHARTOFACCOUNTS;
|
$pcgver = $conf->global->CHARTOFACCOUNTS;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$sql = "SELECT aa.rowid, aa.fk_pcg_version, aa.pcg_type, aa.pcg_subtype, aa.account_number, aa.account_parent , aa.label, aa.active, ";
|
$sql = "SELECT aa.rowid, aa.fk_pcg_version, aa.pcg_type, aa.pcg_subtype, aa.account_number, aa.account_parent , aa.label, aa.active, ";
|
||||||
$sql .= " a2.rowid as rowid2, a2.label as label2, a2.account_number as account_number2";
|
$sql .= " a2.rowid as rowid2, a2.label as label2, a2.account_number as account_number2";
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as aa";
|
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as aa";
|
||||||
@ -198,10 +196,12 @@ if ($resql) {
|
|||||||
if ($search_pcgsubtype != "") $params.= '&search_pcgsubtype='.urlencode($search_pcgsubtype);
|
if ($search_pcgsubtype != "") $params.= '&search_pcgsubtype='.urlencode($search_pcgsubtype);
|
||||||
if ($optioncss != '') $param.='&optioncss='.$optioncss;
|
if ($optioncss != '') $param.='&optioncss='.$optioncss;
|
||||||
|
|
||||||
print_barre_liste($langs->trans('ListAccounts'), $page, $_SERVER["PHP_SELF"], $params, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_accountancy');
|
|
||||||
|
|
||||||
print '<form method="GET" action="' . $_SERVER["PHP_SELF"] . '">';
|
print '<form method="GET" action="' . $_SERVER["PHP_SELF"] . '">';
|
||||||
|
|
||||||
|
$htmlbuttonadd = '<a class="butAction" href="./card.php?action=create">' . $langs->trans("Addanaccount") . '</a>';
|
||||||
|
|
||||||
|
print_barre_liste($langs->trans('ListAccounts'), $page, $_SERVER["PHP_SELF"], $params, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_accountancy', 0, $htmlbuttonadd);
|
||||||
|
|
||||||
// Box to select active chart of account
|
// Box to select active chart of account
|
||||||
$var = ! $var;
|
$var = ! $var;
|
||||||
print $langs->trans("Selectchartofaccounts") . " : ";
|
print $langs->trans("Selectchartofaccounts") . " : ";
|
||||||
@ -229,13 +229,7 @@ if ($resql) {
|
|||||||
print "</select>";
|
print "</select>";
|
||||||
print '<input type="submit" class="button" name="change_chart" value="'.dol_escape_htmltag($langs->trans("ChangeAndLoad")).'">';
|
print '<input type="submit" class="button" name="change_chart" value="'.dol_escape_htmltag($langs->trans("ChangeAndLoad")).'">';
|
||||||
print '<br>';
|
print '<br>';
|
||||||
print "<br>\n";
|
print '<br>';
|
||||||
|
|
||||||
print '<a class="butAction" href="./card.php?action=create">' . $langs->trans("Addanaccount") . '</a>';
|
|
||||||
print '<a class="butAction" href="./categories.php">' . $langs->trans("ApplyMassCategories") . '</a>';
|
|
||||||
// print '<a class="butAction" href="./importaccounts.php">' . $langs->trans("ImportAccount") . '</a>';
|
|
||||||
// print '<a class="butAction" href="./productaccount.php">' . $langs->trans("CheckProductAccountancyCode") . '</a>';
|
|
||||||
print '<br><br>';
|
|
||||||
|
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
@ -307,12 +301,12 @@ if ($resql) {
|
|||||||
|
|
||||||
// Action
|
// Action
|
||||||
print '<td align="center">';
|
print '<td align="center">';
|
||||||
if ($user->admin) {
|
if ($user->rights->accounting->chartofaccount) {
|
||||||
print '<a href="./card.php?action=update&id=' . $obj->rowid . '">';
|
print '<a href="./card.php?action=update&id=' . $obj->rowid . '&backtopage='.urlencode($_SERVER["PHP_SELF"].'?chartofaccounts='.$object->id).'">';
|
||||||
print img_edit();
|
print img_edit();
|
||||||
print '</a>';
|
print '</a>';
|
||||||
print ' ';
|
print ' ';
|
||||||
print '<a href="./card.php?action=delete&id=' . $obj->rowid . '">';
|
print '<a href="./card.php?action=delete&id=' . $obj->rowid . '&backtopage='.urlencode($_SERVER["PHP_SELF"].'?chartofaccounts='.$object->id). '">';
|
||||||
print img_delete();
|
print img_delete();
|
||||||
print '</a>';
|
print '</a>';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -26,6 +26,7 @@
|
|||||||
require '../../main.inc.php';
|
require '../../main.inc.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountancysystem.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
|
||||||
|
|
||||||
@ -159,13 +160,15 @@ if ($action == 'add' && $user->rights->accounting->chartofaccount)
|
|||||||
$result = $object->update($user);
|
$result = $object->update($user);
|
||||||
|
|
||||||
if ($result > 0) {
|
if ($result > 0) {
|
||||||
header("Location: " . $_SERVER["PHP_SELF"] . "?id=" . $id);
|
$urltogo=$backtopage?$backtopage:($_SERVER["PHP_SELF"]."?id=".$id);
|
||||||
|
header("Location: " . $urltogo);
|
||||||
exit();
|
exit();
|
||||||
} else {
|
} else {
|
||||||
$mesg = $object->error;
|
$mesg = $object->error;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
header("Location: " . $_SERVER["PHP_SELF"] . "?id=" . $id);
|
$urltogo=$backtopage?$backtopage:($_SERVER["PHP_SELF"]."?id=".$id);
|
||||||
|
header("Location: " . $urltogo);
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
} else if ($action == 'delete' && $user->rights->accounting->chartofaccount) {
|
} else if ($action == 'delete' && $user->rights->accounting->chartofaccount) {
|
||||||
@ -196,6 +199,9 @@ $form = new Form($db);
|
|||||||
$htmlacc = new FormVentilation($db);
|
$htmlacc = new FormVentilation($db);
|
||||||
$formaccounting = new FormAccounting($db);
|
$formaccounting = new FormAccounting($db);
|
||||||
|
|
||||||
|
$accountsystem = new AccountancySystem($db);
|
||||||
|
$accountsystem->fetch($conf->global->CHARTOFACCOUNTS);
|
||||||
|
|
||||||
// Create mode
|
// Create mode
|
||||||
if ($action == 'create') {
|
if ($action == 'create') {
|
||||||
print load_fiche_titre($langs->trans('NewAccountingAccount'));
|
print load_fiche_titre($langs->trans('NewAccountingAccount'));
|
||||||
@ -208,36 +214,45 @@ if ($action == 'create') {
|
|||||||
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
|
// Chart of account
|
||||||
|
print '<tr><td class="titlefieldcreate"><span class="fieldrequired">' . $langs->trans("Chartofaccounts") . '</span></td>';
|
||||||
|
print '<td>';
|
||||||
|
print $accountsystem->ref;
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
|
|
||||||
// Account number
|
// Account number
|
||||||
print '<tr><td class="titlefieldcreate"><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
|
||||||
print '<tr><td><span class="fieldrequired">' . $langs->trans("Label") . '</span></td>';
|
print '<tr><td><span class="fieldrequired">' . $langs->trans("Label") . '</span></td>';
|
||||||
print '<td><input name="label" size="70" value="' . $object->label . '"</td></tr>';
|
print '<td><input name="label" size="70" value="' . $object->label . '"></td></tr>';
|
||||||
|
|
||||||
// Account parent
|
// Account parent
|
||||||
print '<tr><td>' . $langs->trans("Accountparent") . '</td>';
|
print '<tr><td>' . $langs->trans("Accountparent") . '</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print $htmlacc->select_account($object->account_parent, 'account_parent', 1);
|
print $htmlacc->select_account($object->account_parent, 'account_parent', 1, null, 0, 0, 'minwidth200');
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Category
|
// Category
|
||||||
print '<tr><td>' . $langs->trans("AccountingCategory") . '</td>';
|
print '<tr><td>' . $langs->trans("AccountingCategory") . '</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
$formaccounting->select_accounting_category($object->account_category, 'account_category', 1);
|
$formaccounting->select_accounting_category($object->account_category, 'account_category', 1, 0, 1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Chart of accounts type
|
// Chart of accounts type
|
||||||
print '<tr><td>' . $langs->trans("Pcgtype") . '</td>';
|
print '<tr><td>' . $langs->trans("Pcgtype") . '</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print $htmlacc->select_pcgtype($object->pcg_type, 'pcg_type');
|
print '<input type="text" name="pcg_type" value="'.dol_escape_htmltag(isset($_POST['pcg_type'])?GETPOST('pcg_type','alpha'):$object->pcg_type).'">';
|
||||||
|
//print $htmlacc->select_pcgtype($object->pcg_type, 'pcg_type', 1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Chart of acounts subtype
|
// Chart of acounts subtype
|
||||||
print '<tr><td>' . $langs->trans("Pcgsubtype") . '</td>';
|
print '<tr><td>' . $langs->trans("Pcgsubtype") . '</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print $htmlacc->select_pcgsubtype($object->pcg_subtype, 'pcg_subtype');
|
print '<input type="text" name="pcg_subtype" value="'.dol_escape_htmltag(isset($_POST['pcg_subtype'])?GETPOST('pcg_subtype','alpha'):$object->pcg_subtype).'">';
|
||||||
|
//print $htmlacc->select_pcgsubtype($object->pcg_subtype, 'pcg_subtype', 1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
@ -268,7 +283,8 @@ if ($action == 'create') {
|
|||||||
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
|
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
|
||||||
print '<input type="hidden" name="action" value="edit">';
|
print '<input type="hidden" name="action" value="edit">';
|
||||||
print '<input type="hidden" name="id" value="' . $id . '">';
|
print '<input type="hidden" name="id" value="' . $id . '">';
|
||||||
|
print '<input type="hidden" name="backtopage" value="' . $backtopage . '">';
|
||||||
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
// Account number
|
// Account number
|
||||||
@ -294,13 +310,15 @@ if ($action == 'create') {
|
|||||||
// Chart of accounts type
|
// Chart of accounts type
|
||||||
print '<tr><td>' . $langs->trans("Pcgtype") . '</td>';
|
print '<tr><td>' . $langs->trans("Pcgtype") . '</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print $htmlacc->select_pcgtype($object->pcg_type, 'pcg_type');
|
//print $htmlacc->select_pcgtype($object->pcg_type, 'pcg_type', 1);
|
||||||
|
print '<input type="text" name="pcg_type" value="'.dol_escape_htmltag(isset($_POST['pcg_type'])?GETPOST('pcg_type','alpha'):$object->pcg_type).'">';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Chart of accounts subtype
|
// Chart of accounts subtype
|
||||||
print '<tr><td>' . $langs->trans("Pcgsubtype") . '</td>';
|
print '<tr><td>' . $langs->trans("Pcgsubtype") . '</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print $htmlacc->select_pcgsubtype($object->pcg_subtype, 'pcg_subtype');
|
print '<input type="text" name="pcg_subtype" value="'.dol_escape_htmltag(isset($_POST['pcg_subtype'])?GETPOST('pcg_subtype','alpha'):$object->pcg_subtype).'">';
|
||||||
|
//print $htmlacc->select_pcgsubtype($object->pcg_subtype, 'pcg_subtype', 1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|||||||
@ -47,6 +47,55 @@ class AccountancySystem
|
|||||||
$this->db = $db;
|
$this->db = $db;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load record in memory
|
||||||
|
*
|
||||||
|
* @param int $rowid Id
|
||||||
|
* @param string $ref ref
|
||||||
|
* @return int <0 if KO, Id of record if OK and found
|
||||||
|
*/
|
||||||
|
function fetch($rowid = 0, $ref = '')
|
||||||
|
{
|
||||||
|
global $conf;
|
||||||
|
|
||||||
|
if ($rowid > 0 || $ref)
|
||||||
|
{
|
||||||
|
$sql = "SELECT a.pcg_version, a.label, a.active";
|
||||||
|
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_system as a";
|
||||||
|
$sql .= " WHERE";
|
||||||
|
if ($rowid) {
|
||||||
|
$sql .= " a.rowid = '" . $rowid . "'";
|
||||||
|
} elseif ($ref) {
|
||||||
|
$sql .= " a.pcg_version = '" . $ref . "'";
|
||||||
|
}
|
||||||
|
|
||||||
|
dol_syslog(get_class($this) . "::fetch sql=" . $sql, LOG_DEBUG);
|
||||||
|
$result = $this->db->query($sql);
|
||||||
|
if ($result) {
|
||||||
|
$obj = $this->db->fetch_object($result);
|
||||||
|
|
||||||
|
if ($obj) {
|
||||||
|
$this->id = $obj->rowid;
|
||||||
|
$this->rowid = $obj->rowid;
|
||||||
|
$this->pcg_version = $obj->pcg_version;
|
||||||
|
$this->ref = $obj->pcg_version;
|
||||||
|
$this->label = $obj->label;
|
||||||
|
$this->active = $obj->active;
|
||||||
|
|
||||||
|
return $this->id;
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$this->error = "Error " . $this->db->lasterror();
|
||||||
|
$this->errors[] = "Error " . $this->db->lasterror();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Insert accountancy system name into database
|
* Insert accountancy system name into database
|
||||||
*
|
*
|
||||||
|
|||||||
@ -150,12 +150,19 @@ class AccountingAccount extends CommonObject
|
|||||||
if (isset($this->active))
|
if (isset($this->active))
|
||||||
$this->active = trim($this->active);
|
$this->active = trim($this->active);
|
||||||
|
|
||||||
// Check parameters
|
if (empty($this->pcg_type) || $this->pcg_type == '-1')
|
||||||
// Put here code to add control on parameters values
|
{
|
||||||
|
$this->pcg_type = 'XXXXXX';
|
||||||
|
}
|
||||||
|
if (empty($this->pcg_subtype) || $this->pcg_subtype == '-1')
|
||||||
|
{
|
||||||
|
$this->pcg_subtype = 'XXXXXX';
|
||||||
|
}
|
||||||
|
// Check parameters
|
||||||
|
// Put here code to add control on parameters values
|
||||||
|
|
||||||
// Insert request
|
// Insert request
|
||||||
$sql = "INSERT INTO " . MAIN_DB_PREFIX . "accounting_account(";
|
$sql = "INSERT INTO " . MAIN_DB_PREFIX . "accounting_account(";
|
||||||
|
|
||||||
$sql .= "datec";
|
$sql .= "datec";
|
||||||
$sql .= ", entity";
|
$sql .= ", entity";
|
||||||
$sql .= ", fk_pcg_version";
|
$sql .= ", fk_pcg_version";
|
||||||
@ -167,9 +174,7 @@ class AccountingAccount extends CommonObject
|
|||||||
$sql .= ", fk_accounting_category";
|
$sql .= ", fk_accounting_category";
|
||||||
$sql .= ", fk_user_author";
|
$sql .= ", fk_user_author";
|
||||||
$sql .= ", active";
|
$sql .= ", active";
|
||||||
|
|
||||||
$sql .= ") VALUES (";
|
$sql .= ") VALUES (";
|
||||||
|
|
||||||
$sql .= " '" . $this->db->idate($now) . "'";
|
$sql .= " '" . $this->db->idate($now) . "'";
|
||||||
$sql .= ", " . $conf->entity;
|
$sql .= ", " . $conf->entity;
|
||||||
$sql .= ", " . (empty($this->fk_pcg_version) ? 'NULL' : "'" . $this->db->escape($this->fk_pcg_version) . "'");
|
$sql .= ", " . (empty($this->fk_pcg_version) ? 'NULL' : "'" . $this->db->escape($this->fk_pcg_version) . "'");
|
||||||
@ -225,11 +230,22 @@ class AccountingAccount extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* Update record
|
* Update record
|
||||||
*
|
*
|
||||||
* @param User $user Use making update
|
* @param User $user Use making update
|
||||||
* @return int <0 if KO, >0 if OK
|
* @return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
function update($user) {
|
function update($user)
|
||||||
$this->db->begin();
|
{
|
||||||
|
// Check parameters
|
||||||
|
if (empty($this->pcg_type) || $this->pcg_type == '-1')
|
||||||
|
{
|
||||||
|
$this->pcg_type = 'XXXXXX';
|
||||||
|
}
|
||||||
|
if (empty($this->pcg_subtype) || $this->pcg_subtype == '-1')
|
||||||
|
{
|
||||||
|
$this->pcg_subtype = 'XXXXXX';
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->db->begin();
|
||||||
|
|
||||||
$sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_account ";
|
$sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_account ";
|
||||||
$sql .= " SET fk_pcg_version = " . ($this->fk_pcg_version ? "'" . $this->db->escape($this->fk_pcg_version) . "'" : "null");
|
$sql .= " SET fk_pcg_version = " . ($this->fk_pcg_version ? "'" . $this->db->escape($this->fk_pcg_version) . "'" : "null");
|
||||||
@ -241,7 +257,6 @@ class AccountingAccount extends CommonObject
|
|||||||
$sql .= " , fk_accounting_category = '" . $this->account_category . "'";
|
$sql .= " , fk_accounting_category = '" . $this->account_category . "'";
|
||||||
$sql .= " , fk_user_modif = " . $user->id;
|
$sql .= " , fk_user_modif = " . $user->id;
|
||||||
$sql .= " , active = '" . $this->active . "'";
|
$sql .= " , active = '" . $this->active . "'";
|
||||||
|
|
||||||
$sql .= " WHERE rowid = " . $this->id;
|
$sql .= " WHERE rowid = " . $this->id;
|
||||||
|
|
||||||
dol_syslog(get_class($this) . "::update sql=" . $sql, LOG_DEBUG);
|
dol_syslog(get_class($this) . "::update sql=" . $sql, LOG_DEBUG);
|
||||||
|
|||||||
@ -180,11 +180,15 @@ class FormVentilation extends Form
|
|||||||
$options = array();
|
$options = array();
|
||||||
$out = ajax_combobox($htmlname, $event);
|
$out = ajax_combobox($htmlname, $event);
|
||||||
|
|
||||||
while ($obj = $this->db->fetch_object($resql)) {
|
while ($obj = $this->db->fetch_object($resql))
|
||||||
$options[$obj->pcg_type] = $obj->pcg_type;
|
{
|
||||||
|
if ($obj->pcg_type != '-1')
|
||||||
|
{
|
||||||
|
$options[$obj->pcg_type] = $obj->pcg_type;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$out .= Form::selectarray($htmlname, $options, $selectid, $showempty);
|
$out .= Form::selectarray($htmlname, $options, $selectid, $showempty, 0, 0, '', 0, 0, 0, '', 'minwidth200');
|
||||||
|
|
||||||
$this->db->free($resql);
|
$this->db->free($resql);
|
||||||
return $out;
|
return $out;
|
||||||
@ -200,7 +204,8 @@ class FormVentilation extends Form
|
|||||||
*
|
*
|
||||||
* @return string String with HTML select
|
* @return string String with HTML select
|
||||||
*/
|
*/
|
||||||
function select_pcgsubtype($selectid, $htmlname = 'pcg_subtype', $showempty = 0, $event = array()) {
|
function select_pcgsubtype($selectid, $htmlname = 'pcg_subtype', $showempty = 0, $event = array())
|
||||||
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
$sql = "SELECT DISTINCT pcg_subtype ";
|
$sql = "SELECT DISTINCT pcg_subtype ";
|
||||||
@ -221,11 +226,15 @@ class FormVentilation extends Form
|
|||||||
$options = array();
|
$options = array();
|
||||||
$out = ajax_combobox($htmlname, $event);
|
$out = ajax_combobox($htmlname, $event);
|
||||||
|
|
||||||
while ($obj = $this->db->fetch_object($resql)) {
|
while ($obj = $this->db->fetch_object($resql))
|
||||||
$options[$obj->pcg_subtype] = $obj->pcg_subtype;
|
{
|
||||||
|
if ($obj->pcg_type != '-1')
|
||||||
|
{
|
||||||
|
$options[$obj->pcg_subtype] = $obj->pcg_subtype;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$out .= Form::selectarray($htmlname, $options, $selectid, $showempty);
|
$out .= Form::selectarray($htmlname, $options, $selectid, $showempty, 0, 0, '', 0, 0, 0, '', 'minwidth200');
|
||||||
|
|
||||||
$this->db->free($resql);
|
$this->db->free($resql);
|
||||||
return $out;
|
return $out;
|
||||||
|
|||||||
@ -90,31 +90,35 @@ class FormAccounting
|
|||||||
$num = $db->num_rows($resql);
|
$num = $db->num_rows($resql);
|
||||||
if ($num)
|
if ($num)
|
||||||
{
|
{
|
||||||
print '<select class="flat minwidth200" name="'.$htmlname.'">';
|
$out = '<select class="flat minwidth200" id="'.$htmlname.'" name="'.$htmlname.'">';
|
||||||
$i = 0;
|
$i = 0;
|
||||||
|
|
||||||
if ($useempty) print '<option value="0"> </option>';
|
if ($useempty) $out.= '<option value="0"> </option>';
|
||||||
while ($i < $num)
|
while ($i < $num)
|
||||||
{
|
{
|
||||||
$obj = $db->fetch_object($resql);
|
$obj = $db->fetch_object($resql);
|
||||||
print '<option value="'.$obj->rowid.'"';
|
$out .= '<option value="'.$obj->rowid.'"';
|
||||||
if ($obj->rowid == $selected) print ' selected';
|
if ($obj->rowid == $selected) $out .= ' selected';
|
||||||
print '>'.($maxlen ? dol_trunc($obj->type,$maxlen) : $obj->type);
|
$out .= '>'.($maxlen ? dol_trunc($obj->type,$maxlen) : $obj->type);
|
||||||
print ' ('.$obj->range_account.')';
|
$out .= ' ('.$obj->range_account.')';
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
print '</select>';
|
$out .= '</select>';
|
||||||
if ($user->admin && $help) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
|
if ($user->admin && $help) $out .= info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print $langs->trans("ErrorNoAccountingCategoryForThisCountry",$mysoc->country_code);
|
$out .= $langs->trans("ErrorNoAccountingCategoryForThisCountry",$mysoc->country_code);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dol_print_error($db,$db->lasterror());
|
dol_print_error($db,$db->lasterror());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$out .= ajax_combobox($htmlname, $event);
|
||||||
|
|
||||||
|
print $out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -13,8 +13,8 @@ LTReportBuildWithOptionDefinedInModule=Amounts shown here are calculated using r
|
|||||||
Param=Setup
|
Param=Setup
|
||||||
RemainingAmountPayment=Amount payment remaining :
|
RemainingAmountPayment=Amount payment remaining :
|
||||||
Account=Account
|
Account=Account
|
||||||
Accountparent=Account parent
|
Accountparent=Parent account
|
||||||
Accountsparent=Accounts parent
|
Accountsparent=Parent accounts
|
||||||
Income=Income
|
Income=Income
|
||||||
Outcome=Expense
|
Outcome=Expense
|
||||||
ReportInOut=Income / Expense
|
ReportInOut=Income / Expense
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user