Merge pull request #4696 from aspangaro/3.9-p14

Fix: 3.9rc2 Use getNomUrl to show account_parent instead of rowid of the accountancy account
This commit is contained in:
Laurent Destailleur 2016-03-01 01:47:56 +01:00
commit 839b2074ce
2 changed files with 80 additions and 65 deletions

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com> /* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com> * Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -18,7 +18,7 @@
/** /**
* \file htdocs/accountancy/admin/account.php * \file htdocs/accountancy/admin/account.php
* \ingroup Accounting Expert * \ingroup Advanced accountancy
* \brief List accounting account * \brief List accounting account
*/ */
require '../../main.inc.php'; require '../../main.inc.php';
@ -104,10 +104,12 @@ llxHeader('', $langs->trans("ListAccounts"));
$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 .= " FROM " . MAIN_DB_PREFIX . "accounting_account as aa, " . MAIN_DB_PREFIX . "accounting_system as asy"; $sql .= " a2.rowid as rowid2, a2.label as label2, a2.account_number as account_number2";
$sql .= " WHERE aa.fk_pcg_version = asy.pcg_version"; $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as aa";
$sql .= " AND asy.rowid = " . $pcgver; $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))) { if (strlen(trim($search_account))) {
$sql .= " AND aa.account_number like '%" . $search_account . "%'"; $sql .= " AND aa.account_number like '%" . $search_account . "%'";
@ -175,6 +177,7 @@ if ($result) {
$var = false; $var = false;
$accountstatic = new AccountingAccount($db); $accountstatic = new AccountingAccount($db);
$accountparent = new AccountingAccount($db);
while ( $i < min($num, $limit) ) { while ( $i < min($num, $limit) ) {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
@ -186,7 +189,19 @@ if ($result) {
print '<tr ' . $bc[$var] . '>'; print '<tr ' . $bc[$var] . '>';
print '<td>' . $accountstatic->getNomUrl(1) . '</td>'; print '<td>' . $accountstatic->getNomUrl(1) . '</td>';
print '<td>' . $obj->label . '</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_type . '</td>';
print '<td>' . $obj->pcg_subtype . '</td>'; print '<td>' . $obj->pcg_subtype . '</td>';
print '<td>'; print '<td>';

View File

@ -24,7 +24,7 @@
/** /**
* \file htdocs/accountancy/journal/bankjournal.php * \file htdocs/accountancy/journal/bankjournal.php
* \ingroup Accounting Expert * \ingroup Advanced accountancy
* \brief Page with bank journal * \brief Page with bank journal
*/ */
require '../../main.inc.php'; require '../../main.inc.php';
@ -72,7 +72,7 @@ $now = dol_now();
if ($user->societe_id > 0 && empty($id_bank_account)) if ($user->societe_id > 0 && empty($id_bank_account))
accessforbidden(); accessforbidden();
/* /*
* View * View
*/ */
$year_current = strftime("%Y", dol_now()); $year_current = strftime("%Y", dol_now());