Skip to content

Commit

Permalink
Add a warning if we add a contact that has a user #10789
Browse files Browse the repository at this point in the history
  • Loading branch information
FlorentPoinsaut committed Jul 11, 2024
1 parent 1c52869 commit efd2635
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 8 deletions.
31 changes: 23 additions & 8 deletions htdocs/core/tpl/contacts.tpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -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') {
Expand Down Expand Up @@ -325,14 +327,27 @@
print "</tr>";

foreach ($list as $entry) {
print '<tr class="oddeven" data-rowid="' . $entry->id . '">';

print '<td class="tdoverflowmax200" data-thirdparty_id="' . ((int) $entry->thirdparty_id) . '" data-thirdparty_name="' . dol_escape_htmltag($entry->thirdparty_name) . '">'.$entry->thirdparty_html.'</td>';
print '<td class="tdoverflowmax200" data-contact_id="' . ((int) $entry->contact_id) . '">'.$entry->contact_html.'</td>';
print '<td class="nowrap" data-nature="' . dol_escape_htmltag($entry->nature) . '"><span class="opacitymedium">'.dol_escape_htmltag($entry->nature_html).'</span></td>';
print '<td class="tdoverflowmax200" data-type_id="' . ((int) $entry->type_id) . '" data-type="' . dol_escape_htmltag($entry->type) . '">'.dol_escape_htmltag($entry->type).'</td>';
print '<td class="tdoverflowmax200 center" data-status_id="' . ((int) $entry->status) . '">'.$entry->status_html.'</td>';

?>

Check failure on line 330 in htdocs/core/tpl/contacts.tpl.php

View workflow job for this annotation

GitHub Actions / pre-commit / pre-commit

Line indented incorrectly; expected 1 tabs, found 0
<tr class="oddeven" data-rowid="<?= $entry->id ?>">

Check failure on line 331 in htdocs/core/tpl/contacts.tpl.php

View workflow job for this annotation

GitHub Actions / pre-commit / pre-commit

Short PHP opening tag used with echo; expected "<?php echo $entry ..." but found "<?= $entry ..."
<td class="tdoverflowmax200" data-thirdparty_id="<?= ((int) $entry->thirdparty_id) ?>" data-thirdparty_name="<?= dol_escape_htmltag($entry->thirdparty_name) ?>">

Check failure on line 332 in htdocs/core/tpl/contacts.tpl.php

View workflow job for this annotation

GitHub Actions / pre-commit / pre-commit

Short PHP opening tag used with echo; expected "<?php echo ( ..." but found "<?= ( ..."

Check failure on line 332 in htdocs/core/tpl/contacts.tpl.php

View workflow job for this annotation

GitHub Actions / pre-commit / pre-commit

Short PHP opening tag used with echo; expected "<?php echo dol_escape_htmltag ..." but found "<?= dol_escape_htmltag ..."
<?= $entry->thirdparty_html ?>

Check failure on line 333 in htdocs/core/tpl/contacts.tpl.php

View workflow job for this annotation

GitHub Actions / pre-commit / pre-commit

Short PHP opening tag used with echo; expected "<?php echo $entry ..." but found "<?= $entry ..."
</td>
<td class="tdoverflowmax200" data-contact_id="<?= ((int) $entry->contact_id) ?>">

Check failure on line 335 in htdocs/core/tpl/contacts.tpl.php

View workflow job for this annotation

GitHub Actions / pre-commit / pre-commit

Short PHP opening tag used with echo; expected "<?php echo ( ..." but found "<?= ( ..."
<?= $entry->contact_html ?>

Check failure on line 336 in htdocs/core/tpl/contacts.tpl.php

View workflow job for this annotation

GitHub Actions / pre-commit / pre-commit

Short PHP opening tag used with echo; expected "<?php echo $entry ..." but found "<?= $entry ..."
</td>
<td class="nowrap" data-nature="<?= dol_escape_htmltag($entry->nature) ?>">

Check failure on line 338 in htdocs/core/tpl/contacts.tpl.php

View workflow job for this annotation

GitHub Actions / pre-commit / pre-commit

Short PHP opening tag used with echo; expected "<?php echo dol_escape_htmltag ..." but found "<?= dol_escape_htmltag ..."
<span class="opacitymedium">
<?= dol_escape_htmltag($entry->nature_html) ?>

Check failure on line 340 in htdocs/core/tpl/contacts.tpl.php

View workflow job for this annotation

GitHub Actions / pre-commit / pre-commit

Short PHP opening tag used with echo; expected "<?php echo dol_escape_htmltag ..." but found "<?= dol_escape_htmltag ..."
</span>
<?= ($entry->contact_warning ? img_picto($langs->trans("ThisContactHasAnUser"), 'warning') : '') ?>

Check failure on line 342 in htdocs/core/tpl/contacts.tpl.php

View workflow job for this annotation

GitHub Actions / pre-commit / pre-commit

Short PHP opening tag used with echo; expected "<?php echo ( ..." but found "<?= ( ..."
</td>
<td class="tdoverflowmax200" data-type_id="<?= ((int) $entry->type_id) ?>" data-type="<?= dol_escape_htmltag($entry->type) ?>">
<?= dol_escape_htmltag($entry->type) ?>
</td>
<td class="tdoverflowmax200 center" data-status_id="<?= ((int) $entry->status) ?>">
<?= $entry->status_html ?>
</td>
<?php
if ($permission) {
$href = $_SERVER["PHP_SELF"];
$href .= '?id='.((int) $object->id);
Expand Down
1 change: 1 addition & 0 deletions htdocs/langs/en_US/main.lang
Original file line number Diff line number Diff line change
Expand Up @@ -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.

0 comments on commit efd2635

Please sign in to comment.