Merge pull request #6872 from aspangaro/6.0-pcard
Use getNomUrl for accounting account in product card
This commit is contained in:
commit
4474fc8014
@ -1067,7 +1067,7 @@ class BookKeeping extends CommonObject
|
|||||||
$sql.= " WHERE 1 = 1";
|
$sql.= " WHERE 1 = 1";
|
||||||
if (! empty($delyear)) $sql.= " AND YEAR(doc_date) = " . $delyear; // FIXME Must use between
|
if (! empty($delyear)) $sql.= " AND YEAR(doc_date) = " . $delyear; // FIXME Must use between
|
||||||
if (! empty($journal)) $sql.= " AND code_journal = '".$journal."'";
|
if (! empty($journal)) $sql.= " AND code_journal = '".$journal."'";
|
||||||
$sql .= " AND entity IN (" . getEntity("accountancy", 1) . ")";
|
$sql .= " AND entity IN (" . getEntity("accountancy", 1) . ")";
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
|
|
||||||
if (! $resql) {
|
if (! $resql) {
|
||||||
@ -1099,7 +1099,7 @@ class BookKeeping extends CommonObject
|
|||||||
$sql = "DELETE";
|
$sql = "DELETE";
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element;
|
$sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element;
|
||||||
$sql .= " WHERE piece_num = " . $piecenum;
|
$sql .= " WHERE piece_num = " . $piecenum;
|
||||||
$sql .= " AND entity IN (" . getEntity("accountancy", 1) . ")";
|
$sql .= " AND entity IN (" . getEntity("accountancy", 1) . ")";
|
||||||
|
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
|
|
||||||
@ -1202,10 +1202,10 @@ class BookKeeping extends CommonObject
|
|||||||
public function fetchPerMvt($piecenum) {
|
public function fetchPerMvt($piecenum) {
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
$sql = "SELECT piece_num,doc_date,code_journal,doc_ref,doc_type";
|
$sql = "SELECT piece_num,doc_date,code_journal,doc_ref,doc_type";
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element;
|
$sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element;
|
||||||
$sql .= " WHERE piece_num = " . $piecenum;
|
$sql .= " WHERE piece_num = " . $piecenum;
|
||||||
$sql .= " AND entity IN (" . getEntity("accountancy", 1) . ")";
|
$sql .= " AND entity IN (" . getEntity("accountancy", 1) . ")";
|
||||||
|
|
||||||
dol_syslog(get_class($this) . "::" . __METHOD__, LOG_DEBUG);
|
dol_syslog(get_class($this) . "::" . __METHOD__, LOG_DEBUG);
|
||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
@ -1233,7 +1233,7 @@ class BookKeeping extends CommonObject
|
|||||||
*/
|
*/
|
||||||
public function getNextNumMvt()
|
public function getNextNumMvt()
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
$sql = "SELECT MAX(piece_num)+1 as max FROM " . MAIN_DB_PREFIX . $this->table_element;
|
$sql = "SELECT MAX(piece_num)+1 as max FROM " . MAIN_DB_PREFIX . $this->table_element;
|
||||||
$sql .= " WHERE entity IN (" . getEntity("accountancy", 1) . ")";
|
$sql .= " WHERE entity IN (" . getEntity("accountancy", 1) . ")";
|
||||||
@ -1243,9 +1243,9 @@ class BookKeeping extends CommonObject
|
|||||||
|
|
||||||
if ($result) {
|
if ($result) {
|
||||||
$obj = $this->db->fetch_object($result);
|
$obj = $this->db->fetch_object($result);
|
||||||
if ($obj) $result = $obj->max;
|
if ($obj) $result = $obj->max;
|
||||||
if (empty($result)) $result = 1;
|
if (empty($result)) $result = 1;
|
||||||
return $result;
|
return $result;
|
||||||
} else {
|
} else {
|
||||||
$this->error = "Error " . $this->db->lasterror();
|
$this->error = "Error " . $this->db->lasterror();
|
||||||
dol_syslog(get_class($this) . "::getNextNumMvt " . $this->error, LOG_ERR);
|
dol_syslog(get_class($this) . "::getNextNumMvt " . $this->error, LOG_ERR);
|
||||||
@ -1260,7 +1260,7 @@ class BookKeeping extends CommonObject
|
|||||||
* @return int <0 if KO, >0 if OK
|
* @return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
function fetch_all_per_mvt($piecenum) {
|
function fetch_all_per_mvt($piecenum) {
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
$sql = "SELECT rowid, doc_date, doc_type,";
|
$sql = "SELECT rowid, doc_date, doc_type,";
|
||||||
$sql .= " doc_ref, fk_doc, fk_docdet, code_tiers,";
|
$sql .= " doc_ref, fk_doc, fk_docdet, code_tiers,";
|
||||||
@ -1268,7 +1268,7 @@ class BookKeeping extends CommonObject
|
|||||||
$sql .= " montant, sens, fk_user_author, import_key, code_journal, piece_num";
|
$sql .= " montant, sens, fk_user_author, import_key, code_journal, piece_num";
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element;
|
$sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element;
|
||||||
$sql .= " WHERE piece_num = " . $piecenum;
|
$sql .= " WHERE piece_num = " . $piecenum;
|
||||||
$sql .= " AND entity IN (" . getEntity("accountancy", 1) . ")";
|
$sql .= " AND entity IN (" . getEntity("accountancy", 1) . ")";
|
||||||
|
|
||||||
dol_syslog(get_class($this) . "::" . __METHOD__, LOG_DEBUG);
|
dol_syslog(get_class($this) . "::" . __METHOD__, LOG_DEBUG);
|
||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
@ -1313,14 +1313,14 @@ class BookKeeping extends CommonObject
|
|||||||
* @return int Result
|
* @return int Result
|
||||||
*/
|
*/
|
||||||
function export_bookkeping($model = 'ebp') {
|
function export_bookkeping($model = 'ebp') {
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
$sql = "SELECT rowid, doc_date, doc_type,";
|
$sql = "SELECT rowid, doc_date, doc_type,";
|
||||||
$sql .= " doc_ref, fk_doc, fk_docdet, code_tiers,";
|
$sql .= " doc_ref, fk_doc, fk_docdet, code_tiers,";
|
||||||
$sql .= " numero_compte, label_compte, debit, credit,";
|
$sql .= " numero_compte, label_compte, debit, credit,";
|
||||||
$sql .= " montant, sens, fk_user_author, import_key, code_journal, piece_num";
|
$sql .= " montant, sens, fk_user_author, import_key, code_journal, piece_num";
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element;
|
$sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element;
|
||||||
$sql .= " WHERE entity IN (" . getEntity("accountancy", 1) . ")";
|
$sql .= " WHERE entity IN (" . getEntity("accountancy", 1) . ")";
|
||||||
|
|
||||||
dol_syslog(get_class($this) . "::export_bookkeping", LOG_DEBUG);
|
dol_syslog(get_class($this) . "::export_bookkeping", LOG_DEBUG);
|
||||||
|
|
||||||
|
|||||||
@ -1,20 +1,20 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005 Eric Seigne <eric.seigne@ryxeo.com>
|
* Copyright (C) 2005 Eric Seigne <eric.seigne@ryxeo.com>
|
||||||
* Copyright (C) 2005-2015 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2005-2015 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||||
* Copyright (C) 2006 Auguria SARL <info@auguria.org>
|
* Copyright (C) 2006 Auguria SARL <info@auguria.org>
|
||||||
* Copyright (C) 2010-2015 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2010-2015 Juanjo Menent <jmenent@2byte.es>
|
||||||
* Copyright (C) 2013-2016 Marcos García <marcosgdf@gmail.com>
|
* Copyright (C) 2013-2016 Marcos García <marcosgdf@gmail.com>
|
||||||
* Copyright (C) 2012-2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
* Copyright (C) 2012-2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||||
* Copyright (C) 2011-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
* Copyright (C) 2011-2017 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||||
* Copyright (C) 2014 Cédric Gross <c.gross@kreiz-it.fr>
|
* Copyright (C) 2014 Cédric Gross <c.gross@kreiz-it.fr>
|
||||||
* Copyright (C) 2014-2015 Ferran Marcet <fmarcet@2byte.es>
|
* Copyright (C) 2014-2015 Ferran Marcet <fmarcet@2byte.es>
|
||||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||||
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||||
* Copyright (C) 2016 Charlie Benke <charlie@patas-monkey.com>
|
* Copyright (C) 2016 Charlie Benke <charlie@patas-monkey.com>
|
||||||
* Copyright (C) 2016 Meziane Sof <virtualsof@yahoo.fr>
|
* Copyright (C) 2016 Meziane Sof <virtualsof@yahoo.fr>
|
||||||
*
|
*
|
||||||
* 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
|
||||||
@ -51,8 +51,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/modules/product/modules_product.php';
|
|||||||
if (! empty($conf->propal->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
|
if (! empty($conf->propal->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
|
||||||
if (! empty($conf->facture->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
if (! empty($conf->facture->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||||
if (! empty($conf->commande->enabled)) require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
|
if (! empty($conf->commande->enabled)) require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.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';
|
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/accountancy/class/html.formventilation.class.php';
|
||||||
|
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
|
||||||
|
|
||||||
$langs->load("products");
|
$langs->load("products");
|
||||||
$langs->load("other");
|
$langs->load("other");
|
||||||
@ -1531,8 +1531,12 @@ else
|
|||||||
print '<tr><td class="nowrap">';
|
print '<tr><td class="nowrap">';
|
||||||
print $langs->trans("ProductAccountancySellCode");
|
print $langs->trans("ProductAccountancySellCode");
|
||||||
print '</td><td colspan="2">';
|
print '</td><td colspan="2">';
|
||||||
if (! empty($conf->accounting->enabled)) {
|
if (! empty($conf->accounting->enabled))
|
||||||
print length_accountg($object->accountancy_code_sell);
|
{
|
||||||
|
$accountingaccount = new AccountingAccount($db);
|
||||||
|
$accountingaccount->fetch('',$object->accountancy_code_sell);
|
||||||
|
|
||||||
|
print $accountingaccount->getNomUrl(0,1,1,'',1);
|
||||||
} else {
|
} else {
|
||||||
print $object->accountancy_code_sell;
|
print $object->accountancy_code_sell;
|
||||||
}
|
}
|
||||||
@ -1542,8 +1546,12 @@ else
|
|||||||
print '<tr><td class="nowrap">';
|
print '<tr><td class="nowrap">';
|
||||||
print $langs->trans("ProductAccountancyBuyCode");
|
print $langs->trans("ProductAccountancyBuyCode");
|
||||||
print '</td><td colspan="2">';
|
print '</td><td colspan="2">';
|
||||||
if (! empty($conf->accounting->enabled)) {
|
if (! empty($conf->accounting->enabled))
|
||||||
print length_accountg($object->accountancy_code_buy);
|
{
|
||||||
|
$accountingaccount2 = new AccountingAccount($db);
|
||||||
|
$accountingaccount2->fetch('',$object->accountancy_code_buy);
|
||||||
|
|
||||||
|
print $accountingaccount2->getNomUrl(0,1,1,'',1);
|
||||||
} else {
|
} else {
|
||||||
print $object->accountancy_code_buy;
|
print $object->accountancy_code_buy;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user