diff --git a/htdocs/core/class/html.formcompany.class.php b/htdocs/core/class/html.formcompany.class.php index 58c9950898c..d28b867dc93 100644 --- a/htdocs/core/class/html.formcompany.class.php +++ b/htdocs/core/class/html.formcompany.class.php @@ -888,4 +888,44 @@ class FormCompany } } } + + function selectProspectCustomerType($selected, $htmlname = 'client', $htmlidname='customerprospect', $typeinput='form',$morecss = '') { + + global $conf,$langs; + + $out = ''; + + return $out; + } } diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index d92a0b47bcc..99b92e67074 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1854,4 +1854,5 @@ OnMobileOnly=On small screen (smartphone) only DisableProspectCustomerType=Disable the "Prospect + Customer" third party type (so third party must be Prospect or Customer but can't be both) MAIN_OPTIMIZEFORTEXTBROWSER=Simplify interface for blind person MAIN_OPTIMIZEFORTEXTBROWSERDesc=Enable this option if you are a blind person, or if you use the application from a text browser like Lynx or Links. -ThisValueCanOverwrittenOnUserLevel=This value can be overwritten by each user from its user page - tab '%s' \ No newline at end of file +ThisValueCanOverwrittenOnUserLevel=This value can be overwritten by each user from its user page - tab '%s' +DefaultCustomerType=Default thirdparty type for "New customer" creation form \ No newline at end of file diff --git a/htdocs/societe/admin/societe.php b/htdocs/societe/admin/societe.php index 6f808b8307a..e283d3220b2 100644 --- a/htdocs/societe/admin/societe.php +++ b/htdocs/societe/admin/societe.php @@ -28,6 +28,7 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; $langs->loadLangs(array("admin", "companies", "other")); @@ -36,6 +37,8 @@ $value=GETPOST('value', 'alpha'); if (!$user->admin) accessforbidden(); +$formcompany = new FormCompany($db); + /* @@ -101,6 +104,21 @@ if ($action == 'updateoptions') setEventMessages($langs->trans("Error"), null, 'errors'); } } + + if (GETPOST('THIRDPARTY_CUSTOMERTYPE_BY_DEFAULT')) + { + $customertypedefault = GETPOST('defaultcustomertype', 'int'); + $res = dolibarr_set_const($db, "THIRDPARTY_CUSTOMERTYPE_BY_DEFAULT", $customertypedefault, 'chaine', 0, '', $conf->entity); + if (! $res > 0) $error++; + if (! $error) + { + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + } + else + { + setEventMessages($langs->trans("Error"), null, 'errors'); + } + } } // Activate a document generator module @@ -306,7 +324,6 @@ if($action=='setonsearchandlistgooncustomerorsuppliercard'){ } } - /* * View */ @@ -861,44 +878,16 @@ else print ''; print ''; -/*print ''; -print ''.$langs->trans("OnSearchAndListGoOnCustomerOrSupplierCard").''; -print ' '; -print ''; -if (!empty($conf->global->SOCIETE_ON_SEARCH_AND_LIST_GO_ON_CUSTOMER_OR_SUPPLIER_CARD)) -{ - print ''; - print img_picto($langs->trans("Activated"),'switch_on'); - -} -else -{ - print ''; - print img_picto($langs->trans("Disabled"),'switch_off'); -} -print ''; -print ''; -*/ - -/* -// COMPANY_USE_SEARCH_TO_SELECT - +// Default Prospect/Customer thirdparty type on customer création print ''; -print ''.$langs->trans("HideClosedThirdpartyComboBox").''; -if (! empty($conf->global->COMPANY_HIDE_INACTIVE_IN_COMBOBOX)) -{ - print ''; - print img_picto($langs->trans("Activated"),'switch_on'); - print ''; -} -else -{ - print ''; - print img_picto($langs->trans("Disabled"),'switch_off'); - print ''; -} +print ''.$langs->trans("DefaultCustomerType").''; +print ''; +print $formcompany->selectProspectCustomerType($conf->global->THIRDPARTY_CUSTOMERTYPE_BY_DEFAULT,'defaultcustomertype','defaultcustomertype','admin'); +print ''; +print ''; +print ''; +print ''; print ''; -*/ print ''; print ''; diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index bde8dffbb8f..d1ac49813f7 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -937,7 +937,13 @@ else $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")=='c') { + if (! empty($conf->global->THIRDPARTY_CUSTOMERTYPE_BY_DEFAULT)) { + $object->client=$conf->global->THIRDPARTY_CUSTOMERTYPE_BY_DEFAULT; + } else { + $object->client=3; + } + } if (GETPOST("type")=='p') { $object->client=2; } if (! empty($conf->fournisseur->enabled) && (GETPOST("type")=='f' || (GETPOST("type")=='' && ! empty($conf->global->THIRDPARTY_SUPPLIER_BY_DEFAULT)))) { $object->fournisseur=1; } @@ -1179,13 +1185,8 @@ else print ''.$form->editfieldkey('ProspectCustomer', 'customerprospect', '', $object, 0, 'string', '', 1).''; print ''; $selected=GETPOST('client', 'int')!=''?GETPOST('client', 'int'):$object->client; - print ''; + print $formcompany->selectProspectCustomerType($selected,'client'); + print ''; print ''.$form->editfieldkey('CustomerCode', 'customer_code', '', $object, 0).''; print ''; - print ''; + print ''; print '
'; @@ -1770,12 +1771,9 @@ else // Prospect/Customer print '
'.$form->editfieldkey('ProspectCustomer', 'customerprospect', '', $object, 0, 'string', '', 1).''; + print $formcompany->selectProspectCustomerType($object->client,'client'); + print ''.$form->editfieldkey('CustomerCode', 'customer_code', '', $object, 0).''; print ''; } // Prospect level
'; diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 9a3dd044923..23e40ccc317 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -831,13 +831,14 @@ if (! empty($arrayfields['customerorsupplier']['checked'])) { print ''; if ($type != '') print ''; - print ''; print ''; if (empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) print ''; if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) print ''; //if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) print ''; print ''; - print ''; + print '';*/ print '