Fix calendar pc
This commit is contained in:
parent
bb51da8f8f
commit
bdad08ebea
@ -20,7 +20,7 @@ if ($_SESSION['id']) {
|
||||
$where = "1";
|
||||
|
||||
if(isset($post['active']) && $post['active'] == 1){
|
||||
$where = "calendar_view = 0";
|
||||
$where = "calendar_view = 0 AND cancel = 0";
|
||||
}
|
||||
|
||||
// Общее хранилище deal_id для дедупликации
|
||||
@ -196,10 +196,10 @@ if ($_SESSION['id']) {
|
||||
$i++;
|
||||
}
|
||||
|
||||
$sql = "SELECT *, deal_id FROM user_client_events WHERE user_id = $_SESSION[id] and schedule_date is not null and cancel=0 and $where and $startDateWhere and $endDateWhere";
|
||||
$sql = "SELECT *, deal_id FROM user_client_events WHERE user_id = $_SESSION[id] and schedule_date is not null and $where and $startDateWhere and $endDateWhere";
|
||||
$agencyId = User::getUserAgencyID();
|
||||
if($agencyId != 7384){
|
||||
$sql = "SELECT *, deal_id FROM user_client_events WHERE user_id = $_SESSION[id] and megafon=0 and mango=0 and telphin=0 and beeline=0 and mts=0 and tele2=0 and allo=0 and schedule_date is not null and cancel=0 and $where and $startDateWhere and $endDateWhere";
|
||||
$sql = "SELECT *, deal_id FROM user_client_events WHERE user_id = $_SESSION[id] and megafon=0 and mango=0 and telphin=0 and beeline=0 and mts=0 and tele2=0 and allo=0 and schedule_date is not null and $where and $startDateWhere and $endDateWhere";
|
||||
}
|
||||
$rez = mysql_query($sql);
|
||||
|
||||
@ -213,6 +213,8 @@ if ($_SESSION['id']) {
|
||||
}
|
||||
$dealEvents[$did][] = $event;
|
||||
} else {
|
||||
// Отменённые не-сделочные события пропускаем
|
||||
if ($event['cancel'] == 1) continue;
|
||||
// Не сделки — выводим сразу
|
||||
if ($i > 0) { echo ',{'; } else { echo '{'; }
|
||||
$fio = '';
|
||||
@ -350,7 +352,7 @@ if ($_SESSION['id']) {
|
||||
}
|
||||
|
||||
$className = "deal";
|
||||
if ($bestEvent['calendar_view'] != 0) { $className .= " viewed"; }
|
||||
if ($bestEvent['cancel'] == 1 || $bestEvent['calendar_view'] != 0) { $className .= " viewed"; }
|
||||
|
||||
echo '"title": "'.str_replace('"', "'", $dealTitle).'","className" : "'.$className.'"';
|
||||
echo "}";
|
||||
@ -370,14 +372,16 @@ if ($_SESSION['id']) {
|
||||
$sideOneReqId = (int)$dealRow['side_one_requisition_id'];
|
||||
|
||||
// Получаем schedule_date из связанной заявки
|
||||
$q_dates = mysql_query("SELECT schedule_date, deal_id FROM user_client_events WHERE deal_id = " . $did . " AND type = 'deal' AND schedule_date IS NOT NULL AND cancel = 0 ORDER BY schedule_date DESC LIMIT 1");
|
||||
$q_dates = mysql_query("SELECT schedule_date, deal_id, cancel FROM user_client_events WHERE deal_id = " . $did . " AND type = 'deal' AND schedule_date IS NOT NULL ORDER BY schedule_date DESC LIMIT 1");
|
||||
if ($q_dates && mysql_num_rows($q_dates) > 0) {
|
||||
$dateRow = mysql_fetch_assoc($q_dates);
|
||||
$scheduleDate = $dateRow['schedule_date'];
|
||||
$isCancelled = ($dateRow['cancel'] == 1);
|
||||
} else {
|
||||
// Берём created_at сделки как fallback
|
||||
$q_created = mysql_query("SELECT created_at FROM deals WHERE id = " . $did);
|
||||
$scheduleDate = ($q_created && mysql_num_rows($q_created) > 0) ? mysql_fetch_assoc($q_created)['created_at'] : date('Y-m-d H:i:s');
|
||||
$isCancelled = false;
|
||||
}
|
||||
|
||||
if ($i > 0) { echo ',{'; } else { echo '{'; }
|
||||
@ -387,6 +391,7 @@ if ($_SESSION['id']) {
|
||||
echo '"client_id" : "0",';
|
||||
echo '"req_id" : "' . $sideOneReqId . '",';
|
||||
$className = "deal";
|
||||
if ($isCancelled) { $className .= " viewed"; }
|
||||
echo '"title": "' . str_replace('"', "'", $dealTitle) . '","className" : "' . $className . '"';
|
||||
echo "}";
|
||||
$i++;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user