コード例 #1
0
ファイル: incident_add.php プロジェクト: nicdev007/sitracker
function to_row($contactrow)
{
    global $now, $updateid, $CONFIG, $dbg;
    $str = '';
    if (($contactrow['expirydate'] < $now or $contactrow['term'] == 'yes') and $contactrow['expirydate'] != -1) {
        $class = 'expired';
    } else {
        $class = "shade2";
    }
    $incidents_remaining = $contactrow['incident_quantity'] - $contactrow['incidents_used'];
    $str = "<tr class='{$class}'>";
    if ($contactrow['expirydate'] < $now and $contactrow['expirydate'] != '-1') {
        $str .= "<td>{$GLOBALS['strExpired']}</td>";
    } elseif ($contactrow['term'] == 'yes') {
        $str .= "<td>{$GLOBALS['strTerminated']}</td>";
    } elseif ($contactrow['incident_quantity'] >= 1 and $contactrow['incidents_used'] >= $contactrow['incident_quantity']) {
        $str .= "<td class='expired'>{$GLOBALS['strZeroRemaining']} ({$contactrow['incidents_used']}/{$contactrow['incident_quantity']} {$strUsed})</td>";
    } else {
        $str .= "<td><a href=\"{$_SERVER['PHP_SELF']}?action=incidentform&amp;type=support&amp;";
        $str .= "contactid=" . $contactrow['contactid'] . "&amp;maintid=" . $contactrow['maintid'];
        $str .= "&amp;producttext=" . urlencode($contactrow['productname']) . "&amp;productid=";
        $str .= $contactrow['productid'] . "&amp;updateid={$updateid}&amp;siteid=" . $contactrow['siteid'];
        $str .= "&amp;win={$win}\" onclick=\"return confirm_support();\">{$GLOBALS['strAddIncident']}</a> ";
        if ($contactrow['incident_quantity'] == 0) {
            $str .= "({$GLOBALS['strUnlimited']})";
        } else {
            $str .= "(" . sprintf($GLOBALS['strRemaining'], $incidents_remaining) . ")";
        }
    }
    $str .= "</td>";
    $str .= '<td>' . $contactrow['forenames'] . ' ' . $contactrow['surname'] . '</td>';
    $str .= '<td>' . $contactrow['name'] . '</td>';
    $str .= '<td>' . $contactrow['productname'] . '</td>';
    $str .= '<td>' . servicelevel_id2tag($contactrow['servicelevelid']) . '</td>';
    if ($contactrow['expirydate'] == '-1') {
        $str .= "<td>{$GLOBALS['strUnlimited']}</td>";
    } else {
        $str .= '<td>' . ldate($CONFIG['dateformat_date'], $contactrow['expirydate']) . '</td>';
    }
    $str .= "</tr>\n";
    return $str;
}
コード例 #2
0
 echo "<tr><th>{$strProduct} <sup class='red'>*</sup></th><td>";
 if ($_SESSION['formdata']['add_contract']['product'] != '') {
     echo product_drop_down("product", $_SESSION['formdata']['add_contract']['product']) . "</td></tr>\n";
 } else {
     echo product_drop_down("product", 0) . "</td></tr>\n";
 }
 echo "<tr><th>{$strServiceLevel}</th><td>";
 if ($_SESSION['formdata']['add_contract']['servicelevelid'] != '') {
     $slid = $_SESSION['formdata']['add_contract']['servicelevelid'];
 } else {
     $slid = 0;
     // Default to first service level
 }
 echo servicelevel_drop_down('servicelevelid', $slid, TRUE, "onchange=\"addcontract_sltimed(\$F('servicelevelid'));\"") . "</td></tr>\n";
 // check the initially selected service level to decide whether to show the extra hiddentimed section
 $sltag = servicelevel_id2tag($slid);
 $timed = servicelevel_timed($sltag);
 echo "<tr><th colspan='2' style='text-align: left;'><br />{$strServicePeriod}</th></tr>\n";
 echo "<tr><th>{$strStartDate}</th>";
 echo "<td><input type='text' name='startdate' id='startdate' size='10' value='" . date('Y-m-d', $now) . "' /> ";
 echo date_picker('add_contract.startdate');
 echo "</td></tr>\n";
 echo "<tr><th>{$strExpiryDate}</th>";
 echo "<td><input class='required' name='expiry' size='10' ";
 if ($_SESSION['formdata']['add_contract']['expiry'] != '') {
     echo "value='{$_SESSION['formdata']['add_contract']['expiry']}'";
 }
 echo "/> " . date_picker('add_contract.expiry');
 echo "<input type='checkbox' name='noexpiry' ";
 if ($_SESSION['formdata']['add_contract']['noexpiry'] == "on") {
     echo "checked='checked' ";
コード例 #3
0
ファイル: ajaxdata.php プロジェクト: sitracker/sitracker_old
     $content = cleanvar($_REQUEST['content']);
     if ($userid == $_SESSION['userid']) {
         if ($draftid == -1) {
             $sql = "INSERT INTO `{$dbDrafts}` (userid,incidentid,type,meta,content,lastupdate) VALUES ('{$userid}','{$incidentid}','{$type}','{$meta}','{$content}','{$now}')";
         } else {
             $sql = "UPDATE `{$dbDrafts}` SET content = '{$content}', meta = '{$meta}', lastupdate = '{$now}' WHERE id = {$draftid}";
         }
         $result = mysql_query($sql);
         if (mysql_error()) {
             trigger_error("MySQL Query Error " . mysql_error(), E_USER_ERROR);
         }
         echo mysql_insert_id();
     }
     break;
 case 'servicelevel_timed':
     $sltag = servicelevel_id2tag(cleanvar($_REQUEST['servicelevel']));
     if (servicelevel_timed($sltag)) {
         echo "TRUE";
     } else {
         echo "FALSE";
     }
     break;
 case 'contexthelp':
     $context = cleanvar($_REQUEST['context']);
     $helpfile = APPLICATION_HELPPATH . "{$_SESSION['lang']}" . DIRECTORY_SEPARATOR . "{$context}.txt";
     // Default back to english if language helpfile isn't found
     if (!file_exists($helpfile)) {
         $helpfile = APPLICATION_HELPPATH . "{$_SESSION['lang']}" . DIRECTORY_SEPARATOR . "en-GB/{$context}.txt";
     }
     if (file_exists($helpfile)) {
         $fp = fopen($helpfile, 'r', TRUE);
コード例 #4
0
    $site_notes = '';
}
unset($site);
if (!empty($incident->contactnotes)) {
    $contact_notes = icon('contact', 16) . " <strong>{$strContactNotes}</strong><br />" . nl2br($incident->contactnotes);
} else {
    $contact_notes = '';
}
$product_name = product_name($incident->product);
if ($incident->softwareid > 0) {
    $software_name = software_name($incident->softwareid);
}
$servicelevel_id = maintenance_servicelevel($incident->maintenanceid);
$servicelevel_tag = $incident->servicelevel;
if ($servicelevel_tag == '') {
    $servicelevel_tag = servicelevel_id2tag(maintenance_servicelevel($incident->maintenanceid));
}
$servicelevel_name = servicelevel_name($servicelevelid);
if ($incident->closed == 0) {
    $closed = time();
} else {
    $closed = $incident->closed;
}
$opened_for = format_seconds($closed - $incident->opened);
$priority = $incident->priority;
// Lookup the service level times
$slsql = "SELECT * FROM `{$dbServiceLevels}` WHERE tag='{$servicelevel_tag}' AND priority='{$incident->priority}' ";
$slresult = mysql_query($slsql);
if (mysql_error()) {
    trigger_error("MySQL Query Error " . mysql_error(), E_USER_WARNING);
}
コード例 #5
0
ファイル: add.php プロジェクト: sitracker/sitracker_old
    echo "</textarea></td></tr>";
    echo "</table>";
    echo "<input name='contractid' value='{$contractid}' type='hidden' />";
    echo "<input name='productid' value='{$productid}' type='hidden' />";
    echo "<p align='center'><input type='submit' value='{$strAddIncident}' /></p>";
    echo "</form>";
    include APPLICATION_INCPATH . 'htmlfooter.inc.php';
} else {
    $contactid = $_SESSION['contactid'];
    $contractid = cleanvar($_REQUEST['contractid']);
    $software = cleanvar($_REQUEST['software']);
    $incidenttitle = cleanvar($_REQUEST['title']);
    $probdesc = cleanvar($_REQUEST['probdesc']);
    $workarounds = cleanvar($_REQUEST['workarounds']);
    $reproduction = cleanvar($_REQUEST['reproduction']);
    $servicelevel = servicelevel_id2tag(maintenance_servicelevel($contractid));
    $productid = cleanvar($_REQUEST['productid']);
    $_SESSION['formdata']['portaladdincident'] = $_POST;
    $errors = 0;
    if (empty($incidenttitle)) {
        $_SESSION['formerrors']['portaladdincident'] .= user_alert(sprintf($strFieldMustNotBeBlank, "'{$strIncidentTitle}'"), E_USER_ERROR);
        $errors = 1;
    }
    if (empty($probdesc)) {
        $_SESSION['formerrors']['portaladdincident'] .= user_alert(sprintf($strFieldMustNotBeBlank, "'{$strProblemDescription}'"), E_USER_ERROR);
        $errors = 1;
    }
    foreach ($_POST as $key => $value) {
        if (substr($key, 0, 5) == 'pinfo' and empty($value)) {
            $id = intval(str_replace("pinfo", "", $key));
            $sql = "SELECT information FROM `{$dbProductInfo}` ";
コード例 #6
0
     $updated = "<em class='updatedveryrecently'>" . sprintf($strAgo, format_seconds($now - $incidents['lastupdated'])) . "</em>";
 } elseif ($incidents['lastupdated'] > $now - 3600) {
     $updated = "<em class='updatedrecently'>" . sprintf($strAgo, format_seconds($now - $incidents['lastupdated'])) . "</em>";
 } elseif (date('dmy', $incidents['lastupdated']) == date('dmy', $now)) {
     $updated = "{$strToday} @ " . ldate($CONFIG['dateformat_time'], $incidents['lastupdated']);
 } elseif (date('dmy', $incidents['lastupdated']) == date('dmy', $now - 86400)) {
     $updated = "{$strYesterday} @ " . ldate($CONFIG['dateformat_time'], $incidents['lastupdated']);
 } elseif ($incidents['lastupdated'] < $now - 86400 and $incidents['lastupdated'] > $now - 86400 * 6) {
     $updated = ldate('l', $incidents['lastupdated']) . " @ " . ldate($CONFIG['dateformat_time'], $incidents['lastupdated']);
 } else {
     $updated = ldate($CONFIG['dateformat_datetime'], $incidents["lastupdated"]);
 }
 // Fudge for old ones
 $tag = $incidents['servicelevel'];
 if ($tag == '') {
     $tag = servicelevel_id2tag(maintenance_servicelevel($incidents['maintenanceid']));
 }
 $slsql = "SELECT * FROM `{$dbServiceLevels}` WHERE tag='{$tag}' AND priority='{$incidents['priority']}' ";
 $slresult = mysql_query($slsql);
 if (mysql_error()) {
     trigger_error("mysql query error " . mysql_error(), E_USER_WARNING);
 }
 $servicelevel = mysql_fetch_object($slresult);
 if (mysql_num_rows($slresult) < 1) {
     trigger_error("could not retrieve service level ({$slsql})", E_USER_WARNING);
 }
 // Get Last Update
 list($update_userid, $update_type, $update_currentowner, $update_currentstatus, $update_body, $update_timestamp, $update_nextaction, $update_id) = incident_lastupdate($incidents['id']);
 // Get next target
 $target = incident_get_next_target($incidents['id']);
 $working_day_mins = ($CONFIG['end_working_day'] - $CONFIG['start_working_day']) / 60;