示例#1
0
    $kickoff_date = is_null($improvement->kickoff_date) ? '' : date('d.m.Y', strtotime($improvement->kickoff_date));
    $check_date = is_null($improvement->check_date) ? '' : date('d.m.Y', strtotime($improvement->check_date));
    $pic = $improvement->pic;
    $status = '';
    if ($improvement->status == '4' && $improvement->team != '1') {
        if (is_null($improvement->check_date) || strtotime($improvement->check_date) < strtotime('tomorrow')) {
            $message = 'Please set a valid <strong>Check Date</strong> and Save Changes. ';
            $messagebox->add($message);
        }
    }
}
$teams = load_config('teams');
$categories = '<div id="teamcat-0" class="notice teamcats" style="display:none;">' . 'MIMS Team is not yet selected</div>';
foreach ($teams as $dk => $dv) {
    $def = $team == $dk ? $category : 1;
    $cat_options = improvement::getTeamCategories($dk);
    //remove old IT categories
    $catkey_to_remove = array(2, 3, 4, 5, 9, 13, 14);
    foreach ($catkey_to_remove as $ck) {
        if ($ck != $category) {
            unset($cat_options[$ck]);
        }
    }
    $categories .= '<select class="w300 teamcats" id="teamcat-' . $dk . '" style="display:none;"' . ($category_disabled ? ' disabled="disabled"' : '') . '>' . loadComboListFromArray($cat_options, null, $def, false) . '</select>';
}
$etas = improvement::getETA();
$users_filter = "status=1";
if ($improvement->owner_id > 0) {
    $users_filter .= " OR id={$improvement->owner_id}";
}
if ($improvement->pic > 0) {
示例#2
0
$q = tep_db_query("SELECT improvements_id FROM improvements WHERE status=4 AND check_date<='{$today}'");
while ($row = tep_db_fetch_array($q)) {
    $i = new improvement($row['improvements_id']);
    $i->updateStatus('4', '5', $username);
}
$logger->write("- Auto move to Checkings Tab");
//$q = tep_db_query("SELECT improvements_id, DATEDIFF(deadline, '$today') AS deadline_diff FROM improvements WHERE status<4 HAVING deadline_diff<=1");
$q = tep_db_query("SELECT improvements_id, DATEDIFF(deadline, '{$today}') AS deadline_diff FROM improvements WHERE status<4 OR status=7 HAVING deadline_diff<=1");
while ($row = tep_db_fetch_array($q)) {
    $i = new improvement($row['improvements_id']);
    $targets = array();
    $targets[] = $i->owner_id;
    if ($i->pic > 0) {
        $targets[] = $i->pic;
    }
    $message = $obj_notifications->messageTemplateDeadlineReminder($username, 'Improvement', $i->id, $row['deadline_diff'], improvement::getTeamCategories($i->team, $i->category), $i->name);
    $obj_notifications->broadcast($targets, $message, $username, 'open=improvement&id=' . $i->id, false, $targets);
}
$logger->write("- Deadline Notifications Sent");
$logger->write("Task 3 - End");
$logger->write("Task 4a (CLEAR OLD NOTIFICATIONS) - Start");
////////////////////////////////////////////////
// CLEAR OLD NOTIFICATIONS OLDER THAN 1 MONTH //
////////////////////////////////////////////////
$max_days = 30;
$date_max = date('Y-m-d 00:00:00', strtotime("-{$max_days} days"));
$q = tep_db_query("DELETE FROM minierp_users_has_notifications WHERE posted_date<='{$date_max}' AND status=0 AND need_feedback=0");
$logger->write("Task 4b (RESET NEW STATUS FOR UNCONFIRMED FEEDBACK) - Start");
/////////////////////////////////////////
// SET BACK UNANSWERED FEEDBACK AS NEW //
/////////////////////////////////////////
 $tabcontent .= '<select><option value="0" class="notice">Select an Owner...</option>' . loadComboListFromArray($owners, null, $filter_owner, false) . '</select>';
 $tabcontent .= '</div>';
 $tabcontent .= '<div class="filter_dept" style="float:left;' . ($filter_type == '0' ? '' : 'display:none;') . '">';
 //$tabcontent .= '<strong style="margin-right:5px;">Team</strong>';
 $tabcontent .= '<select><option value="0" class="notice">Select a Team...</option>' . loadComboListFromArray($teams, null, $filter_team) . '</select>';
 $tabcontent .= '</div>';
 $tabcontent .= '<div class="filter_pic" style="float:left;' . ($filter_type == '0' ? '' : 'display:none;') . '">';
 $tabcontent .= '<strong> &nbsp; PIC &nbsp; </strong>';
 $tabcontent .= '<select>';
 $tabcontent .= loadComboListFromArray($pics, null, $filter_pic);
 $tabcontent .= '</select>';
 $tabcontent .= '</div>';
 $tabcontent .= '<div class="filter_deptcat" style="float:left;' . ($filter_type == '0' ? '' : 'display:none;') . '">';
 $tabcontent .= '<strong> &nbsp; Category &nbsp; </strong>';
 $tabcontent .= '<select><option value="0">Show All</option>';
 $tabcontent .= loadComboListFromArray(improvement::getTeamCategories($filter_team), null, $filter_teamcat);
 $tabcontent .= '</select>';
 $tabcontent .= '</div>';
 if ($filter_type == '1' || $filter_teamcat != '0') {
     $tabcontent .= '<div style="margin:2px 0 0 5px;float:left;"> &sdot; <span class="smallText red">Sorting is disabled when "Filter by" <strong>Owner</strong> or <strong>Category</strong> is used</div>';
 } else {
     if (in_array($status, $status_sort_by_ownner)) {
         $tabcontent .= '<div style="margin:2px 0 0 5px;float:left;"> &sdot; <span class="smallText red">Sorting is grouped by <strong>Owner</strong></div>';
     }
 }
 $tabcontent .= '<div style="clear:left;height:5px;">&nbsp;</div>';
 //LOAD IMPROVEMENTS LIST
 $q = "SELECT i.improvements_id AS datas_id";
 $q .= " FROM improvements i";
 $q .= " LEFT JOIN improvements_status_history ish ON ish.improvements_id=i.improvements_id AND ish.status=i.status";
 $q .= " WHERE i.status={$status} {$filter} GROUP BY i.improvements_id HAVING MAX(ish.status_time)";