From 923b561aff06be4bdbe9e98d9dff223758af9f96 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 8 Oct 2018 20:01:45 +0200 Subject: [PATCH] FIX Option for prof id mandatory not working with custom type of company --- htdocs/langs/en_US/admin.lang | 2 +- htdocs/langs/en_US/companies.lang | 2 +- htdocs/langs/fr_FR/admin.lang | 2 +- htdocs/langs/fr_FR/companies.lang | 2 +- htdocs/societe/class/societe.class.php | 8 ++++++-- 5 files changed, 10 insertions(+), 6 deletions(-) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index aade72a64bb..cbe085f3149 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1207,7 +1207,7 @@ WatermarkOnDraft=Watermark on draft document JSOnPaimentBill=Activate feature to autofill payment lines on payment form CompanyIdProfChecker=Rules for Professional IDs MustBeUnique=Must be unique? -MustBeMandatory=Mandatory to create third parties? +MustBeMandatory=Mandatory to create third parties (if vat number or type of company defined) ? MustBeInvoiceMandatory=Mandatory to validate invoices? TechnicalServicesProvided=Technical services provided #####DAV ##### diff --git a/htdocs/langs/en_US/companies.lang b/htdocs/langs/en_US/companies.lang index 19cc993876c..78762e542e2 100644 --- a/htdocs/langs/en_US/companies.lang +++ b/htdocs/langs/en_US/companies.lang @@ -38,7 +38,7 @@ ThirdPartyCustomers=Customers ThirdPartyCustomersStats=Customers ThirdPartyCustomersWithIdProf12=Customers with %s or %s ThirdPartySuppliers=Vendors -ThirdPartyType=Third Party Type +ThirdPartyType=Type of company Individual=Private individual ToCreateContactWithSameName=Will create automatically a contact/address with same information than third party under the third party. In most cases, even if your third party is a physical people, creating a third party alone is enough. ParentCompany=Parent company diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index cd048e908f8..58cd1d09b11 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -1207,7 +1207,7 @@ WatermarkOnDraft=Filigrane sur les documents brouillons JSOnPaimentBill=Activer la fonctionnalité de remplissage automatique des lignes de paiement sur le formulaire de paiement CompanyIdProfChecker=Règles sur les Identifiants professionnels MustBeUnique=Doit être unique ? -MustBeMandatory=Obligatoire pour créer des tiers ? +MustBeMandatory=Obligatoire pour créer des tiers (si num tva ou type de société défini) ? MustBeInvoiceMandatory=Obligatoire pour valider des factures ? TechnicalServicesProvided=Services techniques fournis #####DAV ##### diff --git a/htdocs/langs/fr_FR/companies.lang b/htdocs/langs/fr_FR/companies.lang index fbd8bb87e4e..548a7f6e0dd 100644 --- a/htdocs/langs/fr_FR/companies.lang +++ b/htdocs/langs/fr_FR/companies.lang @@ -38,7 +38,7 @@ ThirdPartyCustomers=Clients ThirdPartyCustomersStats=Clients ThirdPartyCustomersWithIdProf12=Clients avec %s ou %s ThirdPartySuppliers=Fournisseurs -ThirdPartyType=Type du tiers +ThirdPartyType=Type du société Individual=Individu privé ToCreateContactWithSameName=Crée automatiquement un contact/adresse, sous le tiers, avec la même information que le tiers. Dans la plupart des cas, même si votre tiers est une personne physique, la création d'un tiers seul suffit. ParentCompany=Maison mère diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 2125d0e6627..bae4a0a4495 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -3127,8 +3127,12 @@ class Societe extends CommonObject // Define if third party is treated as company (or not) when nature is unknown $isacompany=empty($conf->global->MAIN_UNKNOWN_CUSTOMERS_ARE_COMPANIES)?0:1; // 0 by default if (! empty($this->tva_intra)) $isacompany=1; - else if (! empty($this->typent_code) && in_array($this->typent_code,array('TE_PRIVATE'))) $isacompany=0; - else if (! empty($this->typent_code) && in_array($this->typent_code,array('TE_SMALL','TE_MEDIUM','TE_LARGE','TE_GROUP'))) $isacompany=1; + else if (! empty($this->typent_code) && $this->typent_code != 'TE_UNKNOWN') + { + // TODO Add a field is_a_company into dictionary + if (preg_match('/^TE_PRIVATE/', $this->typent_code)) $isacompany=0; + else $isacompany=1; + } return $isacompany; }