Skip to content
Snippets Groups Projects
Commit a762910f authored by aspangaro's avatar aspangaro
Browse files

Add getNomUrl on accounting for account

parent 967e7ea4
No related branches found
No related tags found
No related merge requests found
<?php
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
* Copyright (C) 2013-2015 Alexandre Spangaro <alexandre.spangaro@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
......@@ -154,7 +154,7 @@ if ($result) {
print_liste_field_titre($langs->trans("Accountparent"), $_SERVER["PHP_SELF"], "aa.account_parent", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Pcgtype"), $_SERVER["PHP_SELF"], "aa.pcg_type", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Pcgsubtype"), $_SERVER["PHP_SELF"], "aa.pcg_subtype", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Active"), $_SERVER["PHP_SELF"], "aa.active", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Activated"), $_SERVER["PHP_SELF"], "aa.active", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Action"),$_SERVER["PHP_SELF"],"",$param,"",'width="60" align="center"',$sortfield,$sortorder);
print '</tr>';
......@@ -174,12 +174,17 @@ if ($result) {
$var = true;
$accountstatic=new AccountingAccount($db);
while ( $i < min($num, $limit) ) {
$obj = $db->fetch_object($resql);
$var = ! $var;
$accountstatic->id=$obj->rowid;
$accountstatic->label=$obj->label;
$accountstatic->account_number=$obj->account_number;
print '<tr ' . $bc[$var] . '>';
print '<td><a href="./card.php?id=' . $obj->rowid . '">' . $obj->account_number . '</td>';
print '<td>' . $accountstatic->getNomUrl(1) . '</td>';
print '<td>' . $obj->label . '</td>';
print '<td>' . $obj->account_parent . '</td>';
print '<td>' . $obj->pcg_type . '</td>';
......@@ -210,6 +215,7 @@ if ($result) {
print '</td>' . "\n";
print "</tr>\n";
$var=!$var;
$i ++;
}
......
<?php
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
* Copyright (C) 2013-2015 Alexandre Spangaro <alexandre.spangaro@gmail.com>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
*
......@@ -66,8 +66,7 @@ class AccountingAccount extends CommonObject
*/
function fetch($rowid = null, $account_number = null)
{
if ($rowid || $account_number)
{
if ($rowid || $account_number) {
$sql = "SELECT rowid, datec, tms, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, fk_user_author, fk_user_modif, active";
$sql.= " FROM " . MAIN_DB_PREFIX . "accountingaccount WHERE";
if ($rowid) {
......@@ -78,12 +77,10 @@ class AccountingAccount extends CommonObject
dol_syslog(get_class($this) . "::fetch sql=" . $sql, LOG_DEBUG);
$result = $this->db->query($sql);
if ($result)
{
if ($result) {
$obj = $this->db->fetch_object($result);
if ($obj)
{
if ($obj) {
$this->id = $obj->rowid;
$this->rowid = $obj->rowid;
$this->datec = $obj->datec;
......@@ -99,18 +96,13 @@ class AccountingAccount extends CommonObject
$this->active = $obj->active;
return $this->id;
}
else
{
} else {
return 0;
}
}
else
{
} else {
dol_print_error($this->db);
}
}
return -1;
}
......@@ -344,6 +336,31 @@ class AccountingAccount extends CommonObject
}
}
/**
* Return clicable name (with picto eventually)
*
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
* @return string Chaine avec URL
*/
function getNomUrl($withpicto=0)
{
global $langs;
$result='';
$link = '<a href="'.DOL_URL_ROOT.'/accountancy/admin/card.php?id='.$this->id.'">';
$linkend='</a>';
$picto='billr';
$label=$langs->trans("Show").': '.$this->account_number.' - '.$this->label;
if ($withpicto) $result.=($link.img_object($label,$picto).$linkend);
if ($withpicto && $withpicto != 2) $result.=' ';
if ($withpicto != 2) $result.=$link.$this->account_number.$linkend;
return $result;
}
/**
* Information on record
*
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment