FIX Option for prof id mandatory not working with custom type of company

This commit is contained in:
Laurent Destailleur 2018-10-08 20:01:45 +02:00
parent 91038af84d
commit 923b561aff
5 changed files with 10 additions and 6 deletions

View File

@ -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 #####

View File

@ -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

View File

@ -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 #####

View File

@ -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

View File

@ -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;
}