00001 <?php 00002 // product_info_add.php - Form to add product information 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 00012 // This Page Is Valid XHTML 1.0 Transitional! 16Dec05 00013 00014 // Product information is the info related to a product that is requested when adding an incident 00015 00016 00017 $permission = 25; // Add Product Info 00018 00019 require ('core.php'); 00020 require (APPLICATION_LIBPATH . 'functions.inc.php'); 00021 // This page requires authentication 00022 require (APPLICATION_LIBPATH . 'auth.inc.php'); 00023 00024 // External variables 00025 $product = clean_int($_REQUEST['product']); 00026 $information = clean_dbstring($_POST['information']); 00027 $moreinformation = clean_dbstring($_POST['moreinformation']); 00028 00029 $title = $strAddProductInformation; 00030 00031 // Show add product information form 00032 if (empty($_REQUEST['submit'])) 00033 { 00034 include (APPLICATION_INCPATH . 'htmlheader.inc.php'); 00035 echo "<h2>{$strAddProductQuestion}</h2>"; 00036 echo "<h5>".sprintf($strMandatoryMarked,"<sup class='red'>*</sup>")."</h5>"; 00037 echo "<form action='{$_SERVER['PHP_SELF']}' method='post' onsubmit='return confirm_action(\"{$strAreYouSureAdd}\")'>"; 00038 echo "<table class='vertical' align='center'>"; 00039 echo "<tr><th>{$strProduct}: <sup class='red'>*</sup></th><td>".product_drop_down("product", $product)."</td></tr>"; 00040 echo "<tr><th>{$strQuestion}: <sup class='red'>*</sup></th><td><input name='information' size='30' /></td></tr>"; 00041 echo "<tr><th>{$strAdditionalInfo}:</th><td><input name='moreinformation' size='30' /></td></tr>"; 00042 echo "</table>"; 00043 echo "<p align='center'><input name='submit' type='submit' value='{$strAdd}' /></p>"; 00044 echo "</form>"; 00045 include (APPLICATION_INCPATH . 'htmlfooter.inc.php'); 00046 } 00047 else 00048 { 00049 00050 // FIXME these errors need tidying INL 9Jun08 00051 00052 // Add product information 00053 $errors = 0; 00054 include (APPLICATION_INCPATH . 'htmlheader.inc.php'); 00055 // check for blank product 00056 if ($product == 0) 00057 { 00058 $errors = 1; 00059 echo user_alert(sprintf($strFieldMustNotBeBlank, "'{$strProduct}'"), E_USER_ERROR); 00060 } 00061 // check for blank information 00062 if ($information == '') 00063 { 00064 $errors = 1; 00065 echo user_alert(sprintf($strFieldMustNotBeBlank, "'{$strQuestion}'"), E_USER_ERROR); 00066 } 00067 00068 // add product information if no errors 00069 if ($errors == 0) 00070 { 00071 $sql = "INSERT INTO `{$dbProductInfo}` (productid, information, moreinformation) "; 00072 $sql .= "VALUES ('$product', '$information', '$moreinformation')"; 00073 $result = mysql_query($sql); 00074 if (mysql_error()) trigger_error(mysql_error(),E_USER_ERROR); 00075 00076 if (!$result) echo "<p class='error'>".sprintf($strAddXfailed, $strProductInformation)."\n"; 00077 else 00078 { 00079 journal(CFG_LOGGING_NORMAL, 'Product Info Added', "Info was added to Product $product", CFG_JOURNAL_PRODUCTS, $product); 00080 html_redirect("products.php?productid={$product}"); 00081 exit; 00082 } 00083 } 00084 include (APPLICATION_INCPATH . 'htmlfooter.inc.php'); 00085 } 00086 ?>
For more help developing with SiT! see http://sitracker.org/wiki/DevelopmentHowTo