diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php
index 24d8d146e96..af181347932 100644
--- a/htdocs/societe/soc.php
+++ b/htdocs/societe/soc.php
@@ -240,6 +240,26 @@ if (empty($reshook))
{
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
+ if (! GETPOST('name'))
+ {
+ setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ThirdPartyName")), 'errors');
+ $error++;
+ $action='create';
+ }
+ if (GETPOST('client') < 0)
+ {
+ setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ProspectCustomer")), 'errors');
+ $error++;
+ $action='create';
+ }
+ if (GETPOST('fournisseur') < 0)
+ {
+ setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Supplier")), 'errors');
+ $error++;
+ $action='create';
+ }
+
+
if ($action == 'update')
{
$ret=$object->fetch($socid);
@@ -962,10 +982,11 @@ else
print '
| '.fieldLabel('ProspectCustomer','customerprospect',1).' | ';
print ' | ';
print ''.fieldLabel('CustomerCode','customer_code').' | ';
@@ -984,7 +1005,7 @@ else
// Supplier
print ' |
';
print '| '.fieldLabel('Supplier','fournisseur',1).' | ';
- print $form->selectyesno("fournisseur",(isset($_POST['fournisseur'])?GETPOST('fournisseur'):$object->fournisseur),1);
+ print $form->selectyesno("fournisseur", (isset($_POST['fournisseur'])?GETPOST('fournisseur'):(GETPOST("type") == '' ? -1 : $object->fournisseur)), 1, 0, (GETPOST("type") == '' ? 1 : 0));
print ' | ';
print ''.fieldLabel('SupplierCode','supplier_code').' | ';
print ' |