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() ->get()
->getResultArray(); ->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 array_values($deduped);
return $data;
} }
} }

View File

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