diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index e60536c9bcb..0c726543905 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -15,7 +15,8 @@ * Copyright (C) 2018-2024 Frédéric France * Copyright (C) 2022 Gauthier VERDOL * Copyright (C) 2023-2024 Benjamin Falière - * Copyright (C) 2024 MDW + * Copyright (C) 2024 MDW + * Copyright (C) 2025 Lenin Rivas * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -103,6 +104,9 @@ $origin = GETPOST('origin', 'alpha'); $originid = (GETPOSTINT('originid') ? GETPOSTINT('originid') : GETPOSTINT('origin_id')); // For backward compatibility $rank = (GETPOSTINT('rank') > 0) ? GETPOSTINT('rank') : -1; +// Type Contact default +$type_contact_code = (getDolGlobalString('ORDER_TYPE_CONTACT_DEFAULT') ? getDolGlobalString('ORDER_TYPE_CONTACT_DEFAULT') : 'CUSTOMER'); + // PDF $hidedetails = (GETPOSTINT('hidedetails') ? GETPOSTINT('hidedetails') : (getDolGlobalString('MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS') ? 1 : 0)); $hidedesc = (GETPOSTINT('hidedesc') ? GETPOSTINT('hidedesc') : (getDolGlobalString('MAIN_GENERATE_DOCUMENTS_HIDE_DESC') ? 1 : 0)); @@ -549,7 +553,8 @@ if (empty($reshook)) { // Insert default contacts if defined if ($object_id > 0) { if (GETPOSTINT('contactid')) { - $result = $object->add_contact(GETPOSTINT('contactid'), 'CUSTOMER', 'external'); + // $result = $object->add_contact(GETPOSTINT('contactid'), 'CUSTOMER', 'external'); + $result = $object->add_contact(GETPOSTINT('contactid'), $type_contact_code, 'external'); if ($result < 0) { setEventMessages($langs->trans("ErrorFailedToAddContact"), null, 'errors'); $error++; @@ -1995,7 +2000,10 @@ if ($action == 'create' && $usercancreate) { // Contact of order if ($socid > 0) { // Contacts (ask contact only if thirdparty already defined). - print "".$langs->trans("DefaultContact").''; + // print "".$langs->trans("DefaultContact").''; + print ""; + print $form->textwithpicto($langs->trans("DefaultContact"), $langs->trans("TypeContact_commande_external_".$type_contact_code)); + print ''; print img_picto('', 'contact', 'class="pictofixedwidth"'); //print $form->selectcontacts($soc->id, $contactid, 'contactid', 1, empty($srccontactslist) ? "" : $srccontactslist, '', 1, 'maxwidth300 widthcentpercentminusx'); print $form->select_contact($soc->id, $contactid, 'contactid', 1, empty($srccontactslist) ? "" : $srccontactslist, '', 1, 'maxwidth300 widthcentpercentminusx', true);