Skip to content

Commit

Permalink
Fix: Use getNomUrl to show account_parent instead of rowid of the acc…
Browse files Browse the repository at this point in the history
…ount
  • Loading branch information
aspangaro committed Feb 27, 2016
1 parent 8807222 commit ba6dadb
Showing 1 changed file with 25 additions and 10 deletions.
35 changes: 25 additions & 10 deletions htdocs/accountancy/admin/account.php
@@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
/* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand All @@ -17,9 +17,9 @@
*/

/**
* \file htdocs/accountancy/admin/account.php
* \ingroup Accounting Expert
* \brief List accounting account
* \file htdocs/accountancy/admin/account.php
* \ingroup Advanced accountancy
* \brief List accounting account
*/
require '../../main.inc.php';

Expand Down Expand Up @@ -104,10 +104,12 @@

$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 .= " FROM " . MAIN_DB_PREFIX . "accounting_account as aa, " . MAIN_DB_PREFIX . "accounting_system as asy";
$sql .= " WHERE aa.fk_pcg_version = asy.pcg_version";
$sql .= " AND asy.rowid = " . $pcgver;
$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 .= " FROM " . MAIN_DB_PREFIX . "accounting_account as aa";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as a2 ON aa.account_parent = a2.rowid";
$sql .= " WHERE asy.rowid = " . $pcgver;

if (strlen(trim($search_account))) {
$sql .= " AND aa.account_number like '%" . $search_account . "%'";
Expand Down Expand Up @@ -175,6 +177,7 @@
$var = false;

$accountstatic = new AccountingAccount($db);
$accountparent = new AccountingAccount($db);

while ( $i < min($num, $limit) ) {
$obj = $db->fetch_object($resql);
Expand All @@ -186,7 +189,19 @@
print '<tr ' . $bc[$var] . '>';
print '<td>' . $accountstatic->getNomUrl(1) . '</td>';
print '<td>' . $obj->label . '</td>';
print '<td>' . $obj->account_parent . '</td>';

if ($obj->account_parent)
{
$accountparent->id = $obj->rowid2;
$accountparent->label = $obj->label2;
$accountparent->account_number = $obj->account_number2;

print '<td>' . $accountparent->getNomUrl(1) . '</td>';
}
else
{
print '<td>&nbsp;</td>';
}
print '<td>' . $obj->pcg_type . '</td>';
print '<td>' . $obj->pcg_subtype . '</td>';
print '<td>';
Expand Down

0 comments on commit ba6dadb

Please sign in to comment.