From efd263579fba5bc2c5e17dfe0d67283808d28362 Mon Sep 17 00:00:00 2001 From: Florent Poinsaut Date: Thu, 11 Jul 2024 18:49:44 +0200 Subject: [PATCH] Add a warning if we add a contact that has a user #10789 --- htdocs/core/tpl/contacts.tpl.php | 31 +++++++++++++++++++++++-------- htdocs/langs/en_US/main.lang | 1 + 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/htdocs/core/tpl/contacts.tpl.php b/htdocs/core/tpl/contacts.tpl.php index 32c6b6a9b5871..cb52f20f94bd8 100644 --- a/htdocs/core/tpl/contacts.tpl.php +++ b/htdocs/core/tpl/contacts.tpl.php @@ -255,11 +255,13 @@ $entry->contact_id = $userstatic->id; $entry->contact_html = $userstatic->getNomUrl(-1, '', 0, 0, 0, 0, '', 'valignmiddle'); $entry->contact_name = strtolower($userstatic->getFullName($langs)); + $entry->contact_warning = false; } elseif ($contact['source'] == 'external') { $contactstatic->fetch($contact['id']); $entry->contact_id = $contactstatic->id; $entry->contact_html = $contactstatic->getNomUrl(1, '', 0, '', 0, 0); $entry->contact_name = strtolower($contactstatic->getFullName($langs)); + $entry->contact_warning = ($contactstatic->user_id > 0); } if ($contact['source'] == 'internal') { @@ -325,14 +327,27 @@ print ""; foreach ($list as $entry) { - print ''; - - print ''.$entry->thirdparty_html.''; - print ''.$entry->contact_html.''; - print ''.dol_escape_htmltag($entry->nature_html).''; - print ''.dol_escape_htmltag($entry->type).''; - print ''.$entry->status_html.''; - +?> + + + thirdparty_html ?> + + + contact_html ?> + + + + nature_html) ?> + + contact_warning ? img_picto($langs->trans("ThisContactHasAnUser"), 'warning') : '') ?> + + + type) ?> + + + status_html ?> + +id); diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 18dc30a2c5f29..3813ea70f76e5 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -1299,3 +1299,4 @@ AllEntities=All entities TranslationOfKey=Translation of the key AnyTranslationKey SignedStatus=Signed status NbRecordQualified=Number of qualified records +ThisContactHasAnUser=Warning, you must assign the associated user and not this contact to allow access to this object.