NEW CONSTANT: ORDER_TYPE_CONTACT_DEFAULT

For example: Direct to SHIPPING
This commit is contained in:
Lenin Rivas 2025-01-29 12:05:23 -05:00 committed by GitHub
parent e0494b8e1d
commit bd87aa005d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -15,7 +15,8 @@
* Copyright (C) 2018-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2022 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
* Copyright (C) 2023-2024 Benjamin Falière <benjamin.faliere@altairis.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2025 Lenin Rivas <lenin.rivas777@gmail.com>
*
* 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 "<tr><td>".$langs->trans("DefaultContact").'</td><td>';
// print "<tr><td>".$langs->trans("DefaultContact").'</td><td>';
print "<tr><td>";
print $form->textwithpicto($langs->trans("DefaultContact"), $langs->trans("TypeContact_commande_external_".$type_contact_code));
print '</td><td>';
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);