case "Delete": $f->freeze(); case "Add": $db->query("select id from userinfo where UserName='******'"); $db->next_record(); $ContID = $db->f(0); case "Edit": echo "<font class=bigTextBold>{$cmd} Support Parts</font>\n"; $f->display(); break; default: $cmd = "Query"; $t = new SupportPartsTable(); $t->heading = 'on'; $t->add_extra = 'on'; $db = new DB_hotspot(); echo " <a href=\"" . $sess->self_url() . $sess->add_query(array("cmd" => "Add")) . "\">Add Support Parts</a> \n"; echo " <a href=\"" . $sess->url("/SupportTickets.php") . "\">Tickets</a> \n"; echo "<font class=bigTextBold>{$cmd} Support Parts</font>\n"; // These fields will be searchable and displayed in results. // Format is "RealFieldName"=>"Field Name Formatted For Display", $t->fields = array("ItemID", "ProductCode", "PartNo", "Description", "Quantity", "Price", "TicketNo"); $t->map_cols = array("ItemID" => "Item I D", "ProductCode" => "Product Code", "PartNo" => "Part No", "Description" => "Description", "Quantity" => "Quantity", "Price" => "Price", "TicketNo" => "Ticket No"); // When we hit this page the first time, // there is no . if (!isset($q)) { $q = new SupportParts_Sql_Query(); // We make one $q->conditions = 1; // ... with a single condition (at first) $q->translate = "on";
$db->f("Description"), $Charge, $sess->url("/SupportParts.php").$sess->add_query(array("cmd"=>"View","id"=>$db->f("id"))), $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 CHARGE </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> \n"; echo "<h1>Find Ticket</h1>"; extract($_REQUEST); if ($SrchState == "Array") { $SrchState = array(); } if (!$assigned) { # $assigned='me'; # if ($auth->auth["uname"]=='cams') $assigned = 'anyone'; }
default: $cmd = "Query"; $t = new SupportTicketsTable(); $t->heading = 'on'; $t->add_extra = 'on'; /* or set to base url of php file to link to, defaults to PHP_SELF */ $t->add_total = 'on'; /* add a grand total row to the bottom of the table on the numberic columns */ $t->add_insert = 'SupportTicketsform'; /* Add a blank row ontop of table allowing insert or search */ $t->add_insert_buttons = 'Search'; /* Control which buttons appear on the add_insert row eg: Add,Search */ /* See below - EditMode can also be turned on/off by user if section below uncommented */ #$t->edit = 'SupportTicketsform'; /* Allow rows to be editable with a save button that appears onchange */ #$t->ipe_table = 'SupportTickets'; /* Make in place editing changes immediate without a save button */ $db = new DB_hotspot(); echo "<a href=\"" . $sess->self_url() . $sess->add_query(array("cmd" => "Add")) . "\">Add Support Tickets</a>\n"; $SupportTickets_fields = array(); if (array_key_exists("SupportTickets_fields", $_REQUEST)) { $SupportTickets_fields = $_REQUEST["SupportTickets_fields"]; } if (empty($SupportTickets_fields)) { $SupportTickets_fields = array_first_chunk($t->default, 7, 11); $sess->register("SupportTickets_fields"); } $t->fields = $SupportTickets_fields; #$t->extra_html = array('fieldname'=>'extrahtml'); #$t->align = array('fieldname'=>'right', 'otherfield'=>'center'); echo "<a href=javascript:show('ColumnSelector')>Column Chooser</a>"; echo "<form id=ColumnSelector method='post' style=display:none>\n"; echo "<a href=javascript:hide('ColumnSelector')>Hide</a>";
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>"; }