From e51dd2919eafcddcabefe4f3132b9d0a11761204 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josep=20Llu=C3=ADs?= Date: Tue, 20 Oct 2020 17:15:03 +0200 Subject: [PATCH 1/2] Add customer country information in popup Add customer country information in popup of draft invoices. In other boxes it's ok. --- htdocs/compta/index.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php index 0591d75d5a3..98e6a64fd7a 100644 --- a/htdocs/compta/index.php +++ b/htdocs/compta/index.php @@ -8,6 +8,7 @@ * Copyright (C) 2016 Marcos García * Copyright (C) 2019 Nicolas ZABOURI * Copyright (C) 2020 Tobias Sekan + * Copyright (C) 2020 Josep Lluís Amador * * 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 @@ -143,8 +144,9 @@ if (!empty($conf->facture->enabled) && $user->rights->facture->lire) $sql .= ", s.nom as name"; $sql .= ", s.rowid as socid, s.email"; $sql .= ", s.code_client, s.code_compta, s.code_fournisseur, s.code_compta_fournisseur"; + $sql .= ", cc.rowid as country_id, cc.code as country_code"; if (!$user->rights->societe->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user "; - $sql .= " FROM ".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."societe as s"; + $sql .= " FROM ".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."societe as s LEFT JOIN ".MAIN_DB_PREFIX."c_country as cc ON cc.rowid = s.fk_pays"; if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql .= " WHERE s.rowid = f.fk_soc AND f.fk_statut = ".Facture::STATUS_DRAFT; $sql .= " AND f.entity IN (".getEntity('invoice').")"; @@ -161,7 +163,8 @@ if (!empty($conf->facture->enabled) && $user->rights->facture->lire) $sql .= " GROUP BY f.rowid, f.ref, f.datef, f.total, f.tva, f.total_ttc, f.ref_client, f.type, "; $sql .= "s.email, s.nom, s.rowid, s.code_client, s.code_compta, s.code_fournisseur, s.code_compta_fournisseur"; - + $sql .= ", cc.rowid as country_id, cc.code as country_code"; + // Add Group from hooks $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldListGroupByCustomerDraft', $parameters); @@ -207,6 +210,8 @@ if (!empty($conf->facture->enabled) && $user->rights->facture->lire) $companystatic->id = $obj->socid; $companystatic->name = $obj->name; $companystatic->email = $obj->email; + $companystatic->country_id = $obj->country_id; + $companystatic->country_code = $obj->country_code; $companystatic->client = 1; $companystatic->code_client = $obj->code_client; $companystatic->code_fournisseur = $obj->code_fournisseur; From ff02bba5bfdd738e7ee8cbb78c7568e9b2918090 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Tue, 20 Oct 2020 15:18:29 +0000 Subject: [PATCH 2/2] Fixing style errors. --- htdocs/compta/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php index 98e6a64fd7a..cdf5a0e62c4 100644 --- a/htdocs/compta/index.php +++ b/htdocs/compta/index.php @@ -164,7 +164,7 @@ if (!empty($conf->facture->enabled) && $user->rights->facture->lire) $sql .= " GROUP BY f.rowid, f.ref, f.datef, f.total, f.tva, f.total_ttc, f.ref_client, f.type, "; $sql .= "s.email, s.nom, s.rowid, s.code_client, s.code_compta, s.code_fournisseur, s.code_compta_fournisseur"; $sql .= ", cc.rowid as country_id, cc.code as country_code"; - + // Add Group from hooks $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldListGroupByCustomerDraft', $parameters);