Skip to content

Commit

Permalink
OverDue Task count will show inside the task list page and kanban page.
Browse files Browse the repository at this point in the history
  • Loading branch information
swetalina-orangescrum committed Oct 6, 2022
1 parent 3c39c69 commit b0812ba
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 4 deletions.
11 changes: 10 additions & 1 deletion app/Controller/EasycasesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -9387,7 +9387,16 @@ public function kanban_task()
}
}
$msQuery1 = " ";

$frmTz = '+00:00';
$toTz = $this->Tmzone->getGmtTz(TZ_GMT, TZ_DST);
$GMT_DATE =$this->Tmzone->GetDateTime(SES_TIMEZONE, TZ_GMT, TZ_DST, TZ_CODE, GMT_DATETIME, "datetime");
if($this->Format->isAllowed('View All Task', $roleAccess)) {
$over_due_task_count = $this->Easycase->query("SELECT COUNT(*) as cnt from easycases as Easycase WHERE istype='1' AND " . $clt_sql . " " . $cond_easycase_actuve . " AND Easycase.project_id=".$curProjId." AND Easycase.project_id<>0 AND (DATE(CONVERT_TZ(Easycase.due_date,'".$frmTz."','".$toTz."')) <'" . $GMT_DATE . "') AND (DATE(CONVERT_TZ(Easycase.due_date,'".$frmTz."','".$toTz."')) !='0000-00-00') AND (Easycase.legend !=3)");
}else{
$over_due_task_count = $this->Easycase->query("SELECT COUNT(*) as cnt from easycases as Easycase WHERE istype='1' AND " . $clt_sql . " " . $cond_easycase_actuve . " AND Easycase.project_id=".$curProjId." AND Easycase.project_id<>0 AND (DATE(CONVERT_TZ(Easycase.due_date,'".$frmTz."','".$toTz."')) <'" . $GMT_DATE . "') AND (DATE(CONVERT_TZ(Easycase.due_date,'".$frmTz."','".$toTz."')) !='0000-00-00') AND (Easycase.legend !=3) AND (Easycase.user_id = ".SES_ID." OR Easycase.assign_to = ".SES_ID.")");
}
$over_due_task_count = $over_due_task_count[0][0]['cnt'];
$resCaseProj['over_due_task_count'] = $over_due_task_count;
$resCaseProj['page_limit'] = $page_limit;
$resCaseProj['csPage'] = $casePage;
$resCaseProj['caseUrl'] = $caseUrl;
Expand Down
17 changes: 17 additions & 0 deletions app/Controller/RequestsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -1588,7 +1588,17 @@ public function case_project($inactiveFlag = '', $proUid = '', $inCasePage = '',
$caseAll = $this->Easycase->query("SELECT SQL_CALC_FOUND_ROWS Easycase.*,User.short_name,IF((Easycase.assign_to =" . SES_ID . "),'Me',User.short_name) AS Assigned ,(SELECT parent_task_id from easycases where id=Easycase.parent_task_id AND Easycase.project_id='$curProjId' AND Easycase.project_id!=0 ) AS is_sub_sub_task,(SELECT count(parent_task_id) from easycases as E1 where E1.parent_task_id IN (SELECT id from easycases as E2 where E2.parent_task_id = Easycase.id AND Easycase.project_id='$curProjId' AND Easycase.project_id!=0) AND E1.project_id!=0 AND E1.project_id='$curProjId') AS sub_sub_task FROM ( SELECT Easycase.*,EasycaseMilestone.id AS Emid, EasycaseMilestone.milestone_id AS Em_milestone_id,EasycaseMilestone.user_id AS Em_user_id,EasycaseMilestone.id_seq,EasycaseMilestone.m_order,Milestone.id as Mid,Milestone.title AS Mtitle ,Milestone.end_date,Milestone.isactive AS Misactive,Milestone.project_id AS Mproject_id,Milestone.uniq_id AS Muinq_id FROM easycases as Easycase,easycase_milestones AS EasycaseMilestone,milestones AS Milestone WHERE EasycaseMilestone.easycase_id=Easycase.id AND Milestone.id=EasycaseMilestone.milestone_id AND Easycase.istype='1' AND " . $clt_sql . " " . $cond_easycase_actuve . " AND " . $qrycheck . " AND Easycase.project_id!=0 AND Easycase.project_id IN (SELECT ProjectUser.project_id FROM project_users AS ProjectUser,projects as Project WHERE ProjectUser.user_id=" . SES_ID . " AND ProjectUser.project_id=Project.id AND Project.isactive='1' AND ProjectUser.company_id='" . SES_COMP . "') " . $searchcase . " " . trim($qry) . " AND EasycaseMilestone.easycase_id=Easycase.id AND EasycaseMilestone.project_id IN (SELECT ProjectUser.project_id FROM project_users AS ProjectUser,projects as Project WHERE ProjectUser.user_id=" . SES_ID . " AND ProjectUser.project_id=Project.id AND Project.isactive='1')" . $msQuery . " ) AS Easycase LEFT JOIN users User ON Easycase.assign_to=User.id ORDER BY Easycase.end_date ASC,Easycase.Mtitle ASC," . $orderby . " LIMIT $limit1,$limit2");
}
} else {
$frmTz = '+00:00';
$toTz = $this->Tmzone->getGmtTz(TZ_GMT, TZ_DST);
$GMT_DATE =$this->Tmzone->GetDateTime(SES_TIMEZONE, TZ_GMT, TZ_DST, TZ_CODE, GMT_DATETIME, "date");
if ($projUniq == 'all') {
if ($this->Format->isAllowed('View All Task', $roleAccess)) {
$over_due_task_count = $this->Easycase->query("SELECT COUNT(*) as cnt from easycases as Easycase WHERE istype='1' AND " . $clt_sql . " " . $cond_easycase_actuve . " AND Easycase.project_id<>0 AND (DATE(CONVERT_TZ(Easycase.due_date,'".$frmTz."','".$toTz."')) <'" . $GMT_DATE . "') AND (DATE(CONVERT_TZ(Easycase.due_date,'".$frmTz."','".$toTz."')) !='0000-00-00') AND (Easycase.legend !=3)");
}else{
$over_due_task_count = $this->Easycase->query("SELECT COUNT(*) as cnt from easycases as Easycase WHERE istype='1' AND " . $clt_sql . " " . $cond_easycase_actuve . " AND Easycase.project_id<>0 AND (DATE(CONVERT_TZ(Easycase.due_date,'".$frmTz."','".$toTz."')) <'" . $GMT_DATE . "') AND (DATE(CONVERT_TZ(Easycase.due_date,'".$frmTz."','".$toTz."')) !='0000-00-00') AND (Easycase.legend !=3) AND (Easycase.user_id = ".SES_ID." OR Easycase.assign_to = ".SES_ID.")");
}

$over_due_task_count = $over_due_task_count[0][0]['cnt'];
if ($caseMenuFilters == "latest") {
// Target_4

Expand Down Expand Up @@ -1649,6 +1659,12 @@ public function case_project($inactiveFlag = '', $proUid = '', $inCasePage = '',
}
}
} else {
if($this->Format->isAllowed('View All Task', $roleAccess)) {
$over_due_task_count = $this->Easycase->query("SELECT COUNT(*) as cnt from easycases as Easycase WHERE istype='1' AND " . $clt_sql . " " . $cond_easycase_actuve . " AND Easycase.project_id=".$curProjId." AND Easycase.project_id<>0 AND (DATE(CONVERT_TZ(Easycase.due_date,'".$frmTz."','".$toTz."')) <'" . $GMT_DATE . "') AND (DATE(CONVERT_TZ(Easycase.due_date,'".$frmTz."','".$toTz."')) !='0000-00-00') AND (Easycase.legend !=3)");
}else{
$over_due_task_count = $this->Easycase->query("SELECT COUNT(*) as cnt from easycases as Easycase WHERE istype='1' AND " . $clt_sql . " " . $cond_easycase_actuve . " AND Easycase.project_id=".$curProjId." AND Easycase.project_id<>0 AND (DATE(CONVERT_TZ(Easycase.due_date,'".$frmTz."','".$toTz."')) <'" . $GMT_DATE . "') AND (DATE(CONVERT_TZ(Easycase.due_date,'".$frmTz."','".$toTz."')) !='0000-00-00') AND (Easycase.legend !=3) AND (Easycase.user_id = ".SES_ID." OR Easycase.assign_to = ".SES_ID.")");
}
$over_due_task_count = $over_due_task_count[0][0]['cnt'];
/*
//Existing Query

Expand Down Expand Up @@ -2162,6 +2178,7 @@ public function case_project($inactiveFlag = '', $proUid = '', $inCasePage = '',
*/
/* --End-- */
$resCaseProj['field_name_arr'] = $field_name_arr;
$resCaseProj['over_due_task_count'] = $over_due_task_count;
$resCaseProj['ajax_group_by'] = $ajax_group_by;
if (!empty($inactiveFlag)) {
return $resCaseProj;
Expand Down
3 changes: 2 additions & 1 deletion app/View/Elements/case_project.ctp
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,8 @@ var task_parent_ids = JSON.stringify(task_parent_ids);
</li>
</ul>
</div>
</span>
</span>
<span><div onclick="showOverDueTask();" style="font-size:18px;color:#2d6dc4;"><?php echo __("Overdue Tasks : ") ?><%= over_due_task_count %></div></span>
<?php if($this->Format->displayHelpVideo()){ ?>
<span style="line-height: 30px;">
<a href="javascript:void(0);" class="help-video-pop" video-url = "https://www.youtube.com/embed/G1oCxuSd640" onclick="showVideoHelp(this);" ><i class="material-icons">play_circle_outline</i><?php echo PLAY_VIDEO_TEXT;?></a>
Expand Down
3 changes: 2 additions & 1 deletion app/View/Elements/case_project_v2.ctp
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,8 @@ var task_parent_ids = JSON.stringify(task_parent_ids);
</li>
</ul>
</div>
</span>
</span>
<span><div onclick="showOverDueTask();" style="font-size:18px;color:#2d6dc4;"><?php echo __("Overdue Tasks : ") ?><%= over_due_task_count %></div></span>
<?php if($this->Format->displayHelpVideo()){ ?>
<span style="line-height:30px;">
<a href="javascript:void(0);" class="help-video-pop" video-url = "https://www.youtube.com/embed/G1oCxuSd640" onclick="showVideoHelp(this);" ><i class="material-icons">play_circle_outline</i><?php echo PLAY_VIDEO_TEXT;?></a>
Expand Down
3 changes: 2 additions & 1 deletion app/View/Elements/kanban_task.ctp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ var rel_arr = new Array();
<?php } ?>

</div>
<div class="view_list_refresh" id="task_view_types" style="padding-right: 20px;margin-top: -20px;">
<span style="display: flex;flex-direction: row-reverse;padding: 20px 70px 0px 0px;"><div style="font-size:18px;color:#2d6dc4;"onclick="showOverDueTask();"><?php echo __("Overdue Tasks : ") ?><%= over_due_task_count %></div></span>
<div class="view_list_refresh" id="task_view_types" style="padding-right: 30px;margin-top: -29px;">
<span class="reload_icon">
<a class="" href="javascript:void(0);" onclick="reloadTasks();">
<span title="<?php echo __('Reload');?>" rel="tooltip"><i class="material-icons">&#xE5D5;</i></span>
Expand Down
4 changes: 4 additions & 0 deletions app/webroot/js/dashboard_v1.js
Original file line number Diff line number Diff line change
Expand Up @@ -14397,4 +14397,8 @@ function date_time_format1(date) {
var today = new Date(date);
var dateString = today.format("yyyy-mm-dd");
return dateString;
}
function showOverDueTask(){
checkboxdueDate('overdue','check');
filterRequest('duedate');
}

0 comments on commit b0812ba

Please sign in to comment.