From: <dai...@us...> - 2016-01-13 07:32:38
|
Revision: 7444 http://sourceforge.net/p/web-erp/reponame/7444 Author: daintree Date: 2016-01-13 07:32:36 +0000 (Wed, 13 Jan 2016) Log Message: ----------- Fixed bug in creating customer credit notes manually - blank taxes were being added that caused the SQL to commit the transaction to fail with foreign key constraint to tax authorities Modified Paths: -------------- trunk/SelectCreditItems.php trunk/TaxGroups.php trunk/doc/Change.log trunk/includes/DefineCartClass.php Modified: trunk/SelectCreditItems.php =================================================================== --- trunk/SelectCreditItems.php 2016-01-13 03:03:24 UTC (rev 7443) +++ trunk/SelectCreditItems.php 2016-01-13 07:32:36 UTC (rev 7444) @@ -407,9 +407,9 @@ /*Always do the stuff below if not looking for a customerid Set up the form for the credit note display and entry*/ - echo '<form id="MainForm" action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?identifier='.$identifier . '" method="post">'; - echo '<div>'; - echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; + echo '<form id="MainForm" action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?identifier='.$identifier . '" method="post"> + <div> + <input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; /*Process Quick Entry */ @@ -569,9 +569,9 @@ $DiscountPercentage = filter_number_format($_POST['Discount_' . $LineItem->LineNumber]); - foreach ($LineItem->Taxes as $TaxLine) { - if (isset($_POST[$LineItem->LineNumber . $TaxLine->TaxCalculationOrder . '_TaxRate'])){ - $_SESSION['CreditItems'.$identifier]->LineItems[$LineItem->LineNumber]->Taxes[$TaxLine->TaxCalculationOrder]->TaxRate = filter_number_format($_POST[$LineItem->LineNumber . $TaxLine->TaxCalculationOrder . '_TaxRate'])/100; + foreach ($LineItem->Taxes as $TaxKey=>$TaxLine) { + if (is_numeric(filter_number_format($_POST[$LineItem->LineNumber . $TaxLine->TaxCalculationOrder . '_TaxRate']))){ + $_SESSION['CreditItems'.$identifier]->LineItems[$LineItem->LineNumber]->Taxes[$TaxKey]->TaxRate = filter_number_format($_POST[$LineItem->LineNumber . $TaxKey . '_TaxRate'])/100; } } } @@ -593,9 +593,9 @@ } - foreach ($_SESSION['CreditItems'.$identifier]->FreightTaxes as $FreightTaxLine) { - if (isset($_POST['FreightTaxRate' . $FreightTaxLine->TaxCalculationOrder])){ - $_SESSION['CreditItems'.$identifier]->FreightTaxes[$FreightTaxLine->TaxCalculationOrder]->TaxRate = filter_number_format($_POST['FreightTaxRate' . $FreightTaxLine->TaxCalculationOrder])/100; + foreach ($_SESSION['CreditItems'.$identifier]->FreightTaxes as $FreightTaxKey=>$FreightTaxLine) { + if (is_numeric(filter_number_format($_POST['FreightTaxRate' . $FreightTaxLine->TaxCalculationOrder]))){ + $_SESSION['CreditItems'.$identifier]->FreightTaxes[$FreightTaxKey]->TaxRate = filter_number_format($_POST['FreightTaxRate' . $FreightTaxKey])/100; } } @@ -737,13 +737,9 @@ /*Need to list the taxes applicable to this line */ echo '<td>'; - $i=0; foreach ($_SESSION['CreditItems'.$identifier]->LineItems[$LineItem->LineNumber]->Taxes AS $Tax) { - if ($i>0){ - echo '<br />'; - } + echo '<br />'; echo $Tax->TaxAuthDescription; - $i++; } echo '</td>'; echo '<td>'; @@ -751,11 +747,12 @@ $i=0; // initialise the number of taxes iterated through $TaxLineTotal =0; //initialise tax total for the line - foreach ($LineItem->Taxes AS $Tax) { + foreach ($LineItem->Taxes AS $TaxKey=>$Tax) { + if ($i>0){ echo '<br />'; } - echo '<input type="text" class="number" name="' . $LineItem->LineNumber . $Tax->TaxCalculationOrder . '_TaxRate" maxlength="4" size="4" value="' . locale_number_format($Tax->TaxRate*100,'Variable') . '" />'; + echo '<input type="text" class="number" name="' . $LineItem->LineNumber . $TaxKey . '_TaxRate" maxlength="4" size="4" value="' . locale_number_format($Tax->TaxRate*100,'Variable') . '" />'; $i++; if ($Tax->TaxOnTax ==1){ $TaxTotals[$Tax->TaxAuthID] += ($Tax->TaxRate * ($LineTotal + $TaxLineTotal)); Modified: trunk/TaxGroups.php =================================================================== --- trunk/TaxGroups.php 2016-01-13 03:03:24 UTC (rev 7443) +++ trunk/TaxGroups.php 2016-01-13 07:32:36 UTC (rev 7444) @@ -59,6 +59,7 @@ } elseif(isset($SelectedGroup) ) { $TaxAuthority = $_GET['TaxAuthority']; if( isset($_GET['add']) ) { // adding a tax authority to a tax group + $sql = "INSERT INTO taxgrouptaxes ( taxgroupid, taxauthid, calculationorder) Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2016-01-13 03:03:24 UTC (rev 7443) +++ trunk/doc/Change.log 2016-01-13 07:32:36 UTC (rev 7444) @@ -1,6 +1,8 @@ webERP Change Log -13/01/16 Exson: Fixed the variables non-refresh bugs in GLAccountInquiry.php. Reported by Richard. -11/01/16 Exson: Fixed the bug of bank account original amount data error. Reported by Tim, Richard and make this data only available for bank account. + +13/1/16 Phil: Fixed bug in creating customer credit notes manually - blank taxes were being added that caused the SQL to commit the transaction to fail with foreign key constraint to tax authorities +13/01/16 Exson: Fixed the variables non-refresh bugs in GLAccountInquiry.php. Reported by Richard. +11/01/16 Exson: Fixed the bug of bank account original amount data error. Reported by Tim, Richard and make this data only available for bank account. 01/07/16 Exson: Fixed the lot control items negative not allowed problem and fix the data storage caused precision error which make material issuing is impossible under some situation in WorkOrderIssue.php. 29/12/15 RChacon: On GLAccountUsers.php: Fix script name; add $ViewTopic and $BookMark; improve $SelectedGLAccount validation; improve page_title_text; improve select GL account; regroup modify access permission code (improve logic); add classes to table elements; translate database "0" and "1" to human "No" and "Yes"; simplify and tide code; modify prnMsg from multiple part sentence to one part sentence (better to translate when language use a different grammar structure from English); add "Print This", "Select A Different GL account" and "Return" buttons. Add info to ManualGeneralLedger.html. 28/12/15 Exson: Fixed the bug that discount not modified for items whose discount is null in discount matrix in SelectOrderItems.php. Modified: trunk/includes/DefineCartClass.php =================================================================== --- trunk/includes/DefineCartClass.php 2016-01-13 03:03:24 UTC (rev 7443) +++ trunk/includes/DefineCartClass.php 2016-01-13 07:32:36 UTC (rev 7444) @@ -314,11 +314,11 @@ while ($myrow = DB_fetch_array($GetTaxRatesResult)){ $this->LineItems[$LineNumber]->Taxes[$i] = new Tax($myrow['taxcalculationorder'], - $myrow['taxauthid'], - $myrow['description'], - $myrow['taxrate'], - $myrow['taxontax'], - $myrow['taxglcode']); + $myrow['taxauthid'], + $myrow['description'], + $myrow['taxrate'], + $myrow['taxontax'], + $myrow['taxglcode']); $i++; } } //end method GetExistingTaxes @@ -353,13 +353,12 @@ } else { $i=1; while ($myrow = DB_fetch_array($GetTaxRatesResult)){ - $this->LineItems[$LineNumber]->Taxes[$i] = new Tax($myrow['calculationorder'], - $myrow['taxauthid'], - $myrow['description'], - $myrow['taxrate'], - $myrow['taxontax'], - $myrow['taxglcode']); + $myrow['taxauthid'], + $myrow['description'], + $myrow['taxrate'], + $myrow['taxontax'], + $myrow['taxglcode']); $i++; } //end loop around different taxes } //end if there are some taxes defined @@ -403,11 +402,11 @@ while ($myrow = DB_fetch_array($GetTaxRatesResult)){ $this->FreightTaxes[$i] = new Tax($myrow['calculationorder'], - $myrow['taxauthid'], - $myrow['description'], - $myrow['taxrate'], - $myrow['taxontax'], - $myrow['taxglcode']); + $myrow['taxauthid'], + $myrow['description'], + $myrow['taxrate'], + $myrow['taxontax'], + $myrow['taxglcode']); $i++; } } //end method GetFreightTaxes() @@ -545,4 +544,4 @@ } } -?> +?> \ No newline at end of file |