From 870979362e1c4e44da42863b28f2dcaeff4afcc0 Mon Sep 17 00:00:00 2001 From: Alain Rihs Date: Tue, 15 Jul 2025 15:54:52 +0200 Subject: [PATCH] FIX when using THIRDPARTY_CUSTOMERTYPE_BY_DEFAULT and direct link New prospect, New Customer or New Supplier (#34702) * Update card.php #FIX when using THIRDPARTY_CUSTOMERTYPE_BY_DEFAULT and direct link New prospect, New Customer or New Supplier * Fix name of option for supplier * Update functions.lib.php (#34718) Add __MYCOMPANY_URL__ & __MYCOMPANY_PHONEMOBILE__ in getCommonSubstitutionArray * Fix bad value fourn paiement process (#34722) * Fix bad value fourn paiement process * best fix * fix takepos console error (#34709) * fix console error * exit early --------- Co-authored-by: Laurent Destailleur * Update card.php * Fix CI * Clean code * Comment * Update card.php "if (getDolGlobalInt('THIRDPARTY_CUSTOMERTYPE_BY_DEFAULT')) {": this part of code is wrong when we click on "New customer", Customer AND Prospect are selected. New test on line 1452 cover this case. So when type is C, variable object->client should be 1. And I corrected the new code with parenthesis. * Update card.php distraction error in the new code --------- Co-authored-by: ldestailleur Co-authored-by: Deefaze <6393617+Deefaze@users.noreply.github.com> Co-authored-by: Lucas Marcouiller <45882981+Hystepik@users.noreply.github.com> Co-authored-by: Francis Appels --- htdocs/societe/card.php | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index eb9f28c26fc..f7c530e3129 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -1032,11 +1032,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio } // Prospect / Customer if (GETPOST("type", 'aZ') == 'c') { - if (getDolGlobalInt('THIRDPARTY_CUSTOMERTYPE_BY_DEFAULT')) { - $object->client = getDolGlobalInt('THIRDPARTY_CUSTOMERTYPE_BY_DEFAULT'); - } else { - $object->client = 3; - } + $object->client = 1; } if (GETPOST("type", 'aZ') == 'p') { $object->client = 2; @@ -1449,8 +1445,8 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio // Prospect/Customer/Supplier $selected = $object->client; - $selectedcustomer = (getDolGlobalInt('THIRDPARTY_CUSTOMERTYPE_BY_DEFAULT')==1 || getDolGlobalInt('THIRDPARTY_CUSTOMERTYPE_BY_DEFAULT')==3 ? 1 : 0); - $selectedprospect = (getDolGlobalInt('THIRDPARTY_CUSTOMERTYPE_BY_DEFAULT')==2 || getDolGlobalInt('THIRDPARTY_CUSTOMERTYPE_BY_DEFAULT')==3 ? 1 : 0); + $selectedcustomer = ((getDolGlobalInt('THIRDPARTY_CUSTOMERTYPE_BY_DEFAULT')==1 && GETPOST("type", 'aZ') != 'p' && GETPOST("type", 'aZ') != 'f') || (getDolGlobalInt('THIRDPARTY_CUSTOMERTYPE_BY_DEFAULT')==3 && GETPOST("type", 'aZ') != 'p' && GETPOST("type", 'aZ') != 'f') ? 1 : 0); + $selectedprospect = ((getDolGlobalInt('THIRDPARTY_CUSTOMERTYPE_BY_DEFAULT')==2 && GETPOST("type", 'aZ') != 'c' && GETPOST("type", 'aZ') != 'f') || (getDolGlobalInt('THIRDPARTY_CUSTOMERTYPE_BY_DEFAULT')==3 && GETPOST("type", 'aZ') != 'c' && GETPOST("type", 'aZ') != 'f') ? 1 : 0); switch ($selected) { case 1: $selectedcustomer = 1;