From 3f2aa6a4fb993b970f9aba87827d68d9fdef9e7b Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Thu, 8 Mar 2018 06:52:31 +0100 Subject: [PATCH 1/4] New : On invoice card, show accounting account linked --- htdocs/compta/facture/class/facture.class.php | 19 +++++++++++++------ htdocs/core/tpl/objectline_view.tpl.php | 9 +++++++++ htdocs/langs/en_US/compta.lang | 1 + 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 7c49ff909d6..1697216cc09 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -13,8 +13,9 @@ * Copyright (C) 2012 Cédric Salvador * Copyright (C) 2012-2014 Raphaël Doursenaud * Copyright (C) 2013 Cedric Gross - * Copyright (C) 2013 Florian Henry - * Copyright (C) 2016 Ferran Marcet + * Copyright (C) 2013 Florian Henry + * Copyright (C) 2016 Ferran Marcet + * Copyright (C) 2018 Alexandre Spangaro * * 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 @@ -43,6 +44,9 @@ require_once DOL_DOCUMENT_ROOT.'/societe/class/client.class.php'; require_once DOL_DOCUMENT_ROOT.'/margin/lib/margins.lib.php'; require_once DOL_DOCUMENT_ROOT.'/multicurrency/class/multicurrency.class.php'; +if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php'; +if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php'; + /** * Class to manage invoices */ @@ -1457,6 +1461,9 @@ class Facture extends CommonInvoice $line->fk_prev_id = $objp->fk_prev_id; $line->fk_unit = $objp->fk_unit; + // Accountancy + $line->fk_accounting_account = $objp->fk_code_ventilation; + // Multicurrency $line->fk_multicurrency = $objp->fk_multicurrency; $line->multicurrency_code = $objp->multicurrency_code; @@ -1584,10 +1591,10 @@ class Facture extends CommonInvoice $sql.= " note_private=".(isset($this->note_private)?"'".$this->db->escape($this->note_private)."'":"null").","; $sql.= " note_public=".(isset($this->note_public)?"'".$this->db->escape($this->note_public)."'":"null").","; $sql.= " model_pdf=".(isset($this->modelpdf)?"'".$this->db->escape($this->modelpdf)."'":"null").","; - $sql.= " import_key=".(isset($this->import_key)?"'".$this->db->escape($this->import_key)."'":"null"); - $sql.= ", situation_cycle_ref=".$this->situation_cycle_ref; - $sql.= ", situation_counter=".$this->situation_counter; - $sql.= ", situation_final=".$this->situation_final; + $sql.= " import_key=".(isset($this->import_key)?"'".$this->db->escape($this->import_key)."'":"null").","; + $sql.= " situation_cycle_ref=".$this->situation_cycle_ref.","; + $sql.= " situation_counter=".$this->situation_counter.","; + $sql.= " situation_final=".$this->situation_final; $sql.= " WHERE rowid=".$this->id; diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php index 8d5b13ece7c..1d9e81fe1ee 100644 --- a/htdocs/core/tpl/objectline_view.tpl.php +++ b/htdocs/core/tpl/objectline_view.tpl.php @@ -285,6 +285,15 @@ if (empty($outputalsopricetotalwithtax)) $outputalsopricetotalwithtax=0; +accounting->enabled)) + { + $accountingaccount=new AccountingAccount($this->db); + $accountingaccount->fetch($line->fk_accounting_account); + echo '' . $langs->trans('AccountingAffectation') . ': ' . $accountingaccount->getNomUrl(0,1,1) . ''; + } +?> + Date: Mon, 19 Mar 2018 12:09:38 +0100 Subject: [PATCH 2/4] Update objectline_view.tpl.php --- htdocs/core/tpl/objectline_view.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php index 1d9e81fe1ee..ff0cec92649 100644 --- a/htdocs/core/tpl/objectline_view.tpl.php +++ b/htdocs/core/tpl/objectline_view.tpl.php @@ -286,7 +286,7 @@ if (empty($outputalsopricetotalwithtax)) $outputalsopricetotalwithtax=0; accounting->enabled)) + if (! empty($conf->accounting->enabled) && $line->fk_accounting_account > 0) { $accountingaccount=new AccountingAccount($this->db); $accountingaccount->fetch($line->fk_accounting_account); From c3cd2ff3db4480f0f8cc6ca8542e143bbe078699 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 19 Mar 2018 12:13:18 +0100 Subject: [PATCH 3/4] Update objectline_view.tpl.php --- htdocs/core/tpl/objectline_view.tpl.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php index ff0cec92649..82fe0dde873 100644 --- a/htdocs/core/tpl/objectline_view.tpl.php +++ b/htdocs/core/tpl/objectline_view.tpl.php @@ -143,6 +143,14 @@ if (empty($outputalsopricetotalwithtax)) $outputalsopricetotalwithtax=0; echo get_date_range($line->date_start,$line->date_end, $format); } } + + if (! empty($conf->accounting->enabled) && $line->fk_accounting_account > 0) + { + $accountingaccount=new AccountingAccount($this->db); + $accountingaccount->fetch($line->fk_accounting_account); + echo '
' . $langs->trans('AccountingAffectation') . ': ' . $accountingaccount->getNomUrl(0,1,1); + } + ?> -accounting->enabled) && $line->fk_accounting_account > 0) - { - $accountingaccount=new AccountingAccount($this->db); - $accountingaccount->fetch($line->fk_accounting_account); - echo '' . $langs->trans('AccountingAffectation') . ': ' . $accountingaccount->getNomUrl(0,1,1) . ''; - } -?> - showOptionals($extrafieldsline,'view',array('style'=>$bcdd[$var],'colspan'=>$coldisplay)); } ?> - + + From 2ae1bb26c510c85221f6350af1fb6aff3dfbc18b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 19 Mar 2018 12:14:43 +0100 Subject: [PATCH 4/4] Update compta.lang --- htdocs/langs/en_US/compta.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/compta.lang b/htdocs/langs/en_US/compta.lang index 7b2c99fe8fc..871b911a971 100644 --- a/htdocs/langs/en_US/compta.lang +++ b/htdocs/langs/en_US/compta.lang @@ -237,4 +237,4 @@ ErrorBankAccountNotFound=Error: Bank account not found FiscalPeriod=Accounting period ListSocialContributionAssociatedProject=List of social contributions associated with the project DeleteFromCat=Remove from accounting group -AccountingAffectation=Accounting affectation +AccountingAffectation=Accounting assignement