From: <tim...@us...> - 2010-09-28 18:37:48
|
Revision: 3823 http://web-erp.svn.sourceforge.net/web-erp/?rev=3823&view=rev Author: tim_schofield Date: 2010-09-28 18:37:42 +0000 (Tue, 28 Sep 2010) Log Message: ----------- SQL quoting corrections and layout changes and improvements Modified Paths: -------------- trunk/TaxProvinces.php trunk/doc/Change.log.html Modified: trunk/TaxProvinces.php =================================================================== --- trunk/TaxProvinces.php 2010-09-28 18:26:15 UTC (rev 3822) +++ trunk/TaxProvinces.php 2010-09-28 18:37:42 UTC (rev 3823) @@ -9,6 +9,8 @@ include('includes/header.inc'); +echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/maintenance.png" title="' . _('Search') . '" alt="">' . ' ' . $title.'</p>'; + if ( isset($_GET['SelectedTaxProvince']) ) $SelectedTaxProvince = $_GET['SelectedTaxProvince']; elseif (isset($_POST['SelectedTaxProvince'])) @@ -39,7 +41,7 @@ /*SelectedTaxProvince could also exist if submit had not been clicked this code would not run in this case cos submit is false of course see the delete code below*/ // Check the name does not clash $sql = "SELECT count(*) FROM taxprovinces - WHERE taxprovinceid <> " . $SelectedTaxProvince ." + WHERE taxprovinceid <> '" . $SelectedTaxProvince ."' AND taxprovincename " . LIKE . " '" . $_POST['TaxProvinceName'] . "'"; $result = DB_query($sql,$db); $myrow = DB_fetch_row($result); @@ -48,8 +50,8 @@ prnMsg( _('The tax province cannot be renamed because another with the same name already exists.'),'error'); } else { // Get the old name and check that the record still exists - $sql = "SELECT taxprovincename FROM taxprovinces - WHERE taxprovinceid = " . $SelectedTaxProvince; + $sql = "SELECT taxprovincename FROM taxprovinces + WHERE taxprovinceid = '" . $SelectedTaxProvince . "'"; $result = DB_query($sql,$db); if ( DB_num_rows($result) != 0 ) { // This is probably the safest way there is @@ -70,7 +72,7 @@ } } elseif ($InputError !=1) { /*SelectedTaxProvince is null cos no item selected on first time round so must be adding a record*/ - $sql = "SELECT count(*) FROM taxprovinces + $sql = "SELECT count(*) FROM taxprovinces WHERE taxprovincename " .LIKE. " '".$_POST['TaxProvinceName'] ."'"; $result = DB_query($sql,$db); $myrow = DB_fetch_row($result); @@ -85,15 +87,15 @@ )"; $ErrMsg = _('Could not add tax province'); $result = DB_query($sql,$db, $ErrMsg); - + $TaxProvinceID = DB_Last_Insert_ID($db, 'taxprovinces', 'taxprovinceid'); - $sql = 'INSERT INTO taxauthrates (taxauthority, dispatchtaxprovince, taxcatid) - SELECT taxauthorities.taxid, ' . $TaxProvinceID . ', taxcategories.taxcatid - FROM taxauthorities CROSS JOIN taxcategories'; + $sql = "INSERT INTO taxauthrates (taxauthority, dispatchtaxprovince, taxcatid) + SELECT taxauthorities.taxid, '" . $TaxProvinceID . "', taxcategories.taxcatid + FROM taxauthorities CROSS JOIN taxcategories"; $ErrMsg = _('Could not add tax authority rates for the new dispatch tax province. The rates of tax will not be able to be added - manual database interaction will be required to use this dispatch tax province'); $result = DB_query($sql,$db, $ErrMsg); } - + if (!$result){ prnMsg(_('Errors were encountered adding this tax province'),'error'); } else { @@ -108,8 +110,8 @@ //the link to delete a selected record was clicked instead of the submit button // PREVENT DELETES IF DEPENDENT RECORDS IN 'stockmaster' // Get the original name of the tax province the ID is just a secure way to find the tax province - $sql = "SELECT taxprovincename FROM taxprovinces - WHERE taxprovinceid = " . $SelectedTaxProvince; + $sql = "SELECT taxprovincename FROM taxprovinces + WHERE taxprovinceid = '" . $SelectedTaxProvince . "'"; $result = DB_query($sql,$db); if ( DB_num_rows($result) == 0 ) { // This is probably the safest way there is @@ -117,20 +119,20 @@ } else { $myrow = DB_fetch_row($result); $OldTaxProvinceName = $myrow[0]; - $sql= "SELECT COUNT(*) FROM locations WHERE taxprovinceid = " . $SelectedTaxProvince; + $sql= "SELECT COUNT(*) FROM locations WHERE taxprovinceid = '" . $SelectedTaxProvince . "'"; $result = DB_query($sql,$db); $myrow = DB_fetch_row($result); if ($myrow[0]>0) { prnMsg( _('Cannot delete this tax province because at least one stock location is defined to be inside this province'),'warn'); echo '<br>' . _('There are') . ' ' . $myrow[0] . ' ' . _('stock locations that refer to this tax province') . '</font>'; } else { - $sql = 'DELETE FROM taxauthrates WHERE dispatchtaxprovince = ' . $SelectedTaxProvince; + $sql = "DELETE FROM taxauthrates WHERE dispatchtaxprovince = '" . $SelectedTaxProvince . "'"; $result = DB_query($sql,$db); - $sql = 'DELETE FROM taxprovinces WHERE taxprovinceid = ' .$SelectedTaxProvince;; + $sql = "DELETE FROM taxprovinces WHERE taxprovinceid = '" .$SelectedTaxProvince . "'"; $result = DB_query($sql,$db); prnMsg( $OldTaxProvinceName . ' ' . _('tax province and any tax rates set for it have been deleted'),'success'); } - } //end if + } //end if unset ($SelectedTaxProvince); unset ($_GET['SelectedTaxProvince']); unset($_GET['delete']); @@ -140,7 +142,7 @@ if (!isset($SelectedTaxProvince)) { -/* An tax province could be posted when one has been edited and is being updated +/* An tax province could be posted when one has been edited and is being updated or GOT when selected for modification SelectedTaxProvince will exist because it was sent with the page in a GET . If its the first time the page has been displayed with no parameters @@ -156,7 +158,7 @@ $ErrMsg = _('Could not get tax categories because'); $result = DB_query($sql,$db,$ErrMsg); - echo "<table> + echo "<table class=selection> <tr> <th>" . _('Tax Provinces') . "</th> </tr>"; @@ -198,7 +200,7 @@ $sql = "SELECT taxprovinceid, taxprovincename FROM taxprovinces - WHERE taxprovinceid=" . $SelectedTaxProvince; + WHERE taxprovinceid='" . $SelectedTaxProvince . "'"; $result = DB_query($sql, $db); if ( DB_num_rows($result) == 0 ) { @@ -210,12 +212,12 @@ $_POST['TaxProvinceName'] = $myrow['taxprovincename']; echo "<input type=hidden name='SelectedTaxProvince' VALUE='" . $myrow['taxprovinceid'] . "'>"; - echo "<table>"; + echo "<table class=selection>"; } } else { $_POST['TaxProvinceName']=''; - echo "<table>"; + echo "<table class=selection>"; } echo "<tr> <td>" . _('Tax Province Name') . ':' . "</td> @@ -223,7 +225,7 @@ </tr>"; echo '</table>'; - echo '<div class="centre"><input type=Submit name=submit value=' . _('Enter Information') . '></div>'; + echo '<br /><div class="centre"><input type=Submit name=submit value=' . _('Enter Information') . '></div>'; echo '</form>'; Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2010-09-28 18:26:15 UTC (rev 3822) +++ trunk/doc/Change.log.html 2010-09-28 18:37:42 UTC (rev 3823) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> +<p>28/09/10 Tim: TaxProvinces.php - SQL quoting corrections and layout changes and improvements</p> <p>28/09/10 Tim: TaxGroups.php - SQL quoting corrections and layout changes and improvements</p> <p>28/09/10 Tim: TaxCategories.php - SQL quoting corrections and layout changes and improvements</p> <p>28/09/10 Tim: TaxAuthorityRates.php - SQL quoting corrections and layout changes and improvements</p> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |