Esempio n. 1
0
function contact_info($contactid, $email, $name)
{
    global $strUnknown;
    //$info .= "<span style='float:right;'>".gravatar($email, 16) . '</span>';
    if (!empty($contactid)) {
        $info .= "<a href='contact.php?id={$contactid}'>";
        $info .= icon('contact', 16);
        $info .= "</a>";
    } else {
        $info .= icon('email', 16);
    }
    $info .= ' ';
    if (!empty($email)) {
        $info .= "<a href=\"mailto:{$email}\" class='info'>";
    }
    if (!empty($name)) {
        $info .= "{$name}";
    } elseif (!empty($email)) {
        $info .= "{$email}";
    } else {
        $info .= "{$strUnknown}";
    }
    if (!empty($email)) {
        $info .= "<span>" . gravatar($email, 50, FALSE);
        $info .= "{$email}";
        $info .= "</span>";
        $info .= "</a>";
    }
    if (!empty($contactid)) {
        $info .= " (" . contact_site($contactid) . ")";
    }
    return $info;
}
Esempio n. 2
0
 echo " method='post' name='supportdetails' onsubmit=\"return validateForm(this)\">";
 echo "<input type='hidden' name='type' value=\"{$type}\" />";
 echo "<input type='hidden' name='contactid' value=\"{$contactid}\" />";
 echo "<input type='hidden' name='productid' value=\"{$productid}\" />";
 echo "<input type='hidden' name='maintid' value=\"{$maintid}\" />";
 echo "<input type='hidden' name='siteid' value=\"{$siteid}\" />";
 if (!empty($updateid)) {
     echo "<input type='hidden' name='updateid' value='{$updateid}' />";
 }
 echo "<table class='vertical' width='90%'>";
 echo "<tr><td>";
 $contactemail = contact_email($contactid);
 echo "<a href=\"mailto:{$contactemail}\">" . icon('contact', 16, '', $contactemail) . "</a>";
 echo " <strong>" . contact_realname($contactid) . "</strong> <span style='font-size:80%;'>(<a href='contact_edit.php?action=edit&amp;";
 echo "contact={$contactid}'>{$strEdit}</a>)</span>, ";
 echo contact_site($contactid) . " ";
 echo "{$strTel}: " . contact_phone($contactid);
 echo "</td>";
 echo "<td>";
 echo icon('contract', 16) . " <strong>{$strContract} {$maintid}</strong>: ";
 echo strip_tags($producttext);
 echo "</td></tr>";
 if (empty($updateid)) {
     echo "<tr><td><label for='incidenttitle'>{$strIncidentTitle}</label><br />";
     echo "<input class='required' maxlength='200' id='incidenttitle' ";
     echo "name='incidenttitle' size='50' type='text' />";
     echo " <span class='required'>{$strRequired}</span></td>\n";
     echo "<td>";
     if ($type == 'free') {
         echo "<label>{$strServiceLevel}" . serviceleveltag_drop_down('servicelevel', $CONFIG['default_service_level'], TRUE) . "</label><br />";
         echo "<label>{$strSkill}: " . skill_drop_down('software', 0) . "</label>";
Esempio n. 3
0
             echo "</table>\n";
         }
         $sql = "SELECT * FROM `{$dbIncidents}` WHERE product={$product->id} ORDER BY id DESC";
         $result = mysql_query($sql);
         if (mysql_error()) {
             trigger_error(mysql_error(), E_USER_WARNING);
         }
         if (mysql_num_rows($result) >= 1) {
             echo "<h3>{$strRelatedIncidents}</h3>";
             echo "<table align='center'>";
             echo "<tr><th>{$strIncident}</th><th>{$strContact}</th><th>{$strSite}</th><th>{$strTitle}</th></tr>";
             $shade = 'shade1';
             while ($incident = mysql_fetch_object($result)) {
                 echo "<tr class='{$shade}'>";
                 echo "<td><a href=\"javascript:incident_details_window('{$incident->id}','incident{$incident->id}');\">" . sprintf($strIncidentNum, $incident->id) . "</a></td>";
                 echo "<td>" . contact_realname($incident->contact) . "</td><td>" . contact_site($incident->contact) . "</td>";
                 echo "<td>{$incident->title}</td>";
                 echo "</tr>\n";
                 if ($shade == 'shade1') {
                     $shade = 'shade2';
                 } else {
                     $shade = 'shade1';
                 }
             }
             echo "</table>\n";
         }
     }
 } else {
     echo "<p class='error'>{$strNoMatchingProduct}</p>";
 }
 echo "<p align='center'><a href='{$_SERVER['PHP_SELF']}#{$productid}'>{$strBackToList}</a></p>";
    } else {
        $sql = "SELECT s.name, p.name FROM `{$dbMaintenance}` m, `{$dbSites}` s, `{$dbProducts}` p WHERE m.site=s.id ";
        $sql .= "AND m.product=p.id AND m.id='{$maintid}'";
        $result = mysql_query($sql);
        if (mysql_error()) {
            trigger_error("MySQL Query Error " . mysql_error(), E_USER_WARNING);
        }
        list($sitename, $product) = mysql_fetch_row($result);
        echo "<tr><th>{$strContract} " . icon('contract', 16) . "</th><td>{$maintid} - {$sitename}, {$product}</td></tr>";
        echo "<input name=\"maintid\" type=\"hidden\" value=\"{$maintid}\" />";
    }
    if (empty($contactid)) {
        echo "<tr><th>{$strContact} " . icon('contact', 16) . "</th>";
        echo "<td>" . contact_drop_down("contactid", 0, TRUE) . "</td></tr>";
    } else {
        echo "<tr><th>{$strContact} " . icon('contact', 16) . "</th><td>{$contactid} - " . contact_realname($contactid) . ", " . site_name(contact_site($contactid));
        echo "<input name=\"contactid\" type=\"hidden\" value=\"{$contactid}\" />";
        echo "</td></tr>";
    }
    echo "</table>";
    echo "<p align='center'><input name='submit' type='submit' value='{$strContinue}' /></p>";
    echo "</form>";
    include APPLICATION_INCPATH . 'htmlfooter.inc.php';
} else {
    if ($action == "add") {
        // Add support contact
        $errors = 0;
        // check for blank contact
        if ($contactid == 0) {
            $errors = 1;
            $errors_string .= user_alert("You must select a contact", E_USER_ERROR);
        if ($CONFIG['portal_creates_incidents']) {
            echo "?contractid={$contractid}";
        }
        echo "'>{$strAddIncident}</a></li>";
    } else {
        echo "<li><a href='entitlement.php'>{$strEntitlement}</a></li>";
    }
    $sql = "SELECT COUNT(docid) FROM `{$dbKBArticles}`";
    $result = mysql_query($sql);
    if (mysql_error()) {
        trigger_error(mysql_error(), E_USER_WARNING);
    }
    list($countkb) = mysql_fetch_row($result);
    if ($CONFIG['kb_enabled'] != FALSE and $CONFIG['portal_kb_enabled'] !== 'Disabled' and $countkb > 0) {
        echo "<li><a href='kb.php'>{$strKnowledgeBase}</a></li>";
    }
    if ($_SESSION['usertype'] == 'admin') {
        echo "<li><a href='admin.php'>{$strAdmin}</a></li>";
    }
    echo "<li><a href='../logout.php'>{$strLogout}</a></li>";
    echo "</ul>";
    echo "<div id='portaluser'><a href='contactdetails.php'>";
    echo contact_realname($_SESSION['contactid']);
    echo ", " . contact_site($_SESSION['contactid']);
    echo "</a>";
    echo "</div>";
    echo "</div>";
    echo "<div id='mainframe'>";
}
$headerdisplayed = TRUE;
// Set a variable so we can check to see if the header was included
Esempio n. 6
0
/**
 * Return the html of contract detatils
 * @author Kieran Hogg
 * @param int $maintid - ID of the contract
 * @param string $mode. 'internal' or 'external'
 * @return array of supported contracts, NULL if none
 * @todo FIXME not quite generic enough for a function ?
 */
function contract_details($id, $mode = 'internal')
{
    global $CONFIG, $iconset, $dbMaintenance, $dbSites, $dbResellers, $dbLicenceTypes, $now;
    $sql = "SELECT m.*, m.notes AS maintnotes, s.name AS sitename, ";
    $sql .= "r.name AS resellername, lt.name AS licensetypename ";
    $sql .= "FROM `{$dbMaintenance}` AS m, `{$dbSites}` AS s, ";
    $sql .= "`{$dbResellers}` AS r, `{$dbLicenceTypes}` AS lt ";
    $sql .= "WHERE s.id = m.site ";
    $sql .= "AND m.id='{$id}' ";
    $sql .= "AND m.reseller = r.id ";
    $sql .= "AND (m.licence_type IS NULL OR m.licence_type = lt.id) ";
    if ($mode == 'external') {
        $sql .= "AND m.site = '{$_SESSION['siteid']}'";
    }
    $maintresult = mysql_query($sql);
    if (mysql_error()) {
        trigger_error("MySQL Query Error " . mysql_error(), E_USER_WARNING);
    }
    $maint = mysql_fetch_object($maintresult);
    $html = "<table align='center' class='vertical'>";
    $html .= "<tr><th>{$GLOBALS['strContract']} {$GLOBALS['strID']}:</th>";
    $html .= "<td><h3>" . icon('contract', 32) . " ";
    $html .= "{$maint->id}</h3></td></tr>";
    $html .= "<tr><th>{$GLOBALS['strStatus']}:</th><td>";
    if ($maint->term == 'yes') {
        $html .= "<strong>{$GLOBALS['strTerminated']}</strong>";
    } else {
        $html .= $GLOBALS['strActive'];
    }
    if ($maint->expirydate < $now and $maint->expirydate != '-1') {
        $html .= "<span class='expired'>, {$GLOBALS['strExpired']}</span>";
    }
    $html .= "</td></tr>\n";
    $html .= "<tr><th>{$GLOBALS['strSite']}:</th>";
    if ($mode == 'internal') {
        $html .= "<td><a href=\"site_details.php?id=" . $maint->site . "\">" . $maint->sitename . "</a></td></tr>";
    } else {
        $html .= "<td><a href=\"sitedetails.php\">" . $maint->sitename . "</a></td></tr>";
    }
    $html .= "<tr><th>{$GLOBALS['strAdminContact']}:</th>";
    if ($mode == 'internal') {
        $html .= "<td><a href=\"contact_details.php?id=";
        $html .= "{$maint->admincontact}\">";
        $html .= contact_realname($maint->admincontact) . "</a></td></tr>";
    } else {
        $html .= "<td><a href='contactdetails.php?id={$maint->admincontact}'>";
        $html .= contact_realname($maint->admincontact) . "</a></td></tr>";
    }
    $html .= "<tr><th>{$GLOBALS['strReseller']}:</th><td>";
    if (empty($maint->resellername)) {
        $html .= $GLOBALS['strNoReseller'];
    } else {
        $html .= $maint->resellername;
    }
    $html .= "</td></tr>";
    $html .= "<tr><th>{$GLOBALS['strProduct']}:</th><td>" . product_name($maint->product) . "</td></tr>";
    $html .= "<tr><th>{$GLOBALS['strIncidents']}:</th>";
    $html .= "<td>";
    $incidents_remaining = $maint->incident_quantity - $maint->incidents_used;
    if ($maint->incident_quantity == 0) {
        $quantity = $GLOBALS['strUnlimited'];
    } else {
        $quantity = $maint->incident_quantity;
    }
    $html .= sprintf($GLOBALS['strUsedNofN'], $maint->incidents_used, $quantity);
    if ($maint->incidents_used >= $maint->incident_quantity and $maint->incident_quantity != 0) {
        $html .= " ({$GLOBALS['strZeroRemaining']})";
    }
    $html .= "</td></tr>";
    if ($maint->licence_quantity != '0') {
        $html .= "<tr><th>{$GLOBALS['strLicense']}:</th>";
        $html .= "<td>{$maint->licence_quantity} {$maint->licensetypename}</td></tr>\n";
    }
    $html .= "<tr><th>{$GLOBALS['strServiceLevel']}:</th><td>" . servicelevel_name($maint->servicelevelid) . "</td></tr>";
    $html .= "<tr><th>{$GLOBALS['strExpiryDate']}:</th><td>";
    if ($maint->expirydate == '-1') {
        $html .= "{$GLOBALS['strUnlimited']}";
    } else {
        $html .= ldate($CONFIG['dateformat_date'], $maint->expirydate);
    }
    $html .= "</td></tr>";
    if ($mode == 'internal') {
        $timed = db_read_column('timed', $GLOBALS['dbServiceLevels'], $maint->servicelevelid);
        if ($timed == 'yes') {
            $timed = TRUE;
        } else {
            $timed = FALSE;
        }
        $html .= "<tr><th>{$GLOBALS['strService']}</th><td>";
        $html .= contract_service_table($id, $timed);
        $html .= "</td></tr>\n";
        if ($timed) {
            $html .= "<tr><th>{$GLOBALS['strBalance']}</th><td>{$CONFIG['currency_symbol']}" . number_format(get_contract_balance($id, TRUE, TRUE), 2);
            $multiplier = get_billable_multiplier(strtolower(date('D', $now)), date('G', $now));
            $html .= " (&cong;" . contract_unit_balance($id, TRUE, TRUE) . " units)";
            $html .= "</td></tr>";
        }
    }
    if ($maint->maintnotes != '' and $mode == 'internal') {
        $html .= "<tr><th>{$GLOBALS['strNotes']}:</th><td>{$maint->maintnotes}</td></tr>";
    }
    $html .= "</table>";
    if ($mode == 'internal') {
        $html .= "<p align='center'>";
        $html .= "<a href=\"contract_edit.php?action=edit&amp;maintid={$id}\">{$GLOBALS['strEditContract']}</a> | ";
        $html .= "<a href='contract_add_service.php?contractid={$id}'>{$GLOBALS['strAddService']}</a></p>";
    }
    $html .= "<h3>{$GLOBALS['strContacts']}</h3>";
    if (mysql_num_rows($maintresult) > 0) {
        if ($maint->allcontactssupported == 'yes') {
            $html .= "<p class='info'>{$GLOBALS['strAllSiteContactsSupported']}</p>";
        } else {
            $allowedcontacts = $maint->supportedcontacts;
            $supportedcontacts = supported_contacts($id);
            $numberofcontacts = 0;
            $numberofcontacts = sizeof($supportedcontacts);
            if ($allowedcontacts == 0) {
                $allowedcontacts = $GLOBALS['strUnlimited'];
            }
            $html .= "<table align='center'>";
            $supportcount = 1;
            if ($numberofcontacts > 0) {
                foreach ($supportedcontacts as $contact) {
                    $html .= "<tr><th>{$GLOBALS['strContact']} #{$supportcount}:</th>";
                    $html .= "<td>" . icon('contact', 16) . " ";
                    if ($mode == 'internal') {
                        $html .= "<a href=\"contact_details.php?";
                    } else {
                        $html .= "<a href=\"contactdetails.php?";
                    }
                    $html .= "id={$contact}\">" . contact_realname($contact) . "</a>, ";
                    $html .= contact_site($contact) . "</td>";
                    if ($mode == 'internal') {
                        $html .= "<td><a href=\"contract_delete_contact.php?contactid=" . $contact . "&amp;maintid={$id}&amp;context=maintenance\">{$GLOBALS['strRemove']}</a></td></tr>\n";
                    } else {
                        $html .= "<td><a href=\"{$_SERVER['PHP_SELF']}?id={$id}&amp;contactid=" . $contact . "&amp;action=remove\">{$GLOBALS['strRemove']}</a></td></tr>\n";
                    }
                    $supportcount++;
                }
                $html .= "</table>";
            } else {
                $html .= "<p class='info'>{$GLOBALS['strNoRecords']}<p>";
            }
        }
        if ($maint->allcontactssupported != 'yes') {
            $html .= "<p align='center'>";
            $html .= sprintf($GLOBALS['strUsedNofN'], "<strong>" . $numberofcontacts . "</strong>", "<strong>" . $allowedcontacts . "</strong>");
            $html .= "</p>";
            if ($numberofcontacts < $allowedcontacts or $allowedcontacts == 0 and $mode == 'internal') {
                $html .= "<p align='center'><a href='contract_add_contact.php?maintid={$id}&amp;siteid={$maint->site}&amp;context=maintenance'>";
                $html .= "{$GLOBALS['strAddContact']}</a></p>";
            } else {
                $html .= "<h3>{$GLOBALS['strAddContact']}</h3>";
                $html .= "<form action='{$_SERVER['PHP_SELF']}?id={$id}&amp;action=";
                $html .= "add' method='post' >";
                $html .= "<p align='center'>{$GLOBLAS['strAddNewSupportedContact']} ";
                $html .= contact_site_drop_down('contactid', 'contactid', maintenance_siteid($id), supported_contacts($id));
                $html .= help_link('NewSupportedContact');
                $html .= " <input type='submit' value='{$GLOBALS['strAdd']}' /></p></form>";
            }
            if ($mode == 'external') {
                $html .= "<p align='center'><a href='addcontact.php'>";
                $html .= "{$GLOBALS['strAddNewSiteContact']}</a></p>";
            }
        }
        $html .= "<br />";
        $html .= "<h3>{$GLOBALS['strSkillsSupportedUnderContract']}:</h3>";
        // supported software
        $sql = "SELECT * FROM `{$GLOBALS[dbSoftwareProducts]}` AS sp, `{$GLOBALS[dbSoftware]}` AS s ";
        $sql .= "WHERE sp.softwareid = s.id AND productid='{$maint->product}' ";
        $result = mysql_query($sql);
        if (mysql_error()) {
            trigger_error("MySQL Query Error " . mysql_error(), E_USER_WARNING);
        }
        if (mysql_num_rows($result) > 0) {
            $html .= "<table align='center'>";
            while ($software = mysql_fetch_object($result)) {
                $software->lifetime_end = mysql2date($software->lifetime_end);
                $html .= "<tr><td> " . icon('skill', 16) . " ";
                if ($software->lifetime_end > 0 and $software->lifetime_end < $now) {
                    $html .= "<span class='deleted'>";
                }
                $html .= $software->name;
                if ($software->lifetime_end > 0 and $software->lifetime_end < $now) {
                    $html .= "</span>";
                }
                $html .= "</td></tr>\n";
            }
            $html .= "</table>\n";
        } else {
            $html .= "<p align='center'>{$GLOBALS['strNone']} / {$GLOBALS['strUnknown']}<p>";
        }
    } else {
        $html = "<p align='center'>{$GLOBALS['strNothingToDisplay']}</p>";
    }
    return $html;
}
Esempio n. 7
0
/**
    * @author Tom Gerrard
*/
function generate_row($update)
{
    global $CONFIG, $sit;
    if (empty($update['fromaddr']) and !empty($update['from'])) {
        $update['fromaddr'] = $update['from'];
    }
    $update['fromaddr'] = strtolower($update['fromaddr']);
    if (strlen($update['bodytext']) > 1003) {
        $updatebodytext = substr($update['bodytext'], 0, 1000) . '&hellip;';
    } else {
        $updatebodytext = $update['bodytext'];
    }
    $search = array('<b>', '</b>', '<i>', '</i>', '<u>', '</u>', '&lt;', '&gt;');
    $replace = '';
    $updatebodytext = htmlspecialchars(str_replace($search, $replace, $updatebodytext));
    if ($updatebodytext == '') {
        $updatebodytext = '&nbsp;';
    }
    $shade = 'shade1';
    if ($update['contactid'] != 0) {
        $shade = 'idle';
    } else {
        if (!empty($update['fromaddr'])) {
            // Have a look if we've got a user with this email address
            $sql = "SELECT COUNT(id) FROM `{$GLOBALS['dbUsers']}` WHERE email LIKE '%{$update['fromaddr']}%'";
            $result = mysql_query($sql);
            if (mysql_error()) {
                trigger_error(mysql_error(), E_USER_WARNING);
            }
            list($contactmatches) = mysql_fetch_row($result);
            if ($contactmatches > 0) {
                $shade = 'notice';
            }
        }
    }
    $pluginshade = plugin_do('holdingqueue_rowshade', $update);
    $shade = $pluginshade ? $pluginshade : $shade;
    $html_row = "<tr class='{$shade}'>";
    $html_row .= "<td style='text-align: center'>";
    if ($update['locked'] == $sit[2] or empty($update['locked'])) {
        $html_row .= "<input type='checkbox' name='selected[]' value='" . $update['updateid'] . "' />";
    }
    $html_row .= "</td>";
    $html_row .= "<td align='center' width='20%'>" . date($CONFIG['dateformat_datetime'], $update['timestamp']) . '</td>';
    $html_row .= "<td width='20%'>";
    if (!empty($update['contactid']) and $update['fromaddr'] == contact_email($update['contactid'])) {
        $html_row .= gravatar($update['fromaddr'], 16) . ' ';
        $contact_realname = contact_realname($update['contactid']);
        $html_row .= "<a href='contact_details.php?id={$update['contactid']}' class='info'>";
        $html_row .= "{$contact_realname}<span>" . htmlentities($update['fromaddr'], ENT_QUOTES, $GLOBALS['i18ncharset']) . "</span></a>";
        $html_row .= " of " . contact_site($update['contactid']);
        if ($update['emailfrom'] != $contact_realname) {
            $html_row .= "<br />\n";
            $html_row .= htmlentities($update['emailfrom'], ENT_QUOTES, $GLOBALS['i18ncharset']);
        }
    } else {
        $html_row .= gravatar($update['fromaddr'], 16) . ' ';
        $html_row .= "<a href=\"mailto:{$update['fromaddr']}\">{$update['fromaddr']}</a><br />\n";
        $html_row .= htmlentities($update['emailfrom'], ENT_QUOTES, $GLOBALS['i18ncharset']);
    }
    $html_row .= "</td>";
    $html_row .= "<td width='20%'><a href=\"javascript:incident_details_window('{$update['tempid']}','incomingview');\" id='update{$update['id']}' class='info'>";
    //     $html_row.="<td width='20%'><a href=\"javascript:void(0);\" id='update{$update['id']}' class='info' style='cursor:help;'>";
    if (empty($update['subject'])) {
        $update['subject'] = $GLOBALS['strUntitled'];
    }
    $html_row .= htmlentities($update['subject'], ENT_QUOTES, $GLOBALS['i18ncharset']);
    $html_row .= '<span>' . parse_updatebody($updatebodytext) . '</span></a></td>';
    $span = sprintf($GLOBALS['strByX'], user_realname($update['reason_user'])) . "<br />";
    $span .= sprintf($GLOBALS['strOnxAtY'], ldate($CONFIG['dateformat_date'], mysql2date($update['reason_time'])), ldate($CONFIG['dateformat_time'], mysql2date($update['reason_time'])));
    $html_row .= "<td align='center' width='20%'><a class='info'>{$update['reason']}<span>{$span}</span></a></td>";
    $html_row .= "<td align='center' width='20%'>";
    if ($update['locked'] != $sit[2] && $update['locked'] > 0) {
        $html_row .= sprintf($strLockedByX, user_realname($update['locked'], TRUE));
    } else {
        if ($update['locked'] == $sit[2]) {
            $html_row .= "<a href='{$_SERVER['PHP_SELF']}?unlock={$update['tempid']}'";
            $html_row .= " title='{$strUnlockThisToBeModifiedByOther}'> {$GLOBALS['strUnlock']}</a> | ";
        } else {
            $html_row .= "<a href=\"javascript:incident_details_window('{$update['tempid']}'";
            $html_row .= ",'incomingview');\" id='update{$update['id']}' class='info'";
            $html_row .= " title='View and lock this held e-mail'>{$GLOBALS['strView']}</a> | ";
        }
        if ($update['reason_id'] == 2) {
            $html_row .= "<a href='incident_reopen.php?id={$update['incident_id']}&updateid={$update['updateid']}'>{$GLOBALS['strReopen']}</a> | ";
        }
        $html_row .= "<a href='delete_update.php?updateid=" . $update['id'] . "&amp;tempid=" . $update['tempid'] . "&amp;timestamp=" . $update['timestamp'] . "' title='{$strRemoveThisPermanently}' onclick=\"return confirm_action('{$GLOBALS['strAreYouSureDelete']}');\"> {$GLOBALS['strDelete']}</a>";
    }
    $html_row .= "</td></tr>\n";
    return $html_row;
}
Esempio n. 8
0
 $result = mysql_query($sql);
 if (mysql_error()) {
     trigger_error("MySQL Query Error " . mysql_error(), E_USER_ERROR);
 }
 if (!$result) {
     $addition_errors = 1;
     $addition_errors_string .= "<p class='error'>Update of incident failed</p>\n";
 }
 if ($addition_errors == 0) {
     // dump details to incident update
     if ($oldtitle != $title) {
         $header .= "Title: {$oldtitle} -&gt; <b>{$title}</b>\n";
     }
     if ($oldcontact != $contact) {
         $contactname = contact_realname($contact);
         $contactsite = contact_site($contact);
         $header .= "Contact: " . contact_realname($oldcontact) . " -&gt; <b>{$contactname}</b>\n";
         $maintsiteid = maintenance_siteid(incident_maintid($id));
         if ($maintsiteid > 0 and contact_siteid($contact) != $maintsiteid) {
             $maintcontactsite = site_name($maintsiteid);
             $header .= "Assigned to <b>{$contactname} of {$contactsite}</b> on behalf of {$maintcontactsite} (The contract holder)\n";
         }
     }
     if ($oldexternalid != $externalid) {
         $header .= "External ID: ";
         if ($oldexternalid != '') {
             $header .= $oldexternalid;
         } else {
             $header .= "None";
         }
         $header .= " -&gt; <b>";
 $result = mysql_query($sql);
 if (mysql_error()) {
     trigger_error(mysql_error(), E_USER_WARNING);
 }
 $i = 0;
 while ($obj = mysql_fetch_object($result)) {
     $name = $obj->externalengineer;
     if (empty($name)) {
         $name = $strNoNameAssociated;
     }
     $esc[$name]['name'] = $name;
     $esc[$name]['count']++;
     $esc[$name][$obj->priority]++;
     $str = "<span><strong>" . $obj->forenames . " " . $obj->surname . "</strong><br />" . $obj->siteName . "</span>";
     $esc[$name]['calls'][$i]['text'] = "<a href=\"javascript:incident_details_window_l('" . $obj->id . "', 'incident" . $obj->id . "')\"  title=\"{$obj->title}\" class='info'>[" . $obj->id . "]{$str}</a> #" . $obj->externalid . " " . $obj->title;
     $esc[$name]['calls'][$i]['text'] .= "<br />" . contact_realname($obj->contact) . ', ' . contact_site($obj->contact);
     $esc[$name]['calls'][$i]['software'] = $obj->name;
     $esc[$name]['calls'][$i]['status'] = $obj->status;
     $esc[$name]['calls'][$i]['localowner'] = $obj->owner;
     $esc[$name]['calls'][$i]['salfordtowner'] = $obj->towner;
     $i++;
 }
 if (!empty($esc)) {
     $html .= "<table align='center'>";
     $html .= "<tr><th>{$strExternalEngineersName}</th><th>{$strNumOfCalls}</th>";
     $html .= "<th align='center'>" . priority_icon(4) . "</th>";
     $html .= "<th align='center'>" . priority_icon(3) . "</th>";
     $html .= "<th align='center'>" . priority_icon(2) . "</th>";
     $html .= "<th align='center'>" . priority_icon(1) . "</th>";
     $html .= "<td>";
     $html .= "<table width='100%'><tr><th width='50%'>{$strIncident}</th>";