From: <tim...@us...> - 2010-07-07 20:57:30
|
Revision: 3587 http://web-erp.svn.sourceforge.net/web-erp/?rev=3587&view=rev Author: tim_schofield Date: 2010-07-07 20:57:24 +0000 (Wed, 07 Jul 2010) Log Message: ----------- Layout improvements and properly quoting sql Modified Paths: -------------- trunk/GLAccounts.php trunk/doc/Change.log.html Modified: trunk/GLAccounts.php =================================================================== --- trunk/GLAccounts.php 2010-07-07 20:57:00 UTC (rev 3586) +++ trunk/GLAccounts.php 2010-07-07 20:57:24 UTC (rev 3587) @@ -14,6 +14,9 @@ $SelectedAccount = $_GET['SelectedAccount']; } +echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/transactions.png" title="' . + _('General Ledger Accounts') . '" alt="">' . ' ' . $title . '</p>'; + if (isset($_POST['submit'])) { //initialise no input errors assumed initially before we test @@ -36,7 +39,7 @@ $sql = "UPDATE chartmaster SET accountname='" . $_POST['AccountName'] . "', group_='" . $_POST['Group'] . "' - WHERE accountcode = $SelectedAccount"; + WHERE accountcode ='" . $SelectedAccount . "'"; $ErrMsg = _('Could not update the account because'); $result = DB_query($sql,$db,$ErrMsg); @@ -46,12 +49,13 @@ /*SelectedAccount is null cos no item selected on first time round so must be adding a record must be submitting new entries */ $ErrMsg = _('Could not add the new account code'); - $sql = 'INSERT INTO chartmaster (accountcode, + $sql = "INSERT INTO chartmaster (accountcode, accountname, group_) - VALUES (' . $_POST['AccountCode'] . ", - '" . $_POST['AccountName'] . "', - '" . $_POST['Group'] . "')"; + VALUES ('" . $_POST['AccountCode'] . "', + '" . $_POST['AccountName'] . "', + '" . $_POST['Group'] . "' + )"; $result = DB_query($sql,$db,$ErrMsg); /*Add the new chart details records for existing periods first */ @@ -82,7 +86,7 @@ - $sql= "SELECT COUNT(*) FROM chartdetails WHERE chartdetails.accountcode = $SelectedAccount AND chartdetails.actual <>0"; + $sql= "SELECT COUNT(*) FROM chartdetails WHERE chartdetails.accountcode ='" . $SelectedAccount . "' AND chartdetails.actual <>0"; $result = DB_query($sql,$db); $myrow = DB_fetch_row($result); if ($myrow[0]>0) { @@ -92,7 +96,7 @@ } else { // PREVENT DELETES IF DEPENDENT RECORDS IN 'GLTrans' - $sql= "SELECT COUNT(*) FROM gltrans WHERE gltrans.account = $SelectedAccount"; + $sql= "SELECT COUNT(*) FROM gltrans WHERE gltrans.account ='" . $SelectedAccount . "'"; $ErrMsg = _('Could not test for existing transactions because'); @@ -107,14 +111,14 @@ } else { //PREVENT DELETES IF Company default accounts set up to this account $sql= "SELECT COUNT(*) FROM companies - WHERE debtorsact=$SelectedAccount - OR pytdiscountact=$SelectedAccount - OR creditorsact=$SelectedAccount - OR payrollact=$SelectedAccount - OR grnact=$SelectedAccount - OR exchangediffact=$SelectedAccount - OR purchasesexchangediffact=$SelectedAccount - OR retainedearnings=$SelectedAccount"; + WHERE debtorsact='" . $SelectedAccount ."' + OR pytdiscountact='" . $SelectedAccount ."' + OR creditorsact='" . $SelectedAccount ."' + OR payrollact='" . $SelectedAccount ."' + OR grnact='" . $SelectedAccount ."' + OR exchangediffact='" . $SelectedAccount ."' + OR purchasesexchangediffact='" . $SelectedAccount ."' + OR retainedearnings='" . $SelectedAccount ."'"; $ErrMsg = _('Could not test for default company GL codes because'); @@ -129,8 +133,8 @@ } else { //PREVENT DELETES IF Company default accounts set up to this account $sql= "SELECT COUNT(*) FROM taxauthorities - WHERE taxglcode=$SelectedAccount - OR purchtaxglaccount =$SelectedAccount"; + WHERE taxglcode='" . $SelectedAccount ."' + OR purchtaxglaccount ='" . $SelectedAccount ."'"; $ErrMsg = _('Could not test for tax authority GL codes because'); $result = DB_query($sql,$db,$ErrMsg); @@ -142,8 +146,8 @@ } else { //PREVENT DELETES IF SALES POSTINGS USE THE GL ACCOUNT $sql= "SELECT COUNT(*) FROM salesglpostings - WHERE salesglcode=$SelectedAccount - OR discountglcode=$SelectedAccount"; + WHERE salesglcode='" . $SelectedAccount ."' + OR discountglcode='" . $SelectedAccount ."'"; $ErrMsg = _('Could not test for existing sales interface GL codes because'); @@ -155,7 +159,7 @@ prnMsg( _('Cannot delete this account because it is used by one of the sales GL posting interface records'),'warn'); } else { //PREVENT DELETES IF COGS POSTINGS USE THE GL ACCOUNT - $sql= "SELECT COUNT(*) FROM cogsglpostings WHERE glcode=$SelectedAccount"; + $sql= "SELECT COUNT(*) FROM cogsglpostings WHERE glcode='" . $SelectedAccount ."'"; $ErrMsg = _('Could not test for existing cost of sales interface codes because'); @@ -169,11 +173,11 @@ } else { //PREVENT DELETES IF STOCK POSTINGS USE THE GL ACCOUNT $sql= "SELECT COUNT(*) FROM stockcategory - WHERE stockact=$SelectedAccount - OR adjglact=$SelectedAccount - OR purchpricevaract=$SelectedAccount - OR materialuseagevarac=$SelectedAccount - OR wipact=$SelectedAccount"; + WHERE stockact='" . $SelectedAccount ."' + OR adjglact='" . $SelectedAccount ."' + OR purchpricevaract='" . $SelectedAccount ."' + OR materialuseagevarac='" . $SelectedAccount ."' + OR wipact='" . $SelectedAccount ."'"; $Errmsg = _('Could not test for existing stock GL codes because'); @@ -186,7 +190,7 @@ } else { //PREVENT DELETES IF STOCK POSTINGS USE THE GL ACCOUNT $sql= "SELECT COUNT(*) FROM bankaccounts - WHERE accountcode=$SelectedAccount"; + WHERE accountcode='" . $SelectedAccount ."'"; $ErrMsg = _('Could not test for existing bank account GL codes because'); $result = DB_query($sql,$db,$ErrMsg); @@ -197,9 +201,9 @@ prnMsg( _('Cannot delete this account because it is used by one the defined bank accounts'),'warn'); } else { - $sql = 'DELETE FROM chartdetails WHERE accountcode=' . $SelectedAccount; + $sql = "DELETE FROM chartdetails WHERE accountcode='" . $SelectedAccount ."'"; $result = DB_query($sql,$db); - $sql="DELETE FROM chartmaster WHERE accountcode= $SelectedAccount"; + $sql="DELETE FROM chartmaster WHERE accountcode= '" . $SelectedAccount ."'"; $result = DB_query($sql,$db); prnMsg( _('Account') . ' ' . $SelectedAccount . ' ' . _('has been deleted'),'succes'); } @@ -219,7 +223,7 @@ if (isset($SelectedAccount)) { //editing an existing account - $sql = "SELECT accountcode, accountname, group_ FROM chartmaster WHERE accountcode=$SelectedAccount"; + $sql = "SELECT accountcode, accountname, group_ FROM chartmaster WHERE accountcode='" . $SelectedAccount ."'"; $result = DB_query($sql, $db); $myrow = DB_fetch_array($result); @@ -230,9 +234,9 @@ echo "<input type=hidden name='SelectedAccount' VALUE=$SelectedAccount>"; echo "<input type=hidden name='AccountCode' VALUE=" . $_POST['AccountCode'] .">"; - echo "<table><tr><td>" . _('Account Code') . ":</td><td>" . $_POST['AccountCode'] . "</td></tr>"; + echo "<table class=selection><tr><td>" . _('Account Code') . ":</td><td>" . $_POST['AccountCode'] . "</td></tr>"; } else { - echo "<table>"; + echo "<table class=selection>"; echo "<tr><td>" . _('Account Code') . ":</td><td><input type=TEXT name='AccountCode' size=11 class=number maxlength=10></td></tr>"; } @@ -258,20 +262,16 @@ } else { echo "<script>defaultControl(document.GLAccounts.AccountName);</script>"; } - - ?> - </select></td></tr> + echo '</select></td></tr></table>'; - </table> + echo '<br><div class="centre"><input type="Submit" name="submit" value="'. _('Enter Information') . '"></div>'; - <div class="centre"><input type="Submit" name="submit" value="<?php echo _('Enter Information'); ?>"></div> + echo '</form>'; - </form> +} //end if record deleted no point displaying form to add record -<?php } //end if record deleted no point displaying form to add record - if (!isset($SelectedAccount)) { /* It could still be the second time the page has been run and a record has been selected for modification - SelectedAccount will exist because it was sent with the new call. If its the first time the page has been displayed with no parameters then none of the above are true and the list of ChartMaster will be displayed with @@ -291,7 +291,7 @@ $result = DB_query($sql,$db,$ErrMsg); - echo '<table border=1>'; + echo '<br><table class=selection>'; echo "<tr> <th>" . _('Account Code') . "</th> <th>" . _('Account Name') . "</th> Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2010-07-07 20:57:00 UTC (rev 3586) +++ trunk/doc/Change.log.html 2010-07-07 20:57:24 UTC (rev 3587) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> +<p>07/07/10 Tim: GLAccounts.php - Layout improvements and properly quoting sql</p> <p>07/07/10 Tim: GLAccountInquiry.php - Layout improvements and properly quoting sql</p> <p>07/07/10 Tim: GeocodeSetup.php - Properly quoting sql</p> <p>07/07/10 Tim: FreightCosts.php - Layout improvements and properly quoting sql</p> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |