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 <eldy@destailleur.fr>

* 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 <eldy@destailleur.fr>
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 <francis.appels@yahoo.com>
This commit is contained in:
Alain Rihs 2025-07-15 15:54:52 +02:00 committed by ldestailleur
parent 61dcd176e0
commit db3a5cfbef

View file

@ -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;