From: 360team.ca <gop...@us...> - 2010-12-06 22:19:03
|
Update of /cvsroot/xrms/xrms/admin/opportunity-types In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv19811/opportunity-types Modified Files: new-2.php Log Message: Added input validation to ensure that when a new workflow type is created, it has at least a *_type_short_name or a*_type_pretty_name. If neither is provided, no record will be inserted in the database. Index: new-2.php =================================================================== RCS file: /cvsroot/xrms/xrms/admin/opportunity-types/new-2.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** new-2.php 2 Jan 2006 21:59:08 -0000 1.2 --- new-2.php 6 Dec 2010 22:18:55 -0000 1.3 *************** *** 20,37 **** $opportunity_type_display_html = $_POST['opportunity_type_display_html']; ! $con = get_xrms_dbconnection(); ! //save to database ! $rec = array(); ! $rec['opportunity_type_short_name'] = $opportunity_type_short_name; ! $rec['opportunity_type_pretty_name'] = $opportunity_type_pretty_name; ! $rec['opportunity_type_pretty_plural'] = $opportunity_type_pretty_plural; ! $rec['opportunity_type_display_html'] = $opportunity_type_display_html; ! $tbl = "opportunity_types"; ! $ins = $con->GetInsertSQL($tbl, $rec, get_magic_quotes_gpc()); ! $con->execute($ins); ! $con->close(); header("Location: some.php"); --- 20,55 ---- $opportunity_type_display_html = $_POST['opportunity_type_display_html']; ! // Only insert the record if we have at least a short or pretty name ! // @TODO: Should send a message to the user here giving them a clue if we are ! // doing nothing ! if ((strlen($opportunity_type_short_name) > 0) OR (strlen($opportunity_type_pretty_name) > 0)) { ! // Set defaults if we didn't get everything we need ! if (strlen($opportunity_type_pretty_name) == 0) { ! $opportunity_type_pretty_name = $opportunity_type_short_name; ! } ! if (strlen($opportunity_type_pretty_plural) == 0) { ! $opportunity_type_pretty_plural = $opportunity_type_pretty_name; ! } ! if (strlen($opportunity_type_display_html) == 0) { ! $opportunity_type_display_html = $opportunity_type_pretty_name; ! } ! $con = get_xrms_dbconnection(); ! //save to database ! $rec = array(); ! $rec['opportunity_type_short_name'] = $opportunity_type_short_name; ! $rec['opportunity_type_pretty_name'] = $opportunity_type_pretty_name; ! $rec['opportunity_type_pretty_plural'] = $opportunity_type_pretty_plural; ! $rec['opportunity_type_display_html'] = $opportunity_type_display_html; ! ! $tbl = "opportunity_types"; ! $ins = $con->GetInsertSQL($tbl, $rec, get_magic_quotes_gpc()); ! $con->execute($ins); ! ! $con->close(); ! ! } header("Location: some.php"); *************** *** 39,42 **** --- 57,63 ---- /** * $Log$ + * Revision 1.3 2010/12/06 22:18:55 gopherit + * Added input validation to ensure that when a new workflow type is created, it has at least a *_type_short_name or a*_type_pretty_name. If neither is provided, no record will be inserted in the database. + * * Revision 1.2 2006/01/02 21:59:08 vanmer * - changed to use centralized database connection function |