00001 <?php 00002 // contract.inc.php - functions relating to contracts 00003 // 00004 // SiT (Support Incident Tracker) - Support call tracking system 00005 // Copyright (C) 2010-2011 The Support Incident Tracker Project 00006 // Copyright (C) 2000-2009 Salford Software Ltd. and Contributors 00007 // 00008 // This software may be used and distributed according to the terms 00009 // of the GNU General Public License, incorporated herein by reference. 00010 00011 // Prevent script from being run directly (ie. it must always be included 00012 if (realpath(__FILE__) == realpath($_SERVER['SCRIPT_FILENAME'])) 00013 { 00014 exit; 00015 } 00016 00017 require_once (APPLICATION_LIBPATH . 'base.inc.php'); 00018 00028 function guess_contract_id($contactid) 00029 { 00030 global $dbSupportContacts; 00031 00032 $contactid = intval($contactid); 00033 $sql = "SELECT * FROM `{$dbSupportContacts}` "; 00034 $sql .= "WHERE contactid = '{$contactid}'"; 00035 $result = mysql_query($sql); 00036 if (mysql_error()) trigger_error(mysql_error(),E_USER_ERROR); 00037 00038 $num_contracts = mysql_num_rows($result); 00039 00040 if ($num_contracts == 0) 00041 { 00042 $contractid = FALSE; 00043 } 00044 elseif ($num_contracts == 1) 00045 { 00046 $row = mysql_fetch_object($result); 00047 $contractid = $row->id; 00048 } 00049 else 00050 { 00051 //to complete as a programming exercise 00052 } 00053 00054 return $contractid; 00055 } 00056 00064 function contract_slatag($maintid) 00065 { 00066 $maintid = intval($maintid); 00067 $slaid = db_read_column('servicelevelid', $GLOBALS['dbMaintenance'], $maintid); 00068 00069 $sql = "SELECT tag FROM `{$GLOBALS['dbServiceLevels']}` WHERE id = {$slaid} LIMIT 1"; 00070 $result = mysql_query($sql); 00071 $obj = mysql_fetch_object($result); 00072 00073 return $obj->tag; 00074 } 00075 00076 ?>
For more help developing with SiT! see http://sitracker.org/wiki/DevelopmentHowTo