Merge pull request #20056 from aspangaro/14p32

FIX Disable customer type by default if type prospect/customer is disabled
This commit is contained in:
Laurent Destailleur 2022-03-30 12:17:44 +02:00 committed by GitHub
commit 14d8c1045d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 28 additions and 25 deletions

View File

@ -225,7 +225,7 @@ if ($action == "setaskforshippingmet") {
} }
} }
//Activate "Disable prospect/customer type" // Activate "Disable prospect/customer type"
if ($action == "setdisableprospectcustomer") { if ($action == "setdisableprospectcustomer") {
$setdisableprospectcustomer = GETPOST('value', 'int'); $setdisableprospectcustomer = GETPOST('value', 'int');
$res = dolibarr_set_const($db, "SOCIETE_DISABLE_PROSPECTSCUSTOMERS", $setdisableprospectcustomer, 'yesno', 0, '', $conf->entity); $res = dolibarr_set_const($db, "SOCIETE_DISABLE_PROSPECTSCUSTOMERS", $setdisableprospectcustomer, 'yesno', 0, '', $conf->entity);

View File

@ -6,7 +6,7 @@
* Copyright (C) 2005-2017 Regis Houssin <regis.houssin@inodbox.com> * Copyright (C) 2005-2017 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2008 Patrick Raguin <patrick.raguin@auguria.net> * Copyright (C) 2008 Patrick Raguin <patrick.raguin@auguria.net>
* Copyright (C) 2010-2020 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010-2020 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011-2013 Alexandre Spangaro <aspangaro@open-dsi.fr> * Copyright (C) 2011-2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr> * Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr> * Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
@ -986,21 +986,24 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
$modCodeFournisseur = new $module; $modCodeFournisseur = new $module;
// Define if customer/prospect or supplier status is set or not // Define if customer/prospect or supplier status is set or not
if (GETPOST("type") != 'f') { if (GETPOST("type", 'aZ') != 'f') {
$object->client = -1; $object->client = -1;
if (!empty($conf->global->THIRDPARTY_CUSTOMERPROSPECT_BY_DEFAULT)) { if (!empty($conf->global->THIRDPARTY_CUSTOMERPROSPECT_BY_DEFAULT)) {
$object->client = 3; $object->client = 3;
} }
} }
// Prospect / Customer // Prospect / Customer
if (GETPOST("type") == 'c') { if (GETPOST("type", 'aZ') == 'c') {
if (!empty($conf->global->THIRDPARTY_CUSTOMERTYPE_BY_DEFAULT)) { if (!empty($conf->global->THIRDPARTY_CUSTOMERTYPE_BY_DEFAULT)) {
$object->client = $conf->global->THIRDPARTY_CUSTOMERTYPE_BY_DEFAULT; $object->client = $conf->global->THIRDPARTY_CUSTOMERTYPE_BY_DEFAULT;
} else { } else {
$object->client = 3; $object->client = 3;
} }
} }
if (GETPOST("type") == 'p') { if (!empty($conf->global->SOCIETE_DISABLE_PROSPECTSCUSTOMERS) && $object->client == 3) {
$object->client = 1;
}
if (GETPOST("type", 'aZ') == 'p') {
$object->client = 2; $object->client = 2;
} }
if (((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) && (GETPOST("type") == 'f' || (GETPOST("type") == '' && !empty($conf->global->THIRDPARTY_SUPPLIER_BY_DEFAULT)))) { if (((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) && (GETPOST("type") == 'f' || (GETPOST("type") == '' && !empty($conf->global->THIRDPARTY_SUPPLIER_BY_DEFAULT)))) {