From 3551dff18ac3e98eb923f88fc543b1a3db66b96f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 19 Jan 2013 15:57:28 +0100 Subject: [PATCH] Fix: [ bug #671 ] Product country origin is automatically entered in description of invoices, but not in invoices generated from orders --- htdocs/comm/propal.php | 13 ++++++++++++- htdocs/commande/fiche.php | 13 ++++++++++++- htdocs/compta/facture.php | 23 ++++++++++++----------- 3 files changed, 36 insertions(+), 13 deletions(-) diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index 15824176bbb..7511c6f2ea4 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2011 Laurent Destailleur + * Copyright (C) 2004-2013 Laurent Destailleur * Copyright (C) 2004 Eric Seigne * Copyright (C) 2005 Marc Barilley / Ocebo * Copyright (C) 2005-2012 Regis Houssin @@ -736,6 +736,17 @@ else if ($action == "addline" && $user->rights->propal->creer) } $desc=dol_concatdesc($desc,$product_desc); + + // Add custom code and origin country into description + if (empty($conf->global->MAIN_PRODUCT_DISABLE_CUSTOMCOUNTRYCODE) && (! empty($prod->customcode) || ! empty($prod->country_code))) + { + $tmptxt='('; + if (! empty($prod->customcode)) $tmptxt.=$langs->transnoentitiesnoconv("CustomCode").': '.$prod->customcode; + if (! empty($prod->customcode) && ! empty($prod->country_code)) $tmptxt.=' - '; + if (! empty($prod->country_code)) $tmptxt.=$langs->transnoentitiesnoconv("CountryOrigin").': '.getCountry($prod->country_code,0,$db,$langs,0); + $tmptxt.=')'; + $desc.= dol_concatdesc($desc, $tmptxt); + } } $type = $prod->type; diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index a1d5581aba0..9b6465c64a7 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2012 Laurent Destailleur + * Copyright (C) 2004-2013 Laurent Destailleur * Copyright (C) 2005 Marc Barilley / Ocebo * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2006 Andre Cianfarani @@ -651,6 +651,17 @@ else if ($action == 'addline' && $user->rights->commande->creer) } $desc=dol_concatdesc($desc,$product_desc); + + // Add custom code and origin country into description + if (empty($conf->global->MAIN_PRODUCT_DISABLE_CUSTOMCOUNTRYCODE) && (! empty($prod->customcode) || ! empty($prod->country_code))) + { + $tmptxt='('; + if (! empty($prod->customcode)) $tmptxt.=$langs->transnoentitiesnoconv("CustomCode").': '.$prod->customcode; + if (! empty($prod->customcode) && ! empty($prod->country_code)) $tmptxt.=' - '; + if (! empty($prod->country_code)) $tmptxt.=$langs->transnoentitiesnoconv("CountryOrigin").': '.getCountry($prod->country_code,0,$db,$langs,0); + $tmptxt.=')'; + $desc.= dol_concatdesc($desc, $tmptxt); + } } $type = $prod->type; diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 87b50e2da74..86f03b2d040 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -1,7 +1,7 @@ * Copyright (C) 2004 Eric Seigne - * Copyright (C) 2004-2012 Laurent Destailleur + * Copyright (C) 2004-2013 Laurent Destailleur * Copyright (C) 2005 Marc Barilley / Ocebo * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2006 Andre Cianfarani @@ -1034,7 +1034,7 @@ else if (($action == 'addline' || $action == 'addline_predef') && $user->rights- $desc = $product_desc; } else - { + { $tva_tx = get_default_tva($mysoc,$object->client,$prod->id); $tva_npr = get_default_npr($mysoc,$object->client,$prod->id); @@ -1091,16 +1091,17 @@ else if (($action == 'addline' || $action == 'addline_predef') && $user->rights- } $desc=dol_concatdesc($desc,$product_desc); - } - if (! empty($prod->customcode) || ! empty($prod->country_code)) - { - $tmptxt='('; - if (! empty($prod->customcode)) $tmptxt.=$langs->transnoentitiesnoconv("CustomCode").': '.$prod->customcode; - if (! empty($prod->customcode) && ! empty($prod->country_code)) $tmptxt.=' - '; - if (! empty($prod->country_code)) $tmptxt.=$langs->transnoentitiesnoconv("CountryOrigin").': '.getCountry($prod->country_code,0,$db,$langs,0); - $tmptxt.=')'; - $desc.= (dol_textishtml($desc)?"
\n":"\n").$tmptxt; + // Add custom code and origin country into description + if (empty($conf->global->MAIN_PRODUCT_DISABLE_CUSTOMCOUNTRYCODE) && (! empty($prod->customcode) || ! empty($prod->country_code))) + { + $tmptxt='('; + if (! empty($prod->customcode)) $tmptxt.=$langs->transnoentitiesnoconv("CustomCode").': '.$prod->customcode; + if (! empty($prod->customcode) && ! empty($prod->country_code)) $tmptxt.=' - '; + if (! empty($prod->country_code)) $tmptxt.=$langs->transnoentitiesnoconv("CountryOrigin").': '.getCountry($prod->country_code,0,$db,$langs,0); + $tmptxt.=')'; + $desc.= dol_concatdesc($desc, $tmptxt); + } } $type = $prod->type;