FIX_DUPLICATE_MAIL_LIST

This commit is contained in:
VENKATESHWARAN 2026-05-26 11:53:16 +05:30
parent b4dadec67a
commit 5dc49f7108
2 changed files with 32 additions and 17 deletions

View File

@ -148,10 +148,22 @@ class UserModel extends Model
->get()
->getResultArray();
// The user_teams join produces one row per (user, team) pair, so users
// belonging to multiple teams appear multiple times. Collapse to one
// row per user while keeping a team_id from [6, 7] when available, so
// the existing in_array($user['team_id'], [6, 7]) checks in the views
// continue to work correctly.
$deduped = [];
foreach ($data as $row) {
$userId = $row['id'];
if (!isset($deduped[$userId])) {
$deduped[$userId] = $row;
} elseif (in_array($row['team_id'], [6, 7])) {
$deduped[$userId]['team_id'] = $row['team_id'];
}
}
// dd($data);
return $data;
return array_values($deduped);
}
}

View File

@ -1,3 +1,5 @@
<?php $page_name = $page_name ?? ""; ?>
<style>
.table-container {
@ -496,8 +498,8 @@
</div>
<div class="col-2" style="position: relative;right: 255px;">
<?php if($lead_data['demography_file_status'] == "failed") { ?>
<a href="<?= base_url('util/getMemberDataExcelFileErrors?lead_id=').$lead_data['id'] ?>"
<?php if($lead_data['demography_file_status'] ?? "" == "failed") { ?>
<a href="<?= base_url('util/getMemberDataExcelFileErrors?lead_id=') . ($lead_data['id'] ?? '') ?>"
class="mdi mdi-information-outline text-danger"
style="cursor: pointer; font-size: 27px"
data-toggle="tooltip"
@ -801,7 +803,7 @@
<div class="form-group col-md-4">
<label for="cc">CC </label>
<select class="form-control" id="cc" name="cc" required multiple>
<?php if($page_name == "RFQ") { $exclusiveUserList = $userList; } ?>
<?php if($page_name == "RFQ") { $exclusiveUserList = $userList ?? []; } ?>
<?php if (isset($exclusiveUserList)) { ?>
<?php foreach ($exclusiveUserList as $user) { ?>
<?php if ($page_name == "RFQ" || in_array($user['role'],[1,5]) || in_array($user['team_id'],[6,7])) { ?>
@ -981,7 +983,7 @@
<div class="form-group col-md-6">
<label for="placement_cc">CC </label>
<select class="form-control" id="placement_cc" name="placement_cc" required multiple>
<?php if($page_name == "RFQ") { $exclusiveUserList = $userList; } ?>
<?php if($page_name == "RFQ") { $exclusiveUserList = $userList ?? []; } ?>
<?php if (isset($exclusiveUserList)) { ?>
>
<?php foreach ($exclusiveUserList as $user) { ?>
@ -1356,7 +1358,7 @@ let intervalId;
$(document).ready(function () {
console.log("Document ready");
var demography_file_status_for_hide_and_show = '<?= $lead_data['demography_file_status'] ?>';
var demography_file_status_for_hide_and_show = '<?= $lead_data['demography_file_status'] ?? "" ?>';
toggleButtons(demography_file_status_for_hide_and_show);
let lead_status = '<?= isset($lead_data['status']) ? $lead_data['status'] : '' ?>';
@ -1404,7 +1406,7 @@ $('.remove-icon').on('click', function() {
var currentThrdottedMenu = '';
var proposal_colum_count = 1;
var demography_file_status = '<?= $lead_data['demography_file_status'] ?>';
var demography_file_status = '<?= $lead_data['demography_file_status'] ?? "" ?>';
var over_all_column_data = {
"Proposal 1": {
@ -1818,7 +1820,7 @@ function addSuggestionsToTable() {
<span class="dropdown" onclick="showThreeDottedMenu(event)">
<button class="dropbtn"></button>
<div class="dropdown-content">
<a href="#" class="addInsurer">Add Insurer</a>
<a href="#" class="F">Add Insurer</a>
<a href="#" class="qcrProposal" style="background-color: rgb(221, 221, 221);">
QCR <i class="mdi mdi-checkbox-marked" style="color: green; margin-left: 8px;"></i>
</a>
@ -2549,7 +2551,7 @@ function detachDynamicEventListeners() {
function addInsurer(event) {
const insurers = <?= json_encode($insurer); ?>;
const insurers = <?= json_encode($insurer ?? []); ?>;
selectInsurer(insurers).then(result => {
@ -2701,7 +2703,7 @@ function dupInsurer(event) {
const thPosition = getThPosition(event);
console.log(thPosition);
const insurers = <?= json_encode($insurer); ?>;
const insurers = <?= json_encode($insurer ?? []); ?>;
selectInsurer(insurers).then(result => {
@ -3217,7 +3219,7 @@ function changeInsurer(event) {
}
// let newInsurerName = prompt("Enter New insurer name:");
const insurers = <?= json_encode($insurer); ?>;
const insurers = <?= json_encode($insurer ?? []); ?>;
selectInsurer(insurers).then(result => {
@ -4124,7 +4126,7 @@ function appendInput(data) {
<div class="form-group col-md-6">
<label for="client_cc">CC </label>
<select class="form-control" id="client_cc" name="client_cc" required multiple>
<?php if($page_name == "RFQ") { $exclusiveUserList = $userList; } ?>
<?php if($page_name == "RFQ") { $exclusiveUserList = $userList ?? []; } ?>
<?php if (isset($exclusiveUserList)) { ?>
<?php foreach ($exclusiveUserList as $user) { ?>
<?php if ($page_name == "RFQ" || in_array($user['role'],[1,5]) || in_array($user['team_id'],[6,7])) { ?>
@ -4139,7 +4141,7 @@ function appendInput(data) {
<div class="form-group col-md-6">
<label for="client_bcc">BCC </label>
<select class="form-control" id="client_bcc" name="client_bcc" required multiple>
<?php if($page_name == "RFQ") { $exclusiveUserList = $userList; } ?>
<?php if($page_name == "RFQ") { $exclusiveUserList = $userList ?? []; } ?>
<?php if (isset($exclusiveUserList)) { ?>
<?php foreach ($exclusiveUserList as $user) { ?>
<?php if ($page_name == "RFQ" || in_array($user['role'],[1,5]) || in_array($user['team_id'],[6,7])) { ?>
@ -4190,7 +4192,7 @@ function appendInput(data) {
<div class="form-group col-md-4">
<label for="client_cc">CC </label>
<select class="form-control" id="client_cc" name="client_cc" required multiple>
<?php if($page_name == "RFQ") { $exclusiveUserList = $userList; } ?>
<?php if($page_name == "RFQ") { $exclusiveUserList = $userList ?? []; } ?>
<?php if (isset($exclusiveUserList)) { ?>
<?php foreach ($exclusiveUserList as $user) { ?>
<?php if ($page_name == "RFQ" || in_array($user['role'],[1,5]) || in_array($user['team_id'],[6,7])) { ?>
@ -4205,10 +4207,11 @@ function appendInput(data) {
<div class="form-group col-md-4">
<label for="client_bcc">BCC </label>
<select class="form-control" id="client_bcc" name="client_bcc" required multiple>
<?php if($page_name == "RFQ") { $exclusiveUserList = $userList; } ?>
<?php if($page_name == "RFQ") { $exclusiveUserList = $userList ?? []; } ?>
<?php if (isset($exclusiveUserList)) { ?>
<?php foreach ($exclusiveUserList as $user) { ?>
<?php if ($page_name == "RFQ" || in_array($user['role'],[1,5]) || in_array($user['team_id'],[6,7])) { ?>
<option value="<?= $user['id'];?>">
<?= $user['first_name'].' - '.$user['email'];?>
</option>
<?php } } ?>