Example #1
0
     $q->start_row = $startingwith;
     $q->row_count = $rowcount;
 }
 // When we hit that page a second time, the array named
 // by $base will be set and we must generate the $query.
 // Ah, and don\'t set $base to "q" when $q is your Sql_Query
 // object... :-)
 if (isset($x)) {
     $query = $q->where("x", 1);
 }
 if (!$query) {
     $query = "id!='0'";
 }
 $db->query("SELECT COUNT(*) as total from SupportParts where " . $query);
 $db->next_record();
 if ($db->f("total") < $q->start_row - $q->row_count) {
     $q->start_row = $db->f("total") - $q->row_count;
 }
 if ($q->start_row < 0) {
     $q->start_row = 0;
 }
 if (!$sortorder) {
     $sortorder = "id";
 }
 $query .= " LIMIT " . $q->start_row . "," . $q->row_count;
 // In any case we must display that form now. Note that the
 // "x" here and in the call to $q->where must match.
 // Tag everything as a CSS "query" class.
 printf($q->form("x", $t->map_cols, "query"));
 printf("<hr>");
 // if (!$query) { $query="id!='0'"; }
     			$sess->url("/SupportParts.php").$sess->add_query(array("cmd"=>"Edit","id"=>$db->f("id"))),
     			$sess->url("/SupportParts.php").$sess->add_query(array("cmd"=>"Delete","id"=>$db->f("id")))
     									);
     	}
     	printf("<tr><td colspan=2></td><td align=right>TOTAL&nbsp;CHARGE&nbsp;</td><td align=right>$%0.2f</td><td></td></tr>\n",$TotalCharge);
         } */
     break;
 default:
     $cmd = "Query";
     $t = new MySupportTicketsTable();
     $t->heading = 'on';
     $t->add_extra = 'on';
     $db = new DB_hotspot();
     $db->query("select Mail from userinfo where UserName='******'");
     if ($db->next_record()) {
         $MyEmail = $db->f(0);
     }
     echo "<br><a href=\"" . $sess->url("/SupportTickets.php") . $sess->add_query(array("cmd" => "Add")) . "\">Create New Support Ticket</a>&nbsp\n";
     echo "<h1>Find Ticket</h1>";
     extract($_REQUEST);
     if ($SrchState == "Array") {
         $SrchState = array();
     }
     if (!$assigned) {
         #	$assigned='me';
         #	if ($auth->auth["uname"]=='cams')
         $assigned = 'anyone';
     }
     if ($assigned == 'me') {
         $AssignedTo = $auth->auth["uname"];
     }
Example #3
0
 if (array_key_exists("x", $_POST)) {
     get_request_values("x");
     $query = $q_SupportTickets->where("x", 1);
     $hideQuery = "";
 } else {
     $hideQuery = "style='display:none'";
 }
 if (!$sortorder) {
     $sortorder = "id";
 }
 if (empty($query)) {
     $query = "1 order by  " . $db->qi("id") . " desc";
 }
 $db->query("SELECT COUNT(*) as total from " . $db->qi("SupportTickets") . " where " . $query);
 $db->next_record();
 if ($db->f("total") < $q_SupportTickets->start_row - $q_SupportTickets->row_count) {
     $q_SupportTickets->start_row = $db->f("total") - $q_SupportTickets->row_count;
 }
 if ($q_SupportTickets->start_row < 0) {
     $q_SupportTickets->start_row = 0;
 }
 $query .= " LIMIT " . $q_SupportTickets->start_row . "," . $q_SupportTickets->row_count;
 // In any case we must display that form now. Note that the
 // "x" here and in the call to $q->where must match.
 // Tag everything as a CSS "query" class.
 echo "<a href=javascript:show('customQuery')>Custom Query</a>";
 echo "\n<div id=customQuery {$hideQuery}><a href=javascript:hide('customQuery')>Hide</a>\n";
 printf($q_SupportTickets->form("x", $t->map_cols, "query"));
 echo "\n</div>\n";
 // Do we have a valid query string?
 if ($query) {
Example #4
0
function SupportEmail($TicketNo, $OldStatus = "")
{
    global $UserName, $Name, $Company, $StreetAddress, $Town, $State, $PostCode, $CO, $OtherDetail;
    global $Quantity, $ProductCode, $PartNo, $Description, $Price, $Duration, $Rate, $Details, $Email, $Comment, $ByContact;
    global $HomePhone, $WorkPhone, $Mobile, $Status, $ShortDesc, $EngineerEmail, $Created, $EnteredBy, $SequenceNo;
    global $AssignedTo, $ByUser;
    if ($TicketNo < 1) {
        return false;
    }
    $Level = 0;
    $db = new DB_hotspot();
    $stf = new SupportTicketsform();
    $stf->find_values($TicketNo);
    $mf = new userinfoform();
    $mf->find_values(UserID($UserName));
    $EngineerEmail = get_email($AssignedTo);
    if ($OldStatus) {
        $Status = $OldStatus . "->" . $Status;
    }
    $subj = "Ticket: {$TicketNo}, {$Status}, {$ShortDesc}";
    $Msg = "Job for: <b>{$UserName}, {$Name}</b><br>\n";
    if ($StreetAddress . $Town . $State . $PostCode) {
        $Msg .= "at: <b>";
        if ($StreetAddress) {
            $Msg .= "{$StreetAddress}, ";
        }
        if ($Town) {
            $Msg .= "{$Town}, ";
        }
        if ($State) {
            $Msg .= "{$State}, ";
        }
        if ($PostCode) {
            $Msg .= "{$PostCode}";
        }
        $Msg .= "</b><br>\n";
    }
    if (isset($HomePhone)) {
        $Msg .= "HomePhone: <b>{$HomePhone}</b><br>\n";
    }
    if (isset($WorkPhone)) {
        $Msg .= "WorkPhone: <b>{$WorkPhone}</b><br>\n";
    }
    if (isset($Mobile)) {
        $Msg .= "Mob: <b>{$Mobile}</b><br>\n";
    }
    if (isset($Mail)) {
        $Msg .= "Email: <b>{$Mail}</b><br>\n";
    }
    $Msg .= "------------------------------------------------------------<br>\n";
    $Msg .= "Entered By: <b>{$EnteredBy}</b><br>\n";
    $Msg .= "Date: <b>{$Created}</b><br>\n";
    if (isset($Location)) {
        $Msg .= "Location: <b>{$Location}</b><br>\n";
    }
    if (isset($RoomNo)) {
        $Msg .= "Room No: <b>{$RoomNo}</b><br>\n";
    }
    if (isset($Severity)) {
        $Msg .= "Severity: <b>{$Severity}</b><br>\n";
    }
    if ($Level > 0) {
        $Msg .= "Level: <b>{$Level}</b><br>\n";
    }
    $Msg .= "Description: <b>{$ShortDesc}</b> {$OtherDetail}<br>\n";
    $Msg .= "------------------------------------------------------------<br>\n";
    /*
    	$db->query("select id from SupportParts where TicketNo='".$TicketNo."'");
    	$sp = new SupportPartsform;
    	while ($db->next_record()) {
    		$sp->find_values($db->f(0));
    		$Msg .= "Part: <b>$Quantity x $ProductCode, $PartNo, $Description @ $Price</b><br>\n";
    	}
    	$db->query("select id from SupportDetails where TicketNo='".$TicketNo."'");
    	$sd = new SupportDetailsform;
    	while ($db->next_record()) {
    		$sd->find_values($db->f(0));
    		$Msg .= "Work: <b>$Duration minutes @ $Rate /hour, $Details</b><br>\n";
    	}
    */
    $db->query("select distinct FileName from SupportFiles where TicketNo='" . $TicketNo . "'");
    while ($db->next_record()) {
        $Msg .= "Attachment: http://os.{$CO}.com.au/files/{$TicketNo}/" . $db->f(0) . "<br>\n";
    }
    $db->query("select id from SupportComments where TicketNo='" . $TicketNo . "'");
    $sc = new SupportCommentsform();
    while ($db->next_record()) {
        $sc->find_values($db->f(0));
        $mf->find_values($ByContact);
        $Msg .= "Comment by <b>{$ByUser}:</b> ";
        $Msg .= str_replace('" src="/candy/', '" src="http://os.' . $CO . '.com.au/candy/', $Comment);
        $Msg .= "<br>\n";
    }
    $url = "https://os.{$CO}.com.au/SupportTickets.php?cmd=View&id=" . $TicketNo;
    $Msg .= "<a href='{$url}'>{$url}</a><br>\n";
    $hdrs = "From: ticket+{$TicketNo}@{$CO}.net.au";
    if ($EngineerEmail) {
        $hdrs .= "\r\nTo: {$EngineerEmail}";
    }
    htmlMail("info@{$CO}.com.au", $subj, $Msg, $hdrs);
    //, $text="", $name="", $type="Application/Octet-Stream", $data="", $name2="", $display2="")
    echo "<pre>";
    echo $hdrs;
    echo $subj;
    echo "\n";
    echo $Msg;
    echo "</pre>";
}