From e12d10158c8bee720b190e8b7eeda39732d3a8da Mon Sep 17 00:00:00 2001 From: Eric Seigne Date: Fri, 17 Feb 2023 10:14:20 +0100 Subject: [PATCH] NEW: add customer code to invoices listing --- htdocs/compta/facture/list.php | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index fd60a6a84a4..709b246602b 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -200,6 +200,7 @@ $fieldstosearchall = array( 'f.ref_client'=>'RefCustomer', 'f.note_public'=>'NotePublic', 's.nom'=>"ThirdParty", + 's.code_client'=>"CustomerCodeShort", 's.name_alias'=>"AliasNameShort", 's.zip'=>"Zip", 's.town'=>"Town", @@ -222,6 +223,7 @@ $arrayfields = array( 'p.title'=>array('label'=>"ProjectLabel", 'checked'=>0, 'enabled'=>(!isModEnabled('project') ? 0 : 1), 'position'=>41), 's.nom'=>array('label'=>"ThirdParty", 'checked'=>1, 'position'=>50), 's.name_alias'=>array('label'=>"AliasNameShort", 'checked'=>1, 'position'=>51), + 's.code_client'=>array('label'=>"CustomerCodeShort", 'checked'=>1, 'position'=>52), 's2.nom'=>array('label'=>'ParentCompany', 'position'=>32, 'checked'=>0), 's.town'=>array('label'=>"Town", 'checked'=>-1, 'position'=>55), 's.zip'=>array('label'=>"Zip", 'checked'=>1, 'position'=>60), @@ -574,7 +576,7 @@ $sql .= ' f.datef, f.date_valid, f.date_lim_reglement as datelimite, f.module_so $sql .= ' f.paye as paye, f.fk_statut, f.close_code,'; $sql .= ' f.datec as date_creation, f.tms as date_update, f.date_closing as date_closing,'; $sql .= ' f.retained_warranty, f.retained_warranty_date_limit, f.situation_final, f.situation_cycle_ref, f.situation_counter,'; -$sql .= ' s.rowid as socid, s.nom as name, s.name_alias as alias, s.email, s.phone, s.fax, s.address, s.town, s.zip, s.fk_pays, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta as code_compta_client, s.code_compta_fournisseur,'; +$sql .= ' s.rowid as socid, s.nom as name, s.name_alias as alias, s.code_client as code_client, s.email, s.phone, s.fax, s.address, s.town, s.zip, s.fk_pays, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta as code_compta_client, s.code_compta_fournisseur,'; $sql .= " s.parent as fk_parent,"; $sql .= " s2.nom as name2,"; $sql .= ' typent.code as typent_code,'; @@ -687,6 +689,9 @@ if (empty($arrayfields['s.name_alias']['checked']) && $search_company) { if ($search_parent_name) { $sql .= natural_search('s2.nom', $search_parent_name); } +if ($search_company_code_client) { + $sql .= natural_search('s.code_client', $search_company_code_client); +} if ($search_town) { $sql .= natural_search('s.town', $search_town); } @@ -1402,6 +1407,10 @@ if ($resql) { print ''; print ''; } + // Customer Code + if (!empty($arrayfields['s.code_client']['checked'])) { + print ''; + } // Town if (!empty($arrayfields['s.town']['checked'])) { print ''; @@ -1654,6 +1663,9 @@ if ($resql) { if (!empty($arrayfields['s2.nom']['checked'])) { print_liste_field_titre($arrayfields['s2.nom']['label'], $_SERVER['PHP_SELF'], 's2.nom', '', $param, '', $sortfield, $sortorder); } + if (!empty($arrayfields['s.code_client']['checked'])) { + print_liste_field_titre($arrayfields['s.code_client']['label'], $_SERVER['PHP_SELF'], 's.code_client', '', $param, '', $sortfield, $sortorder); + } if (!empty($arrayfields['s.town']['checked'])) { print_liste_field_titre($arrayfields['s.town']['label'], $_SERVER["PHP_SELF"], 's.town', '', $param, '', $sortfield, $sortorder); } @@ -1850,6 +1862,7 @@ if ($resql) { $companystatic->id = $obj->socid; $companystatic->name = $obj->name; $companystatic->name_alias = $obj->alias; + $companystatic->code_client = $obj->code_client; $companystatic->client = $obj->client; $companystatic->fournisseur = $obj->fournisseur; $companystatic->code_client = $obj->code_client; @@ -2095,7 +2108,16 @@ if ($resql) { $totalarray['nbfield']++; } } - // Town + // Customer Code + if (!empty($arrayfields['s.code_client']['checked'])) { + print ''; + print dol_escape_htmltag($companystatic->code_client); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Town if (!empty($arrayfields['s.town']['checked'])) { print ''; print dol_escape_htmltag($obj->town);