diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index eedcd449c0d..02543d46993 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -783,10 +783,14 @@ else $modCodeFournisseur = new $module; // Define if customer/prospect or supplier status is set or not - if (GETPOST("type")!='f' && empty($conf->global->THIRDPARTY_NOTCUSTOMERPROSPECT_BY_DEFAULT)) { $object->client=3; } - if (GETPOST("type")=='c') { $object->client=1; } + if (GETPOST("type")!='f') + { + $object->client=-1; + if (! empty($conf->global->THIRDPARTY_CUSTOMERPROSPECT_BY_DEFAULT)) { $object->client=3; } + } + if (GETPOST("type")=='c') { $object->client=3; } // Prospect / Customer if (GETPOST("type")=='p') { $object->client=2; } - if (! empty($conf->fournisseur->enabled) && (GETPOST("type")=='f' || (GETPOST("type")=='' && empty($conf->global->THIRDPARTY_NOTSUPPLIER_BY_DEFAULT)))) { $object->fournisseur=1; } + if (! empty($conf->fournisseur->enabled) && (GETPOST("type")=='f' || (GETPOST("type")=='' && ! empty($conf->global->THIRDPARTY_SUPPLIER_BY_DEFAULT)))) { $object->fournisseur=1; } $object->name = GETPOST('name', 'alpha'); $object->firstname = GETPOST('firstname', 'alpha'); @@ -983,8 +987,9 @@ else // Prospect/Customer print ''.fieldLabel('ProspectCustomer','customerprospect',1).''; - print ''; if (GETPOST("type") == '') print ''; if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) print ''; if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) print ''; @@ -1008,7 +1013,9 @@ else // Supplier print ''; print ''.fieldLabel('Supplier','fournisseur',1).''; - print $form->selectyesno("fournisseur", (isset($_POST['fournisseur'])?GETPOST('fournisseur'):(GETPOST("type") == '' ? -1 : $object->fournisseur)), 1, 0, (GETPOST("type") == '' ? 1 : 0)); + $default = -1; + if (! empty($conf->global->THIRDPARTY_SUPPLIER_BY_DEFAULT)) $default=1; + print $form->selectyesno("fournisseur", (isset($_POST['fournisseur'])?GETPOST('fournisseur'):(GETPOST("type") == '' ? $default : $object->fournisseur)), 1, 0, (GETPOST("type") == '' ? 1 : 0)); print ''; print ''.fieldLabel('SupplierCode','supplier_code').''; print '
';